diff options
481 files changed, 10763 insertions, 7416 deletions
@@ -2007,13 +2007,14 @@ S: University of Stuttgart, Germany and | |||
2007 | S: Ecole Nationale Superieure des Telecommunications, Paris | 2007 | S: Ecole Nationale Superieure des Telecommunications, Paris |
2008 | 2008 | ||
2009 | N: Jamie Lokier | 2009 | N: Jamie Lokier |
2010 | E: jamie@imbolc.ucc.ie | 2010 | E: jamie@shareable.org |
2011 | W: http://www.shareable.org/ | ||
2011 | D: Reboot-through-BIOS for broken 486 motherboards | 2012 | D: Reboot-through-BIOS for broken 486 motherboards |
2012 | D: Some parport fixes | 2013 | D: Parport fixes, futex improvements |
2013 | S: 11 Goodson Walk | 2014 | D: First instruction of x86 sysenter path :) |
2014 | S: Marston | 2015 | S: 51 Sunningwell Road |
2015 | S: Oxford | 2016 | S: Oxford |
2016 | S: OX3 0HX | 2017 | S: OX1 4SZ |
2017 | S: United Kingdom | 2018 | S: United Kingdom |
2018 | 2019 | ||
2019 | N: Mark Lord | 2020 | N: Mark Lord |
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt index 21272e4b4a5c..495858b236b6 100644 --- a/Documentation/feature-removal-schedule.txt +++ b/Documentation/feature-removal-schedule.txt | |||
@@ -176,6 +176,18 @@ Who: Richard Knutsson <ricknu-0@student.ltu.se> and Greg Kroah-Hartman <gregkh@s | |||
176 | 176 | ||
177 | --------------------------- | 177 | --------------------------- |
178 | 178 | ||
179 | What: Usage of invalid timevals in setitimer | ||
180 | When: March 2007 | ||
181 | Why: POSIX requires to validate timevals in the setitimer call. This | ||
182 | was never done by Linux. The invalid (e.g. negative timevals) were | ||
183 | silently converted to more or less random timeouts and intervals. | ||
184 | Until the removal a per boot limited number of warnings is printed | ||
185 | and the timevals are sanitized. | ||
186 | |||
187 | Who: Thomas Gleixner <tglx@linutronix.de> | ||
188 | |||
189 | --------------------------- | ||
190 | |||
179 | What: I2C interface of the it87 driver | 191 | What: I2C interface of the it87 driver |
180 | When: January 2007 | 192 | When: January 2007 |
181 | Why: The ISA interface is faster and should be always available. The I2C | 193 | Why: The ISA interface is faster and should be always available. The I2C |
diff --git a/Documentation/filesystems/v9fs.txt b/Documentation/filesystems/9p.txt index 24c7a9c41f0d..43b89c214d20 100644 --- a/Documentation/filesystems/v9fs.txt +++ b/Documentation/filesystems/9p.txt | |||
@@ -1,5 +1,5 @@ | |||
1 | V9FS: 9P2000 for Linux | 1 | v9fs: Plan 9 Resource Sharing for Linux |
2 | ====================== | 2 | ======================================= |
3 | 3 | ||
4 | ABOUT | 4 | ABOUT |
5 | ===== | 5 | ===== |
@@ -9,18 +9,19 @@ v9fs is a Unix implementation of the Plan 9 9p remote filesystem protocol. | |||
9 | This software was originally developed by Ron Minnich <rminnich@lanl.gov> | 9 | This software was originally developed by Ron Minnich <rminnich@lanl.gov> |
10 | and Maya Gokhale <maya@lanl.gov>. Additional development by Greg Watson | 10 | and Maya Gokhale <maya@lanl.gov>. Additional development by Greg Watson |
11 | <gwatson@lanl.gov> and most recently Eric Van Hensbergen | 11 | <gwatson@lanl.gov> and most recently Eric Van Hensbergen |
12 | <ericvh@gmail.com> and Latchesar Ionkov <lucho@ionkov.net>. | 12 | <ericvh@gmail.com>, Latchesar Ionkov <lucho@ionkov.net> and Russ Cox |
13 | <rsc@swtch.com>. | ||
13 | 14 | ||
14 | USAGE | 15 | USAGE |
15 | ===== | 16 | ===== |
16 | 17 | ||
17 | For remote file server: | 18 | For remote file server: |
18 | 19 | ||
19 | mount -t 9P 10.10.1.2 /mnt/9 | 20 | mount -t 9p 10.10.1.2 /mnt/9 |
20 | 21 | ||
21 | For Plan 9 From User Space applications (http://swtch.com/plan9) | 22 | For Plan 9 From User Space applications (http://swtch.com/plan9) |
22 | 23 | ||
23 | mount -t 9P `namespace`/acme /mnt/9 -o proto=unix,name=$USER | 24 | mount -t 9p `namespace`/acme /mnt/9 -o proto=unix,uname=$USER |
24 | 25 | ||
25 | OPTIONS | 26 | OPTIONS |
26 | ======= | 27 | ======= |
@@ -32,7 +33,7 @@ OPTIONS | |||
32 | fd - used passed file descriptors for connection | 33 | fd - used passed file descriptors for connection |
33 | (see rfdno and wfdno) | 34 | (see rfdno and wfdno) |
34 | 35 | ||
35 | name=name user name to attempt mount as on the remote server. The | 36 | uname=name user name to attempt mount as on the remote server. The |
36 | server may override or ignore this value. Certain user | 37 | server may override or ignore this value. Certain user |
37 | names may require authentication. | 38 | names may require authentication. |
38 | 39 | ||
@@ -42,7 +43,7 @@ OPTIONS | |||
42 | debug=n specifies debug level. The debug level is a bitmask. | 43 | debug=n specifies debug level. The debug level is a bitmask. |
43 | 0x01 = display verbose error messages | 44 | 0x01 = display verbose error messages |
44 | 0x02 = developer debug (DEBUG_CURRENT) | 45 | 0x02 = developer debug (DEBUG_CURRENT) |
45 | 0x04 = display 9P trace | 46 | 0x04 = display 9p trace |
46 | 0x08 = display VFS trace | 47 | 0x08 = display VFS trace |
47 | 0x10 = display Marshalling debug | 48 | 0x10 = display Marshalling debug |
48 | 0x20 = display RPC debug | 49 | 0x20 = display RPC debug |
@@ -53,11 +54,11 @@ OPTIONS | |||
53 | 54 | ||
54 | wfdno=n the file descriptor for writing with proto=fd | 55 | wfdno=n the file descriptor for writing with proto=fd |
55 | 56 | ||
56 | maxdata=n the number of bytes to use for 9P packet payload (msize) | 57 | maxdata=n the number of bytes to use for 9p packet payload (msize) |
57 | 58 | ||
58 | port=n port to connect to on the remote server | 59 | port=n port to connect to on the remote server |
59 | 60 | ||
60 | noextend force legacy mode (no 9P2000.u semantics) | 61 | noextend force legacy mode (no 9p2000.u semantics) |
61 | 62 | ||
62 | uid attempt to mount as a particular uid | 63 | uid attempt to mount as a particular uid |
63 | 64 | ||
@@ -72,7 +73,7 @@ OPTIONS | |||
72 | RESOURCES | 73 | RESOURCES |
73 | ========= | 74 | ========= |
74 | 75 | ||
75 | The Linux version of the 9P server is now maintained under the npfs project | 76 | The Linux version of the 9p server is now maintained under the npfs project |
76 | on sourceforge (http://sourceforge.net/projects/npfs). | 77 | on sourceforge (http://sourceforge.net/projects/npfs). |
77 | 78 | ||
78 | There are user and developer mailing lists available through the v9fs project | 79 | There are user and developer mailing lists available through the v9fs project |
diff --git a/Documentation/filesystems/udf.txt b/Documentation/filesystems/udf.txt index e5213bc301f7..511b4230c053 100644 --- a/Documentation/filesystems/udf.txt +++ b/Documentation/filesystems/udf.txt | |||
@@ -26,6 +26,20 @@ The following mount options are supported: | |||
26 | nostrict Unset strict conformance | 26 | nostrict Unset strict conformance |
27 | iocharset= Set the NLS character set | 27 | iocharset= Set the NLS character set |
28 | 28 | ||
29 | The uid= and gid= options need a bit more explaining. They will accept a | ||
30 | decimal numeric value which will be used as the default ID for that mount. | ||
31 | They will also accept the string "ignore" and "forget". For files on the disk | ||
32 | that are owned by nobody ( -1 ), they will instead look as if they are owned | ||
33 | by the default ID. The ignore option causes the default ID to override all | ||
34 | IDs on the disk, not just -1. The forget option causes all IDs to be written | ||
35 | to disk as -1, so when the media is later remounted, they will appear to be | ||
36 | owned by whatever default ID it is mounted with at that time. | ||
37 | |||
38 | For typical desktop use of removable media, you should set the ID to that | ||
39 | of the interactively logged on user, and also specify both the forget and | ||
40 | ignore options. This way the interactive user will always see the files | ||
41 | on the disk as belonging to him. | ||
42 | |||
29 | The remaining are for debugging and disaster recovery: | 43 | The remaining are for debugging and disaster recovery: |
30 | 44 | ||
31 | novrs Skip volume sequence recognition | 45 | novrs Skip volume sequence recognition |
diff --git a/Documentation/filesystems/vfs.txt b/Documentation/filesystems/vfs.txt index e56e842847d3..adaa899e5c90 100644 --- a/Documentation/filesystems/vfs.txt +++ b/Documentation/filesystems/vfs.txt | |||
@@ -230,10 +230,15 @@ only called from a process context (i.e. not from an interrupt handler | |||
230 | or bottom half). | 230 | or bottom half). |
231 | 231 | ||
232 | alloc_inode: this method is called by inode_alloc() to allocate memory | 232 | alloc_inode: this method is called by inode_alloc() to allocate memory |
233 | for struct inode and initialize it. | 233 | for struct inode and initialize it. If this function is not |
234 | defined, a simple 'struct inode' is allocated. Normally | ||
235 | alloc_inode will be used to allocate a larger structure which | ||
236 | contains a 'struct inode' embedded within it. | ||
234 | 237 | ||
235 | destroy_inode: this method is called by destroy_inode() to release | 238 | destroy_inode: this method is called by destroy_inode() to release |
236 | resources allocated for struct inode. | 239 | resources allocated for struct inode. It is only required if |
240 | ->alloc_inode was defined and simply undoes anything done by | ||
241 | ->alloc_inode. | ||
237 | 242 | ||
238 | read_inode: this method is called to read a specific inode from the | 243 | read_inode: this method is called to read a specific inode from the |
239 | mounted filesystem. The i_ino member in the struct inode is | 244 | mounted filesystem. The i_ino member in the struct inode is |
@@ -443,14 +448,81 @@ otherwise noted. | |||
443 | The Address Space Object | 448 | The Address Space Object |
444 | ======================== | 449 | ======================== |
445 | 450 | ||
446 | The address space object is used to identify pages in the page cache. | 451 | The address space object is used to group and manage pages in the page |
447 | 452 | cache. It can be used to keep track of the pages in a file (or | |
453 | anything else) and also track the mapping of sections of the file into | ||
454 | process address spaces. | ||
455 | |||
456 | There are a number of distinct yet related services that an | ||
457 | address-space can provide. These include communicating memory | ||
458 | pressure, page lookup by address, and keeping track of pages tagged as | ||
459 | Dirty or Writeback. | ||
460 | |||
461 | The first can be used independently to the others. The VM can try to | ||
462 | either write dirty pages in order to clean them, or release clean | ||
463 | pages in order to reuse them. To do this it can call the ->writepage | ||
464 | method on dirty pages, and ->releasepage on clean pages with | ||
465 | PagePrivate set. Clean pages without PagePrivate and with no external | ||
466 | references will be released without notice being given to the | ||
467 | address_space. | ||
468 | |||
469 | To achieve this functionality, pages need to be placed on an LRU with | ||
470 | lru_cache_add and mark_page_active needs to be called whenever the | ||
471 | page is used. | ||
472 | |||
473 | Pages are normally kept in a radix tree index by ->index. This tree | ||
474 | maintains information about the PG_Dirty and PG_Writeback status of | ||
475 | each page, so that pages with either of these flags can be found | ||
476 | quickly. | ||
477 | |||
478 | The Dirty tag is primarily used by mpage_writepages - the default | ||
479 | ->writepages method. It uses the tag to find dirty pages to call | ||
480 | ->writepage on. If mpage_writepages is not used (i.e. the address | ||
481 | provides its own ->writepages) , the PAGECACHE_TAG_DIRTY tag is | ||
482 | almost unused. write_inode_now and sync_inode do use it (through | ||
483 | __sync_single_inode) to check if ->writepages has been successful in | ||
484 | writing out the whole address_space. | ||
485 | |||
486 | The Writeback tag is used by filemap*wait* and sync_page* functions, | ||
487 | via wait_on_page_writeback_range, to wait for all writeback to | ||
488 | complete. While waiting ->sync_page (if defined) will be called on | ||
489 | each page that is found to require writeback. | ||
490 | |||
491 | An address_space handler may attach extra information to a page, | ||
492 | typically using the 'private' field in the 'struct page'. If such | ||
493 | information is attached, the PG_Private flag should be set. This will | ||
494 | cause various VM routines to make extra calls into the address_space | ||
495 | handler to deal with that data. | ||
496 | |||
497 | An address space acts as an intermediate between storage and | ||
498 | application. Data is read into the address space a whole page at a | ||
499 | time, and provided to the application either by copying of the page, | ||
500 | or by memory-mapping the page. | ||
501 | Data is written into the address space by the application, and then | ||
502 | written-back to storage typically in whole pages, however the | ||
503 | address_space has finer control of write sizes. | ||
504 | |||
505 | The read process essentially only requires 'readpage'. The write | ||
506 | process is more complicated and uses prepare_write/commit_write or | ||
507 | set_page_dirty to write data into the address_space, and writepage, | ||
508 | sync_page, and writepages to writeback data to storage. | ||
509 | |||
510 | Adding and removing pages to/from an address_space is protected by the | ||
511 | inode's i_mutex. | ||
512 | |||
513 | When data is written to a page, the PG_Dirty flag should be set. It | ||
514 | typically remains set until writepage asks for it to be written. This | ||
515 | should clear PG_Dirty and set PG_Writeback. It can be actually | ||
516 | written at any point after PG_Dirty is clear. Once it is known to be | ||
517 | safe, PG_Writeback is cleared. | ||
518 | |||
519 | Writeback makes use of a writeback_control structure... | ||
448 | 520 | ||
449 | struct address_space_operations | 521 | struct address_space_operations |
450 | ------------------------------- | 522 | ------------------------------- |
451 | 523 | ||
452 | This describes how the VFS can manipulate mapping of a file to page cache in | 524 | This describes how the VFS can manipulate mapping of a file to page cache in |
453 | your filesystem. As of kernel 2.6.13, the following members are defined: | 525 | your filesystem. As of kernel 2.6.16, the following members are defined: |
454 | 526 | ||
455 | struct address_space_operations { | 527 | struct address_space_operations { |
456 | int (*writepage)(struct page *page, struct writeback_control *wbc); | 528 | int (*writepage)(struct page *page, struct writeback_control *wbc); |
@@ -469,47 +541,148 @@ struct address_space_operations { | |||
469 | loff_t offset, unsigned long nr_segs); | 541 | loff_t offset, unsigned long nr_segs); |
470 | struct page* (*get_xip_page)(struct address_space *, sector_t, | 542 | struct page* (*get_xip_page)(struct address_space *, sector_t, |
471 | int); | 543 | int); |
544 | /* migrate the contents of a page to the specified target */ | ||
545 | int (*migratepage) (struct page *, struct page *); | ||
472 | }; | 546 | }; |
473 | 547 | ||
474 | writepage: called by the VM write a dirty page to backing store. | 548 | writepage: called by the VM to write a dirty page to backing store. |
549 | This may happen for data integrity reasons (i.e. 'sync'), or | ||
550 | to free up memory (flush). The difference can be seen in | ||
551 | wbc->sync_mode. | ||
552 | The PG_Dirty flag has been cleared and PageLocked is true. | ||
553 | writepage should start writeout, should set PG_Writeback, | ||
554 | and should make sure the page is unlocked, either synchronously | ||
555 | or asynchronously when the write operation completes. | ||
556 | |||
557 | If wbc->sync_mode is WB_SYNC_NONE, ->writepage doesn't have to | ||
558 | try too hard if there are problems, and may choose to write out | ||
559 | other pages from the mapping if that is easier (e.g. due to | ||
560 | internal dependencies). If it chooses not to start writeout, it | ||
561 | should return AOP_WRITEPAGE_ACTIVATE so that the VM will not keep | ||
562 | calling ->writepage on that page. | ||
563 | |||
564 | See the file "Locking" for more details. | ||
475 | 565 | ||
476 | readpage: called by the VM to read a page from backing store. | 566 | readpage: called by the VM to read a page from backing store. |
567 | The page will be Locked when readpage is called, and should be | ||
568 | unlocked and marked uptodate once the read completes. | ||
569 | If ->readpage discovers that it needs to unlock the page for | ||
570 | some reason, it can do so, and then return AOP_TRUNCATED_PAGE. | ||
571 | In this case, the page will be relocated, relocked and if | ||
572 | that all succeeds, ->readpage will be called again. | ||
477 | 573 | ||
478 | sync_page: called by the VM to notify the backing store to perform all | 574 | sync_page: called by the VM to notify the backing store to perform all |
479 | queued I/O operations for a page. I/O operations for other pages | 575 | queued I/O operations for a page. I/O operations for other pages |
480 | associated with this address_space object may also be performed. | 576 | associated with this address_space object may also be performed. |
481 | 577 | ||
578 | This function is optional and is called only for pages with | ||
579 | PG_Writeback set while waiting for the writeback to complete. | ||
580 | |||
482 | writepages: called by the VM to write out pages associated with the | 581 | writepages: called by the VM to write out pages associated with the |
483 | address_space object. | 582 | address_space object. If wbc->sync_mode is WBC_SYNC_ALL, then |
583 | the writeback_control will specify a range of pages that must be | ||
584 | written out. If it is WBC_SYNC_NONE, then a nr_to_write is given | ||
585 | and that many pages should be written if possible. | ||
586 | If no ->writepages is given, then mpage_writepages is used | ||
587 | instead. This will choose pages from the address space that are | ||
588 | tagged as DIRTY and will pass them to ->writepage. | ||
484 | 589 | ||
485 | set_page_dirty: called by the VM to set a page dirty. | 590 | set_page_dirty: called by the VM to set a page dirty. |
591 | This is particularly needed if an address space attaches | ||
592 | private data to a page, and that data needs to be updated when | ||
593 | a page is dirtied. This is called, for example, when a memory | ||
594 | mapped page gets modified. | ||
595 | If defined, it should set the PageDirty flag, and the | ||
596 | PAGECACHE_TAG_DIRTY tag in the radix tree. | ||
486 | 597 | ||
487 | readpages: called by the VM to read pages associated with the address_space | 598 | readpages: called by the VM to read pages associated with the address_space |
488 | object. | 599 | object. This is essentially just a vector version of |
600 | readpage. Instead of just one page, several pages are | ||
601 | requested. | ||
602 | readpages is only used for read-ahead, so read errors are | ||
603 | ignored. If anything goes wrong, feel free to give up. | ||
489 | 604 | ||
490 | prepare_write: called by the generic write path in VM to set up a write | 605 | prepare_write: called by the generic write path in VM to set up a write |
491 | request for a page. | 606 | request for a page. This indicates to the address space that |
492 | 607 | the given range of bytes is about to be written. The | |
493 | commit_write: called by the generic write path in VM to write page to | 608 | address_space should check that the write will be able to |
494 | its backing store. | 609 | complete, by allocating space if necessary and doing any other |
610 | internal housekeeping. If the write will update parts of | ||
611 | any basic-blocks on storage, then those blocks should be | ||
612 | pre-read (if they haven't been read already) so that the | ||
613 | updated blocks can be written out properly. | ||
614 | The page will be locked. If prepare_write wants to unlock the | ||
615 | page it, like readpage, may do so and return | ||
616 | AOP_TRUNCATED_PAGE. | ||
617 | In this case the prepare_write will be retried one the lock is | ||
618 | regained. | ||
619 | |||
620 | commit_write: If prepare_write succeeds, new data will be copied | ||
621 | into the page and then commit_write will be called. It will | ||
622 | typically update the size of the file (if appropriate) and | ||
623 | mark the inode as dirty, and do any other related housekeeping | ||
624 | operations. It should avoid returning an error if possible - | ||
625 | errors should have been handled by prepare_write. | ||
495 | 626 | ||
496 | bmap: called by the VFS to map a logical block offset within object to | 627 | bmap: called by the VFS to map a logical block offset within object to |
497 | physical block number. This method is use by for the legacy FIBMAP | 628 | physical block number. This method is used by the FIBMAP |
498 | ioctl. Other uses are discouraged. | 629 | ioctl and for working with swap-files. To be able to swap to |
499 | 630 | a file, the file must have a stable mapping to a block | |
500 | invalidatepage: called by the VM on truncate to disassociate a page from its | 631 | device. The swap system does not go through the filesystem |
501 | address_space mapping. | 632 | but instead uses bmap to find out where the blocks in the file |
502 | 633 | are and uses those addresses directly. | |
503 | releasepage: called by the VFS to release filesystem specific metadata from | 634 | |
504 | a page. | 635 | |
505 | 636 | invalidatepage: If a page has PagePrivate set, then invalidatepage | |
506 | direct_IO: called by the VM for direct I/O writes and reads. | 637 | will be called when part or all of the page is to be removed |
638 | from the address space. This generally corresponds to either a | ||
639 | truncation or a complete invalidation of the address space | ||
640 | (in the latter case 'offset' will always be 0). | ||
641 | Any private data associated with the page should be updated | ||
642 | to reflect this truncation. If offset is 0, then | ||
643 | the private data should be released, because the page | ||
644 | must be able to be completely discarded. This may be done by | ||
645 | calling the ->releasepage function, but in this case the | ||
646 | release MUST succeed. | ||
647 | |||
648 | releasepage: releasepage is called on PagePrivate pages to indicate | ||
649 | that the page should be freed if possible. ->releasepage | ||
650 | should remove any private data from the page and clear the | ||
651 | PagePrivate flag. It may also remove the page from the | ||
652 | address_space. If this fails for some reason, it may indicate | ||
653 | failure with a 0 return value. | ||
654 | This is used in two distinct though related cases. The first | ||
655 | is when the VM finds a clean page with no active users and | ||
656 | wants to make it a free page. If ->releasepage succeeds, the | ||
657 | page will be removed from the address_space and become free. | ||
658 | |||
659 | The second case if when a request has been made to invalidate | ||
660 | some or all pages in an address_space. This can happen | ||
661 | through the fadvice(POSIX_FADV_DONTNEED) system call or by the | ||
662 | filesystem explicitly requesting it as nfs and 9fs do (when | ||
663 | they believe the cache may be out of date with storage) by | ||
664 | calling invalidate_inode_pages2(). | ||
665 | If the filesystem makes such a call, and needs to be certain | ||
666 | that all pages are invalidated, then its releasepage will | ||
667 | need to ensure this. Possibly it can clear the PageUptodate | ||
668 | bit if it cannot free private data yet. | ||
669 | |||
670 | direct_IO: called by the generic read/write routines to perform | ||
671 | direct_IO - that is IO requests which bypass the page cache | ||
672 | and transfer data directly between the storage and the | ||
673 | application's address space. | ||
507 | 674 | ||
508 | get_xip_page: called by the VM to translate a block number to a page. | 675 | get_xip_page: called by the VM to translate a block number to a page. |
509 | The page is valid until the corresponding filesystem is unmounted. | 676 | The page is valid until the corresponding filesystem is unmounted. |
510 | Filesystems that want to use execute-in-place (XIP) need to implement | 677 | Filesystems that want to use execute-in-place (XIP) need to implement |
511 | it. An example implementation can be found in fs/ext2/xip.c. | 678 | it. An example implementation can be found in fs/ext2/xip.c. |
512 | 679 | ||
680 | migrate_page: This is used to compact the physical memory usage. | ||
681 | If the VM wants to relocate a page (maybe off a memory card | ||
682 | that is signalling imminent failure) it will pass a new page | ||
683 | and an old page to this function. migrate_page should | ||
684 | transfer any private data across and update any references | ||
685 | that it has to the page. | ||
513 | 686 | ||
514 | The File Object | 687 | The File Object |
515 | =============== | 688 | =============== |
diff --git a/Documentation/firmware_class/firmware_sample_driver.c b/Documentation/firmware_class/firmware_sample_driver.c index d3ad2c24490a..ad3edaba4533 100644 --- a/Documentation/firmware_class/firmware_sample_driver.c +++ b/Documentation/firmware_class/firmware_sample_driver.c | |||
@@ -23,7 +23,6 @@ char __init inkernel_firmware[] = "let's say that this is firmware\n"; | |||
23 | #endif | 23 | #endif |
24 | 24 | ||
25 | static struct device ghost_device = { | 25 | static struct device ghost_device = { |
26 | .name = "Ghost Device", | ||
27 | .bus_id = "ghost0", | 26 | .bus_id = "ghost0", |
28 | }; | 27 | }; |
29 | 28 | ||
@@ -92,7 +91,7 @@ static void sample_probe_async(void) | |||
92 | { | 91 | { |
93 | /* Let's say that I can't sleep */ | 92 | /* Let's say that I can't sleep */ |
94 | int error; | 93 | int error; |
95 | error = request_firmware_nowait (THIS_MODULE, | 94 | error = request_firmware_nowait (THIS_MODULE, FW_ACTION_NOHOTPLUG, |
96 | "sample_driver_fw", &ghost_device, | 95 | "sample_driver_fw", &ghost_device, |
97 | "my device pointer", | 96 | "my device pointer", |
98 | sample_probe_async_cont); | 97 | sample_probe_async_cont); |
diff --git a/Documentation/firmware_class/firmware_sample_firmware_class.c b/Documentation/firmware_class/firmware_sample_firmware_class.c index 57b956aecbc5..9e1b0e4051cd 100644 --- a/Documentation/firmware_class/firmware_sample_firmware_class.c +++ b/Documentation/firmware_class/firmware_sample_firmware_class.c | |||
@@ -172,7 +172,6 @@ static void fw_remove_class_device(struct class_device *class_dev) | |||
172 | static struct class_device *class_dev; | 172 | static struct class_device *class_dev; |
173 | 173 | ||
174 | static struct device my_device = { | 174 | static struct device my_device = { |
175 | .name = "Sample Device", | ||
176 | .bus_id = "my_dev0", | 175 | .bus_id = "my_dev0", |
177 | }; | 176 | }; |
178 | 177 | ||
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt index 44a25f3f51d1..f8cb55c30b0f 100644 --- a/Documentation/kernel-parameters.txt +++ b/Documentation/kernel-parameters.txt | |||
@@ -367,12 +367,17 @@ running once the system is up. | |||
367 | tty<n> Use the virtual console device <n>. | 367 | tty<n> Use the virtual console device <n>. |
368 | 368 | ||
369 | ttyS<n>[,options] | 369 | ttyS<n>[,options] |
370 | ttyUSB0[,options] | ||
370 | Use the specified serial port. The options are of | 371 | Use the specified serial port. The options are of |
371 | the form "bbbbpn", where "bbbb" is the baud rate, | 372 | the form "bbbbpnf", where "bbbb" is the baud rate, |
372 | "p" is parity ("n", "o", or "e"), and "n" is bits. | 373 | "p" is parity ("n", "o", or "e"), "n" is number of |
373 | Default is "9600n8". | 374 | bits, and "f" is flow control ("r" for RTS or |
374 | 375 | omit it). Default is "9600n8". | |
375 | See also Documentation/serial-console.txt. | 376 | |
377 | See Documentation/serial-console.txt for more | ||
378 | information. See | ||
379 | Documentation/networking/netconsole.txt for an | ||
380 | alternative. | ||
376 | 381 | ||
377 | uart,io,<addr>[,options] | 382 | uart,io,<addr>[,options] |
378 | uart,mmio,<addr>[,options] | 383 | uart,mmio,<addr>[,options] |
diff --git a/Documentation/networking/ray_cs.txt b/Documentation/networking/ray_cs.txt index 5427f8c7df95..145d27a52395 100644 --- a/Documentation/networking/ray_cs.txt +++ b/Documentation/networking/ray_cs.txt | |||
@@ -25,7 +25,7 @@ the essid= string parameter is available via the kernel command line. | |||
25 | This will change after the method of sorting out parameters for all | 25 | This will change after the method of sorting out parameters for all |
26 | the PCMCIA drivers is agreed upon. If you must have a built in driver | 26 | the PCMCIA drivers is agreed upon. If you must have a built in driver |
27 | with nondefault parameters, they can be edited in | 27 | with nondefault parameters, they can be edited in |
28 | /usr/src/linux/drivers/net/pcmcia/ray_cs.c. Searching for MODULE_PARM | 28 | /usr/src/linux/drivers/net/pcmcia/ray_cs.c. Searching for module_param |
29 | will find them all. | 29 | will find them all. |
30 | 30 | ||
31 | Information on card services is available at: | 31 | Information on card services is available at: |
diff --git a/Documentation/serial-console.txt b/Documentation/serial-console.txt index 6c689b0df2b8..9a7bc8b3f479 100644 --- a/Documentation/serial-console.txt +++ b/Documentation/serial-console.txt | |||
@@ -17,11 +17,13 @@ The format of this option is: | |||
17 | ttyX for any other virtual console | 17 | ttyX for any other virtual console |
18 | ttySx for a serial port | 18 | ttySx for a serial port |
19 | lp0 for the first parallel port | 19 | lp0 for the first parallel port |
20 | ttyUSB0 for the first USB serial device | ||
20 | 21 | ||
21 | options: depend on the driver. For the serial port this | 22 | options: depend on the driver. For the serial port this |
22 | defines the baudrate/parity/bits of the port, | 23 | defines the baudrate/parity/bits/flow control of |
23 | in the format BBBBPN, where BBBB is the speed, | 24 | the port, in the format BBBBPNF, where BBBB is the |
24 | P is parity (n/o/e), and N is bits. Default is | 25 | speed, P is parity (n/o/e), N is number of bits, |
26 | and F is flow control ('r' for RTS). Default is | ||
25 | 9600n8. The maximum baudrate is 115200. | 27 | 9600n8. The maximum baudrate is 115200. |
26 | 28 | ||
27 | You can specify multiple console= options on the kernel command line. | 29 | You can specify multiple console= options on the kernel command line. |
@@ -45,6 +47,9 @@ become the console. | |||
45 | You will need to create a new device to use /dev/console. The official | 47 | You will need to create a new device to use /dev/console. The official |
46 | /dev/console is now character device 5,1. | 48 | /dev/console is now character device 5,1. |
47 | 49 | ||
50 | (You can also use a network device as a console. See | ||
51 | Documentation/networking/netconsole.txt for information on that.) | ||
52 | |||
48 | Here's an example that will use /dev/ttyS1 (COM2) as the console. | 53 | Here's an example that will use /dev/ttyS1 (COM2) as the console. |
49 | Replace the sample values as needed. | 54 | Replace the sample values as needed. |
50 | 55 | ||
diff --git a/Documentation/sound/oss/Introduction b/Documentation/sound/oss/Introduction index 15d4fb975ac0..f04ba6bb7395 100644 --- a/Documentation/sound/oss/Introduction +++ b/Documentation/sound/oss/Introduction | |||
@@ -69,7 +69,7 @@ are available, for example IRQ, address, DMA. | |||
69 | 69 | ||
70 | Warning, the options for different cards sometime use different names | 70 | Warning, the options for different cards sometime use different names |
71 | for the same or a similar feature (dma1= versus dma16=). As a last | 71 | for the same or a similar feature (dma1= versus dma16=). As a last |
72 | resort, inspect the code (search for MODULE_PARM). | 72 | resort, inspect the code (search for module_param). |
73 | 73 | ||
74 | Notes: | 74 | Notes: |
75 | 75 | ||
diff --git a/Documentation/sound/oss/cs46xx b/Documentation/sound/oss/cs46xx index 88d6cf8b39f3..b54432709863 100644 --- a/Documentation/sound/oss/cs46xx +++ b/Documentation/sound/oss/cs46xx | |||
@@ -88,7 +88,7 @@ parameters. for a copy email: twoller@crystal.cirrus.com | |||
88 | 88 | ||
89 | MODULE_PARMS definitions | 89 | MODULE_PARMS definitions |
90 | ------------------------ | 90 | ------------------------ |
91 | MODULE_PARM(defaultorder, "i"); | 91 | module_param(defaultorder, ulong, 0); |
92 | defaultorder=N | 92 | defaultorder=N |
93 | where N is a value from 1 to 12 | 93 | where N is a value from 1 to 12 |
94 | The buffer order determines the size of the dma buffer for the driver. | 94 | The buffer order determines the size of the dma buffer for the driver. |
@@ -98,18 +98,18 @@ to not underrun the dma buffer as easily. As default, use 32k (order=3) | |||
98 | rather than 64k as some of the games work more responsively. | 98 | rather than 64k as some of the games work more responsively. |
99 | (2^N) * PAGE_SIZE = allocated buffer size | 99 | (2^N) * PAGE_SIZE = allocated buffer size |
100 | 100 | ||
101 | MODULE_PARM(cs_debuglevel, "i"); | 101 | module_param(cs_debuglevel, ulong, 0644); |
102 | MODULE_PARM(cs_debugmask, "i"); | 102 | module_param(cs_debugmask, ulong, 0644); |
103 | cs_debuglevel=N | 103 | cs_debuglevel=N |
104 | cs_debugmask=0xMMMMMMMM | 104 | cs_debugmask=0xMMMMMMMM |
105 | where N is a value from 0 (no debug printfs), to 9 (maximum) | 105 | where N is a value from 0 (no debug printfs), to 9 (maximum) |
106 | 0xMMMMMMMM is a debug mask corresponding to the CS_xxx bits (see driver source). | 106 | 0xMMMMMMMM is a debug mask corresponding to the CS_xxx bits (see driver source). |
107 | 107 | ||
108 | MODULE_PARM(hercules_egpio_disable, "i"); | 108 | module_param(hercules_egpio_disable, ulong, 0); |
109 | hercules_egpio_disable=N | 109 | hercules_egpio_disable=N |
110 | where N is a 0 (enable egpio), or a 1 (disable egpio support) | 110 | where N is a 0 (enable egpio), or a 1 (disable egpio support) |
111 | 111 | ||
112 | MODULE_PARM(initdelay, "i"); | 112 | module_param(initdelay, ulong, 0); |
113 | initdelay=N | 113 | initdelay=N |
114 | This value is used to determine the millescond delay during the initialization | 114 | This value is used to determine the millescond delay during the initialization |
115 | code prior to powering up the PLL. On laptops this value can be used to | 115 | code prior to powering up the PLL. On laptops this value can be used to |
@@ -118,19 +118,19 @@ system is booted under battery power then the mdelay()/udelay() functions fail t | |||
118 | properly delay the required time. Also, if the system is booted under AC power | 118 | properly delay the required time. Also, if the system is booted under AC power |
119 | and then the power removed, the mdelay()/udelay() functions will not delay properly. | 119 | and then the power removed, the mdelay()/udelay() functions will not delay properly. |
120 | 120 | ||
121 | MODULE_PARM(powerdown, "i"); | 121 | module_param(powerdown, ulong, 0); |
122 | powerdown=N | 122 | powerdown=N |
123 | where N is 0 (disable any powerdown of the internal blocks) or 1 (enable powerdown) | 123 | where N is 0 (disable any powerdown of the internal blocks) or 1 (enable powerdown) |
124 | 124 | ||
125 | 125 | ||
126 | MODULE_PARM(external_amp, "i"); | 126 | module_param(external_amp, bool, 0); |
127 | external_amp=1 | 127 | external_amp=1 |
128 | if N is set to 1, then force enabling the EAPD support in the primary AC97 codec. | 128 | if N is set to 1, then force enabling the EAPD support in the primary AC97 codec. |
129 | override the detection logic and force the external amp bit in the AC97 0x26 register | 129 | override the detection logic and force the external amp bit in the AC97 0x26 register |
130 | to be reset (0). EAPD should be 0 for powerup, and 1 for powerdown. The VTB Santa Cruz | 130 | to be reset (0). EAPD should be 0 for powerup, and 1 for powerdown. The VTB Santa Cruz |
131 | card has inverted logic, so there is a special function for these cards. | 131 | card has inverted logic, so there is a special function for these cards. |
132 | 132 | ||
133 | MODULE_PARM(thinkpad, "i"); | 133 | module_param(thinkpad, bool, 0); |
134 | thinkpad=1 | 134 | thinkpad=1 |
135 | if N is set to 1, then force enabling the clkrun functionality. | 135 | if N is set to 1, then force enabling the clkrun functionality. |
136 | Currently, when the part is being used, then clkrun is disabled for the entire system, | 136 | Currently, when the part is being used, then clkrun is disabled for the entire system, |
diff --git a/Documentation/video4linux/CQcam.txt b/Documentation/video4linux/CQcam.txt index e415e3604539..464e4cec94cb 100644 --- a/Documentation/video4linux/CQcam.txt +++ b/Documentation/video4linux/CQcam.txt | |||
@@ -1,7 +1,7 @@ | |||
1 | c-qcam - Connectix Color QuickCam video4linux kernel driver | 1 | c-qcam - Connectix Color QuickCam video4linux kernel driver |
2 | 2 | ||
3 | Copyright (C) 1999 Dave Forrest <drf5n@virginia.edu> | 3 | Copyright (C) 1999 Dave Forrest <drf5n@virginia.edu> |
4 | released under GNU GPL. | 4 | released under GNU GPL. |
5 | 5 | ||
6 | 1999-12-08 Dave Forrest, written with kernel version 2.2.12 in mind | 6 | 1999-12-08 Dave Forrest, written with kernel version 2.2.12 in mind |
7 | 7 | ||
@@ -45,21 +45,21 @@ configuration. The appropriate flags are: | |||
45 | CONFIG_PNP_PARPORT M for autoprobe.o IEEE1284 readback module | 45 | CONFIG_PNP_PARPORT M for autoprobe.o IEEE1284 readback module |
46 | CONFIG_PRINTER_READBACK M for parport_probe.o IEEE1284 readback module | 46 | CONFIG_PRINTER_READBACK M for parport_probe.o IEEE1284 readback module |
47 | CONFIG_VIDEO_DEV M for videodev.o video4linux module | 47 | CONFIG_VIDEO_DEV M for videodev.o video4linux module |
48 | CONFIG_VIDEO_CQCAM M for c-qcam.o Color Quickcam module | 48 | CONFIG_VIDEO_CQCAM M for c-qcam.o Color Quickcam module |
49 | 49 | ||
50 | With these flags, the kernel should compile and install the modules. | 50 | With these flags, the kernel should compile and install the modules. |
51 | To record and monitor the compilation, I use: | 51 | To record and monitor the compilation, I use: |
52 | 52 | ||
53 | (make zlilo ; \ | 53 | (make zlilo ; \ |
54 | make modules; \ | 54 | make modules; \ |
55 | make modules_install ; | 55 | make modules_install ; |
56 | depmod -a ) &>log & | 56 | depmod -a ) &>log & |
57 | less log # then a capital 'F' to watch the progress | 57 | less log # then a capital 'F' to watch the progress |
58 | 58 | ||
59 | But that is my personal preference. | 59 | But that is my personal preference. |
60 | 60 | ||
61 | 2.2 Configuration | 61 | 2.2 Configuration |
62 | 62 | ||
63 | The configuration requires module configuration and device | 63 | The configuration requires module configuration and device |
64 | configuration. I like kmod or kerneld process with the | 64 | configuration. I like kmod or kerneld process with the |
65 | /etc/modprobe.conf file so the modules can automatically load/unload as | 65 | /etc/modprobe.conf file so the modules can automatically load/unload as |
@@ -68,7 +68,7 @@ using MAKEDEV, or need to be created. The following sections detail | |||
68 | these procedures. | 68 | these procedures. |
69 | 69 | ||
70 | 70 | ||
71 | 2.1 Module Configuration | 71 | 2.1 Module Configuration |
72 | 72 | ||
73 | Using modules requires a bit of work to install and pass the | 73 | Using modules requires a bit of work to install and pass the |
74 | parameters. Understand that entries in /etc/modprobe.conf of: | 74 | parameters. Understand that entries in /etc/modprobe.conf of: |
@@ -128,9 +128,9 @@ system (CONFIG_PROC_FS), the parallel printer support | |||
128 | (CONFIG_PRINTER), the IEEE 1284 system,(CONFIG_PRINTER_READBACK), you | 128 | (CONFIG_PRINTER), the IEEE 1284 system,(CONFIG_PRINTER_READBACK), you |
129 | should be able to read some identification from your quickcam with | 129 | should be able to read some identification from your quickcam with |
130 | 130 | ||
131 | modprobe -v parport | 131 | modprobe -v parport |
132 | modprobe -v parport_probe | 132 | modprobe -v parport_probe |
133 | cat /proc/parport/PORTNUMBER/autoprobe | 133 | cat /proc/parport/PORTNUMBER/autoprobe |
134 | Returns: | 134 | Returns: |
135 | CLASS:MEDIA; | 135 | CLASS:MEDIA; |
136 | MODEL:Color QuickCam 2.0; | 136 | MODEL:Color QuickCam 2.0; |
@@ -140,7 +140,7 @@ Returns: | |||
140 | and well. A common problem is that the current driver does not | 140 | and well. A common problem is that the current driver does not |
141 | reliably detect a c-qcam, even though one is attached. In this case, | 141 | reliably detect a c-qcam, even though one is attached. In this case, |
142 | 142 | ||
143 | modprobe -v c-qcam | 143 | modprobe -v c-qcam |
144 | or | 144 | or |
145 | insmod -v c-qcam | 145 | insmod -v c-qcam |
146 | 146 | ||
@@ -152,16 +152,16 @@ video4linux mailing list and archive for more current information. | |||
152 | 3.1 Checklist: | 152 | 3.1 Checklist: |
153 | 153 | ||
154 | Can you get an image? | 154 | Can you get an image? |
155 | v4lgrab >qcam.ppm ; wc qcam.ppm ; xv qcam.ppm | 155 | v4lgrab >qcam.ppm ; wc qcam.ppm ; xv qcam.ppm |
156 | 156 | ||
157 | Is a working c-qcam connected to the port? | 157 | Is a working c-qcam connected to the port? |
158 | grep ^ /proc/parport/?/autoprobe | 158 | grep ^ /proc/parport/?/autoprobe |
159 | 159 | ||
160 | Do the /dev/video* files exist? | 160 | Do the /dev/video* files exist? |
161 | ls -lad /dev/video | 161 | ls -lad /dev/video |
162 | 162 | ||
163 | Is the c-qcam module loaded? | 163 | Is the c-qcam module loaded? |
164 | modprobe -v c-qcam ; lsmod | 164 | modprobe -v c-qcam ; lsmod |
165 | 165 | ||
166 | Does the camera work with alternate programs? cqcam, etc? | 166 | Does the camera work with alternate programs? cqcam, etc? |
167 | 167 | ||
@@ -174,7 +174,7 @@ video4linux mailing list and archive for more current information. | |||
174 | isn't, you might try patching the c-qcam module to add a parport=xxx | 174 | isn't, you might try patching the c-qcam module to add a parport=xxx |
175 | option as in the bw-qcam module so you can specify the parallel port: | 175 | option as in the bw-qcam module so you can specify the parallel port: |
176 | 176 | ||
177 | insmod -v c-qcam parport=0 | 177 | insmod -v c-qcam parport=0 |
178 | 178 | ||
179 | And bypass the detection code, see ../../drivers/char/c-qcam.c and | 179 | And bypass the detection code, see ../../drivers/char/c-qcam.c and |
180 | look for the 'qc_detect' code and call. | 180 | look for the 'qc_detect' code and call. |
@@ -183,12 +183,12 @@ look for the 'qc_detect' code and call. | |||
183 | this work is documented at the video4linux2 site listed below. | 183 | this work is documented at the video4linux2 site listed below. |
184 | 184 | ||
185 | 185 | ||
186 | 9.0 --- A sample program using v4lgrabber, | 186 | 9.0 --- A sample program using v4lgrabber, |
187 | 187 | ||
188 | This program is a simple image grabber that will copy a frame from the | 188 | This program is a simple image grabber that will copy a frame from the |
189 | first video device, /dev/video0 to standard output in portable pixmap | 189 | first video device, /dev/video0 to standard output in portable pixmap |
190 | format (.ppm) Using this like: 'v4lgrab | convert - c-qcam.jpg' | 190 | format (.ppm) Using this like: 'v4lgrab | convert - c-qcam.jpg' |
191 | produced this picture of me at | 191 | produced this picture of me at |
192 | http://mug.sys.virginia.edu/~drf5n/extras/c-qcam.jpg | 192 | http://mug.sys.virginia.edu/~drf5n/extras/c-qcam.jpg |
193 | 193 | ||
194 | -------------------- 8< ---------------- 8< ----------------------------- | 194 | -------------------- 8< ---------------- 8< ----------------------------- |
@@ -202,8 +202,8 @@ produced this picture of me at | |||
202 | * Use as: | 202 | * Use as: |
203 | * v4lgrab >image.ppm | 203 | * v4lgrab >image.ppm |
204 | * | 204 | * |
205 | * Copyright (C) 1998-05-03, Phil Blundell <philb@gnu.org> | 205 | * Copyright (C) 1998-05-03, Phil Blundell <philb@gnu.org> |
206 | * Copied from http://www.tazenda.demon.co.uk/phil/vgrabber.c | 206 | * Copied from http://www.tazenda.demon.co.uk/phil/vgrabber.c |
207 | * with minor modifications (Dave Forrest, drf5n@virginia.edu). | 207 | * with minor modifications (Dave Forrest, drf5n@virginia.edu). |
208 | * | 208 | * |
209 | */ | 209 | */ |
@@ -225,55 +225,55 @@ produced this picture of me at | |||
225 | 225 | ||
226 | #define READ_VIDEO_PIXEL(buf, format, depth, r, g, b) \ | 226 | #define READ_VIDEO_PIXEL(buf, format, depth, r, g, b) \ |
227 | { \ | 227 | { \ |
228 | switch (format) \ | 228 | switch (format) \ |
229 | { \ | 229 | { \ |
230 | case VIDEO_PALETTE_GREY: \ | 230 | case VIDEO_PALETTE_GREY: \ |
231 | switch (depth) \ | 231 | switch (depth) \ |
232 | { \ | 232 | { \ |
233 | case 4: \ | 233 | case 4: \ |
234 | case 6: \ | 234 | case 6: \ |
235 | case 8: \ | 235 | case 8: \ |
236 | (r) = (g) = (b) = (*buf++ << 8);\ | 236 | (r) = (g) = (b) = (*buf++ << 8);\ |
237 | break; \ | 237 | break; \ |
238 | \ | 238 | \ |
239 | case 16: \ | 239 | case 16: \ |
240 | (r) = (g) = (b) = \ | 240 | (r) = (g) = (b) = \ |
241 | *((unsigned short *) buf); \ | 241 | *((unsigned short *) buf); \ |
242 | buf += 2; \ | 242 | buf += 2; \ |
243 | break; \ | 243 | break; \ |
244 | } \ | 244 | } \ |
245 | break; \ | 245 | break; \ |
246 | \ | 246 | \ |
247 | \ | 247 | \ |
248 | case VIDEO_PALETTE_RGB565: \ | 248 | case VIDEO_PALETTE_RGB565: \ |
249 | { \ | 249 | { \ |
250 | unsigned short tmp = *(unsigned short *)buf; \ | 250 | unsigned short tmp = *(unsigned short *)buf; \ |
251 | (r) = tmp&0xF800; \ | 251 | (r) = tmp&0xF800; \ |
252 | (g) = (tmp<<5)&0xFC00; \ | 252 | (g) = (tmp<<5)&0xFC00; \ |
253 | (b) = (tmp<<11)&0xF800; \ | 253 | (b) = (tmp<<11)&0xF800; \ |
254 | buf += 2; \ | 254 | buf += 2; \ |
255 | } \ | 255 | } \ |
256 | break; \ | 256 | break; \ |
257 | \ | 257 | \ |
258 | case VIDEO_PALETTE_RGB555: \ | 258 | case VIDEO_PALETTE_RGB555: \ |
259 | (r) = (buf[0]&0xF8)<<8; \ | 259 | (r) = (buf[0]&0xF8)<<8; \ |
260 | (g) = ((buf[0] << 5 | buf[1] >> 3)&0xF8)<<8; \ | 260 | (g) = ((buf[0] << 5 | buf[1] >> 3)&0xF8)<<8; \ |
261 | (b) = ((buf[1] << 2 ) & 0xF8)<<8; \ | 261 | (b) = ((buf[1] << 2 ) & 0xF8)<<8; \ |
262 | buf += 2; \ | 262 | buf += 2; \ |
263 | break; \ | 263 | break; \ |
264 | \ | 264 | \ |
265 | case VIDEO_PALETTE_RGB24: \ | 265 | case VIDEO_PALETTE_RGB24: \ |
266 | (r) = buf[0] << 8; (g) = buf[1] << 8; \ | 266 | (r) = buf[0] << 8; (g) = buf[1] << 8; \ |
267 | (b) = buf[2] << 8; \ | 267 | (b) = buf[2] << 8; \ |
268 | buf += 3; \ | 268 | buf += 3; \ |
269 | break; \ | 269 | break; \ |
270 | \ | 270 | \ |
271 | default: \ | 271 | default: \ |
272 | fprintf(stderr, \ | 272 | fprintf(stderr, \ |
273 | "Format %d not yet supported\n", \ | 273 | "Format %d not yet supported\n", \ |
274 | format); \ | 274 | format); \ |
275 | } \ | 275 | } \ |
276 | } | 276 | } |
277 | 277 | ||
278 | int get_brightness_adj(unsigned char *image, long size, int *brightness) { | 278 | int get_brightness_adj(unsigned char *image, long size, int *brightness) { |
279 | long i, tot = 0; | 279 | long i, tot = 0; |
@@ -324,40 +324,40 @@ int main(int argc, char ** argv) | |||
324 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { | 324 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { |
325 | vpic.depth=6; | 325 | vpic.depth=6; |
326 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { | 326 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { |
327 | vpic.depth=4; | 327 | vpic.depth=4; |
328 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { | 328 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { |
329 | fprintf(stderr, "Unable to find a supported capture format.\n"); | 329 | fprintf(stderr, "Unable to find a supported capture format.\n"); |
330 | close(fd); | 330 | close(fd); |
331 | exit(1); | 331 | exit(1); |
332 | } | 332 | } |
333 | } | 333 | } |
334 | } | 334 | } |
335 | } else { | 335 | } else { |
336 | vpic.depth=24; | 336 | vpic.depth=24; |
337 | vpic.palette=VIDEO_PALETTE_RGB24; | 337 | vpic.palette=VIDEO_PALETTE_RGB24; |
338 | 338 | ||
339 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { | 339 | if(ioctl(fd, VIDIOCSPICT, &vpic) < 0) { |
340 | vpic.palette=VIDEO_PALETTE_RGB565; | 340 | vpic.palette=VIDEO_PALETTE_RGB565; |
341 | vpic.depth=16; | 341 | vpic.depth=16; |
342 | 342 | ||
343 | if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { | 343 | if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { |
344 | vpic.palette=VIDEO_PALETTE_RGB555; | 344 | vpic.palette=VIDEO_PALETTE_RGB555; |
345 | vpic.depth=15; | 345 | vpic.depth=15; |
346 | 346 | ||
347 | if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { | 347 | if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { |
348 | fprintf(stderr, "Unable to find a supported capture format.\n"); | 348 | fprintf(stderr, "Unable to find a supported capture format.\n"); |
349 | return -1; | 349 | return -1; |
350 | } | 350 | } |
351 | } | 351 | } |
352 | } | 352 | } |
353 | } | 353 | } |
354 | 354 | ||
355 | buffer = malloc(win.width * win.height * bpp); | 355 | buffer = malloc(win.width * win.height * bpp); |
356 | if (!buffer) { | 356 | if (!buffer) { |
357 | fprintf(stderr, "Out of memory.\n"); | 357 | fprintf(stderr, "Out of memory.\n"); |
358 | exit(1); | 358 | exit(1); |
359 | } | 359 | } |
360 | 360 | ||
361 | do { | 361 | do { |
362 | int newbright; | 362 | int newbright; |
363 | read(fd, buffer, win.width * win.height * bpp); | 363 | read(fd, buffer, win.width * win.height * bpp); |
@@ -365,8 +365,8 @@ int main(int argc, char ** argv) | |||
365 | if (f) { | 365 | if (f) { |
366 | vpic.brightness += (newbright << 8); | 366 | vpic.brightness += (newbright << 8); |
367 | if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { | 367 | if(ioctl(fd, VIDIOCSPICT, &vpic)==-1) { |
368 | perror("VIDIOSPICT"); | 368 | perror("VIDIOSPICT"); |
369 | break; | 369 | break; |
370 | } | 370 | } |
371 | } | 371 | } |
372 | } while (f); | 372 | } while (f); |
@@ -381,7 +381,7 @@ int main(int argc, char ** argv) | |||
381 | fputc(g>>8, stdout); | 381 | fputc(g>>8, stdout); |
382 | fputc(b>>8, stdout); | 382 | fputc(b>>8, stdout); |
383 | } | 383 | } |
384 | 384 | ||
385 | close(fd); | 385 | close(fd); |
386 | return 0; | 386 | return 0; |
387 | } | 387 | } |
diff --git a/Documentation/video4linux/README.cpia b/Documentation/video4linux/README.cpia index c95e7bbc0fdf..19cd3bf24981 100644 --- a/Documentation/video4linux/README.cpia +++ b/Documentation/video4linux/README.cpia | |||
@@ -87,7 +87,7 @@ hardware configuration of the parport. You can give the boot-parameter | |||
87 | at the LILO-prompt or specify it in lilo.conf. I use the following | 87 | at the LILO-prompt or specify it in lilo.conf. I use the following |
88 | append-line in lilo.conf: | 88 | append-line in lilo.conf: |
89 | 89 | ||
90 | append="parport=0x378,7,3" | 90 | append="parport=0x378,7,3" |
91 | 91 | ||
92 | See Documentation/parport.txt for more information about the | 92 | See Documentation/parport.txt for more information about the |
93 | configuration of the parport and the values given above. Do not simply | 93 | configuration of the parport and the values given above. Do not simply |
@@ -175,7 +175,7 @@ THANKS (in no particular order): | |||
175 | - Manuel J. Petit de Gabriel <mpetit@dit.upm.es> for providing help | 175 | - Manuel J. Petit de Gabriel <mpetit@dit.upm.es> for providing help |
176 | with Isabel (http://isabel.dit.upm.es/) | 176 | with Isabel (http://isabel.dit.upm.es/) |
177 | - Bas Huisman <bhuism@cs.utwente.nl> for writing the initial parport code | 177 | - Bas Huisman <bhuism@cs.utwente.nl> for writing the initial parport code |
178 | - Jarl Totland <Jarl.Totland@bdc.no> for setting up the mailing list | 178 | - Jarl Totland <Jarl.Totland@bdc.no> for setting up the mailing list |
179 | and maintaining the web-server[3] | 179 | and maintaining the web-server[3] |
180 | - Chris Whiteford <Chris@informinteractive.com> for fixes related to the | 180 | - Chris Whiteford <Chris@informinteractive.com> for fixes related to the |
181 | 1.02 firmware | 181 | 1.02 firmware |
diff --git a/Documentation/video4linux/Zoran b/Documentation/video4linux/Zoran index 52c94bd7dca1..be9f21b84555 100644 --- a/Documentation/video4linux/Zoran +++ b/Documentation/video4linux/Zoran | |||
@@ -28,7 +28,7 @@ Iomega Buz: | |||
28 | * Philips saa7111 TV decoder | 28 | * Philips saa7111 TV decoder |
29 | * Philips saa7185 TV encoder | 29 | * Philips saa7185 TV encoder |
30 | Drivers to use: videodev, i2c-core, i2c-algo-bit, | 30 | Drivers to use: videodev, i2c-core, i2c-algo-bit, |
31 | videocodec, saa7111, saa7185, zr36060, zr36067 | 31 | videocodec, saa7111, saa7185, zr36060, zr36067 |
32 | Inputs/outputs: Composite and S-video | 32 | Inputs/outputs: Composite and S-video |
33 | Norms: PAL, SECAM (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) | 33 | Norms: PAL, SECAM (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) |
34 | Card number: 7 | 34 | Card number: 7 |
@@ -39,7 +39,7 @@ Linux Media Labs LML33: | |||
39 | * Brooktree bt819 TV decoder | 39 | * Brooktree bt819 TV decoder |
40 | * Brooktree bt856 TV encoder | 40 | * Brooktree bt856 TV encoder |
41 | Drivers to use: videodev, i2c-core, i2c-algo-bit, | 41 | Drivers to use: videodev, i2c-core, i2c-algo-bit, |
42 | videocodec, bt819, bt856, zr36060, zr36067 | 42 | videocodec, bt819, bt856, zr36060, zr36067 |
43 | Inputs/outputs: Composite and S-video | 43 | Inputs/outputs: Composite and S-video |
44 | Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) | 44 | Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) |
45 | Card number: 5 | 45 | Card number: 5 |
@@ -50,7 +50,7 @@ Linux Media Labs LML33R10: | |||
50 | * Philips saa7114 TV decoder | 50 | * Philips saa7114 TV decoder |
51 | * Analog Devices adv7170 TV encoder | 51 | * Analog Devices adv7170 TV encoder |
52 | Drivers to use: videodev, i2c-core, i2c-algo-bit, | 52 | Drivers to use: videodev, i2c-core, i2c-algo-bit, |
53 | videocodec, saa7114, adv7170, zr36060, zr36067 | 53 | videocodec, saa7114, adv7170, zr36060, zr36067 |
54 | Inputs/outputs: Composite and S-video | 54 | Inputs/outputs: Composite and S-video |
55 | Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) | 55 | Norms: PAL (720x576 @ 25 fps), NTSC (720x480 @ 29.97 fps) |
56 | Card number: 6 | 56 | Card number: 6 |
@@ -61,7 +61,7 @@ Pinnacle/Miro DC10(new): | |||
61 | * Philips saa7110a TV decoder | 61 | * Philips saa7110a TV decoder |
62 | * Analog Devices adv7176 TV encoder | 62 | * Analog Devices adv7176 TV encoder |
63 | Drivers to use: videodev, i2c-core, i2c-algo-bit, | 63 | Drivers to use: videodev, i2c-core, i2c-algo-bit, |
64 | videocodec, saa7110, adv7175, zr36060, zr36067 | 64 | videocodec, saa7110, adv7175, zr36060, zr36067 |
65 | Inputs/outputs: Composite, S-video and Internal | 65 | Inputs/outputs: Composite, S-video and Internal |
66 | Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) | 66 | Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) |
67 | Card number: 1 | 67 | Card number: 1 |
@@ -84,7 +84,7 @@ Pinnacle/Miro DC10(old): * | |||
84 | * Micronas vpx3220a TV decoder | 84 | * Micronas vpx3220a TV decoder |
85 | * mse3000 TV encoder or Analog Devices adv7176 TV encoder * | 85 | * mse3000 TV encoder or Analog Devices adv7176 TV encoder * |
86 | Drivers to use: videodev, i2c-core, i2c-algo-bit, | 86 | Drivers to use: videodev, i2c-core, i2c-algo-bit, |
87 | videocodec, vpx3220, mse3000/adv7175, zr36050, zr36016, zr36067 | 87 | videocodec, vpx3220, mse3000/adv7175, zr36050, zr36016, zr36067 |
88 | Inputs/outputs: Composite, S-video and Internal | 88 | Inputs/outputs: Composite, S-video and Internal |
89 | Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) | 89 | Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) |
90 | Card number: 0 | 90 | Card number: 0 |
@@ -96,7 +96,7 @@ Pinnacle/Miro DC30: * | |||
96 | * Micronas vpx3225d/vpx3220a/vpx3216b TV decoder | 96 | * Micronas vpx3225d/vpx3220a/vpx3216b TV decoder |
97 | * Analog Devices adv7176 TV encoder | 97 | * Analog Devices adv7176 TV encoder |
98 | Drivers to use: videodev, i2c-core, i2c-algo-bit, | 98 | Drivers to use: videodev, i2c-core, i2c-algo-bit, |
99 | videocodec, vpx3220/vpx3224, adv7175, zr36050, zr36016, zr36067 | 99 | videocodec, vpx3220/vpx3224, adv7175, zr36050, zr36016, zr36067 |
100 | Inputs/outputs: Composite, S-video and Internal | 100 | Inputs/outputs: Composite, S-video and Internal |
101 | Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) | 101 | Norms: PAL, SECAM (768x576 @ 25 fps), NTSC (640x480 @ 29.97 fps) |
102 | Card number: 3 | 102 | Card number: 3 |
@@ -123,11 +123,11 @@ Note: use encoder=X or decoder=X for non-default i2c chips (see i2c-id.h) | |||
123 | 123 | ||
124 | The best know TV standards are NTSC/PAL/SECAM. but for decoding a frame that | 124 | The best know TV standards are NTSC/PAL/SECAM. but for decoding a frame that |
125 | information is not enough. There are several formats of the TV standards. | 125 | information is not enough. There are several formats of the TV standards. |
126 | And not every TV decoder is able to handle every format. Also the every | 126 | And not every TV decoder is able to handle every format. Also the every |
127 | combination is supported by the driver. There are currently 11 different | 127 | combination is supported by the driver. There are currently 11 different |
128 | tv broadcast formats all aver the world. | 128 | tv broadcast formats all aver the world. |
129 | 129 | ||
130 | The CCIR defines parameters needed for broadcasting the signal. | 130 | The CCIR defines parameters needed for broadcasting the signal. |
131 | The CCIR has defined different standards: A,B,D,E,F,G,D,H,I,K,K1,L,M,N,... | 131 | The CCIR has defined different standards: A,B,D,E,F,G,D,H,I,K,K1,L,M,N,... |
132 | The CCIR says not much about about the colorsystem used !!! | 132 | The CCIR says not much about about the colorsystem used !!! |
133 | And talking about a colorsystem says not to much about how it is broadcast. | 133 | And talking about a colorsystem says not to much about how it is broadcast. |
@@ -136,18 +136,18 @@ The CCIR standards A,E,F are not used any more. | |||
136 | 136 | ||
137 | When you speak about NTSC, you usually mean the standard: CCIR - M using | 137 | When you speak about NTSC, you usually mean the standard: CCIR - M using |
138 | the NTSC colorsystem which is used in the USA, Japan, Mexico, Canada | 138 | the NTSC colorsystem which is used in the USA, Japan, Mexico, Canada |
139 | and a few others. | 139 | and a few others. |
140 | 140 | ||
141 | When you talk about PAL, you usually mean: CCIR - B/G using the PAL | 141 | When you talk about PAL, you usually mean: CCIR - B/G using the PAL |
142 | colorsystem which is used in many Countries. | 142 | colorsystem which is used in many Countries. |
143 | 143 | ||
144 | When you talk about SECAM, you mean: CCIR - L using the SECAM Colorsystem | 144 | When you talk about SECAM, you mean: CCIR - L using the SECAM Colorsystem |
145 | which is used in France, and a few others. | 145 | which is used in France, and a few others. |
146 | 146 | ||
147 | There the other version of SECAM, CCIR - D/K is used in Bulgaria, China, | 147 | There the other version of SECAM, CCIR - D/K is used in Bulgaria, China, |
148 | Slovakai, Hungary, Korea (Rep.), Poland, Rumania and a others. | 148 | Slovakai, Hungary, Korea (Rep.), Poland, Rumania and a others. |
149 | 149 | ||
150 | The CCIR - H uses the PAL colorsystem (sometimes SECAM) and is used in | 150 | The CCIR - H uses the PAL colorsystem (sometimes SECAM) and is used in |
151 | Egypt, Libya, Sri Lanka, Syrain Arab. Rep. | 151 | Egypt, Libya, Sri Lanka, Syrain Arab. Rep. |
152 | 152 | ||
153 | The CCIR - I uses the PAL colorsystem, and is used in Great Britain, Hong Kong, | 153 | The CCIR - I uses the PAL colorsystem, and is used in Great Britain, Hong Kong, |
@@ -158,30 +158,30 @@ and is used in Argentinia, Uruguay, an a few others | |||
158 | 158 | ||
159 | We do not talk about how the audio is broadcast ! | 159 | We do not talk about how the audio is broadcast ! |
160 | 160 | ||
161 | A rather good sites about the TV standards are: | 161 | A rather good sites about the TV standards are: |
162 | http://www.sony.jp/ServiceArea/Voltage_map/ | 162 | http://www.sony.jp/ServiceArea/Voltage_map/ |
163 | http://info.electronicwerkstatt.de/bereiche/fernsehtechnik/frequenzen_und_normen/Fernsehnormen/ | 163 | http://info.electronicwerkstatt.de/bereiche/fernsehtechnik/frequenzen_und_normen/Fernsehnormen/ |
164 | and http://www.cabl.com/restaurant/channel.html | 164 | and http://www.cabl.com/restaurant/channel.html |
165 | 165 | ||
166 | Other weird things around: NTSC 4.43 is a modificated NTSC, which is mainly | 166 | Other weird things around: NTSC 4.43 is a modificated NTSC, which is mainly |
167 | used in PAL VCR's that are able to play back NTSC. PAL 60 seems to be the same | 167 | used in PAL VCR's that are able to play back NTSC. PAL 60 seems to be the same |
168 | as NTSC 4.43 . The Datasheets also talk about NTSC 44, It seems as if it would | 168 | as NTSC 4.43 . The Datasheets also talk about NTSC 44, It seems as if it would |
169 | be the same as NTSC 4.43. | 169 | be the same as NTSC 4.43. |
170 | NTSC Combs seems to be a decoder mode where the decoder uses a comb filter | 170 | NTSC Combs seems to be a decoder mode where the decoder uses a comb filter |
171 | to split coma and luma instead of a Delay line. | 171 | to split coma and luma instead of a Delay line. |
172 | 172 | ||
173 | But I did not defiantly find out what NTSC Comb is. | 173 | But I did not defiantly find out what NTSC Comb is. |
174 | 174 | ||
175 | Philips saa7111 TV decoder | 175 | Philips saa7111 TV decoder |
176 | was introduced in 1997, is used in the BUZ and | 176 | was introduced in 1997, is used in the BUZ and |
177 | can handle: PAL B/G/H/I, PAL N, PAL M, NTSC M, NTSC N, NTSC 4.43 and SECAM | 177 | can handle: PAL B/G/H/I, PAL N, PAL M, NTSC M, NTSC N, NTSC 4.43 and SECAM |
178 | 178 | ||
179 | Philips saa7110a TV decoder | 179 | Philips saa7110a TV decoder |
180 | was introduced in 1995, is used in the Pinnacle/Miro DC10(new), DC10+ and | 180 | was introduced in 1995, is used in the Pinnacle/Miro DC10(new), DC10+ and |
181 | can handle: PAL B/G, NTSC M and SECAM | 181 | can handle: PAL B/G, NTSC M and SECAM |
182 | 182 | ||
183 | Philips saa7114 TV decoder | 183 | Philips saa7114 TV decoder |
184 | was introduced in 2000, is used in the LML33R10 and | 184 | was introduced in 2000, is used in the LML33R10 and |
185 | can handle: PAL B/G/D/H/I/N, PAL N, PAL M, NTSC M, NTSC 4.43 and SECAM | 185 | can handle: PAL B/G/D/H/I/N, PAL N, PAL M, NTSC M, NTSC 4.43 and SECAM |
186 | 186 | ||
187 | Brooktree bt819 TV decoder | 187 | Brooktree bt819 TV decoder |
@@ -206,7 +206,7 @@ was introduced in 1996, is used in the BUZ | |||
206 | can generate: PAL B/G, NTSC M | 206 | can generate: PAL B/G, NTSC M |
207 | 207 | ||
208 | Brooktree bt856 TV Encoder | 208 | Brooktree bt856 TV Encoder |
209 | was introduced in 1994, is used in the LML33 | 209 | was introduced in 1994, is used in the LML33 |
210 | can generate: PAL B/D/G/H/I/N, PAL M, NTSC M, PAL-N (Argentina) | 210 | can generate: PAL B/D/G/H/I/N, PAL M, NTSC M, PAL-N (Argentina) |
211 | 211 | ||
212 | Analog Devices adv7170 TV Encoder | 212 | Analog Devices adv7170 TV Encoder |
@@ -221,9 +221,9 @@ ITT mse3000 TV encoder | |||
221 | was introduced in 1991, is used in the DC10 old | 221 | was introduced in 1991, is used in the DC10 old |
222 | can generate: PAL , NTSC , SECAM | 222 | can generate: PAL , NTSC , SECAM |
223 | 223 | ||
224 | The adv717x, should be able to produce PAL N. But you find nothing PAL N | 224 | The adv717x, should be able to produce PAL N. But you find nothing PAL N |
225 | specific in the registers. Seem that you have to reuse a other standard | 225 | specific in the registers. Seem that you have to reuse a other standard |
226 | to generate PAL N, maybe it would work if you use the PAL M settings. | 226 | to generate PAL N, maybe it would work if you use the PAL M settings. |
227 | 227 | ||
228 | ========================== | 228 | ========================== |
229 | 229 | ||
@@ -261,7 +261,7 @@ Here's my experience of using LML33 and Buz on various motherboards: | |||
261 | 261 | ||
262 | VIA MVP3 | 262 | VIA MVP3 |
263 | Forget it. Pointless. Doesn't work. | 263 | Forget it. Pointless. Doesn't work. |
264 | Intel 430FX (Pentium 200) | 264 | Intel 430FX (Pentium 200) |
265 | LML33 perfect, Buz tolerable (3 or 4 frames dropped per movie) | 265 | LML33 perfect, Buz tolerable (3 or 4 frames dropped per movie) |
266 | Intel 440BX (early stepping) | 266 | Intel 440BX (early stepping) |
267 | LML33 tolerable. Buz starting to get annoying (6-10 frames/hour) | 267 | LML33 tolerable. Buz starting to get annoying (6-10 frames/hour) |
@@ -438,52 +438,52 @@ importance of buffer sizes: | |||
438 | > -q 25 -b 128 : 24.655.992 | 438 | > -q 25 -b 128 : 24.655.992 |
439 | > -q 25 -b 256 : 25.859.820 | 439 | > -q 25 -b 256 : 25.859.820 |
440 | 440 | ||
441 | I woke up, and can't go to sleep again. I'll kill some time explaining why | 441 | I woke up, and can't go to sleep again. I'll kill some time explaining why |
442 | this doesn't look strange to me. | 442 | this doesn't look strange to me. |
443 | 443 | ||
444 | Let's do some math using a width of 704 pixels. I'm not sure whether the Buz | 444 | Let's do some math using a width of 704 pixels. I'm not sure whether the Buz |
445 | actually use that number or not, but that's not too important right now. | 445 | actually use that number or not, but that's not too important right now. |
446 | 446 | ||
447 | 704x288 pixels, one field, is 202752 pixels. Divided by 64 pixels per block; | 447 | 704x288 pixels, one field, is 202752 pixels. Divided by 64 pixels per block; |
448 | 3168 blocks per field. Each pixel consist of two bytes; 128 bytes per block; | 448 | 3168 blocks per field. Each pixel consist of two bytes; 128 bytes per block; |
449 | 1024 bits per block. 100% in the new driver mean 1:2 compression; the maximum | 449 | 1024 bits per block. 100% in the new driver mean 1:2 compression; the maximum |
450 | output becomes 512 bits per block. Actually 510, but 512 is simpler to use | 450 | output becomes 512 bits per block. Actually 510, but 512 is simpler to use |
451 | for calculations. | 451 | for calculations. |
452 | 452 | ||
453 | Let's say that we specify d1q50. We thus want 256 bits per block; times 3168 | 453 | Let's say that we specify d1q50. We thus want 256 bits per block; times 3168 |
454 | becomes 811008 bits; 101376 bytes per field. We're talking raw bits and bytes | 454 | becomes 811008 bits; 101376 bytes per field. We're talking raw bits and bytes |
455 | here, so we don't need to do any fancy corrections for bits-per-pixel or such | 455 | here, so we don't need to do any fancy corrections for bits-per-pixel or such |
456 | things. 101376 bytes per field. | 456 | things. 101376 bytes per field. |
457 | 457 | ||
458 | d1 video contains two fields per frame. Those sum up to 202752 bytes per | 458 | d1 video contains two fields per frame. Those sum up to 202752 bytes per |
459 | frame, and one of those frames goes into each buffer. | 459 | frame, and one of those frames goes into each buffer. |
460 | 460 | ||
461 | But wait a second! -b128 gives 128kB buffers! It's not possible to cram | 461 | But wait a second! -b128 gives 128kB buffers! It's not possible to cram |
462 | 202752 bytes of JPEG data into 128kB! | 462 | 202752 bytes of JPEG data into 128kB! |
463 | 463 | ||
464 | This is what the driver notice and automatically compensate for in your | 464 | This is what the driver notice and automatically compensate for in your |
465 | examples. Let's do some math using this information: | 465 | examples. Let's do some math using this information: |
466 | 466 | ||
467 | 128kB is 131072 bytes. In this buffer, we want to store two fields, which | 467 | 128kB is 131072 bytes. In this buffer, we want to store two fields, which |
468 | leaves 65536 bytes for each field. Using 3168 blocks per field, we get | 468 | leaves 65536 bytes for each field. Using 3168 blocks per field, we get |
469 | 20.68686868... available bytes per block; 165 bits. We can't allow the | 469 | 20.68686868... available bytes per block; 165 bits. We can't allow the |
470 | request for 256 bits per block when there's only 165 bits available! The -q50 | 470 | request for 256 bits per block when there's only 165 bits available! The -q50 |
471 | option is silently overridden, and the -b128 option takes precedence, leaving | 471 | option is silently overridden, and the -b128 option takes precedence, leaving |
472 | us with the equivalence of -q32. | 472 | us with the equivalence of -q32. |
473 | 473 | ||
474 | This gives us a data rate of 165 bits per block, which, times 3168, sums up | 474 | This gives us a data rate of 165 bits per block, which, times 3168, sums up |
475 | to 65340 bytes per field, out of the allowed 65536. The current driver has | 475 | to 65340 bytes per field, out of the allowed 65536. The current driver has |
476 | another level of rate limiting; it won't accept -q values that fill more than | 476 | another level of rate limiting; it won't accept -q values that fill more than |
477 | 6/8 of the specified buffers. (I'm not sure why. "Playing it safe" seem to be | 477 | 6/8 of the specified buffers. (I'm not sure why. "Playing it safe" seem to be |
478 | a safe bet. Personally, I think I would have lowered requested-bits-per-block | 478 | a safe bet. Personally, I think I would have lowered requested-bits-per-block |
479 | by one, or something like that.) We can't use 165 bits per block, but have to | 479 | by one, or something like that.) We can't use 165 bits per block, but have to |
480 | lower it again, to 6/8 of the available buffer space: We end up with 124 bits | 480 | lower it again, to 6/8 of the available buffer space: We end up with 124 bits |
481 | per block, the equivalence of -q24. With 128kB buffers, you can't use greater | 481 | per block, the equivalence of -q24. With 128kB buffers, you can't use greater |
482 | than -q24 at -d1. (And PAL, and 704 pixels width...) | 482 | than -q24 at -d1. (And PAL, and 704 pixels width...) |
483 | 483 | ||
484 | The third example is limited to -q24 through the same process. The second | 484 | The third example is limited to -q24 through the same process. The second |
485 | example, using very similar calculations, is limited to -q48. The only | 485 | example, using very similar calculations, is limited to -q48. The only |
486 | example that actually grab at the specified -q value is the last one, which | 486 | example that actually grab at the specified -q value is the last one, which |
487 | is clearly visible, looking at the file size. | 487 | is clearly visible, looking at the file size. |
488 | -- | 488 | -- |
489 | 489 | ||
diff --git a/Documentation/video4linux/bttv/ICs b/Documentation/video4linux/bttv/ICs index 6b7491336967..611315f87c3e 100644 --- a/Documentation/video4linux/bttv/ICs +++ b/Documentation/video4linux/bttv/ICs | |||
@@ -14,13 +14,13 @@ Hauppauge Win/TV pci (version 405): | |||
14 | 14 | ||
15 | Microchip 24LC02B or | 15 | Microchip 24LC02B or |
16 | Philips 8582E2Y: 256 Byte EEPROM with configuration information | 16 | Philips 8582E2Y: 256 Byte EEPROM with configuration information |
17 | I2C 0xa0-0xa1, (24LC02B also responds to 0xa2-0xaf) | 17 | I2C 0xa0-0xa1, (24LC02B also responds to 0xa2-0xaf) |
18 | Philips SAA5246AGP/E: Videotext decoder chip, I2C 0x22-0x23 | 18 | Philips SAA5246AGP/E: Videotext decoder chip, I2C 0x22-0x23 |
19 | TDA9800: sound decoder | 19 | TDA9800: sound decoder |
20 | Winbond W24257AS-35: 32Kx8 CMOS static RAM (Videotext buffer mem) | 20 | Winbond W24257AS-35: 32Kx8 CMOS static RAM (Videotext buffer mem) |
21 | 14052B: analog switch for selection of sound source | 21 | 14052B: analog switch for selection of sound source |
22 | 22 | ||
23 | PAL: | 23 | PAL: |
24 | TDA5737: VHF, hyperband and UHF mixer/oscillator for TV and VCR 3-band tuners | 24 | TDA5737: VHF, hyperband and UHF mixer/oscillator for TV and VCR 3-band tuners |
25 | TSA5522: 1.4 GHz I2C-bus controlled synthesizer, I2C 0xc2-0xc3 | 25 | TSA5522: 1.4 GHz I2C-bus controlled synthesizer, I2C 0xc2-0xc3 |
26 | 26 | ||
diff --git a/Documentation/video4linux/bttv/PROBLEMS b/Documentation/video4linux/bttv/PROBLEMS index 8e31e9e36bf7..2b8b0079f7c7 100644 --- a/Documentation/video4linux/bttv/PROBLEMS +++ b/Documentation/video4linux/bttv/PROBLEMS | |||
@@ -3,7 +3,7 @@ | |||
3 | - Start capturing by pressing "c" or by selecting it via a menu!!! | 3 | - Start capturing by pressing "c" or by selecting it via a menu!!! |
4 | 4 | ||
5 | - The memory of some S3 cards is not recognized right: | 5 | - The memory of some S3 cards is not recognized right: |
6 | 6 | ||
7 | First of all, if you are not using XFree-3.2 or newer, upgrade AT LEAST to | 7 | First of all, if you are not using XFree-3.2 or newer, upgrade AT LEAST to |
8 | XFree-3.2A! This solved the problem for most people. | 8 | XFree-3.2A! This solved the problem for most people. |
9 | 9 | ||
@@ -31,23 +31,23 @@ | |||
31 | (mostly with Trio 64 but also with some others) | 31 | (mostly with Trio 64 but also with some others) |
32 | Get the free demo version of Accelerated X from www.xinside.com and try | 32 | Get the free demo version of Accelerated X from www.xinside.com and try |
33 | bttv with it. bttv seems to work with most S3 cards with Accelerated X. | 33 | bttv with it. bttv seems to work with most S3 cards with Accelerated X. |
34 | 34 | ||
35 | Since I do not know much (better make that almost nothing) about VGA card | 35 | Since I do not know much (better make that almost nothing) about VGA card |
36 | programming I do not know the reason for this. | 36 | programming I do not know the reason for this. |
37 | Looks like XFree does something different when setting up the video memory? | 37 | Looks like XFree does something different when setting up the video memory? |
38 | Maybe somebody can enlighten me? | 38 | Maybe somebody can enlighten me? |
39 | Would be nice if somebody could get this to work with XFree since | 39 | Would be nice if somebody could get this to work with XFree since |
40 | Accelerated X costs more than some of the grabber cards ... | 40 | Accelerated X costs more than some of the grabber cards ... |
41 | 41 | ||
42 | Better linear frame buffer support for S3 cards will probably be in | 42 | Better linear frame buffer support for S3 cards will probably be in |
43 | XFree 4.0. | 43 | XFree 4.0. |
44 | 44 | ||
45 | - Grabbing is not switched off when changing consoles with XFree. | 45 | - Grabbing is not switched off when changing consoles with XFree. |
46 | That's because XFree and some AcceleratedX versions do not send unmap | 46 | That's because XFree and some AcceleratedX versions do not send unmap |
47 | events. | 47 | events. |
48 | 48 | ||
49 | - Some popup windows (e.g. of the window manager) are not refreshed. | 49 | - Some popup windows (e.g. of the window manager) are not refreshed. |
50 | 50 | ||
51 | Disable backing store by starting X with the option "-bs" | 51 | Disable backing store by starting X with the option "-bs" |
52 | 52 | ||
53 | - When using 32 bpp in XFree or 24+8bpp mode in AccelX 3.1 the system | 53 | - When using 32 bpp in XFree or 24+8bpp mode in AccelX 3.1 the system |
diff --git a/Documentation/video4linux/bttv/README.quirks b/Documentation/video4linux/bttv/README.quirks index e8edb87df711..92e03929a6b2 100644 --- a/Documentation/video4linux/bttv/README.quirks +++ b/Documentation/video4linux/bttv/README.quirks | |||
@@ -38,9 +38,9 @@ tolerate. | |||
38 | ------------------------ | 38 | ------------------------ |
39 | 39 | ||
40 | When using the 430FX PCI, the following rules will ensure | 40 | When using the 430FX PCI, the following rules will ensure |
41 | compatibility: | 41 | compatibility: |
42 | 42 | ||
43 | (1) Deassert REQ at the same time as asserting FRAME. | 43 | (1) Deassert REQ at the same time as asserting FRAME. |
44 | (2) Do not reassert REQ to request another bus transaction until after | 44 | (2) Do not reassert REQ to request another bus transaction until after |
45 | finish-ing the previous transaction. | 45 | finish-ing the previous transaction. |
46 | 46 | ||
diff --git a/Documentation/video4linux/bttv/THANKS b/Documentation/video4linux/bttv/THANKS index 2085399da7d4..950aa781c2e9 100644 --- a/Documentation/video4linux/bttv/THANKS +++ b/Documentation/video4linux/bttv/THANKS | |||
@@ -1,6 +1,6 @@ | |||
1 | Many thanks to: | 1 | Many thanks to: |
2 | 2 | ||
3 | - Markus Schroeder <schroedm@uni-duesseldorf.de> for information on the Bt848 | 3 | - Markus Schroeder <schroedm@uni-duesseldorf.de> for information on the Bt848 |
4 | and tuner programming and his control program xtvc. | 4 | and tuner programming and his control program xtvc. |
5 | 5 | ||
6 | - Martin Buck <martin-2.buck@student.uni-ulm.de> for his great Videotext | 6 | - Martin Buck <martin-2.buck@student.uni-ulm.de> for his great Videotext |
@@ -16,7 +16,7 @@ Many thanks to: | |||
16 | - MIRO for providing a free PCTV card and detailed information about the | 16 | - MIRO for providing a free PCTV card and detailed information about the |
17 | components on their cards. (E.g. how the tuner type is detected) | 17 | components on their cards. (E.g. how the tuner type is detected) |
18 | Without their card I could not have debugged the NTSC mode. | 18 | Without their card I could not have debugged the NTSC mode. |
19 | 19 | ||
20 | - Hauppauge for telling how the sound input is selected and what components | 20 | - Hauppauge for telling how the sound input is selected and what components |
21 | they do and will use on their radio cards. | 21 | they do and will use on their radio cards. |
22 | Also many thanks for faxing me the FM1216 data sheet. | 22 | Also many thanks for faxing me the FM1216 data sheet. |
diff --git a/Documentation/video4linux/radiotrack.txt b/Documentation/video4linux/radiotrack.txt index 2b75345f13e3..d1f3ed199186 100644 --- a/Documentation/video4linux/radiotrack.txt +++ b/Documentation/video4linux/radiotrack.txt | |||
@@ -131,17 +131,17 @@ Check Stereo: BASE <-- 0xd8 (current volume, stereo detect, | |||
131 | x=0xff ==> "not stereo", x=0xfd ==> "stereo detected" | 131 | x=0xff ==> "not stereo", x=0xfd ==> "stereo detected" |
132 | 132 | ||
133 | Set Frequency: code = (freq*40) + 10486188 | 133 | Set Frequency: code = (freq*40) + 10486188 |
134 | foreach of the 24 bits in code, | 134 | foreach of the 24 bits in code, |
135 | (from Least to Most Significant): | 135 | (from Least to Most Significant): |
136 | to write a "zero" bit, | 136 | to write a "zero" bit, |
137 | BASE <-- 0x01 (audio mute, no stereo detect, radio | 137 | BASE <-- 0x01 (audio mute, no stereo detect, radio |
138 | disable, "zero" bit phase 1, tuner adjust) | 138 | disable, "zero" bit phase 1, tuner adjust) |
139 | BASE <-- 0x03 (audio mute, no stereo detect, radio | 139 | BASE <-- 0x03 (audio mute, no stereo detect, radio |
140 | disable, "zero" bit phase 2, tuner adjust) | 140 | disable, "zero" bit phase 2, tuner adjust) |
141 | to write a "one" bit, | 141 | to write a "one" bit, |
142 | BASE <-- 0x05 (audio mute, no stereo detect, radio | 142 | BASE <-- 0x05 (audio mute, no stereo detect, radio |
143 | disable, "one" bit phase 1, tuner adjust) | 143 | disable, "one" bit phase 1, tuner adjust) |
144 | BASE <-- 0x07 (audio mute, no stereo detect, radio | 144 | BASE <-- 0x07 (audio mute, no stereo detect, radio |
145 | disable, "one" bit phase 2, tuner adjust) | 145 | disable, "one" bit phase 2, tuner adjust) |
146 | 146 | ||
147 | ---------------------------------------------------------------------------- | 147 | ---------------------------------------------------------------------------- |
diff --git a/Documentation/video4linux/w9966.txt b/Documentation/video4linux/w9966.txt index e7ac33a7eb06..78a651254b84 100644 --- a/Documentation/video4linux/w9966.txt +++ b/Documentation/video4linux/w9966.txt | |||
@@ -26,7 +26,7 @@ is called VIDEO_PALETTE_YUV422 (16 bpp). | |||
26 | A minimal test application (with source) is available from: | 26 | A minimal test application (with source) is available from: |
27 | http://hem.fyristorg.com/mogul/w9966.html | 27 | http://hem.fyristorg.com/mogul/w9966.html |
28 | 28 | ||
29 | The slow framerate is due to missing DMA ECP read support in the | 29 | The slow framerate is due to missing DMA ECP read support in the |
30 | parport drivers. I might add working EPP support later. | 30 | parport drivers. I might add working EPP support later. |
31 | 31 | ||
32 | Good luck! | 32 | Good luck! |
diff --git a/Documentation/video4linux/zr36120.txt b/Documentation/video4linux/zr36120.txt index 5d6357eefde4..ac6d92d01944 100644 --- a/Documentation/video4linux/zr36120.txt +++ b/Documentation/video4linux/zr36120.txt | |||
@@ -2,7 +2,7 @@ Driver for Trust Computer Products Framegrabber, version 0.6.1 | |||
2 | ------ --- ----- -------- -------- ------------ ------- - - - | 2 | ------ --- ----- -------- -------- ------------ ------- - - - |
3 | 3 | ||
4 | - ZORAN ------------------------------------------------------ | 4 | - ZORAN ------------------------------------------------------ |
5 | Author: Pauline Middelink <middelin@polyware.nl> | 5 | Author: Pauline Middelink <middelin@polyware.nl> |
6 | Date: 18 September 1999 | 6 | Date: 18 September 1999 |
7 | Version: 0.6.1 | 7 | Version: 0.6.1 |
8 | 8 | ||
@@ -115,7 +115,7 @@ After making/checking the devices do: | |||
115 | <n> is the cardtype of the card you have. The cardnumber can | 115 | <n> is the cardtype of the card you have. The cardnumber can |
116 | be found in the source of zr36120. Look for tvcards. If your | 116 | be found in the source of zr36120. Look for tvcards. If your |
117 | card is not there, please try if any other card gives some | 117 | card is not there, please try if any other card gives some |
118 | response, and mail me if you got a working tvcard addition. | 118 | response, and mail me if you got a working tvcard addition. |
119 | 119 | ||
120 | PS. <TVCard editors behold!) | 120 | PS. <TVCard editors behold!) |
121 | Dont forget to set video_input to the number of inputs | 121 | Dont forget to set video_input to the number of inputs |
diff --git a/MAINTAINERS b/MAINTAINERS index 5b6a0145505d..fa92d0d3674b 100644 --- a/MAINTAINERS +++ b/MAINTAINERS | |||
@@ -147,6 +147,18 @@ M: p_gortmaker@yahoo.com | |||
147 | L: netdev@vger.kernel.org | 147 | L: netdev@vger.kernel.org |
148 | S: Maintained | 148 | S: Maintained |
149 | 149 | ||
150 | 9P FILE SYSTEM | ||
151 | P: Eric Van Hensbergen | ||
152 | M: ericvh@gmail.com | ||
153 | P: Ron Minnich | ||
154 | M: rminnich@lanl.gov | ||
155 | P: Latchesar Ionkov | ||
156 | M: lucho@ionkov.net | ||
157 | L: v9fs-developer@lists.sourceforge.net | ||
158 | W: http://v9fs.sf.net | ||
159 | T: git kernel.org:/pub/scm/linux/kernel/ericvh/v9fs.git | ||
160 | S: Maintained | ||
161 | |||
150 | A2232 SERIAL BOARD DRIVER | 162 | A2232 SERIAL BOARD DRIVER |
151 | P: Enver Haase | 163 | P: Enver Haase |
152 | M: ehaase@inf.fu-berlin.de | 164 | M: ehaase@inf.fu-berlin.de |
@@ -2212,13 +2224,6 @@ S: Maintained | |||
2212 | RISCOM8 DRIVER | 2224 | RISCOM8 DRIVER |
2213 | S: Orphan | 2225 | S: Orphan |
2214 | 2226 | ||
2215 | RTLINUX REALTIME LINUX | ||
2216 | P: Victor Yodaiken | ||
2217 | M: yodaiken@fsmlabs.com | ||
2218 | L: rtl@rtlinux.org | ||
2219 | W: www.rtlinux.org | ||
2220 | S: Maintained | ||
2221 | |||
2222 | S3 SAVAGE FRAMEBUFFER DRIVER | 2227 | S3 SAVAGE FRAMEBUFFER DRIVER |
2223 | P: Antonino Daplas | 2228 | P: Antonino Daplas |
2224 | M: adaplas@pol.net | 2229 | M: adaplas@pol.net |
@@ -2531,7 +2536,6 @@ S: Unsupported ? | |||
2531 | STRADIS MPEG-2 DECODER DRIVER | 2536 | STRADIS MPEG-2 DECODER DRIVER |
2532 | P: Nathan Laredo | 2537 | P: Nathan Laredo |
2533 | M: laredo@gnu.org | 2538 | M: laredo@gnu.org |
2534 | W: http://mpeg.openprojects.net/ | ||
2535 | W: http://www.stradis.com/ | 2539 | W: http://www.stradis.com/ |
2536 | S: Maintained | 2540 | S: Maintained |
2537 | 2541 | ||
@@ -2650,7 +2654,7 @@ S: Maintained | |||
2650 | 2654 | ||
2651 | TUN/TAP driver | 2655 | TUN/TAP driver |
2652 | P: Maxim Krasnyansky | 2656 | P: Maxim Krasnyansky |
2653 | M: maxk@qualcomm.com, max_mk@yahoo.com | 2657 | M: maxk@qualcomm.com |
2654 | L: vtun@office.satix.net | 2658 | L: vtun@office.satix.net |
2655 | W: http://vtun.sourceforge.net/tun | 2659 | W: http://vtun.sourceforge.net/tun |
2656 | S: Maintained | 2660 | S: Maintained |
@@ -2979,18 +2983,6 @@ L: rio500-users@lists.sourceforge.net | |||
2979 | W: http://rio500.sourceforge.net | 2983 | W: http://rio500.sourceforge.net |
2980 | S: Maintained | 2984 | S: Maintained |
2981 | 2985 | ||
2982 | V9FS FILE SYSTEM | ||
2983 | P: Eric Van Hensbergen | ||
2984 | M: ericvh@gmail.com | ||
2985 | P: Ron Minnich | ||
2986 | M: rminnich@lanl.gov | ||
2987 | P: Latchesar Ionkov | ||
2988 | M: lucho@ionkov.net | ||
2989 | L: v9fs-developer@lists.sourceforge.net | ||
2990 | W: http://v9fs.sf.net | ||
2991 | T: git kernel.org:/pub/scm/linux/kernel/ericvh/v9fs-devel.git | ||
2992 | S: Maintained | ||
2993 | |||
2994 | VIDEO FOR LINUX | 2986 | VIDEO FOR LINUX |
2995 | P: Mauro Carvalho Chehab | 2987 | P: Mauro Carvalho Chehab |
2996 | M: mchehab@infradead.org | 2988 | M: mchehab@infradead.org |
diff --git a/arch/arm/mach-sa1100/collie.c b/arch/arm/mach-sa1100/collie.c index 6888816a1935..102454082474 100644 --- a/arch/arm/mach-sa1100/collie.c +++ b/arch/arm/mach-sa1100/collie.c | |||
@@ -40,6 +40,7 @@ | |||
40 | #include <asm/hardware/scoop.h> | 40 | #include <asm/hardware/scoop.h> |
41 | #include <asm/mach/sharpsl_param.h> | 41 | #include <asm/mach/sharpsl_param.h> |
42 | #include <asm/hardware/locomo.h> | 42 | #include <asm/hardware/locomo.h> |
43 | #include <asm/arch/mcp.h> | ||
43 | 44 | ||
44 | #include "generic.h" | 45 | #include "generic.h" |
45 | 46 | ||
@@ -66,6 +67,32 @@ struct platform_device colliescoop_device = { | |||
66 | .resource = collie_scoop_resources, | 67 | .resource = collie_scoop_resources, |
67 | }; | 68 | }; |
68 | 69 | ||
70 | static struct scoop_pcmcia_dev collie_pcmcia_scoop[] = { | ||
71 | { | ||
72 | .dev = &colliescoop_device.dev, | ||
73 | .irq = COLLIE_IRQ_GPIO_CF_IRQ, | ||
74 | .cd_irq = COLLIE_IRQ_GPIO_CF_CD, | ||
75 | .cd_irq_str = "PCMCIA0 CD", | ||
76 | }, | ||
77 | }; | ||
78 | |||
79 | static struct scoop_pcmcia_config collie_pcmcia_config = { | ||
80 | .devs = &collie_pcmcia_scoop[0], | ||
81 | .num_devs = 1, | ||
82 | }; | ||
83 | |||
84 | |||
85 | static struct mcp_plat_data collie_mcp_data = { | ||
86 | .mccr0 = MCCR0_ADM, | ||
87 | .sclk_rate = 11981000, | ||
88 | }; | ||
89 | |||
90 | |||
91 | static struct sa1100_port_fns collie_port_fns __initdata = { | ||
92 | .set_mctrl = collie_uart_set_mctrl, | ||
93 | .get_mctrl = collie_uart_get_mctrl, | ||
94 | }; | ||
95 | |||
69 | 96 | ||
70 | static struct resource locomo_resources[] = { | 97 | static struct resource locomo_resources[] = { |
71 | [0] = { | 98 | [0] = { |
@@ -159,6 +186,8 @@ static void __init collie_init(void) | |||
159 | GPDR |= GPIO_32_768kHz; | 186 | GPDR |= GPIO_32_768kHz; |
160 | TUCR = TUCR_32_768kHz; | 187 | TUCR = TUCR_32_768kHz; |
161 | 188 | ||
189 | platform_scoop_config = &collie_pcmcia_config; | ||
190 | |||
162 | ret = platform_add_devices(devices, ARRAY_SIZE(devices)); | 191 | ret = platform_add_devices(devices, ARRAY_SIZE(devices)); |
163 | if (ret) { | 192 | if (ret) { |
164 | printk(KERN_WARNING "collie: Unable to register LoCoMo device\n"); | 193 | printk(KERN_WARNING "collie: Unable to register LoCoMo device\n"); |
@@ -166,6 +195,7 @@ static void __init collie_init(void) | |||
166 | 195 | ||
167 | sa11x0_set_flash_data(&collie_flash_data, collie_flash_resources, | 196 | sa11x0_set_flash_data(&collie_flash_data, collie_flash_resources, |
168 | ARRAY_SIZE(collie_flash_resources)); | 197 | ARRAY_SIZE(collie_flash_resources)); |
198 | sa11x0_set_mcp_data(&collie_mcp_data); | ||
169 | 199 | ||
170 | sharpsl_save_param(); | 200 | sharpsl_save_param(); |
171 | } | 201 | } |
diff --git a/arch/i386/Kconfig b/arch/i386/Kconfig index bfea1bedcbf2..b008fb0cd7b7 100644 --- a/arch/i386/Kconfig +++ b/arch/i386/Kconfig | |||
@@ -737,7 +737,7 @@ config PHYSICAL_START | |||
737 | 737 | ||
738 | config HOTPLUG_CPU | 738 | config HOTPLUG_CPU |
739 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" | 739 | bool "Support for hot-pluggable CPUs (EXPERIMENTAL)" |
740 | depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER | 740 | depends on SMP && HOTPLUG && EXPERIMENTAL && !X86_VOYAGER && !X86_PC |
741 | ---help--- | 741 | ---help--- |
742 | Say Y here to experiment with turning CPUs off and on. CPUs | 742 | Say Y here to experiment with turning CPUs off and on. CPUs |
743 | can be controlled through /sys/devices/system/cpu. | 743 | can be controlled through /sys/devices/system/cpu. |
diff --git a/arch/i386/Kconfig.debug b/arch/i386/Kconfig.debug index 00108ba9a78d..6e97df6979e8 100644 --- a/arch/i386/Kconfig.debug +++ b/arch/i386/Kconfig.debug | |||
@@ -44,8 +44,8 @@ comment "Page alloc debug is incompatible with Software Suspend on i386" | |||
44 | depends on DEBUG_KERNEL && SOFTWARE_SUSPEND | 44 | depends on DEBUG_KERNEL && SOFTWARE_SUSPEND |
45 | 45 | ||
46 | config DEBUG_PAGEALLOC | 46 | config DEBUG_PAGEALLOC |
47 | bool "Page alloc debugging" | 47 | bool "Debug page memory allocations" |
48 | depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND | 48 | depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND && !HUGETLBFS |
49 | help | 49 | help |
50 | Unmap pages from the kernel linear mapping after free_pages(). | 50 | Unmap pages from the kernel linear mapping after free_pages(). |
51 | This results in a large slowdown, but helps to find certain types | 51 | This results in a large slowdown, but helps to find certain types |
diff --git a/arch/i386/boot/edd.S b/arch/i386/boot/edd.S index d8d69f2b911d..4b84ea216f2b 100644 --- a/arch/i386/boot/edd.S +++ b/arch/i386/boot/edd.S | |||
@@ -76,6 +76,8 @@ edd_mbr_sig_read: | |||
76 | popw %es | 76 | popw %es |
77 | popw %bx | 77 | popw %bx |
78 | jc edd_mbr_sig_done # on failure, we're done. | 78 | jc edd_mbr_sig_done # on failure, we're done. |
79 | cmpb $0, %ah # some BIOSes do not set CF | ||
80 | jne edd_mbr_sig_done # on failure, we're done. | ||
79 | movl (EDDBUF+EDD_MBR_SIG_OFFSET), %eax # read sig out of the MBR | 81 | movl (EDDBUF+EDD_MBR_SIG_OFFSET), %eax # read sig out of the MBR |
80 | movl %eax, (%bx) # store success | 82 | movl %eax, (%bx) # store success |
81 | incb (EDD_MBR_SIG_NR_BUF) # note that we stored something | 83 | incb (EDD_MBR_SIG_NR_BUF) # note that we stored something |
diff --git a/arch/i386/kernel/dmi_scan.c b/arch/i386/kernel/dmi_scan.c index 6a93d75db431..ca2a0cbcac04 100644 --- a/arch/i386/kernel/dmi_scan.c +++ b/arch/i386/kernel/dmi_scan.c | |||
@@ -106,7 +106,7 @@ static void __init dmi_save_devices(struct dmi_header *dm) | |||
106 | struct dmi_device *dev; | 106 | struct dmi_device *dev; |
107 | 107 | ||
108 | for (i = 0; i < count; i++) { | 108 | for (i = 0; i < count; i++) { |
109 | char *d = ((char *) dm) + (i * 2); | 109 | char *d = (char *)(dm + 1) + (i * 2); |
110 | 110 | ||
111 | /* Skip disabled device */ | 111 | /* Skip disabled device */ |
112 | if ((*d & 0x80) == 0) | 112 | if ((*d & 0x80) == 0) |
diff --git a/arch/i386/kernel/smpboot.c b/arch/i386/kernel/smpboot.c index 4c470e99a742..82371d83bfa9 100644 --- a/arch/i386/kernel/smpboot.c +++ b/arch/i386/kernel/smpboot.c | |||
@@ -1003,7 +1003,6 @@ void cpu_exit_clear(void) | |||
1003 | 1003 | ||
1004 | cpu_clear(cpu, cpu_callout_map); | 1004 | cpu_clear(cpu, cpu_callout_map); |
1005 | cpu_clear(cpu, cpu_callin_map); | 1005 | cpu_clear(cpu, cpu_callin_map); |
1006 | cpu_clear(cpu, cpu_present_map); | ||
1007 | 1006 | ||
1008 | cpu_clear(cpu, smp_commenced_mask); | 1007 | cpu_clear(cpu, smp_commenced_mask); |
1009 | unmap_cpu_to_logical_apicid(cpu); | 1008 | unmap_cpu_to_logical_apicid(cpu); |
@@ -1015,31 +1014,20 @@ struct warm_boot_cpu_info { | |||
1015 | int cpu; | 1014 | int cpu; |
1016 | }; | 1015 | }; |
1017 | 1016 | ||
1018 | static void __devinit do_warm_boot_cpu(void *p) | 1017 | static void __cpuinit do_warm_boot_cpu(void *p) |
1019 | { | 1018 | { |
1020 | struct warm_boot_cpu_info *info = p; | 1019 | struct warm_boot_cpu_info *info = p; |
1021 | do_boot_cpu(info->apicid, info->cpu); | 1020 | do_boot_cpu(info->apicid, info->cpu); |
1022 | complete(info->complete); | 1021 | complete(info->complete); |
1023 | } | 1022 | } |
1024 | 1023 | ||
1025 | int __devinit smp_prepare_cpu(int cpu) | 1024 | static int __cpuinit __smp_prepare_cpu(int cpu) |
1026 | { | 1025 | { |
1027 | DECLARE_COMPLETION(done); | 1026 | DECLARE_COMPLETION(done); |
1028 | struct warm_boot_cpu_info info; | 1027 | struct warm_boot_cpu_info info; |
1029 | struct work_struct task; | 1028 | struct work_struct task; |
1030 | int apicid, ret; | 1029 | int apicid, ret; |
1031 | 1030 | ||
1032 | lock_cpu_hotplug(); | ||
1033 | |||
1034 | /* | ||
1035 | * On x86, CPU0 is never offlined. Trying to bring up an | ||
1036 | * already-booted CPU will hang. So check for that case. | ||
1037 | */ | ||
1038 | if (cpu_online(cpu)) { | ||
1039 | ret = -EINVAL; | ||
1040 | goto exit; | ||
1041 | } | ||
1042 | |||
1043 | apicid = x86_cpu_to_apicid[cpu]; | 1031 | apicid = x86_cpu_to_apicid[cpu]; |
1044 | if (apicid == BAD_APICID) { | 1032 | if (apicid == BAD_APICID) { |
1045 | ret = -ENODEV; | 1033 | ret = -ENODEV; |
@@ -1064,7 +1052,6 @@ int __devinit smp_prepare_cpu(int cpu) | |||
1064 | zap_low_mappings(); | 1052 | zap_low_mappings(); |
1065 | ret = 0; | 1053 | ret = 0; |
1066 | exit: | 1054 | exit: |
1067 | unlock_cpu_hotplug(); | ||
1068 | return ret; | 1055 | return ret; |
1069 | } | 1056 | } |
1070 | #endif | 1057 | #endif |
@@ -1392,6 +1379,22 @@ void __cpu_die(unsigned int cpu) | |||
1392 | 1379 | ||
1393 | int __devinit __cpu_up(unsigned int cpu) | 1380 | int __devinit __cpu_up(unsigned int cpu) |
1394 | { | 1381 | { |
1382 | #ifdef CONFIG_HOTPLUG_CPU | ||
1383 | int ret=0; | ||
1384 | |||
1385 | /* | ||
1386 | * We do warm boot only on cpus that had booted earlier | ||
1387 | * Otherwise cold boot is all handled from smp_boot_cpus(). | ||
1388 | * cpu_callin_map is set during AP kickstart process. Its reset | ||
1389 | * when a cpu is taken offline from cpu_exit_clear(). | ||
1390 | */ | ||
1391 | if (!cpu_isset(cpu, cpu_callin_map)) | ||
1392 | ret = __smp_prepare_cpu(cpu); | ||
1393 | |||
1394 | if (ret) | ||
1395 | return -EIO; | ||
1396 | #endif | ||
1397 | |||
1395 | /* In case one didn't come up */ | 1398 | /* In case one didn't come up */ |
1396 | if (!cpu_isset(cpu, cpu_callin_map)) { | 1399 | if (!cpu_isset(cpu, cpu_callin_map)) { |
1397 | printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu); | 1400 | printk(KERN_DEBUG "skipping cpu%d, didn't come online\n", cpu); |
diff --git a/arch/ia64/ia32/sys_ia32.c b/arch/ia64/ia32/sys_ia32.c index 70dba1f0e2ee..13e739e4c84d 100644 --- a/arch/ia64/ia32/sys_ia32.c +++ b/arch/ia64/ia32/sys_ia32.c | |||
@@ -1166,19 +1166,7 @@ put_tv32 (struct compat_timeval __user *o, struct timeval *i) | |||
1166 | asmlinkage unsigned long | 1166 | asmlinkage unsigned long |
1167 | sys32_alarm (unsigned int seconds) | 1167 | sys32_alarm (unsigned int seconds) |
1168 | { | 1168 | { |
1169 | struct itimerval it_new, it_old; | 1169 | return alarm_setitimer(seconds); |
1170 | unsigned int oldalarm; | ||
1171 | |||
1172 | it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0; | ||
1173 | it_new.it_value.tv_sec = seconds; | ||
1174 | it_new.it_value.tv_usec = 0; | ||
1175 | do_setitimer(ITIMER_REAL, &it_new, &it_old); | ||
1176 | oldalarm = it_old.it_value.tv_sec; | ||
1177 | /* ehhh.. We can't return 0 if we have an alarm pending.. */ | ||
1178 | /* And we'd better return too much than too little anyway */ | ||
1179 | if (it_old.it_value.tv_usec) | ||
1180 | oldalarm++; | ||
1181 | return oldalarm; | ||
1182 | } | 1170 | } |
1183 | 1171 | ||
1184 | /* Translations due to time_t size differences. Which affects all | 1172 | /* Translations due to time_t size differences. Which affects all |
diff --git a/arch/m32r/Kconfig.debug b/arch/m32r/Kconfig.debug index bbf711bab69e..2e1019ddbb22 100644 --- a/arch/m32r/Kconfig.debug +++ b/arch/m32r/Kconfig.debug | |||
@@ -19,7 +19,7 @@ config DEBUG_STACK_USAGE | |||
19 | This option will slow down process creation somewhat. | 19 | This option will slow down process creation somewhat. |
20 | 20 | ||
21 | config DEBUG_PAGEALLOC | 21 | config DEBUG_PAGEALLOC |
22 | bool "Page alloc debugging" | 22 | bool "Debug page memory allocations" |
23 | depends on DEBUG_KERNEL && BROKEN | 23 | depends on DEBUG_KERNEL && BROKEN |
24 | help | 24 | help |
25 | Unmap pages from the kernel linear mapping after free_pages(). | 25 | Unmap pages from the kernel linear mapping after free_pages(). |
diff --git a/arch/mips/kernel/sysirix.c b/arch/mips/kernel/sysirix.c index 0fc3730a294f..5407b784cd01 100644 --- a/arch/mips/kernel/sysirix.c +++ b/arch/mips/kernel/sysirix.c | |||
@@ -645,27 +645,7 @@ static inline void getitimer_real(struct itimerval *value) | |||
645 | 645 | ||
646 | asmlinkage unsigned int irix_alarm(unsigned int seconds) | 646 | asmlinkage unsigned int irix_alarm(unsigned int seconds) |
647 | { | 647 | { |
648 | struct itimerval it_new, it_old; | 648 | return alarm_setitimer(seconds); |
649 | unsigned int oldalarm; | ||
650 | |||
651 | if (!seconds) { | ||
652 | getitimer_real(&it_old); | ||
653 | del_timer(¤t->real_timer); | ||
654 | } else { | ||
655 | it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0; | ||
656 | it_new.it_value.tv_sec = seconds; | ||
657 | it_new.it_value.tv_usec = 0; | ||
658 | do_setitimer(ITIMER_REAL, &it_new, &it_old); | ||
659 | } | ||
660 | oldalarm = it_old.it_value.tv_sec; | ||
661 | /* | ||
662 | * ehhh.. We can't return 0 if we have an alarm pending ... | ||
663 | * And we'd better return too much than too little anyway | ||
664 | */ | ||
665 | if (it_old.it_value.tv_usec) | ||
666 | oldalarm++; | ||
667 | |||
668 | return oldalarm; | ||
669 | } | 649 | } |
670 | 650 | ||
671 | asmlinkage int irix_pause(void) | 651 | asmlinkage int irix_pause(void) |
diff --git a/arch/ppc/8xx_io/cs4218_tdm.c b/arch/ppc/8xx_io/cs4218_tdm.c index 49eb2a7e65c0..a892356d5c3b 100644 --- a/arch/ppc/8xx_io/cs4218_tdm.c +++ b/arch/ppc/8xx_io/cs4218_tdm.c | |||
@@ -126,11 +126,11 @@ static int numReadBufs = 4, readbufSize = 32; | |||
126 | */ | 126 | */ |
127 | static volatile cbd_t *rx_base, *rx_cur, *tx_base, *tx_cur; | 127 | static volatile cbd_t *rx_base, *rx_cur, *tx_base, *tx_cur; |
128 | 128 | ||
129 | MODULE_PARM(catchRadius, "i"); | 129 | module_param(catchRadius, int, 0); |
130 | MODULE_PARM(numBufs, "i"); | 130 | module_param(numBufs, int, 0); |
131 | MODULE_PARM(bufSize, "i"); | 131 | module_param(bufSize, int, 0); |
132 | MODULE_PARM(numreadBufs, "i"); | 132 | module_param(numreadBufs, int, 0); |
133 | MODULE_PARM(readbufSize, "i"); | 133 | module_param(readbufSize, int, 0); |
134 | 134 | ||
135 | #define arraysize(x) (sizeof(x)/sizeof(*(x))) | 135 | #define arraysize(x) (sizeof(x)/sizeof(*(x))) |
136 | #define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff)) | 136 | #define le2be16(x) (((x)<<8 & 0xff00) | ((x)>>8 & 0x00ff)) |
diff --git a/arch/sparc64/Kconfig.debug b/arch/sparc64/Kconfig.debug index 3e31be494e54..afe0a7720a26 100644 --- a/arch/sparc64/Kconfig.debug +++ b/arch/sparc64/Kconfig.debug | |||
@@ -24,7 +24,7 @@ config DEBUG_BOOTMEM | |||
24 | bool "Debug BOOTMEM initialization" | 24 | bool "Debug BOOTMEM initialization" |
25 | 25 | ||
26 | config DEBUG_PAGEALLOC | 26 | config DEBUG_PAGEALLOC |
27 | bool "Page alloc debugging" | 27 | bool "Debug page memory allocations" |
28 | depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND | 28 | depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND |
29 | help | 29 | help |
30 | Unmap pages from the kernel linear mapping after free_pages(). | 30 | Unmap pages from the kernel linear mapping after free_pages(). |
diff --git a/arch/x86_64/ia32/sys_ia32.c b/arch/x86_64/ia32/sys_ia32.c index 2bc55af95419..2b2d029f477c 100644 --- a/arch/x86_64/ia32/sys_ia32.c +++ b/arch/x86_64/ia32/sys_ia32.c | |||
@@ -430,24 +430,12 @@ put_tv32(struct compat_timeval __user *o, struct timeval *i) | |||
430 | return err; | 430 | return err; |
431 | } | 431 | } |
432 | 432 | ||
433 | extern int do_setitimer(int which, struct itimerval *, struct itimerval *); | 433 | extern unsigned int alarm_setitimer(unsigned int seconds); |
434 | 434 | ||
435 | asmlinkage long | 435 | asmlinkage long |
436 | sys32_alarm(unsigned int seconds) | 436 | sys32_alarm(unsigned int seconds) |
437 | { | 437 | { |
438 | struct itimerval it_new, it_old; | 438 | return alarm_setitimer(seconds); |
439 | unsigned int oldalarm; | ||
440 | |||
441 | it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0; | ||
442 | it_new.it_value.tv_sec = seconds; | ||
443 | it_new.it_value.tv_usec = 0; | ||
444 | do_setitimer(ITIMER_REAL, &it_new, &it_old); | ||
445 | oldalarm = it_old.it_value.tv_sec; | ||
446 | /* ehhh.. We can't return 0 if we have an alarm pending.. */ | ||
447 | /* And we'd better return too much than too little anyway */ | ||
448 | if (it_old.it_value.tv_usec) | ||
449 | oldalarm++; | ||
450 | return oldalarm; | ||
451 | } | 439 | } |
452 | 440 | ||
453 | /* Translations due to time_t size differences. Which affects all | 441 | /* Translations due to time_t size differences. Which affects all |
diff --git a/drivers/base/cpu.c b/drivers/base/cpu.c index 29f3d7504da1..dd712b24ec91 100644 --- a/drivers/base/cpu.c +++ b/drivers/base/cpu.c | |||
@@ -19,11 +19,6 @@ EXPORT_SYMBOL(cpu_sysdev_class); | |||
19 | static struct sys_device *cpu_sys_devices[NR_CPUS]; | 19 | static struct sys_device *cpu_sys_devices[NR_CPUS]; |
20 | 20 | ||
21 | #ifdef CONFIG_HOTPLUG_CPU | 21 | #ifdef CONFIG_HOTPLUG_CPU |
22 | int __attribute__((weak)) smp_prepare_cpu (int cpu) | ||
23 | { | ||
24 | return 0; | ||
25 | } | ||
26 | |||
27 | static ssize_t show_online(struct sys_device *dev, char *buf) | 22 | static ssize_t show_online(struct sys_device *dev, char *buf) |
28 | { | 23 | { |
29 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); | 24 | struct cpu *cpu = container_of(dev, struct cpu, sysdev); |
@@ -44,9 +39,7 @@ static ssize_t store_online(struct sys_device *dev, const char *buf, | |||
44 | kobject_uevent(&dev->kobj, KOBJ_OFFLINE); | 39 | kobject_uevent(&dev->kobj, KOBJ_OFFLINE); |
45 | break; | 40 | break; |
46 | case '1': | 41 | case '1': |
47 | ret = smp_prepare_cpu(cpu->sysdev.id); | 42 | ret = cpu_up(cpu->sysdev.id); |
48 | if (!ret) | ||
49 | ret = cpu_up(cpu->sysdev.id); | ||
50 | if (!ret) | 43 | if (!ret) |
51 | kobject_uevent(&dev->kobj, KOBJ_ONLINE); | 44 | kobject_uevent(&dev->kobj, KOBJ_ONLINE); |
52 | break; | 45 | break; |
diff --git a/drivers/block/Kconfig b/drivers/block/Kconfig index 8b1331677407..e57ac5a43246 100644 --- a/drivers/block/Kconfig +++ b/drivers/block/Kconfig | |||
@@ -401,7 +401,6 @@ config BLK_DEV_RAM_SIZE | |||
401 | 401 | ||
402 | config BLK_DEV_INITRD | 402 | config BLK_DEV_INITRD |
403 | bool "Initial RAM disk (initrd) support" | 403 | bool "Initial RAM disk (initrd) support" |
404 | depends on BLK_DEV_RAM=y | ||
405 | help | 404 | help |
406 | The initial RAM disk is a RAM disk that is loaded by the boot loader | 405 | The initial RAM disk is a RAM disk that is loaded by the boot loader |
407 | (loadlin or lilo) and that is mounted as root before the normal boot | 406 | (loadlin or lilo) and that is mounted as root before the normal boot |
diff --git a/drivers/block/ataflop.c b/drivers/block/ataflop.c index f8ce235ccfc3..c39650920bdf 100644 --- a/drivers/block/ataflop.c +++ b/drivers/block/ataflop.c | |||
@@ -271,7 +271,7 @@ unsigned char *DMABuffer; /* buffer for writes */ | |||
271 | static unsigned long PhysDMABuffer; /* physical address */ | 271 | static unsigned long PhysDMABuffer; /* physical address */ |
272 | 272 | ||
273 | static int UseTrackbuffer = -1; /* Do track buffering? */ | 273 | static int UseTrackbuffer = -1; /* Do track buffering? */ |
274 | MODULE_PARM(UseTrackbuffer, "i"); | 274 | module_param(UseTrackbuffer, int, 0); |
275 | 275 | ||
276 | unsigned char *TrackBuffer; /* buffer for reads */ | 276 | unsigned char *TrackBuffer; /* buffer for reads */ |
277 | static unsigned long PhysTrackBuffer; /* physical address */ | 277 | static unsigned long PhysTrackBuffer; /* physical address */ |
@@ -296,7 +296,7 @@ static int MotorOn = 0, MotorOffTrys; | |||
296 | static int IsFormatting = 0, FormatError; | 296 | static int IsFormatting = 0, FormatError; |
297 | 297 | ||
298 | static int UserSteprate[FD_MAX_UNITS] = { -1, -1 }; | 298 | static int UserSteprate[FD_MAX_UNITS] = { -1, -1 }; |
299 | MODULE_PARM(UserSteprate, "1-" __MODULE_STRING(FD_MAX_UNITS) "i"); | 299 | module_param_array(UserSteprate, int, NULL, 0); |
300 | 300 | ||
301 | /* Synchronization of FDC access. */ | 301 | /* Synchronization of FDC access. */ |
302 | static volatile int fdc_busy = 0; | 302 | static volatile int fdc_busy = 0; |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index fb2d0be7cdeb..840919bba76c 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -4594,7 +4594,7 @@ static void __init parse_floppy_cfg_string(char *cfg) | |||
4594 | } | 4594 | } |
4595 | } | 4595 | } |
4596 | 4596 | ||
4597 | int init_module(void) | 4597 | int __init init_module(void) |
4598 | { | 4598 | { |
4599 | if (floppy) | 4599 | if (floppy) |
4600 | parse_floppy_cfg_string(floppy); | 4600 | parse_floppy_cfg_string(floppy); |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index a9bde30dadad..8bca4905d7f7 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -639,10 +639,7 @@ static int __init nbd_init(void) | |||
639 | int err = -ENOMEM; | 639 | int err = -ENOMEM; |
640 | int i; | 640 | int i; |
641 | 641 | ||
642 | if (sizeof(struct nbd_request) != 28) { | 642 | BUILD_BUG_ON(sizeof(struct nbd_request) != 28); |
643 | printk(KERN_CRIT "nbd: sizeof nbd_request needs to be 28 in order to work!\n" ); | ||
644 | return -EIO; | ||
645 | } | ||
646 | 643 | ||
647 | if (nbds_max > MAX_NBD) { | 644 | if (nbds_max > MAX_NBD) { |
648 | printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD, | 645 | printk(KERN_CRIT "nbd: cannot allocate more than %u nbds; %u requested.\n", MAX_NBD, |
diff --git a/drivers/cdrom/cm206.c b/drivers/cdrom/cm206.c index fad27a87ce35..f43a988dd413 100644 --- a/drivers/cdrom/cm206.c +++ b/drivers/cdrom/cm206.c | |||
@@ -218,12 +218,12 @@ static int cm206_base = CM206_BASE; | |||
218 | static int cm206_irq = CM206_IRQ; | 218 | static int cm206_irq = CM206_IRQ; |
219 | #ifdef MODULE | 219 | #ifdef MODULE |
220 | static int cm206[2] = { 0, 0 }; /* for compatible `insmod' parameter passing */ | 220 | static int cm206[2] = { 0, 0 }; /* for compatible `insmod' parameter passing */ |
221 | module_param_array(cm206, int, NULL, 0); /* base,irq or irq,base */ | ||
221 | #endif | 222 | #endif |
222 | 223 | ||
223 | MODULE_PARM(cm206_base, "i"); /* base */ | 224 | module_param(cm206_base, int, 0); /* base */ |
224 | MODULE_PARM(cm206_irq, "i"); /* irq */ | 225 | module_param(cm206_irq, int, 0); /* irq */ |
225 | MODULE_PARM(cm206, "1-2i"); /* base,irq or irq,base */ | 226 | module_param(auto_probe, bool, 0); /* auto probe base and irq */ |
226 | MODULE_PARM(auto_probe, "i"); /* auto probe base and irq */ | ||
227 | MODULE_LICENSE("GPL"); | 227 | MODULE_LICENSE("GPL"); |
228 | 228 | ||
229 | #define POLLOOP 100 /* milliseconds */ | 229 | #define POLLOOP 100 /* milliseconds */ |
diff --git a/drivers/cdrom/sbpcd.c b/drivers/cdrom/sbpcd.c index 4760f515f591..05c9e865ecaf 100644 --- a/drivers/cdrom/sbpcd.c +++ b/drivers/cdrom/sbpcd.c | |||
@@ -464,8 +464,13 @@ static int sbpcd[] = | |||
464 | static __cacheline_aligned DEFINE_SPINLOCK(sbpcd_lock); | 464 | static __cacheline_aligned DEFINE_SPINLOCK(sbpcd_lock); |
465 | static struct request_queue *sbpcd_queue; | 465 | static struct request_queue *sbpcd_queue; |
466 | 466 | ||
467 | MODULE_PARM(sbpcd, "2i"); | 467 | /* You can only set the first pair, from old MODULE_PARM code. */ |
468 | MODULE_PARM(max_drives, "i"); | 468 | static int sbpcd_set(const char *val, struct kernel_param *kp) |
469 | { | ||
470 | get_options((char *)val, 2, (int *)sbpcd); | ||
471 | return 0; | ||
472 | } | ||
473 | module_param_call(sbpcd, sbpcd_set, NULL, NULL, 0); | ||
469 | 474 | ||
470 | #define NUM_PROBE (sizeof(sbpcd) / sizeof(int)) | 475 | #define NUM_PROBE (sizeof(sbpcd) / sizeof(int)) |
471 | 476 | ||
@@ -553,6 +558,7 @@ static unsigned char msgnum; | |||
553 | static char msgbuf[80]; | 558 | static char msgbuf[80]; |
554 | 559 | ||
555 | static int max_drives = MAX_DRIVES; | 560 | static int max_drives = MAX_DRIVES; |
561 | module_param(max_drives, int, 0); | ||
556 | #ifndef MODULE | 562 | #ifndef MODULE |
557 | static unsigned char setup_done; | 563 | static unsigned char setup_done; |
558 | static const char *str_sb_l = "soundblaster"; | 564 | static const char *str_sb_l = "soundblaster"; |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index d745004281d0..abd4c5118a1b 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -736,7 +736,8 @@ int ipmi_create_user(unsigned int if_num, | |||
736 | intf = ipmi_interfaces[if_num]; | 736 | intf = ipmi_interfaces[if_num]; |
737 | if ((if_num >= MAX_IPMI_INTERFACES) || IPMI_INVALID_INTERFACE(intf)) { | 737 | if ((if_num >= MAX_IPMI_INTERFACES) || IPMI_INVALID_INTERFACE(intf)) { |
738 | spin_unlock_irqrestore(&interfaces_lock, flags); | 738 | spin_unlock_irqrestore(&interfaces_lock, flags); |
739 | return -EINVAL; | 739 | rv = -EINVAL; |
740 | goto out_kfree; | ||
740 | } | 741 | } |
741 | 742 | ||
742 | /* Note that each existing user holds a refcount to the interface. */ | 743 | /* Note that each existing user holds a refcount to the interface. */ |
@@ -751,14 +752,14 @@ int ipmi_create_user(unsigned int if_num, | |||
751 | 752 | ||
752 | if (!try_module_get(intf->handlers->owner)) { | 753 | if (!try_module_get(intf->handlers->owner)) { |
753 | rv = -ENODEV; | 754 | rv = -ENODEV; |
754 | goto out_err; | 755 | goto out_kref; |
755 | } | 756 | } |
756 | 757 | ||
757 | if (intf->handlers->inc_usecount) { | 758 | if (intf->handlers->inc_usecount) { |
758 | rv = intf->handlers->inc_usecount(intf->send_info); | 759 | rv = intf->handlers->inc_usecount(intf->send_info); |
759 | if (rv) { | 760 | if (rv) { |
760 | module_put(intf->handlers->owner); | 761 | module_put(intf->handlers->owner); |
761 | goto out_err; | 762 | goto out_kref; |
762 | } | 763 | } |
763 | } | 764 | } |
764 | 765 | ||
@@ -769,9 +770,10 @@ int ipmi_create_user(unsigned int if_num, | |||
769 | *user = new_user; | 770 | *user = new_user; |
770 | return 0; | 771 | return 0; |
771 | 772 | ||
772 | out_err: | 773 | out_kref: |
773 | kfree(new_user); | ||
774 | kref_put(&intf->refcount, intf_free); | 774 | kref_put(&intf->refcount, intf_free); |
775 | out_kfree: | ||
776 | kfree(new_user); | ||
775 | return rv; | 777 | return rv; |
776 | } | 778 | } |
777 | 779 | ||
diff --git a/drivers/char/istallion.c b/drivers/char/istallion.c index ede128356af2..e5247f85a446 100644 --- a/drivers/char/istallion.c +++ b/drivers/char/istallion.c | |||
@@ -378,13 +378,13 @@ MODULE_DESCRIPTION("Stallion Intelligent Multiport Serial Driver"); | |||
378 | MODULE_LICENSE("GPL"); | 378 | MODULE_LICENSE("GPL"); |
379 | 379 | ||
380 | 380 | ||
381 | MODULE_PARM(board0, "1-3s"); | 381 | module_param_array(board0, charp, NULL, 0); |
382 | MODULE_PARM_DESC(board0, "Board 0 config -> name[,ioaddr[,memaddr]"); | 382 | MODULE_PARM_DESC(board0, "Board 0 config -> name[,ioaddr[,memaddr]"); |
383 | MODULE_PARM(board1, "1-3s"); | 383 | module_param_array(board1, charp, NULL, 0); |
384 | MODULE_PARM_DESC(board1, "Board 1 config -> name[,ioaddr[,memaddr]"); | 384 | MODULE_PARM_DESC(board1, "Board 1 config -> name[,ioaddr[,memaddr]"); |
385 | MODULE_PARM(board2, "1-3s"); | 385 | module_param_array(board2, charp, NULL, 0); |
386 | MODULE_PARM_DESC(board2, "Board 2 config -> name[,ioaddr[,memaddr]"); | 386 | MODULE_PARM_DESC(board2, "Board 2 config -> name[,ioaddr[,memaddr]"); |
387 | MODULE_PARM(board3, "1-3s"); | 387 | module_param_array(board3, charp, NULL, 0); |
388 | MODULE_PARM_DESC(board3, "Board 3 config -> name[,ioaddr[,memaddr]"); | 388 | MODULE_PARM_DESC(board3, "Board 3 config -> name[,ioaddr[,memaddr]"); |
389 | 389 | ||
390 | #endif | 390 | #endif |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 29c41f4418c0..26d0116b48d4 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -216,11 +216,9 @@ static ssize_t write_mem(struct file * file, const char __user * buf, | |||
216 | 216 | ||
217 | copied = copy_from_user(ptr, buf, sz); | 217 | copied = copy_from_user(ptr, buf, sz); |
218 | if (copied) { | 218 | if (copied) { |
219 | ssize_t ret; | 219 | written += sz - copied; |
220 | 220 | if (written) | |
221 | ret = written + (sz - copied); | 221 | break; |
222 | if (ret) | ||
223 | return ret; | ||
224 | return -EFAULT; | 222 | return -EFAULT; |
225 | } | 223 | } |
226 | buf += sz; | 224 | buf += sz; |
@@ -456,11 +454,9 @@ do_write_kmem(void *p, unsigned long realp, const char __user * buf, | |||
456 | 454 | ||
457 | copied = copy_from_user(ptr, buf, sz); | 455 | copied = copy_from_user(ptr, buf, sz); |
458 | if (copied) { | 456 | if (copied) { |
459 | ssize_t ret; | 457 | written += sz - copied; |
460 | 458 | if (written) | |
461 | ret = written + (sz - copied); | 459 | break; |
462 | if (ret) | ||
463 | return ret; | ||
464 | return -EFAULT; | 460 | return -EFAULT; |
465 | } | 461 | } |
466 | buf += sz; | 462 | buf += sz; |
@@ -514,11 +510,10 @@ static ssize_t write_kmem(struct file * file, const char __user * buf, | |||
514 | if (len) { | 510 | if (len) { |
515 | written = copy_from_user(kbuf, buf, len); | 511 | written = copy_from_user(kbuf, buf, len); |
516 | if (written) { | 512 | if (written) { |
517 | ssize_t ret; | 513 | if (wrote + virtr) |
518 | 514 | break; | |
519 | free_page((unsigned long)kbuf); | 515 | free_page((unsigned long)kbuf); |
520 | ret = wrote + virtr + (len - written); | 516 | return -EFAULT; |
521 | return ret ? ret : -EFAULT; | ||
522 | } | 517 | } |
523 | } | 518 | } |
524 | len = vwrite(kbuf, (char *)p, len); | 519 | len = vwrite(kbuf, (char *)p, len); |
@@ -563,8 +558,11 @@ static ssize_t write_port(struct file * file, const char __user * buf, | |||
563 | return -EFAULT; | 558 | return -EFAULT; |
564 | while (count-- > 0 && i < 65536) { | 559 | while (count-- > 0 && i < 65536) { |
565 | char c; | 560 | char c; |
566 | if (__get_user(c, tmp)) | 561 | if (__get_user(c, tmp)) { |
562 | if (tmp > buf) | ||
563 | break; | ||
567 | return -EFAULT; | 564 | return -EFAULT; |
565 | } | ||
568 | outb(c,i); | 566 | outb(c,i); |
569 | i++; | 567 | i++; |
570 | tmp++; | 568 | tmp++; |
diff --git a/drivers/char/mxser.c b/drivers/char/mxser.c index ea725a9964e2..0fb2fb9fb024 100644 --- a/drivers/char/mxser.c +++ b/drivers/char/mxser.c | |||
@@ -243,10 +243,10 @@ static int verbose = 0; | |||
243 | 243 | ||
244 | MODULE_AUTHOR("Casper Yang"); | 244 | MODULE_AUTHOR("Casper Yang"); |
245 | MODULE_DESCRIPTION("MOXA Smartio/Industio Family Multiport Board Device Driver"); | 245 | MODULE_DESCRIPTION("MOXA Smartio/Industio Family Multiport Board Device Driver"); |
246 | MODULE_PARM(ioaddr, "1-4i"); | 246 | module_param_array(ioaddr, int, NULL, 0); |
247 | MODULE_PARM(ttymajor, "i"); | 247 | module_param(ttymajor, int, 0); |
248 | MODULE_PARM(calloutmajor, "i"); | 248 | module_param(calloutmajor, int, 0); |
249 | MODULE_PARM(verbose, "i"); | 249 | module_param(verbose, bool, 0); |
250 | MODULE_LICENSE("GPL"); | 250 | MODULE_LICENSE("GPL"); |
251 | 251 | ||
252 | struct mxser_log { | 252 | struct mxser_log { |
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 306ee0f091a4..bee6c47b45bd 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
@@ -65,10 +65,11 @@ | |||
65 | #include <linux/parport.h> | 65 | #include <linux/parport.h> |
66 | #include <linux/ctype.h> | 66 | #include <linux/ctype.h> |
67 | #include <linux/poll.h> | 67 | #include <linux/poll.h> |
68 | #include <asm/uaccess.h> | 68 | #include <linux/major.h> |
69 | #include <linux/ppdev.h> | 69 | #include <linux/ppdev.h> |
70 | #include <linux/smp_lock.h> | 70 | #include <linux/smp_lock.h> |
71 | #include <linux/device.h> | 71 | #include <linux/device.h> |
72 | #include <asm/uaccess.h> | ||
72 | 73 | ||
73 | #define PP_VERSION "ppdev: user-space parallel port driver" | 74 | #define PP_VERSION "ppdev: user-space parallel port driver" |
74 | #define CHRDEV "ppdev" | 75 | #define CHRDEV "ppdev" |
diff --git a/drivers/char/riscom8.c b/drivers/char/riscom8.c index 119e629656b7..657c0d88f48c 100644 --- a/drivers/char/riscom8.c +++ b/drivers/char/riscom8.c | |||
@@ -1743,10 +1743,10 @@ static int iobase; | |||
1743 | static int iobase1; | 1743 | static int iobase1; |
1744 | static int iobase2; | 1744 | static int iobase2; |
1745 | static int iobase3; | 1745 | static int iobase3; |
1746 | MODULE_PARM(iobase, "i"); | 1746 | module_param(iobase, int, 0); |
1747 | MODULE_PARM(iobase1, "i"); | 1747 | module_param(iobase1, int, 0); |
1748 | MODULE_PARM(iobase2, "i"); | 1748 | module_param(iobase2, int, 0); |
1749 | MODULE_PARM(iobase3, "i"); | 1749 | module_param(iobase3, int, 0); |
1750 | 1750 | ||
1751 | MODULE_LICENSE("GPL"); | 1751 | MODULE_LICENSE("GPL"); |
1752 | #endif /* MODULE */ | 1752 | #endif /* MODULE */ |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index d58f82318853..35082dc12eae 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -42,16 +42,15 @@ | |||
42 | /* Whether we react on sysrq keys or just ignore them */ | 42 | /* Whether we react on sysrq keys or just ignore them */ |
43 | int sysrq_enabled = 1; | 43 | int sysrq_enabled = 1; |
44 | 44 | ||
45 | /* Loglevel sysrq handler */ | ||
46 | static void sysrq_handle_loglevel(int key, struct pt_regs *pt_regs, | 45 | static void sysrq_handle_loglevel(int key, struct pt_regs *pt_regs, |
47 | struct tty_struct *tty) | 46 | struct tty_struct *tty) |
48 | { | 47 | { |
49 | int i; | 48 | int i; |
50 | i = key - '0'; | 49 | i = key - '0'; |
51 | console_loglevel = 7; | 50 | console_loglevel = 7; |
52 | printk("Loglevel set to %d\n", i); | 51 | printk("Loglevel set to %d\n", i); |
53 | console_loglevel = i; | 52 | console_loglevel = i; |
54 | } | 53 | } |
55 | static struct sysrq_key_op sysrq_loglevel_op = { | 54 | static struct sysrq_key_op sysrq_loglevel_op = { |
56 | .handler = sysrq_handle_loglevel, | 55 | .handler = sysrq_handle_loglevel, |
57 | .help_msg = "loglevel0-8", | 56 | .help_msg = "loglevel0-8", |
@@ -59,11 +58,9 @@ static struct sysrq_key_op sysrq_loglevel_op = { | |||
59 | .enable_mask = SYSRQ_ENABLE_LOG, | 58 | .enable_mask = SYSRQ_ENABLE_LOG, |
60 | }; | 59 | }; |
61 | 60 | ||
62 | |||
63 | /* SAK sysrq handler */ | ||
64 | #ifdef CONFIG_VT | 61 | #ifdef CONFIG_VT |
65 | static void sysrq_handle_SAK(int key, struct pt_regs *pt_regs, | 62 | static void sysrq_handle_SAK(int key, struct pt_regs *pt_regs, |
66 | struct tty_struct *tty) | 63 | struct tty_struct *tty) |
67 | { | 64 | { |
68 | if (tty) | 65 | if (tty) |
69 | do_SAK(tty); | 66 | do_SAK(tty); |
@@ -75,12 +72,13 @@ static struct sysrq_key_op sysrq_SAK_op = { | |||
75 | .action_msg = "SAK", | 72 | .action_msg = "SAK", |
76 | .enable_mask = SYSRQ_ENABLE_KEYBOARD, | 73 | .enable_mask = SYSRQ_ENABLE_KEYBOARD, |
77 | }; | 74 | }; |
75 | #else | ||
76 | #define sysrq_SAK_op (*(struct sysrq_key_op *)0) | ||
78 | #endif | 77 | #endif |
79 | 78 | ||
80 | #ifdef CONFIG_VT | 79 | #ifdef CONFIG_VT |
81 | /* unraw sysrq handler */ | ||
82 | static void sysrq_handle_unraw(int key, struct pt_regs *pt_regs, | 80 | static void sysrq_handle_unraw(int key, struct pt_regs *pt_regs, |
83 | struct tty_struct *tty) | 81 | struct tty_struct *tty) |
84 | { | 82 | { |
85 | struct kbd_struct *kbd = &kbd_table[fg_console]; | 83 | struct kbd_struct *kbd = &kbd_table[fg_console]; |
86 | 84 | ||
@@ -93,10 +91,11 @@ static struct sysrq_key_op sysrq_unraw_op = { | |||
93 | .action_msg = "Keyboard mode set to XLATE", | 91 | .action_msg = "Keyboard mode set to XLATE", |
94 | .enable_mask = SYSRQ_ENABLE_KEYBOARD, | 92 | .enable_mask = SYSRQ_ENABLE_KEYBOARD, |
95 | }; | 93 | }; |
94 | #else | ||
95 | #define sysrq_unraw_op (*(struct sysrq_key_op *)0) | ||
96 | #endif /* CONFIG_VT */ | 96 | #endif /* CONFIG_VT */ |
97 | 97 | ||
98 | #ifdef CONFIG_KEXEC | 98 | #ifdef CONFIG_KEXEC |
99 | /* crashdump sysrq handler */ | ||
100 | static void sysrq_handle_crashdump(int key, struct pt_regs *pt_regs, | 99 | static void sysrq_handle_crashdump(int key, struct pt_regs *pt_regs, |
101 | struct tty_struct *tty) | 100 | struct tty_struct *tty) |
102 | { | 101 | { |
@@ -108,16 +107,16 @@ static struct sysrq_key_op sysrq_crashdump_op = { | |||
108 | .action_msg = "Trigger a crashdump", | 107 | .action_msg = "Trigger a crashdump", |
109 | .enable_mask = SYSRQ_ENABLE_DUMP, | 108 | .enable_mask = SYSRQ_ENABLE_DUMP, |
110 | }; | 109 | }; |
110 | #else | ||
111 | #define sysrq_crashdump_op (*(struct sysrq_key_op *)0) | ||
111 | #endif | 112 | #endif |
112 | 113 | ||
113 | /* reboot sysrq handler */ | ||
114 | static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs, | 114 | static void sysrq_handle_reboot(int key, struct pt_regs *pt_regs, |
115 | struct tty_struct *tty) | 115 | struct tty_struct *tty) |
116 | { | 116 | { |
117 | local_irq_enable(); | 117 | local_irq_enable(); |
118 | emergency_restart(); | 118 | emergency_restart(); |
119 | } | 119 | } |
120 | |||
121 | static struct sysrq_key_op sysrq_reboot_op = { | 120 | static struct sysrq_key_op sysrq_reboot_op = { |
122 | .handler = sysrq_handle_reboot, | 121 | .handler = sysrq_handle_reboot, |
123 | .help_msg = "reBoot", | 122 | .help_msg = "reBoot", |
@@ -126,11 +125,10 @@ static struct sysrq_key_op sysrq_reboot_op = { | |||
126 | }; | 125 | }; |
127 | 126 | ||
128 | static void sysrq_handle_sync(int key, struct pt_regs *pt_regs, | 127 | static void sysrq_handle_sync(int key, struct pt_regs *pt_regs, |
129 | struct tty_struct *tty) | 128 | struct tty_struct *tty) |
130 | { | 129 | { |
131 | emergency_sync(); | 130 | emergency_sync(); |
132 | } | 131 | } |
133 | |||
134 | static struct sysrq_key_op sysrq_sync_op = { | 132 | static struct sysrq_key_op sysrq_sync_op = { |
135 | .handler = sysrq_handle_sync, | 133 | .handler = sysrq_handle_sync, |
136 | .help_msg = "Sync", | 134 | .help_msg = "Sync", |
@@ -139,11 +137,10 @@ static struct sysrq_key_op sysrq_sync_op = { | |||
139 | }; | 137 | }; |
140 | 138 | ||
141 | static void sysrq_handle_mountro(int key, struct pt_regs *pt_regs, | 139 | static void sysrq_handle_mountro(int key, struct pt_regs *pt_regs, |
142 | struct tty_struct *tty) | 140 | struct tty_struct *tty) |
143 | { | 141 | { |
144 | emergency_remount(); | 142 | emergency_remount(); |
145 | } | 143 | } |
146 | |||
147 | static struct sysrq_key_op sysrq_mountro_op = { | 144 | static struct sysrq_key_op sysrq_mountro_op = { |
148 | .handler = sysrq_handle_mountro, | 145 | .handler = sysrq_handle_mountro, |
149 | .help_msg = "Unmount", | 146 | .help_msg = "Unmount", |
@@ -151,28 +148,23 @@ static struct sysrq_key_op sysrq_mountro_op = { | |||
151 | .enable_mask = SYSRQ_ENABLE_REMOUNT, | 148 | .enable_mask = SYSRQ_ENABLE_REMOUNT, |
152 | }; | 149 | }; |
153 | 150 | ||
154 | /* END SYNC SYSRQ HANDLERS BLOCK */ | ||
155 | |||
156 | #ifdef CONFIG_DEBUG_MUTEXES | 151 | #ifdef CONFIG_DEBUG_MUTEXES |
157 | 152 | static void sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, | |
158 | static void | 153 | struct tty_struct *tty) |
159 | sysrq_handle_showlocks(int key, struct pt_regs *pt_regs, struct tty_struct *tty) | ||
160 | { | 154 | { |
161 | mutex_debug_show_all_locks(); | 155 | mutex_debug_show_all_locks(); |
162 | } | 156 | } |
163 | |||
164 | static struct sysrq_key_op sysrq_showlocks_op = { | 157 | static struct sysrq_key_op sysrq_showlocks_op = { |
165 | .handler = sysrq_handle_showlocks, | 158 | .handler = sysrq_handle_showlocks, |
166 | .help_msg = "show-all-locks(D)", | 159 | .help_msg = "show-all-locks(D)", |
167 | .action_msg = "Show Locks Held", | 160 | .action_msg = "Show Locks Held", |
168 | }; | 161 | }; |
169 | 162 | #else | |
163 | #define sysrq_showlocks_op (*(struct sysrq_key_op *)0) | ||
170 | #endif | 164 | #endif |
171 | 165 | ||
172 | /* SHOW SYSRQ HANDLERS BLOCK */ | ||
173 | |||
174 | static void sysrq_handle_showregs(int key, struct pt_regs *pt_regs, | 166 | static void sysrq_handle_showregs(int key, struct pt_regs *pt_regs, |
175 | struct tty_struct *tty) | 167 | struct tty_struct *tty) |
176 | { | 168 | { |
177 | if (pt_regs) | 169 | if (pt_regs) |
178 | show_regs(pt_regs); | 170 | show_regs(pt_regs); |
@@ -184,9 +176,8 @@ static struct sysrq_key_op sysrq_showregs_op = { | |||
184 | .enable_mask = SYSRQ_ENABLE_DUMP, | 176 | .enable_mask = SYSRQ_ENABLE_DUMP, |
185 | }; | 177 | }; |
186 | 178 | ||
187 | |||
188 | static void sysrq_handle_showstate(int key, struct pt_regs *pt_regs, | 179 | static void sysrq_handle_showstate(int key, struct pt_regs *pt_regs, |
189 | struct tty_struct *tty) | 180 | struct tty_struct *tty) |
190 | { | 181 | { |
191 | show_state(); | 182 | show_state(); |
192 | } | 183 | } |
@@ -197,9 +188,8 @@ static struct sysrq_key_op sysrq_showstate_op = { | |||
197 | .enable_mask = SYSRQ_ENABLE_DUMP, | 188 | .enable_mask = SYSRQ_ENABLE_DUMP, |
198 | }; | 189 | }; |
199 | 190 | ||
200 | |||
201 | static void sysrq_handle_showmem(int key, struct pt_regs *pt_regs, | 191 | static void sysrq_handle_showmem(int key, struct pt_regs *pt_regs, |
202 | struct tty_struct *tty) | 192 | struct tty_struct *tty) |
203 | { | 193 | { |
204 | show_mem(); | 194 | show_mem(); |
205 | } | 195 | } |
@@ -210,13 +200,9 @@ static struct sysrq_key_op sysrq_showmem_op = { | |||
210 | .enable_mask = SYSRQ_ENABLE_DUMP, | 200 | .enable_mask = SYSRQ_ENABLE_DUMP, |
211 | }; | 201 | }; |
212 | 202 | ||
213 | /* SHOW SYSRQ HANDLERS BLOCK */ | 203 | /* |
214 | 204 | * Signal sysrq helper function. Sends a signal to all user processes. | |
215 | 205 | */ | |
216 | /* SIGNAL SYSRQ HANDLERS BLOCK */ | ||
217 | |||
218 | /* signal sysrq helper function | ||
219 | * Sends a signal to all user processes */ | ||
220 | static void send_sig_all(int sig) | 206 | static void send_sig_all(int sig) |
221 | { | 207 | { |
222 | struct task_struct *p; | 208 | struct task_struct *p; |
@@ -229,7 +215,7 @@ static void send_sig_all(int sig) | |||
229 | } | 215 | } |
230 | 216 | ||
231 | static void sysrq_handle_term(int key, struct pt_regs *pt_regs, | 217 | static void sysrq_handle_term(int key, struct pt_regs *pt_regs, |
232 | struct tty_struct *tty) | 218 | struct tty_struct *tty) |
233 | { | 219 | { |
234 | send_sig_all(SIGTERM); | 220 | send_sig_all(SIGTERM); |
235 | console_loglevel = 8; | 221 | console_loglevel = 8; |
@@ -243,7 +229,8 @@ static struct sysrq_key_op sysrq_term_op = { | |||
243 | 229 | ||
244 | static void moom_callback(void *ignored) | 230 | static void moom_callback(void *ignored) |
245 | { | 231 | { |
246 | out_of_memory(&NODE_DATA(0)->node_zonelists[ZONE_NORMAL], GFP_KERNEL, 0); | 232 | out_of_memory(&NODE_DATA(0)->node_zonelists[ZONE_NORMAL], |
233 | GFP_KERNEL, 0); | ||
247 | } | 234 | } |
248 | 235 | ||
249 | static DECLARE_WORK(moom_work, moom_callback, NULL); | 236 | static DECLARE_WORK(moom_work, moom_callback, NULL); |
@@ -260,7 +247,7 @@ static struct sysrq_key_op sysrq_moom_op = { | |||
260 | }; | 247 | }; |
261 | 248 | ||
262 | static void sysrq_handle_kill(int key, struct pt_regs *pt_regs, | 249 | static void sysrq_handle_kill(int key, struct pt_regs *pt_regs, |
263 | struct tty_struct *tty) | 250 | struct tty_struct *tty) |
264 | { | 251 | { |
265 | send_sig_all(SIGKILL); | 252 | send_sig_all(SIGKILL); |
266 | console_loglevel = 8; | 253 | console_loglevel = 8; |
@@ -272,8 +259,6 @@ static struct sysrq_key_op sysrq_kill_op = { | |||
272 | .enable_mask = SYSRQ_ENABLE_SIGNAL, | 259 | .enable_mask = SYSRQ_ENABLE_SIGNAL, |
273 | }; | 260 | }; |
274 | 261 | ||
275 | /* END SIGNAL SYSRQ HANDLERS BLOCK */ | ||
276 | |||
277 | static void sysrq_handle_unrt(int key, struct pt_regs *pt_regs, | 262 | static void sysrq_handle_unrt(int key, struct pt_regs *pt_regs, |
278 | struct tty_struct *tty) | 263 | struct tty_struct *tty) |
279 | { | 264 | { |
@@ -288,110 +273,99 @@ static struct sysrq_key_op sysrq_unrt_op = { | |||
288 | 273 | ||
289 | /* Key Operations table and lock */ | 274 | /* Key Operations table and lock */ |
290 | static DEFINE_SPINLOCK(sysrq_key_table_lock); | 275 | static DEFINE_SPINLOCK(sysrq_key_table_lock); |
291 | #define SYSRQ_KEY_TABLE_LENGTH 36 | 276 | |
292 | static struct sysrq_key_op *sysrq_key_table[SYSRQ_KEY_TABLE_LENGTH] = { | 277 | static struct sysrq_key_op *sysrq_key_table[36] = { |
293 | /* 0 */ &sysrq_loglevel_op, | 278 | &sysrq_loglevel_op, /* 0 */ |
294 | /* 1 */ &sysrq_loglevel_op, | 279 | &sysrq_loglevel_op, /* 1 */ |
295 | /* 2 */ &sysrq_loglevel_op, | 280 | &sysrq_loglevel_op, /* 2 */ |
296 | /* 3 */ &sysrq_loglevel_op, | 281 | &sysrq_loglevel_op, /* 3 */ |
297 | /* 4 */ &sysrq_loglevel_op, | 282 | &sysrq_loglevel_op, /* 4 */ |
298 | /* 5 */ &sysrq_loglevel_op, | 283 | &sysrq_loglevel_op, /* 5 */ |
299 | /* 6 */ &sysrq_loglevel_op, | 284 | &sysrq_loglevel_op, /* 6 */ |
300 | /* 7 */ &sysrq_loglevel_op, | 285 | &sysrq_loglevel_op, /* 7 */ |
301 | /* 8 */ &sysrq_loglevel_op, | 286 | &sysrq_loglevel_op, /* 8 */ |
302 | /* 9 */ &sysrq_loglevel_op, | 287 | &sysrq_loglevel_op, /* 9 */ |
303 | /* a */ NULL, /* Don't use for system provided sysrqs, | 288 | |
304 | it is handled specially on the sparc | 289 | /* |
305 | and will never arrive */ | 290 | * Don't use for system provided sysrqs, it is handled specially on |
306 | /* b */ &sysrq_reboot_op, | 291 | * sparc and will never arrive |
307 | #ifdef CONFIG_KEXEC | 292 | */ |
308 | /* c */ &sysrq_crashdump_op, | 293 | NULL, /* a */ |
309 | #else | 294 | &sysrq_reboot_op, /* b */ |
310 | /* c */ NULL, | 295 | &sysrq_crashdump_op, /* c */ |
311 | #endif | 296 | &sysrq_showlocks_op, /* d */ |
312 | #ifdef CONFIG_DEBUG_MUTEXES | 297 | &sysrq_term_op, /* e */ |
313 | /* d */ &sysrq_showlocks_op, | 298 | &sysrq_moom_op, /* f */ |
314 | #else | 299 | NULL, /* g */ |
315 | /* d */ NULL, | 300 | NULL, /* h */ |
316 | #endif | 301 | &sysrq_kill_op, /* i */ |
317 | /* e */ &sysrq_term_op, | 302 | NULL, /* j */ |
318 | /* f */ &sysrq_moom_op, | 303 | &sysrq_SAK_op, /* k */ |
319 | /* g */ NULL, | 304 | NULL, /* l */ |
320 | /* h */ NULL, | 305 | &sysrq_showmem_op, /* m */ |
321 | /* i */ &sysrq_kill_op, | 306 | &sysrq_unrt_op, /* n */ |
322 | /* j */ NULL, | 307 | /* This will often be registered as 'Off' at init time */ |
323 | #ifdef CONFIG_VT | 308 | NULL, /* o */ |
324 | /* k */ &sysrq_SAK_op, | 309 | &sysrq_showregs_op, /* p */ |
325 | #else | 310 | NULL, /* q */ |
326 | /* k */ NULL, | 311 | &sysrq_unraw_op, /* r */ |
327 | #endif | 312 | &sysrq_sync_op, /* s */ |
328 | /* l */ NULL, | 313 | &sysrq_showstate_op, /* t */ |
329 | /* m */ &sysrq_showmem_op, | 314 | &sysrq_mountro_op, /* u */ |
330 | /* n */ &sysrq_unrt_op, | 315 | /* May be assigned at init time by SMP VOYAGER */ |
331 | /* o */ NULL, /* This will often be registered | 316 | NULL, /* v */ |
332 | as 'Off' at init time */ | 317 | NULL, /* w */ |
333 | /* p */ &sysrq_showregs_op, | 318 | NULL, /* x */ |
334 | /* q */ NULL, | 319 | NULL, /* y */ |
335 | #ifdef CONFIG_VT | 320 | NULL /* z */ |
336 | /* r */ &sysrq_unraw_op, | ||
337 | #else | ||
338 | /* r */ NULL, | ||
339 | #endif | ||
340 | /* s */ &sysrq_sync_op, | ||
341 | /* t */ &sysrq_showstate_op, | ||
342 | /* u */ &sysrq_mountro_op, | ||
343 | /* v */ NULL, /* May be assigned at init time by SMP VOYAGER */ | ||
344 | /* w */ NULL, | ||
345 | /* x */ NULL, | ||
346 | /* y */ NULL, | ||
347 | /* z */ NULL | ||
348 | }; | 321 | }; |
349 | 322 | ||
350 | /* key2index calculation, -1 on invalid index */ | 323 | /* key2index calculation, -1 on invalid index */ |
351 | static int sysrq_key_table_key2index(int key) { | 324 | static int sysrq_key_table_key2index(int key) |
325 | { | ||
352 | int retval; | 326 | int retval; |
353 | if ((key >= '0') && (key <= '9')) { | 327 | |
328 | if ((key >= '0') && (key <= '9')) | ||
354 | retval = key - '0'; | 329 | retval = key - '0'; |
355 | } else if ((key >= 'a') && (key <= 'z')) { | 330 | else if ((key >= 'a') && (key <= 'z')) |
356 | retval = key + 10 - 'a'; | 331 | retval = key + 10 - 'a'; |
357 | } else { | 332 | else |
358 | retval = -1; | 333 | retval = -1; |
359 | } | ||
360 | return retval; | 334 | return retval; |
361 | } | 335 | } |
362 | 336 | ||
363 | /* | 337 | /* |
364 | * get and put functions for the table, exposed to modules. | 338 | * get and put functions for the table, exposed to modules. |
365 | */ | 339 | */ |
366 | 340 | struct sysrq_key_op *__sysrq_get_key_op(int key) | |
367 | struct sysrq_key_op *__sysrq_get_key_op (int key) { | 341 | { |
368 | struct sysrq_key_op *op_p; | 342 | struct sysrq_key_op *op_p = NULL; |
369 | int i; | 343 | int i; |
370 | 344 | ||
371 | i = sysrq_key_table_key2index(key); | 345 | i = sysrq_key_table_key2index(key); |
372 | op_p = (i == -1) ? NULL : sysrq_key_table[i]; | 346 | if (i != -1) |
347 | op_p = sysrq_key_table[i]; | ||
373 | return op_p; | 348 | return op_p; |
374 | } | 349 | } |
375 | 350 | ||
376 | static void __sysrq_put_key_op (int key, struct sysrq_key_op *op_p) { | 351 | static void __sysrq_put_key_op(int key, struct sysrq_key_op *op_p) |
377 | int i; | 352 | { |
353 | int i = sysrq_key_table_key2index(key); | ||
378 | 354 | ||
379 | i = sysrq_key_table_key2index(key); | ||
380 | if (i != -1) | 355 | if (i != -1) |
381 | sysrq_key_table[i] = op_p; | 356 | sysrq_key_table[i] = op_p; |
382 | } | 357 | } |
383 | 358 | ||
384 | /* | 359 | /* |
385 | * This is the non-locking version of handle_sysrq | 360 | * This is the non-locking version of handle_sysrq. It must/can only be called |
386 | * It must/can only be called by sysrq key handlers, | 361 | * by sysrq key handlers, as they are inside of the lock |
387 | * as they are inside of the lock | ||
388 | */ | 362 | */ |
389 | 363 | void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, | |
390 | void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, int check_mask) | 364 | int check_mask) |
391 | { | 365 | { |
392 | struct sysrq_key_op *op_p; | 366 | struct sysrq_key_op *op_p; |
393 | int orig_log_level; | 367 | int orig_log_level; |
394 | int i, j; | 368 | int i; |
395 | unsigned long flags; | 369 | unsigned long flags; |
396 | 370 | ||
397 | spin_lock_irqsave(&sysrq_key_table_lock, flags); | 371 | spin_lock_irqsave(&sysrq_key_table_lock, flags); |
@@ -401,26 +375,34 @@ void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, in | |||
401 | 375 | ||
402 | op_p = __sysrq_get_key_op(key); | 376 | op_p = __sysrq_get_key_op(key); |
403 | if (op_p) { | 377 | if (op_p) { |
404 | /* Should we check for enabled operations (/proc/sysrq-trigger should not) | 378 | /* |
405 | * and is the invoked operation enabled? */ | 379 | * Should we check for enabled operations (/proc/sysrq-trigger |
380 | * should not) and is the invoked operation enabled? | ||
381 | */ | ||
406 | if (!check_mask || sysrq_enabled == 1 || | 382 | if (!check_mask || sysrq_enabled == 1 || |
407 | (sysrq_enabled & op_p->enable_mask)) { | 383 | (sysrq_enabled & op_p->enable_mask)) { |
408 | printk ("%s\n", op_p->action_msg); | 384 | printk("%s\n", op_p->action_msg); |
409 | console_loglevel = orig_log_level; | 385 | console_loglevel = orig_log_level; |
410 | op_p->handler(key, pt_regs, tty); | 386 | op_p->handler(key, pt_regs, tty); |
411 | } | 387 | } else { |
412 | else | ||
413 | printk("This sysrq operation is disabled.\n"); | 388 | printk("This sysrq operation is disabled.\n"); |
389 | } | ||
414 | } else { | 390 | } else { |
415 | printk("HELP : "); | 391 | printk("HELP : "); |
416 | /* Only print the help msg once per handler */ | 392 | /* Only print the help msg once per handler */ |
417 | for (i=0; i<SYSRQ_KEY_TABLE_LENGTH; i++) | 393 | for (i = 0; i < ARRAY_SIZE(sysrq_key_table); i++) { |
418 | if (sysrq_key_table[i]) { | 394 | if (sysrq_key_table[i]) { |
419 | for (j=0; sysrq_key_table[i] != sysrq_key_table[j]; j++); | 395 | int j; |
420 | if (j == i) | 396 | |
421 | printk ("%s ", sysrq_key_table[i]->help_msg); | 397 | for (j = 0; sysrq_key_table[i] != |
398 | sysrq_key_table[j]; j++) | ||
399 | ; | ||
400 | if (j != i) | ||
401 | continue; | ||
402 | printk("%s ", sysrq_key_table[i]->help_msg); | ||
403 | } | ||
422 | } | 404 | } |
423 | printk ("\n"); | 405 | printk("\n"); |
424 | console_loglevel = orig_log_level; | 406 | console_loglevel = orig_log_level; |
425 | } | 407 | } |
426 | spin_unlock_irqrestore(&sysrq_key_table_lock, flags); | 408 | spin_unlock_irqrestore(&sysrq_key_table_lock, flags); |
@@ -430,16 +412,17 @@ void __handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty, in | |||
430 | * This function is called by the keyboard handler when SysRq is pressed | 412 | * This function is called by the keyboard handler when SysRq is pressed |
431 | * and any other keycode arrives. | 413 | * and any other keycode arrives. |
432 | */ | 414 | */ |
433 | |||
434 | void handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty) | 415 | void handle_sysrq(int key, struct pt_regs *pt_regs, struct tty_struct *tty) |
435 | { | 416 | { |
436 | if (!sysrq_enabled) | 417 | if (!sysrq_enabled) |
437 | return; | 418 | return; |
438 | __handle_sysrq(key, pt_regs, tty, 1); | 419 | __handle_sysrq(key, pt_regs, tty, 1); |
439 | } | 420 | } |
421 | EXPORT_SYMBOL(handle_sysrq); | ||
440 | 422 | ||
441 | static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, | 423 | static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, |
442 | struct sysrq_key_op *remove_op_p) { | 424 | struct sysrq_key_op *remove_op_p) |
425 | { | ||
443 | 426 | ||
444 | int retval; | 427 | int retval; |
445 | unsigned long flags; | 428 | unsigned long flags; |
@@ -452,7 +435,6 @@ static int __sysrq_swap_key_ops(int key, struct sysrq_key_op *insert_op_p, | |||
452 | retval = -1; | 435 | retval = -1; |
453 | } | 436 | } |
454 | spin_unlock_irqrestore(&sysrq_key_table_lock, flags); | 437 | spin_unlock_irqrestore(&sysrq_key_table_lock, flags); |
455 | |||
456 | return retval; | 438 | return retval; |
457 | } | 439 | } |
458 | 440 | ||
@@ -460,12 +442,10 @@ int register_sysrq_key(int key, struct sysrq_key_op *op_p) | |||
460 | { | 442 | { |
461 | return __sysrq_swap_key_ops(key, op_p, NULL); | 443 | return __sysrq_swap_key_ops(key, op_p, NULL); |
462 | } | 444 | } |
445 | EXPORT_SYMBOL(register_sysrq_key); | ||
463 | 446 | ||
464 | int unregister_sysrq_key(int key, struct sysrq_key_op *op_p) | 447 | int unregister_sysrq_key(int key, struct sysrq_key_op *op_p) |
465 | { | 448 | { |
466 | return __sysrq_swap_key_ops(key, NULL, op_p); | 449 | return __sysrq_swap_key_ops(key, NULL, op_p); |
467 | } | 450 | } |
468 | |||
469 | EXPORT_SYMBOL(handle_sysrq); | ||
470 | EXPORT_SYMBOL(register_sysrq_key); | ||
471 | EXPORT_SYMBOL(unregister_sysrq_key); | 451 | EXPORT_SYMBOL(unregister_sysrq_key); |
diff --git a/drivers/char/tpm/tpm.h b/drivers/char/tpm/tpm.h index fd3a4beaa53d..dec0224b4478 100644 --- a/drivers/char/tpm/tpm.h +++ b/drivers/char/tpm/tpm.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
25 | #include <linux/miscdevice.h> | 25 | #include <linux/miscdevice.h> |
26 | #include <linux/platform_device.h> | 26 | #include <linux/platform_device.h> |
27 | #include <linux/io.h> | ||
27 | 28 | ||
28 | enum tpm_timeout { | 29 | enum tpm_timeout { |
29 | TPM_TIMEOUT = 5, /* msecs */ | 30 | TPM_TIMEOUT = 5, /* msecs */ |
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c index 76592ee1fb38..48d795bb8c4b 100644 --- a/drivers/char/tty_io.c +++ b/drivers/char/tty_io.c | |||
@@ -354,7 +354,7 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size) | |||
354 | 354 | ||
355 | EXPORT_SYMBOL_GPL(tty_buffer_request_room); | 355 | EXPORT_SYMBOL_GPL(tty_buffer_request_room); |
356 | 356 | ||
357 | int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size) | 357 | int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size) |
358 | { | 358 | { |
359 | int copied = 0; | 359 | int copied = 0; |
360 | do { | 360 | do { |
@@ -378,7 +378,7 @@ int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t | |||
378 | 378 | ||
379 | EXPORT_SYMBOL_GPL(tty_insert_flip_string); | 379 | EXPORT_SYMBOL_GPL(tty_insert_flip_string); |
380 | 380 | ||
381 | int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size) | 381 | int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size) |
382 | { | 382 | { |
383 | int copied = 0; | 383 | int copied = 0; |
384 | do { | 384 | do { |
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig index c0dfcf273f0a..16e99db2e12d 100644 --- a/drivers/char/watchdog/Kconfig +++ b/drivers/char/watchdog/Kconfig | |||
@@ -148,6 +148,16 @@ config MPCORE_WATCHDOG | |||
148 | To compile this driver as a module, choose M here: the | 148 | To compile this driver as a module, choose M here: the |
149 | module will be called mpcore_wdt. | 149 | module will be called mpcore_wdt. |
150 | 150 | ||
151 | config EP93XX_WATCHDOG | ||
152 | tristate "EP93xx Watchdog" | ||
153 | depends on WATCHDOG && ARCH_EP93XX | ||
154 | help | ||
155 | Say Y here if to include support for the watchdog timer | ||
156 | embedded in the Cirrus Logic EP93xx family of devices. | ||
157 | |||
158 | To compile this driver as a module, choose M here: the | ||
159 | module will be called ep93xx_wdt. | ||
160 | |||
151 | # X86 (i386 + ia64 + x86_64) Architecture | 161 | # X86 (i386 + ia64 + x86_64) Architecture |
152 | 162 | ||
153 | config ACQUIRE_WDT | 163 | config ACQUIRE_WDT |
diff --git a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile index 36c0b282b8ba..d6f27fde9905 100644 --- a/drivers/char/watchdog/Makefile +++ b/drivers/char/watchdog/Makefile | |||
@@ -30,6 +30,7 @@ obj-$(CONFIG_IXP4XX_WATCHDOG) += ixp4xx_wdt.o | |||
30 | obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o | 30 | obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o |
31 | obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o | 31 | obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o |
32 | obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o | 32 | obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o |
33 | obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o | ||
33 | 34 | ||
34 | # X86 (i386 + ia64 + x86_64) Architecture | 35 | # X86 (i386 + ia64 + x86_64) Architecture |
35 | obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o | 36 | obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o |
diff --git a/drivers/char/watchdog/ep93xx_wdt.c b/drivers/char/watchdog/ep93xx_wdt.c new file mode 100644 index 000000000000..9021dbb78299 --- /dev/null +++ b/drivers/char/watchdog/ep93xx_wdt.c | |||
@@ -0,0 +1,257 @@ | |||
1 | /* | ||
2 | * Watchdog driver for Cirrus Logic EP93xx family of devices. | ||
3 | * | ||
4 | * Copyright (c) 2004 Ray Lehtiniemi | ||
5 | * Copyright (c) 2006 Tower Technologies | ||
6 | * Based on ep93xx driver, bits from alim7101_wdt.c | ||
7 | * | ||
8 | * Authors: Ray Lehtiniemi <rayl@mail.com>, | ||
9 | * Alessandro Zummo <a.zummo@towertech.it> | ||
10 | * | ||
11 | * This file is licensed under the terms of the GNU General Public | ||
12 | * License version 2. This program is licensed "as is" without any | ||
13 | * warranty of any kind, whether express or implied. | ||
14 | * | ||
15 | * This watchdog fires after 250msec, which is a too short interval | ||
16 | * for us to rely on the user space daemon alone. So we ping the | ||
17 | * wdt each ~200msec and eventually stop doing it if the user space | ||
18 | * daemon dies. | ||
19 | * | ||
20 | * TODO: | ||
21 | * | ||
22 | * - Test last reset from watchdog status | ||
23 | * - Add a few missing ioctls | ||
24 | */ | ||
25 | |||
26 | #include <linux/module.h> | ||
27 | #include <linux/fs.h> | ||
28 | #include <linux/miscdevice.h> | ||
29 | #include <linux/watchdog.h> | ||
30 | #include <linux/timer.h> | ||
31 | |||
32 | #include <asm/hardware.h> | ||
33 | #include <asm/uaccess.h> | ||
34 | |||
35 | #define WDT_VERSION "0.3" | ||
36 | #define PFX "ep93xx_wdt: " | ||
37 | |||
38 | /* default timeout (secs) */ | ||
39 | #define WDT_TIMEOUT 30 | ||
40 | |||
41 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
42 | static int timeout = WDT_TIMEOUT; | ||
43 | |||
44 | static struct timer_list timer; | ||
45 | static unsigned long next_heartbeat; | ||
46 | static unsigned long wdt_status; | ||
47 | static unsigned long boot_status; | ||
48 | |||
49 | #define WDT_IN_USE 0 | ||
50 | #define WDT_OK_TO_CLOSE 1 | ||
51 | |||
52 | #define EP93XX_WDT_REG(x) (EP93XX_WATCHDOG_BASE + (x)) | ||
53 | #define EP93XX_WDT_WATCHDOG EP93XX_WDT_REG(0x00) | ||
54 | #define EP93XX_WDT_WDSTATUS EP93XX_WDT_REG(0x04) | ||
55 | |||
56 | /* reset the wdt every ~200ms */ | ||
57 | #define WDT_INTERVAL (HZ/5) | ||
58 | |||
59 | static void wdt_enable(void) | ||
60 | { | ||
61 | __raw_writew(0xaaaa, EP93XX_WDT_WATCHDOG); | ||
62 | } | ||
63 | |||
64 | static void wdt_disable(void) | ||
65 | { | ||
66 | __raw_writew(0xaa55, EP93XX_WDT_WATCHDOG); | ||
67 | } | ||
68 | |||
69 | static inline void wdt_ping(void) | ||
70 | { | ||
71 | __raw_writew(0x5555, EP93XX_WDT_WATCHDOG); | ||
72 | } | ||
73 | |||
74 | static void wdt_startup(void) | ||
75 | { | ||
76 | next_heartbeat = jiffies + (timeout * HZ); | ||
77 | |||
78 | wdt_enable(); | ||
79 | mod_timer(&timer, jiffies + WDT_INTERVAL); | ||
80 | } | ||
81 | |||
82 | static void wdt_shutdown(void) | ||
83 | { | ||
84 | del_timer_sync(&timer); | ||
85 | wdt_disable(); | ||
86 | } | ||
87 | |||
88 | static void wdt_keepalive(void) | ||
89 | { | ||
90 | /* user land ping */ | ||
91 | next_heartbeat = jiffies + (timeout * HZ); | ||
92 | } | ||
93 | |||
94 | static int ep93xx_wdt_open(struct inode *inode, struct file *file) | ||
95 | { | ||
96 | if (test_and_set_bit(WDT_IN_USE, &wdt_status)) | ||
97 | return -EBUSY; | ||
98 | |||
99 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
100 | |||
101 | wdt_startup(); | ||
102 | |||
103 | return nonseekable_open(inode, file); | ||
104 | } | ||
105 | |||
106 | static ssize_t | ||
107 | ep93xx_wdt_write(struct file *file, const char __user *data, size_t len, | ||
108 | loff_t *ppos) | ||
109 | { | ||
110 | /* Can't seek (pwrite) on this device */ | ||
111 | if (*ppos != file->f_pos) | ||
112 | return -ESPIPE; | ||
113 | |||
114 | if (len) { | ||
115 | if (!nowayout) { | ||
116 | size_t i; | ||
117 | |||
118 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
119 | |||
120 | for (i = 0; i != len; i++) { | ||
121 | char c; | ||
122 | |||
123 | if (get_user(c, data + i)) | ||
124 | return -EFAULT; | ||
125 | |||
126 | if (c == 'V') | ||
127 | set_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
128 | else | ||
129 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
130 | } | ||
131 | } | ||
132 | wdt_keepalive(); | ||
133 | } | ||
134 | |||
135 | return len; | ||
136 | } | ||
137 | |||
138 | static struct watchdog_info ident = { | ||
139 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE, | ||
140 | .identity = "EP93xx Watchdog", | ||
141 | }; | ||
142 | |||
143 | static int | ||
144 | ep93xx_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, | ||
145 | unsigned long arg) | ||
146 | { | ||
147 | int ret = -ENOIOCTLCMD; | ||
148 | |||
149 | switch (cmd) { | ||
150 | case WDIOC_GETSUPPORT: | ||
151 | ret = copy_to_user((struct watchdog_info __user *)arg, &ident, | ||
152 | sizeof(ident)) ? -EFAULT : 0; | ||
153 | break; | ||
154 | |||
155 | case WDIOC_GETSTATUS: | ||
156 | ret = put_user(0, (int __user *)arg); | ||
157 | break; | ||
158 | |||
159 | case WDIOC_GETBOOTSTATUS: | ||
160 | ret = put_user(boot_status, (int __user *)arg); | ||
161 | break; | ||
162 | |||
163 | case WDIOC_GETTIMEOUT: | ||
164 | /* actually, it is 0.250 seconds.... */ | ||
165 | ret = put_user(1, (int __user *)arg); | ||
166 | break; | ||
167 | |||
168 | case WDIOC_KEEPALIVE: | ||
169 | wdt_keepalive(); | ||
170 | ret = 0; | ||
171 | break; | ||
172 | } | ||
173 | return ret; | ||
174 | } | ||
175 | |||
176 | static int ep93xx_wdt_release(struct inode *inode, struct file *file) | ||
177 | { | ||
178 | if (test_bit(WDT_OK_TO_CLOSE, &wdt_status)) | ||
179 | wdt_shutdown(); | ||
180 | else | ||
181 | printk(KERN_CRIT PFX "Device closed unexpectedly - " | ||
182 | "timer will not stop\n"); | ||
183 | |||
184 | clear_bit(WDT_IN_USE, &wdt_status); | ||
185 | clear_bit(WDT_OK_TO_CLOSE, &wdt_status); | ||
186 | |||
187 | return 0; | ||
188 | } | ||
189 | |||
190 | static struct file_operations ep93xx_wdt_fops = { | ||
191 | .owner = THIS_MODULE, | ||
192 | .write = ep93xx_wdt_write, | ||
193 | .ioctl = ep93xx_wdt_ioctl, | ||
194 | .open = ep93xx_wdt_open, | ||
195 | .release = ep93xx_wdt_release, | ||
196 | }; | ||
197 | |||
198 | static struct miscdevice ep93xx_wdt_miscdev = { | ||
199 | .minor = WATCHDOG_MINOR, | ||
200 | .name = "watchdog", | ||
201 | .fops = &ep93xx_wdt_fops, | ||
202 | }; | ||
203 | |||
204 | static void ep93xx_timer_ping(unsigned long data) | ||
205 | { | ||
206 | if (time_before(jiffies, next_heartbeat)) | ||
207 | wdt_ping(); | ||
208 | |||
209 | /* Re-set the timer interval */ | ||
210 | mod_timer(&timer, jiffies + WDT_INTERVAL); | ||
211 | } | ||
212 | |||
213 | static int __init ep93xx_wdt_init(void) | ||
214 | { | ||
215 | int err; | ||
216 | |||
217 | err = misc_register(&ep93xx_wdt_miscdev); | ||
218 | |||
219 | boot_status = __raw_readl(EP93XX_WDT_WATCHDOG) & 0x01 ? 1 : 0; | ||
220 | |||
221 | printk(KERN_INFO PFX "EP93XX watchdog, driver version " | ||
222 | WDT_VERSION "%s\n", | ||
223 | (__raw_readl(EP93XX_WDT_WATCHDOG) & 0x08) | ||
224 | ? " (nCS1 disable detected)" : ""); | ||
225 | |||
226 | if (timeout < 1 || timeout > 3600) { | ||
227 | timeout = WDT_TIMEOUT; | ||
228 | printk(KERN_INFO PFX | ||
229 | "timeout value must be 1<=x<=3600, using %d\n", | ||
230 | timeout); | ||
231 | } | ||
232 | |||
233 | setup_timer(&timer, ep93xx_timer_ping, 1); | ||
234 | return err; | ||
235 | } | ||
236 | |||
237 | static void __exit ep93xx_wdt_exit(void) | ||
238 | { | ||
239 | wdt_shutdown(); | ||
240 | misc_deregister(&ep93xx_wdt_miscdev); | ||
241 | } | ||
242 | |||
243 | module_init(ep93xx_wdt_init); | ||
244 | module_exit(ep93xx_wdt_exit); | ||
245 | |||
246 | module_param(nowayout, int, 0); | ||
247 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); | ||
248 | |||
249 | module_param(timeout, int, 0); | ||
250 | MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=3600, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")"); | ||
251 | |||
252 | MODULE_AUTHOR("Ray Lehtiniemi <rayl@mail.com>," | ||
253 | "Alessandro Zummo <a.zummo@towertech.it>"); | ||
254 | MODULE_DESCRIPTION("EP93xx Watchdog"); | ||
255 | MODULE_LICENSE("GPL"); | ||
256 | MODULE_VERSION(WDT_VERSION); | ||
257 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | ||
diff --git a/drivers/dio/dio-driver.c b/drivers/dio/dio-driver.c index ca8e69d2f64d..e4c48e329367 100644 --- a/drivers/dio/dio-driver.c +++ b/drivers/dio/dio-driver.c | |||
@@ -71,22 +71,17 @@ static int dio_device_probe(struct device *dev) | |||
71 | * @drv: the driver structure to register | 71 | * @drv: the driver structure to register |
72 | * | 72 | * |
73 | * Adds the driver structure to the list of registered drivers | 73 | * Adds the driver structure to the list of registered drivers |
74 | * Returns the number of DIO devices which were claimed by the driver | 74 | * Returns zero or a negative error value. |
75 | * during registration. The driver remains registered even if the | ||
76 | * return value is zero. | ||
77 | */ | 75 | */ |
78 | 76 | ||
79 | int dio_register_driver(struct dio_driver *drv) | 77 | int dio_register_driver(struct dio_driver *drv) |
80 | { | 78 | { |
81 | int count = 0; | ||
82 | |||
83 | /* initialize common driver fields */ | 79 | /* initialize common driver fields */ |
84 | drv->driver.name = drv->name; | 80 | drv->driver.name = drv->name; |
85 | drv->driver.bus = &dio_bus_type; | 81 | drv->driver.bus = &dio_bus_type; |
86 | 82 | ||
87 | /* register with core */ | 83 | /* register with core */ |
88 | count = driver_register(&drv->driver); | 84 | return driver_register(&drv->driver); |
89 | return count ? count : 1; | ||
90 | } | 85 | } |
91 | 86 | ||
92 | 87 | ||
diff --git a/drivers/eisa/.gitignore b/drivers/eisa/.gitignore new file mode 100644 index 000000000000..4b335c0aedb0 --- /dev/null +++ b/drivers/eisa/.gitignore | |||
@@ -0,0 +1 @@ | |||
devlist.h | |||
diff --git a/drivers/eisa/eisa-bus.c b/drivers/eisa/eisa-bus.c index 4196137e66de..6078e2f58817 100644 --- a/drivers/eisa/eisa-bus.c +++ b/drivers/eisa/eisa-bus.c | |||
@@ -135,13 +135,8 @@ struct bus_type eisa_bus_type = { | |||
135 | 135 | ||
136 | int eisa_driver_register (struct eisa_driver *edrv) | 136 | int eisa_driver_register (struct eisa_driver *edrv) |
137 | { | 137 | { |
138 | int r; | ||
139 | |||
140 | edrv->driver.bus = &eisa_bus_type; | 138 | edrv->driver.bus = &eisa_bus_type; |
141 | if ((r = driver_register (&edrv->driver)) < 0) | 139 | return driver_register (&edrv->driver); |
142 | return r; | ||
143 | |||
144 | return 0; | ||
145 | } | 140 | } |
146 | 141 | ||
147 | void eisa_driver_unregister (struct eisa_driver *edrv) | 142 | void eisa_driver_unregister (struct eisa_driver *edrv) |
diff --git a/drivers/ide/ide.c b/drivers/ide/ide.c index b2cc43702f65..3fdab563fec2 100644 --- a/drivers/ide/ide.c +++ b/drivers/ide/ide.c | |||
@@ -2058,7 +2058,7 @@ static void __init parse_options (char *line) | |||
2058 | } | 2058 | } |
2059 | } | 2059 | } |
2060 | 2060 | ||
2061 | int init_module (void) | 2061 | int __init init_module (void) |
2062 | { | 2062 | { |
2063 | parse_options(options); | 2063 | parse_options(options); |
2064 | return ide_init(); | 2064 | return ide_init(); |
diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c index 8c12a974b411..a81f987978c8 100644 --- a/drivers/input/touchscreen/ads7846.c +++ b/drivers/input/touchscreen/ads7846.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/slab.h> | 23 | #include <linux/slab.h> |
24 | #include <linux/spi/spi.h> | 24 | #include <linux/spi/spi.h> |
25 | #include <linux/spi/ads7846.h> | 25 | #include <linux/spi/ads7846.h> |
26 | #include <linux/interrupt.h> | ||
26 | 27 | ||
27 | #ifdef CONFIG_ARM | 28 | #ifdef CONFIG_ARM |
28 | #include <asm/mach-types.h> | 29 | #include <asm/mach-types.h> |
diff --git a/drivers/isdn/hardware/avm/b1dma.c b/drivers/isdn/hardware/avm/b1dma.c index 91dd0551fc7c..4d64e5cbcdbf 100644 --- a/drivers/isdn/hardware/avm/b1dma.c +++ b/drivers/isdn/hardware/avm/b1dma.c | |||
@@ -39,7 +39,7 @@ MODULE_AUTHOR("Carsten Paeth"); | |||
39 | MODULE_LICENSE("GPL"); | 39 | MODULE_LICENSE("GPL"); |
40 | 40 | ||
41 | static int suppress_pollack = 0; | 41 | static int suppress_pollack = 0; |
42 | MODULE_PARM(suppress_pollack, "0-1i"); | 42 | module_param(suppress_pollack, bool, 0); |
43 | 43 | ||
44 | /* ------------------------------------------------------------- */ | 44 | /* ------------------------------------------------------------- */ |
45 | 45 | ||
diff --git a/drivers/isdn/hardware/avm/b1isa.c b/drivers/isdn/hardware/avm/b1isa.c index 38bd4dfecbd1..80fb488848b8 100644 --- a/drivers/isdn/hardware/avm/b1isa.c +++ b/drivers/isdn/hardware/avm/b1isa.c | |||
@@ -169,8 +169,8 @@ static struct pci_dev isa_dev[MAX_CARDS]; | |||
169 | static int io[MAX_CARDS]; | 169 | static int io[MAX_CARDS]; |
170 | static int irq[MAX_CARDS]; | 170 | static int irq[MAX_CARDS]; |
171 | 171 | ||
172 | MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i"); | 172 | module_param_array(io, int, NULL, 0); |
173 | MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i"); | 173 | module_param_array(irq, int, NULL, 0); |
174 | MODULE_PARM_DESC(io, "I/O base address(es)"); | 174 | MODULE_PARM_DESC(io, "I/O base address(es)"); |
175 | MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); | 175 | MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); |
176 | 176 | ||
diff --git a/drivers/isdn/hardware/avm/c4.c b/drivers/isdn/hardware/avm/c4.c index 724aac2c1cca..f7253b2136ea 100644 --- a/drivers/isdn/hardware/avm/c4.c +++ b/drivers/isdn/hardware/avm/c4.c | |||
@@ -50,7 +50,7 @@ MODULE_DEVICE_TABLE(pci, c4_pci_tbl); | |||
50 | MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM C2/C4 cards"); | 50 | MODULE_DESCRIPTION("CAPI4Linux: Driver for AVM C2/C4 cards"); |
51 | MODULE_AUTHOR("Carsten Paeth"); | 51 | MODULE_AUTHOR("Carsten Paeth"); |
52 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
53 | MODULE_PARM(suppress_pollack, "0-1i"); | 53 | module_param(suppress_pollack, bool, 0); |
54 | 54 | ||
55 | /* ------------------------------------------------------------- */ | 55 | /* ------------------------------------------------------------- */ |
56 | 56 | ||
diff --git a/drivers/isdn/hardware/avm/t1isa.c b/drivers/isdn/hardware/avm/t1isa.c index 3b701d97bdf1..5a2f854d55b5 100644 --- a/drivers/isdn/hardware/avm/t1isa.c +++ b/drivers/isdn/hardware/avm/t1isa.c | |||
@@ -519,9 +519,9 @@ static int io[MAX_CARDS]; | |||
519 | static int irq[MAX_CARDS]; | 519 | static int irq[MAX_CARDS]; |
520 | static int cardnr[MAX_CARDS]; | 520 | static int cardnr[MAX_CARDS]; |
521 | 521 | ||
522 | MODULE_PARM(io, "1-" __MODULE_STRING(MAX_CARDS) "i"); | 522 | module_param_array(io, int, NULL, 0); |
523 | MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_CARDS) "i"); | 523 | module_param_array(irq, int, NULL, 0); |
524 | MODULE_PARM(cardnr, "1-" __MODULE_STRING(MAX_CARDS) "i"); | 524 | module_param_array(cardnr, int, NULL, 0); |
525 | MODULE_PARM_DESC(io, "I/O base address(es)"); | 525 | MODULE_PARM_DESC(io, "I/O base address(es)"); |
526 | MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); | 526 | MODULE_PARM_DESC(irq, "IRQ number(s) (assigned)"); |
527 | MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)"); | 527 | MODULE_PARM_DESC(cardnr, "Card number(s) (as jumpered)"); |
diff --git a/drivers/isdn/hysdn/boardergo.c b/drivers/isdn/hysdn/boardergo.c index e19a01a305a9..48d134be9908 100644 --- a/drivers/isdn/hysdn/boardergo.c +++ b/drivers/isdn/hysdn/boardergo.c | |||
@@ -38,8 +38,8 @@ ergo_interrupt(int intno, void *dev_id, struct pt_regs *regs) | |||
38 | { | 38 | { |
39 | hysdn_card *card = dev_id; /* parameter from irq */ | 39 | hysdn_card *card = dev_id; /* parameter from irq */ |
40 | tErgDpram *dpr; | 40 | tErgDpram *dpr; |
41 | ulong flags; | 41 | unsigned long flags; |
42 | uchar volatile b; | 42 | unsigned char volatile b; |
43 | 43 | ||
44 | if (!card) | 44 | if (!card) |
45 | return IRQ_NONE; /* error -> spurious interrupt */ | 45 | return IRQ_NONE; /* error -> spurious interrupt */ |
@@ -77,7 +77,7 @@ ergo_irq_bh(hysdn_card * card) | |||
77 | { | 77 | { |
78 | tErgDpram *dpr; | 78 | tErgDpram *dpr; |
79 | int again; | 79 | int again; |
80 | ulong flags; | 80 | unsigned long flags; |
81 | 81 | ||
82 | if (card->state != CARD_STATE_RUN) | 82 | if (card->state != CARD_STATE_RUN) |
83 | return; /* invalid call */ | 83 | return; /* invalid call */ |
@@ -131,8 +131,8 @@ ergo_irq_bh(hysdn_card * card) | |||
131 | static void | 131 | static void |
132 | ergo_stopcard(hysdn_card * card) | 132 | ergo_stopcard(hysdn_card * card) |
133 | { | 133 | { |
134 | ulong flags; | 134 | unsigned long flags; |
135 | uchar val; | 135 | unsigned char val; |
136 | 136 | ||
137 | hysdn_net_release(card); /* first release the net device if existing */ | 137 | hysdn_net_release(card); /* first release the net device if existing */ |
138 | #ifdef CONFIG_HYSDN_CAPI | 138 | #ifdef CONFIG_HYSDN_CAPI |
@@ -157,7 +157,7 @@ ergo_stopcard(hysdn_card * card) | |||
157 | static void | 157 | static void |
158 | ergo_set_errlog_state(hysdn_card * card, int on) | 158 | ergo_set_errlog_state(hysdn_card * card, int on) |
159 | { | 159 | { |
160 | ulong flags; | 160 | unsigned long flags; |
161 | 161 | ||
162 | if (card->state != CARD_STATE_RUN) { | 162 | if (card->state != CARD_STATE_RUN) { |
163 | card->err_log_state = ERRLOG_STATE_OFF; /* must be off */ | 163 | card->err_log_state = ERRLOG_STATE_OFF; /* must be off */ |
@@ -217,9 +217,10 @@ ergo_testram(hysdn_card * card) | |||
217 | /* Negative return values are interpreted as errors. */ | 217 | /* Negative return values are interpreted as errors. */ |
218 | /*****************************************************************************/ | 218 | /*****************************************************************************/ |
219 | static int | 219 | static int |
220 | ergo_writebootimg(struct HYSDN_CARD *card, uchar * buf, ulong offs) | 220 | ergo_writebootimg(struct HYSDN_CARD *card, unsigned char *buf, |
221 | unsigned long offs) | ||
221 | { | 222 | { |
222 | uchar *dst; | 223 | unsigned char *dst; |
223 | tErgDpram *dpram; | 224 | tErgDpram *dpram; |
224 | int cnt = (BOOT_IMG_SIZE >> 2); /* number of words to move and swap (byte order!) */ | 225 | int cnt = (BOOT_IMG_SIZE >> 2); /* number of words to move and swap (byte order!) */ |
225 | 226 | ||
@@ -264,14 +265,14 @@ ergo_writebootimg(struct HYSDN_CARD *card, uchar * buf, ulong offs) | |||
264 | /* case of errors a negative error value is returned. */ | 265 | /* case of errors a negative error value is returned. */ |
265 | /********************************************************************************/ | 266 | /********************************************************************************/ |
266 | static int | 267 | static int |
267 | ergo_writebootseq(struct HYSDN_CARD *card, uchar * buf, int len) | 268 | ergo_writebootseq(struct HYSDN_CARD *card, unsigned char *buf, int len) |
268 | { | 269 | { |
269 | tDpramBootSpooler *sp = (tDpramBootSpooler *) card->dpram; | 270 | tDpramBootSpooler *sp = (tDpramBootSpooler *) card->dpram; |
270 | uchar *dst; | 271 | unsigned char *dst; |
271 | uchar buflen; | 272 | unsigned char buflen; |
272 | int nr_write; | 273 | int nr_write; |
273 | uchar tmp_rdptr; | 274 | unsigned char tmp_rdptr; |
274 | uchar wr_mirror; | 275 | unsigned char wr_mirror; |
275 | int i; | 276 | int i; |
276 | 277 | ||
277 | if (card->debug_flags & LOG_POF_CARD) | 278 | if (card->debug_flags & LOG_POF_CARD) |
@@ -330,7 +331,7 @@ ergo_waitpofready(struct HYSDN_CARD *card) | |||
330 | { | 331 | { |
331 | tErgDpram *dpr = card->dpram; /* pointer to DPRAM structure */ | 332 | tErgDpram *dpr = card->dpram; /* pointer to DPRAM structure */ |
332 | int timecnt = 10000 / 50; /* timeout is 10 secs max. */ | 333 | int timecnt = 10000 / 50; /* timeout is 10 secs max. */ |
333 | ulong flags; | 334 | unsigned long flags; |
334 | int msg_size; | 335 | int msg_size; |
335 | int i; | 336 | int i; |
336 | 337 | ||
@@ -345,7 +346,7 @@ ergo_waitpofready(struct HYSDN_CARD *card) | |||
345 | if ((dpr->ToPcChannel != CHAN_SYSTEM) || | 346 | if ((dpr->ToPcChannel != CHAN_SYSTEM) || |
346 | (dpr->ToPcSize < MIN_RDY_MSG_SIZE) || | 347 | (dpr->ToPcSize < MIN_RDY_MSG_SIZE) || |
347 | (dpr->ToPcSize > MAX_RDY_MSG_SIZE) || | 348 | (dpr->ToPcSize > MAX_RDY_MSG_SIZE) || |
348 | ((*(ulong *) dpr->ToPcBuf) != RDY_MAGIC)) | 349 | ((*(unsigned long *) dpr->ToPcBuf) != RDY_MAGIC)) |
349 | break; /* an error occurred */ | 350 | break; /* an error occurred */ |
350 | 351 | ||
351 | /* Check for additional data delivered during SysReady */ | 352 | /* Check for additional data delivered during SysReady */ |
diff --git a/drivers/isdn/hysdn/boardergo.h b/drivers/isdn/hysdn/boardergo.h index b56ff0889ead..c59422aa8c3f 100644 --- a/drivers/isdn/hysdn/boardergo.h +++ b/drivers/isdn/hysdn/boardergo.h | |||
@@ -23,36 +23,36 @@ | |||
23 | 23 | ||
24 | /* following DPRAM layout copied from OS2-driver boarderg.h */ | 24 | /* following DPRAM layout copied from OS2-driver boarderg.h */ |
25 | typedef struct ErgDpram_tag { | 25 | typedef struct ErgDpram_tag { |
26 | /*0000 */ uchar ToHyBuf[ERG_TO_HY_BUF_SIZE]; | 26 | /*0000 */ unsigned char ToHyBuf[ERG_TO_HY_BUF_SIZE]; |
27 | /*0E00 */ uchar ToPcBuf[ERG_TO_PC_BUF_SIZE]; | 27 | /*0E00 */ unsigned char ToPcBuf[ERG_TO_PC_BUF_SIZE]; |
28 | 28 | ||
29 | /*1C00 */ uchar bSoftUart[SIZE_RSV_SOFT_UART]; | 29 | /*1C00 */ unsigned char bSoftUart[SIZE_RSV_SOFT_UART]; |
30 | /* size 0x1B0 */ | 30 | /* size 0x1B0 */ |
31 | 31 | ||
32 | /*1DB0 *//* tErrLogEntry */ uchar volatile ErrLogMsg[64]; | 32 | /*1DB0 *//* tErrLogEntry */ unsigned char volatile ErrLogMsg[64]; |
33 | /* size 64 bytes */ | 33 | /* size 64 bytes */ |
34 | /*1DB0 ulong ulErrType; */ | 34 | /*1DB0 unsigned long ulErrType; */ |
35 | /*1DB4 ulong ulErrSubtype; */ | 35 | /*1DB4 unsigned long ulErrSubtype; */ |
36 | /*1DB8 ulong ucTextSize; */ | 36 | /*1DB8 unsigned long ucTextSize; */ |
37 | /*1DB9 ulong ucText[ERRLOG_TEXT_SIZE]; *//* ASCIIZ of len ucTextSize-1 */ | 37 | /*1DB9 unsigned long ucText[ERRLOG_TEXT_SIZE]; *//* ASCIIZ of len ucTextSize-1 */ |
38 | /*1DF0 */ | 38 | /*1DF0 */ |
39 | 39 | ||
40 | /*1DF0 */ word volatile ToHyChannel; | 40 | /*1DF0 */ unsigned short volatile ToHyChannel; |
41 | /*1DF2 */ word volatile ToHySize; | 41 | /*1DF2 */ unsigned short volatile ToHySize; |
42 | /*1DF4 */ uchar volatile ToHyFlag; | 42 | /*1DF4 */ unsigned char volatile ToHyFlag; |
43 | /* !=0: msg for Hy waiting */ | 43 | /* !=0: msg for Hy waiting */ |
44 | /*1DF5 */ uchar volatile ToPcFlag; | 44 | /*1DF5 */ unsigned char volatile ToPcFlag; |
45 | /* !=0: msg for PC waiting */ | 45 | /* !=0: msg for PC waiting */ |
46 | /*1DF6 */ word volatile ToPcChannel; | 46 | /*1DF6 */ unsigned short volatile ToPcChannel; |
47 | /*1DF8 */ word volatile ToPcSize; | 47 | /*1DF8 */ unsigned short volatile ToPcSize; |
48 | /*1DFA */ uchar bRes1DBA[0x1E00 - 0x1DFA]; | 48 | /*1DFA */ unsigned char bRes1DBA[0x1E00 - 0x1DFA]; |
49 | /* 6 bytes */ | 49 | /* 6 bytes */ |
50 | 50 | ||
51 | /*1E00 */ uchar bRestOfEntryTbl[0x1F00 - 0x1E00]; | 51 | /*1E00 */ unsigned char bRestOfEntryTbl[0x1F00 - 0x1E00]; |
52 | /*1F00 */ ulong TrapTable[62]; | 52 | /*1F00 */ unsigned long TrapTable[62]; |
53 | /*1FF8 */ uchar bRes1FF8[0x1FFB - 0x1FF8]; | 53 | /*1FF8 */ unsigned char bRes1FF8[0x1FFB - 0x1FF8]; |
54 | /* low part of reset vetor */ | 54 | /* low part of reset vetor */ |
55 | /*1FFB */ uchar ToPcIntMetro; | 55 | /*1FFB */ unsigned char ToPcIntMetro; |
56 | /* notes: | 56 | /* notes: |
57 | * - metro has 32-bit boot ram - accessing | 57 | * - metro has 32-bit boot ram - accessing |
58 | * ToPcInt and ToHyInt would be the same; | 58 | * ToPcInt and ToHyInt would be the same; |
@@ -65,16 +65,16 @@ typedef struct ErgDpram_tag { | |||
65 | * so E1 side should NOT change this byte | 65 | * so E1 side should NOT change this byte |
66 | * when writing! | 66 | * when writing! |
67 | */ | 67 | */ |
68 | /*1FFC */ uchar volatile ToHyNoDpramErrLog; | 68 | /*1FFC */ unsigned char volatile ToHyNoDpramErrLog; |
69 | /* note: ToHyNoDpramErrLog is used to inform | 69 | /* note: ToHyNoDpramErrLog is used to inform |
70 | * boot loader, not to use DPRAM based | 70 | * boot loader, not to use DPRAM based |
71 | * ErrLog; when DOS driver is rewritten | 71 | * ErrLog; when DOS driver is rewritten |
72 | * this becomes obsolete | 72 | * this becomes obsolete |
73 | */ | 73 | */ |
74 | /*1FFD */ uchar bRes1FFD; | 74 | /*1FFD */ unsigned char bRes1FFD; |
75 | /*1FFE */ uchar ToPcInt; | 75 | /*1FFE */ unsigned char ToPcInt; |
76 | /* E1_intclear; on CHAMP2: E1_intset */ | 76 | /* E1_intclear; on CHAMP2: E1_intset */ |
77 | /*1FFF */ uchar ToHyInt; | 77 | /*1FFF */ unsigned char ToHyInt; |
78 | /* E1_intset; on CHAMP2: E1_intclear */ | 78 | /* E1_intset; on CHAMP2: E1_intclear */ |
79 | } tErgDpram; | 79 | } tErgDpram; |
80 | 80 | ||
diff --git a/drivers/isdn/hysdn/hycapi.c b/drivers/isdn/hysdn/hycapi.c index acc1d3cceebb..6bac43cc91bd 100644 --- a/drivers/isdn/hysdn/hycapi.c +++ b/drivers/isdn/hysdn/hycapi.c | |||
@@ -31,7 +31,7 @@ | |||
31 | static char hycapi_revision[]="$Revision: 1.8.6.4 $"; | 31 | static char hycapi_revision[]="$Revision: 1.8.6.4 $"; |
32 | 32 | ||
33 | unsigned int hycapi_enable = 0xffffffff; | 33 | unsigned int hycapi_enable = 0xffffffff; |
34 | MODULE_PARM(hycapi_enable, "i"); | 34 | module_param(hycapi_enable, uint, 0); |
35 | 35 | ||
36 | typedef struct _hycapi_appl { | 36 | typedef struct _hycapi_appl { |
37 | unsigned int ctrl_mask; | 37 | unsigned int ctrl_mask; |
@@ -523,7 +523,7 @@ New nccis are created if necessary. | |||
523 | *******************************************************************/ | 523 | *******************************************************************/ |
524 | 524 | ||
525 | void | 525 | void |
526 | hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len) | 526 | hycapi_rx_capipkt(hysdn_card * card, unsigned char *buf, unsigned short len) |
527 | { | 527 | { |
528 | struct sk_buff *skb; | 528 | struct sk_buff *skb; |
529 | hycapictrl_info *cinfo = card->hyctrlinfo; | 529 | hycapictrl_info *cinfo = card->hyctrlinfo; |
diff --git a/drivers/isdn/hysdn/hysdn_boot.c b/drivers/isdn/hysdn/hysdn_boot.c index 7bfba196f315..6d0eb0f42fca 100644 --- a/drivers/isdn/hysdn/hysdn_boot.c +++ b/drivers/isdn/hysdn/hysdn_boot.c | |||
@@ -30,17 +30,17 @@ | |||
30 | /* needed during boot and so allocated dynamically. */ | 30 | /* needed during boot and so allocated dynamically. */ |
31 | /************************************************************/ | 31 | /************************************************************/ |
32 | struct boot_data { | 32 | struct boot_data { |
33 | word Cryptor; /* for use with Decrypt function */ | 33 | unsigned short Cryptor; /* for use with Decrypt function */ |
34 | word Nrecs; /* records remaining in file */ | 34 | unsigned short Nrecs; /* records remaining in file */ |
35 | uchar pof_state; /* actual state of read handler */ | 35 | unsigned char pof_state;/* actual state of read handler */ |
36 | uchar is_crypted; /* card data is crypted */ | 36 | unsigned char is_crypted;/* card data is crypted */ |
37 | int BufSize; /* actual number of bytes bufferd */ | 37 | int BufSize; /* actual number of bytes bufferd */ |
38 | int last_error; /* last occurred error */ | 38 | int last_error; /* last occurred error */ |
39 | word pof_recid; /* actual pof recid */ | 39 | unsigned short pof_recid;/* actual pof recid */ |
40 | ulong pof_reclen; /* total length of pof record data */ | 40 | unsigned long pof_reclen;/* total length of pof record data */ |
41 | ulong pof_recoffset; /* actual offset inside pof record */ | 41 | unsigned long pof_recoffset;/* actual offset inside pof record */ |
42 | union { | 42 | union { |
43 | uchar BootBuf[BOOT_BUF_SIZE]; /* buffer as byte count */ | 43 | unsigned char BootBuf[BOOT_BUF_SIZE];/* buffer as byte count */ |
44 | tPofRecHdr PofRecHdr; /* header for actual record/chunk */ | 44 | tPofRecHdr PofRecHdr; /* header for actual record/chunk */ |
45 | tPofFileHdr PofFileHdr; /* header from POF file */ | 45 | tPofFileHdr PofFileHdr; /* header from POF file */ |
46 | tPofTimeStamp PofTime; /* time information */ | 46 | tPofTimeStamp PofTime; /* time information */ |
@@ -69,11 +69,11 @@ StartDecryption(struct boot_data *boot) | |||
69 | static void | 69 | static void |
70 | DecryptBuf(struct boot_data *boot, int cnt) | 70 | DecryptBuf(struct boot_data *boot, int cnt) |
71 | { | 71 | { |
72 | uchar *bufp = boot->buf.BootBuf; | 72 | unsigned char *bufp = boot->buf.BootBuf; |
73 | 73 | ||
74 | while (cnt--) { | 74 | while (cnt--) { |
75 | boot->Cryptor = (boot->Cryptor >> 1) ^ ((boot->Cryptor & 1U) ? CRYPT_FEEDTERM : 0); | 75 | boot->Cryptor = (boot->Cryptor >> 1) ^ ((boot->Cryptor & 1U) ? CRYPT_FEEDTERM : 0); |
76 | *bufp++ ^= (uchar) boot->Cryptor; | 76 | *bufp++ ^= (unsigned char)boot->Cryptor; |
77 | } | 77 | } |
78 | } /* DecryptBuf */ | 78 | } /* DecryptBuf */ |
79 | 79 | ||
@@ -86,7 +86,7 @@ pof_handle_data(hysdn_card * card, int datlen) | |||
86 | { | 86 | { |
87 | struct boot_data *boot = card->boot; /* pointer to boot specific data */ | 87 | struct boot_data *boot = card->boot; /* pointer to boot specific data */ |
88 | long l; | 88 | long l; |
89 | uchar *imgp; | 89 | unsigned char *imgp; |
90 | int img_len; | 90 | int img_len; |
91 | 91 | ||
92 | /* handle the different record types */ | 92 | /* handle the different record types */ |
@@ -197,7 +197,7 @@ pof_write_buffer(hysdn_card * card, int datlen) | |||
197 | break; | 197 | break; |
198 | } | 198 | } |
199 | /* Setup the new state and vars */ | 199 | /* Setup the new state and vars */ |
200 | boot->Nrecs = (word) (boot->buf.PofFileHdr.N_PofRecs); /* limited to 65535 */ | 200 | boot->Nrecs = (unsigned short)(boot->buf.PofFileHdr.N_PofRecs); /* limited to 65535 */ |
201 | boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */ | 201 | boot->pof_state = POF_READ_TAG_HEAD; /* now start with single tags */ |
202 | boot->last_error = sizeof(tPofRecHdr); /* new length */ | 202 | boot->last_error = sizeof(tPofRecHdr); /* new length */ |
203 | break; | 203 | break; |
@@ -268,7 +268,7 @@ pof_write_buffer(hysdn_card * card, int datlen) | |||
268 | /* occurred. Additionally the pointer to the buffer data area is set on success */ | 268 | /* occurred. Additionally the pointer to the buffer data area is set on success */ |
269 | /*******************************************************************************/ | 269 | /*******************************************************************************/ |
270 | int | 270 | int |
271 | pof_write_open(hysdn_card * card, uchar ** bufp) | 271 | pof_write_open(hysdn_card * card, unsigned char **bufp) |
272 | { | 272 | { |
273 | struct boot_data *boot; /* pointer to boot specific data */ | 273 | struct boot_data *boot; /* pointer to boot specific data */ |
274 | 274 | ||
@@ -335,7 +335,7 @@ pof_write_close(hysdn_card * card) | |||
335 | /* when POF has been booted. A return value of 0 is used if no error occurred. */ | 335 | /* when POF has been booted. A return value of 0 is used if no error occurred. */ |
336 | /*********************************************************************************/ | 336 | /*********************************************************************************/ |
337 | int | 337 | int |
338 | EvalSysrTokData(hysdn_card * card, uchar * cp, int len) | 338 | EvalSysrTokData(hysdn_card *card, unsigned char *cp, int len) |
339 | { | 339 | { |
340 | u_char *p; | 340 | u_char *p; |
341 | u_char crc; | 341 | u_char crc; |
diff --git a/drivers/isdn/hysdn/hysdn_defs.h b/drivers/isdn/hysdn/hysdn_defs.h index 432f6f99089e..3a9b29b38bc4 100644 --- a/drivers/isdn/hysdn/hysdn_defs.h +++ b/drivers/isdn/hysdn/hysdn_defs.h | |||
@@ -20,14 +20,6 @@ | |||
20 | #include <linux/workqueue.h> | 20 | #include <linux/workqueue.h> |
21 | #include <linux/skbuff.h> | 21 | #include <linux/skbuff.h> |
22 | 22 | ||
23 | /****************************/ | ||
24 | /* storage type definitions */ | ||
25 | /****************************/ | ||
26 | #define uchar unsigned char | ||
27 | #define uint unsigned int | ||
28 | #define ulong unsigned long | ||
29 | #define word unsigned short | ||
30 | |||
31 | #include "ince1pc.h" | 23 | #include "ince1pc.h" |
32 | 24 | ||
33 | #ifdef CONFIG_HYSDN_CAPI | 25 | #ifdef CONFIG_HYSDN_CAPI |
@@ -147,18 +139,18 @@ typedef struct HYSDN_CARD { | |||
147 | 139 | ||
148 | /* general variables for the cards */ | 140 | /* general variables for the cards */ |
149 | int myid; /* own driver card id */ | 141 | int myid; /* own driver card id */ |
150 | uchar bus; /* pci bus the card is connected to */ | 142 | unsigned char bus; /* pci bus the card is connected to */ |
151 | uchar devfn; /* slot+function bit encoded */ | 143 | unsigned char devfn; /* slot+function bit encoded */ |
152 | word subsysid; /* PCI subsystem id */ | 144 | unsigned short subsysid;/* PCI subsystem id */ |
153 | uchar brdtype; /* type of card */ | 145 | unsigned char brdtype; /* type of card */ |
154 | uint bchans; /* number of available B-channels */ | 146 | unsigned int bchans; /* number of available B-channels */ |
155 | uint faxchans; /* number of available fax-channels */ | 147 | unsigned int faxchans; /* number of available fax-channels */ |
156 | uchar mac_addr[6]; /* MAC Address read from card */ | 148 | unsigned char mac_addr[6];/* MAC Address read from card */ |
157 | uint irq; /* interrupt number */ | 149 | unsigned int irq; /* interrupt number */ |
158 | uint iobase; /* IO-port base address */ | 150 | unsigned int iobase; /* IO-port base address */ |
159 | ulong plxbase; /* PLX memory base */ | 151 | unsigned long plxbase; /* PLX memory base */ |
160 | ulong membase; /* DPRAM memory base */ | 152 | unsigned long membase; /* DPRAM memory base */ |
161 | ulong memend; /* DPRAM memory end */ | 153 | unsigned long memend; /* DPRAM memory end */ |
162 | void *dpram; /* mapped dpram */ | 154 | void *dpram; /* mapped dpram */ |
163 | int state; /* actual state of card -> CARD_STATE_** */ | 155 | int state; /* actual state of card -> CARD_STATE_** */ |
164 | struct HYSDN_CARD *next; /* pointer to next card */ | 156 | struct HYSDN_CARD *next; /* pointer to next card */ |
@@ -168,26 +160,26 @@ typedef struct HYSDN_CARD { | |||
168 | void *procconf; /* pointer to procconf filesystem specific data */ | 160 | void *procconf; /* pointer to procconf filesystem specific data */ |
169 | 161 | ||
170 | /* debugging and logging */ | 162 | /* debugging and logging */ |
171 | uchar err_log_state; /* actual error log state of the card */ | 163 | unsigned char err_log_state;/* actual error log state of the card */ |
172 | ulong debug_flags; /* tells what should be debugged and where */ | 164 | unsigned long debug_flags;/* tells what should be debugged and where */ |
173 | void (*set_errlog_state) (struct HYSDN_CARD *, int); | 165 | void (*set_errlog_state) (struct HYSDN_CARD *, int); |
174 | 166 | ||
175 | /* interrupt handler + interrupt synchronisation */ | 167 | /* interrupt handler + interrupt synchronisation */ |
176 | struct work_struct irq_queue; /* interrupt task queue */ | 168 | struct work_struct irq_queue; /* interrupt task queue */ |
177 | uchar volatile irq_enabled; /* interrupt enabled if != 0 */ | 169 | unsigned char volatile irq_enabled;/* interrupt enabled if != 0 */ |
178 | uchar volatile hw_lock; /* hardware is currently locked -> no access */ | 170 | unsigned char volatile hw_lock;/* hardware is currently locked -> no access */ |
179 | 171 | ||
180 | /* boot process */ | 172 | /* boot process */ |
181 | void *boot; /* pointer to boot private data */ | 173 | void *boot; /* pointer to boot private data */ |
182 | int (*writebootimg) (struct HYSDN_CARD *, uchar *, ulong); | 174 | int (*writebootimg) (struct HYSDN_CARD *, unsigned char *, unsigned long); |
183 | int (*writebootseq) (struct HYSDN_CARD *, uchar *, int); | 175 | int (*writebootseq) (struct HYSDN_CARD *, unsigned char *, int); |
184 | int (*waitpofready) (struct HYSDN_CARD *); | 176 | int (*waitpofready) (struct HYSDN_CARD *); |
185 | int (*testram) (struct HYSDN_CARD *); | 177 | int (*testram) (struct HYSDN_CARD *); |
186 | 178 | ||
187 | /* scheduler for data transfer (only async parts) */ | 179 | /* scheduler for data transfer (only async parts) */ |
188 | uchar async_data[256]; /* async data to be sent (normally for config) */ | 180 | unsigned char async_data[256];/* async data to be sent (normally for config) */ |
189 | word volatile async_len; /* length of data to sent */ | 181 | unsigned short volatile async_len;/* length of data to sent */ |
190 | word volatile async_channel; /* channel number for async transfer */ | 182 | unsigned short volatile async_channel;/* channel number for async transfer */ |
191 | int volatile async_busy; /* flag != 0 sending in progress */ | 183 | int volatile async_busy; /* flag != 0 sending in progress */ |
192 | int volatile net_tx_busy; /* a network packet tx is in progress */ | 184 | int volatile net_tx_busy; /* a network packet tx is in progress */ |
193 | 185 | ||
@@ -251,15 +243,18 @@ extern int ergo_inithardware(hysdn_card * card); /* get hardware -> module init | |||
251 | 243 | ||
252 | /* hysdn_boot.c */ | 244 | /* hysdn_boot.c */ |
253 | extern int pof_write_close(hysdn_card *); /* close proc file after writing pof */ | 245 | extern int pof_write_close(hysdn_card *); /* close proc file after writing pof */ |
254 | extern int pof_write_open(hysdn_card *, uchar **); /* open proc file for writing pof */ | 246 | extern int pof_write_open(hysdn_card *, unsigned char **); /* open proc file for writing pof */ |
255 | extern int pof_write_buffer(hysdn_card *, int); /* write boot data to card */ | 247 | extern int pof_write_buffer(hysdn_card *, int); /* write boot data to card */ |
256 | extern int EvalSysrTokData(hysdn_card *, uchar *, int); /* Check Sysready Token Data */ | 248 | extern int EvalSysrTokData(hysdn_card *, unsigned char *, int); /* Check Sysready Token Data */ |
257 | 249 | ||
258 | /* hysdn_sched.c */ | 250 | /* hysdn_sched.c */ |
259 | extern int hysdn_sched_tx(hysdn_card *, uchar *, word volatile *, word volatile *, | 251 | extern int hysdn_sched_tx(hysdn_card *, unsigned char *, |
260 | word); | 252 | unsigned short volatile *, unsigned short volatile *, |
261 | extern int hysdn_sched_rx(hysdn_card *, uchar *, word, word); | 253 | unsigned short); |
262 | extern int hysdn_tx_cfgline(hysdn_card *, uchar *, word); /* send one cfg line */ | 254 | extern int hysdn_sched_rx(hysdn_card *, unsigned char *, unsigned short, |
255 | unsigned short); | ||
256 | extern int hysdn_tx_cfgline(hysdn_card *, unsigned char *, | ||
257 | unsigned short); /* send one cfg line */ | ||
263 | 258 | ||
264 | /* hysdn_net.c */ | 259 | /* hysdn_net.c */ |
265 | extern unsigned int hynet_enable; | 260 | extern unsigned int hynet_enable; |
@@ -269,14 +264,16 @@ extern int hysdn_net_release(hysdn_card *); /* delete the device */ | |||
269 | extern char *hysdn_net_getname(hysdn_card *); /* get name of net interface */ | 264 | extern char *hysdn_net_getname(hysdn_card *); /* get name of net interface */ |
270 | extern void hysdn_tx_netack(hysdn_card *); /* acknowledge a packet tx */ | 265 | extern void hysdn_tx_netack(hysdn_card *); /* acknowledge a packet tx */ |
271 | extern struct sk_buff *hysdn_tx_netget(hysdn_card *); /* get next network packet */ | 266 | extern struct sk_buff *hysdn_tx_netget(hysdn_card *); /* get next network packet */ |
272 | extern void hysdn_rx_netpkt(hysdn_card *, uchar *, word); /* rxed packet from network */ | 267 | extern void hysdn_rx_netpkt(hysdn_card *, unsigned char *, |
268 | unsigned short); /* rxed packet from network */ | ||
273 | 269 | ||
274 | #ifdef CONFIG_HYSDN_CAPI | 270 | #ifdef CONFIG_HYSDN_CAPI |
275 | extern unsigned int hycapi_enable; | 271 | extern unsigned int hycapi_enable; |
276 | extern int hycapi_capi_create(hysdn_card *); /* create a new capi device */ | 272 | extern int hycapi_capi_create(hysdn_card *); /* create a new capi device */ |
277 | extern int hycapi_capi_release(hysdn_card *); /* delete the device */ | 273 | extern int hycapi_capi_release(hysdn_card *); /* delete the device */ |
278 | extern int hycapi_capi_stop(hysdn_card *card); /* suspend */ | 274 | extern int hycapi_capi_stop(hysdn_card *card); /* suspend */ |
279 | extern void hycapi_rx_capipkt(hysdn_card * card, uchar * buf, word len); | 275 | extern void hycapi_rx_capipkt(hysdn_card * card, unsigned char * buf, |
276 | unsigned short len); | ||
280 | extern void hycapi_tx_capiack(hysdn_card * card); | 277 | extern void hycapi_tx_capiack(hysdn_card * card); |
281 | extern struct sk_buff *hycapi_tx_capiget(hysdn_card *card); | 278 | extern struct sk_buff *hycapi_tx_capiget(hysdn_card *card); |
282 | extern int hycapi_init(void); | 279 | extern int hycapi_init(void); |
diff --git a/drivers/isdn/hysdn/hysdn_init.c b/drivers/isdn/hysdn/hysdn_init.c index cb791f8e793a..b75ac5af236a 100644 --- a/drivers/isdn/hysdn/hysdn_init.c +++ b/drivers/isdn/hysdn/hysdn_init.c | |||
@@ -41,8 +41,8 @@ hysdn_card *card_root = NULL; /* pointer to first card */ | |||
41 | /* the last entry contains all 0 */ | 41 | /* the last entry contains all 0 */ |
42 | /**********************************************/ | 42 | /**********************************************/ |
43 | static struct { | 43 | static struct { |
44 | word subid; /* PCI sub id */ | 44 | unsigned short subid; /* PCI sub id */ |
45 | uchar cardtyp; /* card type assigned */ | 45 | unsigned char cardtyp; /* card type assigned */ |
46 | } pci_subid_map[] = { | 46 | } pci_subid_map[] = { |
47 | 47 | ||
48 | { | 48 | { |
diff --git a/drivers/isdn/hysdn/hysdn_net.c b/drivers/isdn/hysdn/hysdn_net.c index aa01628d74c6..d205249a1242 100644 --- a/drivers/isdn/hysdn/hysdn_net.c +++ b/drivers/isdn/hysdn/hysdn_net.c | |||
@@ -24,7 +24,7 @@ | |||
24 | #include "hysdn_defs.h" | 24 | #include "hysdn_defs.h" |
25 | 25 | ||
26 | unsigned int hynet_enable = 0xffffffff; | 26 | unsigned int hynet_enable = 0xffffffff; |
27 | MODULE_PARM(hynet_enable, "i"); | 27 | module_param(hynet_enable, uint, 0); |
28 | 28 | ||
29 | /* store the actual version for log reporting */ | 29 | /* store the actual version for log reporting */ |
30 | char *hysdn_net_revision = "$Revision: 1.8.6.4 $"; | 30 | char *hysdn_net_revision = "$Revision: 1.8.6.4 $"; |
@@ -83,12 +83,12 @@ net_open(struct net_device *dev) | |||
83 | 83 | ||
84 | /* Fill in the MAC-level header (if not already set) */ | 84 | /* Fill in the MAC-level header (if not already set) */ |
85 | if (!card->mac_addr[0]) { | 85 | if (!card->mac_addr[0]) { |
86 | for (i = 0; i < ETH_ALEN - sizeof(ulong); i++) | 86 | for (i = 0; i < ETH_ALEN - sizeof(unsigned long); i++) |
87 | dev->dev_addr[i] = 0xfc; | 87 | dev->dev_addr[i] = 0xfc; |
88 | if ((in_dev = dev->ip_ptr) != NULL) { | 88 | if ((in_dev = dev->ip_ptr) != NULL) { |
89 | struct in_ifaddr *ifa = in_dev->ifa_list; | 89 | struct in_ifaddr *ifa = in_dev->ifa_list; |
90 | if (ifa != NULL) | 90 | if (ifa != NULL) |
91 | memcpy(dev->dev_addr + (ETH_ALEN - sizeof(ulong)), &ifa->ifa_local, sizeof(ulong)); | 91 | memcpy(dev->dev_addr + (ETH_ALEN - sizeof(unsigned long)), &ifa->ifa_local, sizeof(unsigned long)); |
92 | } | 92 | } |
93 | } else | 93 | } else |
94 | memcpy(dev->dev_addr, card->mac_addr, ETH_ALEN); | 94 | memcpy(dev->dev_addr, card->mac_addr, ETH_ALEN); |
@@ -197,7 +197,7 @@ hysdn_tx_netack(hysdn_card * card) | |||
197 | /* we got a packet from the network, go and queue it */ | 197 | /* we got a packet from the network, go and queue it */ |
198 | /*****************************************************/ | 198 | /*****************************************************/ |
199 | void | 199 | void |
200 | hysdn_rx_netpkt(hysdn_card * card, uchar * buf, word len) | 200 | hysdn_rx_netpkt(hysdn_card * card, unsigned char *buf, unsigned short len) |
201 | { | 201 | { |
202 | struct net_local *lp = card->netif; | 202 | struct net_local *lp = card->netif; |
203 | struct sk_buff *skb; | 203 | struct sk_buff *skb; |
diff --git a/drivers/isdn/hysdn/hysdn_pof.h b/drivers/isdn/hysdn/hysdn_pof.h index 6cd81b9b08bc..a368d6caca0e 100644 --- a/drivers/isdn/hysdn/hysdn_pof.h +++ b/drivers/isdn/hysdn/hysdn_pof.h | |||
@@ -47,20 +47,20 @@ | |||
47 | 47 | ||
48 | /*--------------------------------------POF file record structs------------*/ | 48 | /*--------------------------------------POF file record structs------------*/ |
49 | typedef struct PofFileHdr_tag { /* Pof file header */ | 49 | typedef struct PofFileHdr_tag { /* Pof file header */ |
50 | /*00 */ ulong Magic __attribute__((packed)); | 50 | /*00 */ unsigned long Magic __attribute__((packed)); |
51 | /*04 */ ulong N_PofRecs __attribute__((packed)); | 51 | /*04 */ unsigned long N_PofRecs __attribute__((packed)); |
52 | /*08 */ | 52 | /*08 */ |
53 | } tPofFileHdr; | 53 | } tPofFileHdr; |
54 | 54 | ||
55 | typedef struct PofRecHdr_tag { /* Pof record header */ | 55 | typedef struct PofRecHdr_tag { /* Pof record header */ |
56 | /*00 */ word PofRecId __attribute__((packed)); | 56 | /*00 */ unsigned short PofRecId __attribute__((packed)); |
57 | /*02 */ ulong PofRecDataLen __attribute__((packed)); | 57 | /*02 */ unsigned long PofRecDataLen __attribute__((packed)); |
58 | /*06 */ | 58 | /*06 */ |
59 | } tPofRecHdr; | 59 | } tPofRecHdr; |
60 | 60 | ||
61 | typedef struct PofTimeStamp_tag { | 61 | typedef struct PofTimeStamp_tag { |
62 | /*00 */ ulong UnixTime __attribute__((packed)); | 62 | /*00 */ unsigned long UnixTime __attribute__((packed)); |
63 | /*04 */ uchar DateTimeText[0x28] __attribute__((packed)); | 63 | /*04 */ unsigned char DateTimeText[0x28] __attribute__((packed)); |
64 | /* =40 */ | 64 | /* =40 */ |
65 | /*2C */ | 65 | /*2C */ |
66 | } tPofTimeStamp; | 66 | } tPofTimeStamp; |
diff --git a/drivers/isdn/hysdn/hysdn_procconf.c b/drivers/isdn/hysdn/hysdn_procconf.c index 40e56143c768..8e2b03889f3c 100644 --- a/drivers/isdn/hysdn/hysdn_procconf.c +++ b/drivers/isdn/hysdn/hysdn_procconf.c | |||
@@ -36,9 +36,9 @@ struct conf_writedata { | |||
36 | int buf_size; /* actual number of bytes in the buffer */ | 36 | int buf_size; /* actual number of bytes in the buffer */ |
37 | int needed_size; /* needed size when reading pof */ | 37 | int needed_size; /* needed size when reading pof */ |
38 | int state; /* actual interface states from above constants */ | 38 | int state; /* actual interface states from above constants */ |
39 | uchar conf_line[CONF_LINE_LEN]; /* buffered conf line */ | 39 | unsigned char conf_line[CONF_LINE_LEN]; /* buffered conf line */ |
40 | word channel; /* active channel number */ | 40 | unsigned short channel; /* active channel number */ |
41 | uchar *pof_buffer; /* buffer when writing pof */ | 41 | unsigned char *pof_buffer; /* buffer when writing pof */ |
42 | }; | 42 | }; |
43 | 43 | ||
44 | /***********************************************************************/ | 44 | /***********************************************************************/ |
@@ -49,7 +49,7 @@ struct conf_writedata { | |||
49 | static int | 49 | static int |
50 | process_line(struct conf_writedata *cnf) | 50 | process_line(struct conf_writedata *cnf) |
51 | { | 51 | { |
52 | uchar *cp = cnf->conf_line; | 52 | unsigned char *cp = cnf->conf_line; |
53 | int i; | 53 | int i; |
54 | 54 | ||
55 | if (cnf->card->debug_flags & LOG_CNF_LINE) | 55 | if (cnf->card->debug_flags & LOG_CNF_LINE) |
@@ -92,7 +92,7 @@ hysdn_conf_write(struct file *file, const char __user *buf, size_t count, loff_t | |||
92 | { | 92 | { |
93 | struct conf_writedata *cnf; | 93 | struct conf_writedata *cnf; |
94 | int i; | 94 | int i; |
95 | uchar ch, *cp; | 95 | unsigned char ch, *cp; |
96 | 96 | ||
97 | if (!count) | 97 | if (!count) |
98 | return (0); /* nothing to handle */ | 98 | return (0); /* nothing to handle */ |
@@ -390,7 +390,7 @@ int | |||
390 | hysdn_procconf_init(void) | 390 | hysdn_procconf_init(void) |
391 | { | 391 | { |
392 | hysdn_card *card; | 392 | hysdn_card *card; |
393 | uchar conf_name[20]; | 393 | unsigned char conf_name[20]; |
394 | 394 | ||
395 | hysdn_proc_entry = proc_mkdir(PROC_SUBDIR_NAME, proc_net); | 395 | hysdn_proc_entry = proc_mkdir(PROC_SUBDIR_NAME, proc_net); |
396 | if (!hysdn_proc_entry) { | 396 | if (!hysdn_proc_entry) { |
@@ -423,7 +423,7 @@ void | |||
423 | hysdn_procconf_release(void) | 423 | hysdn_procconf_release(void) |
424 | { | 424 | { |
425 | hysdn_card *card; | 425 | hysdn_card *card; |
426 | uchar conf_name[20]; | 426 | unsigned char conf_name[20]; |
427 | 427 | ||
428 | card = card_root; /* start with first card */ | 428 | card = card_root; /* start with first card */ |
429 | while (card) { | 429 | while (card) { |
diff --git a/drivers/isdn/hysdn/hysdn_proclog.c b/drivers/isdn/hysdn/hysdn_proclog.c index 6c26f1efabd5..c4301e8338ef 100644 --- a/drivers/isdn/hysdn/hysdn_proclog.c +++ b/drivers/isdn/hysdn/hysdn_proclog.c | |||
@@ -28,7 +28,7 @@ static void put_log_buffer(hysdn_card * card, char *cp); | |||
28 | /*************************************************/ | 28 | /*************************************************/ |
29 | struct log_data { | 29 | struct log_data { |
30 | struct log_data *next; | 30 | struct log_data *next; |
31 | ulong usage_cnt; /* number of files still to work */ | 31 | unsigned long usage_cnt;/* number of files still to work */ |
32 | void *proc_ctrl; /* pointer to own control procdata structure */ | 32 | void *proc_ctrl; /* pointer to own control procdata structure */ |
33 | char log_start[2]; /* log string start (final len aligned by size) */ | 33 | char log_start[2]; /* log string start (final len aligned by size) */ |
34 | }; | 34 | }; |
@@ -42,7 +42,7 @@ struct procdata { | |||
42 | struct log_data *log_head, *log_tail; /* head and tail for queue */ | 42 | struct log_data *log_head, *log_tail; /* head and tail for queue */ |
43 | int if_used; /* open count for interface */ | 43 | int if_used; /* open count for interface */ |
44 | int volatile del_lock; /* lock for delete operations */ | 44 | int volatile del_lock; /* lock for delete operations */ |
45 | uchar logtmp[LOG_MAX_LINELEN]; | 45 | unsigned char logtmp[LOG_MAX_LINELEN]; |
46 | wait_queue_head_t rd_queue; | 46 | wait_queue_head_t rd_queue; |
47 | }; | 47 | }; |
48 | 48 | ||
@@ -153,9 +153,9 @@ put_log_buffer(hysdn_card * card, char *cp) | |||
153 | static ssize_t | 153 | static ssize_t |
154 | hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) | 154 | hysdn_log_write(struct file *file, const char __user *buf, size_t count, loff_t * off) |
155 | { | 155 | { |
156 | ulong u = 0; | 156 | unsigned long u = 0; |
157 | int found = 0; | 157 | int found = 0; |
158 | uchar *cp, valbuf[128]; | 158 | unsigned char *cp, valbuf[128]; |
159 | long base = 10; | 159 | long base = 10; |
160 | hysdn_card *card = (hysdn_card *) file->private_data; | 160 | hysdn_card *card = (hysdn_card *) file->private_data; |
161 | 161 | ||
@@ -249,7 +249,7 @@ hysdn_log_open(struct inode *ino, struct file *filep) | |||
249 | { | 249 | { |
250 | hysdn_card *card; | 250 | hysdn_card *card; |
251 | struct procdata *pd = NULL; | 251 | struct procdata *pd = NULL; |
252 | ulong flags; | 252 | unsigned long flags; |
253 | 253 | ||
254 | lock_kernel(); | 254 | lock_kernel(); |
255 | card = card_root; | 255 | card = card_root; |
diff --git a/drivers/isdn/hysdn/hysdn_sched.c b/drivers/isdn/hysdn/hysdn_sched.c index 4fa3b01707cd..133032920ff8 100644 --- a/drivers/isdn/hysdn/hysdn_sched.c +++ b/drivers/isdn/hysdn/hysdn_sched.c | |||
@@ -30,7 +30,8 @@ | |||
30 | /* to keep the data until later. */ | 30 | /* to keep the data until later. */ |
31 | /*****************************************************************************/ | 31 | /*****************************************************************************/ |
32 | int | 32 | int |
33 | hysdn_sched_rx(hysdn_card * card, uchar * buf, word len, word chan) | 33 | hysdn_sched_rx(hysdn_card *card, unsigned char *buf, unsigned short len, |
34 | unsigned short chan) | ||
34 | { | 35 | { |
35 | 36 | ||
36 | switch (chan) { | 37 | switch (chan) { |
@@ -72,7 +73,9 @@ hysdn_sched_rx(hysdn_card * card, uchar * buf, word len, word chan) | |||
72 | /* sending. */ | 73 | /* sending. */ |
73 | /*****************************************************************************/ | 74 | /*****************************************************************************/ |
74 | int | 75 | int |
75 | hysdn_sched_tx(hysdn_card * card, uchar * buf, word volatile *len, word volatile *chan, word maxlen) | 76 | hysdn_sched_tx(hysdn_card *card, unsigned char *buf, |
77 | unsigned short volatile *len, unsigned short volatile *chan, | ||
78 | unsigned short maxlen) | ||
76 | { | 79 | { |
77 | struct sk_buff *skb; | 80 | struct sk_buff *skb; |
78 | 81 | ||
@@ -145,10 +148,10 @@ hysdn_sched_tx(hysdn_card * card, uchar * buf, word volatile *len, word volatile | |||
145 | /* are to be sent and this happens very seldom. */ | 148 | /* are to be sent and this happens very seldom. */ |
146 | /*****************************************************************************/ | 149 | /*****************************************************************************/ |
147 | int | 150 | int |
148 | hysdn_tx_cfgline(hysdn_card * card, uchar * line, word chan) | 151 | hysdn_tx_cfgline(hysdn_card *card, unsigned char *line, unsigned short chan) |
149 | { | 152 | { |
150 | int cnt = 50; /* timeout intervalls */ | 153 | int cnt = 50; /* timeout intervalls */ |
151 | ulong flags; | 154 | unsigned long flags; |
152 | 155 | ||
153 | if (card->debug_flags & LOG_SCHED_ASYN) | 156 | if (card->debug_flags & LOG_SCHED_ASYN) |
154 | hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1); | 157 | hysdn_addlog(card, "async tx-cfg chan=%d len=%d", chan, strlen(line) + 1); |
diff --git a/drivers/isdn/hysdn/ince1pc.h b/drivers/isdn/hysdn/ince1pc.h index 4a115a87c782..7a36694df6d7 100644 --- a/drivers/isdn/hysdn/ince1pc.h +++ b/drivers/isdn/hysdn/ince1pc.h | |||
@@ -62,7 +62,7 @@ | |||
62 | * s. RotlCRC algorithm | 62 | * s. RotlCRC algorithm |
63 | * | 63 | * |
64 | * RotlCRC algorithm: | 64 | * RotlCRC algorithm: |
65 | * ucSum= 0 1 uchar | 65 | * ucSum= 0 1 unsigned char |
66 | * for all NonEndTokenChunk bytes: | 66 | * for all NonEndTokenChunk bytes: |
67 | * ROTL(ucSum,1) rotate left by 1 | 67 | * ROTL(ucSum,1) rotate left by 1 |
68 | * ucSum += Char; add current byte with swap around | 68 | * ucSum += Char; add current byte with swap around |
@@ -85,13 +85,13 @@ | |||
85 | 85 | ||
86 | typedef struct ErrLogEntry_tag { | 86 | typedef struct ErrLogEntry_tag { |
87 | 87 | ||
88 | /*00 */ ulong ulErrType; | 88 | /*00 */ unsigned long ulErrType; |
89 | 89 | ||
90 | /*04 */ ulong ulErrSubtype; | 90 | /*04 */ unsigned long ulErrSubtype; |
91 | 91 | ||
92 | /*08 */ uchar ucTextSize; | 92 | /*08 */ unsigned char ucTextSize; |
93 | 93 | ||
94 | /*09 */ uchar ucText[ERRLOG_TEXT_SIZE]; | 94 | /*09 */ unsigned char ucText[ERRLOG_TEXT_SIZE]; |
95 | /* ASCIIZ of len ucTextSize-1 */ | 95 | /* ASCIIZ of len ucTextSize-1 */ |
96 | 96 | ||
97 | /*40 */ | 97 | /*40 */ |
@@ -111,13 +111,13 @@ typedef struct ErrLogEntry_tag { | |||
111 | #define DPRAM_SPOOLER_DATA_SIZE 0x20 | 111 | #define DPRAM_SPOOLER_DATA_SIZE 0x20 |
112 | typedef struct DpramBootSpooler_tag { | 112 | typedef struct DpramBootSpooler_tag { |
113 | 113 | ||
114 | /*00 */ uchar Len; | 114 | /*00 */ unsigned char Len; |
115 | 115 | ||
116 | /*01 */ volatile uchar RdPtr; | 116 | /*01 */ volatile unsigned char RdPtr; |
117 | 117 | ||
118 | /*02 */ uchar WrPtr; | 118 | /*02 */ unsigned char WrPtr; |
119 | 119 | ||
120 | /*03 */ uchar Data[DPRAM_SPOOLER_DATA_SIZE]; | 120 | /*03 */ unsigned char Data[DPRAM_SPOOLER_DATA_SIZE]; |
121 | 121 | ||
122 | /*23 */ | 122 | /*23 */ |
123 | } tDpramBootSpooler; | 123 | } tDpramBootSpooler; |
diff --git a/drivers/isdn/i4l/isdn_ppp.c b/drivers/isdn/i4l/isdn_ppp.c index 1a19a0f89428..b9fed8a3bcc6 100644 --- a/drivers/isdn/i4l/isdn_ppp.c +++ b/drivers/isdn/i4l/isdn_ppp.c | |||
@@ -782,7 +782,8 @@ isdn_ppp_read(int min, struct file *file, char __user *buf, int count) | |||
782 | is->first = b; | 782 | is->first = b; |
783 | 783 | ||
784 | spin_unlock_irqrestore(&is->buflock, flags); | 784 | spin_unlock_irqrestore(&is->buflock, flags); |
785 | copy_to_user(buf, save_buf, count); | 785 | if (copy_to_user(buf, save_buf, count)) |
786 | count = -EFAULT; | ||
786 | kfree(save_buf); | 787 | kfree(save_buf); |
787 | 788 | ||
788 | return count; | 789 | return count; |
diff --git a/drivers/isdn/i4l/isdn_tty.c b/drivers/isdn/i4l/isdn_tty.c index aeaa1db74bd8..3585fb1f3344 100644 --- a/drivers/isdn/i4l/isdn_tty.c +++ b/drivers/isdn/i4l/isdn_tty.c | |||
@@ -2345,12 +2345,15 @@ isdn_tty_at_cout(char *msg, modem_info * info) | |||
2345 | u_long flags; | 2345 | u_long flags; |
2346 | struct sk_buff *skb = NULL; | 2346 | struct sk_buff *skb = NULL; |
2347 | char *sp = NULL; | 2347 | char *sp = NULL; |
2348 | int l = strlen(msg); | 2348 | int l; |
2349 | 2349 | ||
2350 | if (!msg) { | 2350 | if (!msg) { |
2351 | printk(KERN_WARNING "isdn_tty: Null-Message in isdn_tty_at_cout\n"); | 2351 | printk(KERN_WARNING "isdn_tty: Null-Message in isdn_tty_at_cout\n"); |
2352 | return; | 2352 | return; |
2353 | } | 2353 | } |
2354 | |||
2355 | l = strlen(msg); | ||
2356 | |||
2354 | spin_lock_irqsave(&info->readlock, flags); | 2357 | spin_lock_irqsave(&info->readlock, flags); |
2355 | tty = info->tty; | 2358 | tty = info->tty; |
2356 | if ((info->flags & ISDN_ASYNC_CLOSING) || (!tty)) { | 2359 | if ((info->flags & ISDN_ASYNC_CLOSING) || (!tty)) { |
diff --git a/drivers/isdn/isdnloop/isdnloop.c b/drivers/isdn/isdnloop/isdnloop.c index 33d339700411..a67d31af797a 100644 --- a/drivers/isdn/isdnloop/isdnloop.c +++ b/drivers/isdn/isdnloop/isdnloop.c | |||
@@ -22,7 +22,7 @@ static char *isdnloop_id = "loop0"; | |||
22 | MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card"); | 22 | MODULE_DESCRIPTION("ISDN4Linux: Pseudo Driver that simulates an ISDN card"); |
23 | MODULE_AUTHOR("Fritz Elfert"); | 23 | MODULE_AUTHOR("Fritz Elfert"); |
24 | MODULE_LICENSE("GPL"); | 24 | MODULE_LICENSE("GPL"); |
25 | MODULE_PARM(isdnloop_id, "s"); | 25 | module_param(isdnloop_id, charp, 0); |
26 | MODULE_PARM_DESC(isdnloop_id, "ID-String of first card"); | 26 | MODULE_PARM_DESC(isdnloop_id, "ID-String of first card"); |
27 | 27 | ||
28 | static int isdnloop_addcard(char *); | 28 | static int isdnloop_addcard(char *); |
diff --git a/drivers/md/bitmap.c b/drivers/md/bitmap.c index eae4473eadde..670eb01a5a23 100644 --- a/drivers/md/bitmap.c +++ b/drivers/md/bitmap.c | |||
@@ -556,7 +556,7 @@ static void bitmap_mask_state(struct bitmap *bitmap, enum bitmap_state bits, | |||
556 | unsigned long flags; | 556 | unsigned long flags; |
557 | 557 | ||
558 | spin_lock_irqsave(&bitmap->lock, flags); | 558 | spin_lock_irqsave(&bitmap->lock, flags); |
559 | if (!bitmap || !bitmap->sb_page) { /* can't set the state */ | 559 | if (!bitmap->sb_page) { /* can't set the state */ |
560 | spin_unlock_irqrestore(&bitmap->lock, flags); | 560 | spin_unlock_irqrestore(&bitmap->lock, flags); |
561 | return; | 561 | return; |
562 | } | 562 | } |
diff --git a/drivers/media/Kconfig b/drivers/media/Kconfig index c2602b340491..baa9f58beffc 100644 --- a/drivers/media/Kconfig +++ b/drivers/media/Kconfig | |||
@@ -50,5 +50,19 @@ config VIDEO_IR | |||
50 | config VIDEO_TVEEPROM | 50 | config VIDEO_TVEEPROM |
51 | tristate | 51 | tristate |
52 | 52 | ||
53 | config USB_DABUSB | ||
54 | tristate "DABUSB driver" | ||
55 | depends on USB | ||
56 | ---help--- | ||
57 | A Digital Audio Broadcasting (DAB) Receiver for USB and Linux | ||
58 | brought to you by the DAB-Team | ||
59 | <http://wwwbode.cs.tum.edu/Par/arch/dab/>. This driver can be taken | ||
60 | as an example for URB-based bulk, control, and isochronous | ||
61 | transactions. URB's are explained in | ||
62 | <Documentation/usb/URB.txt>. | ||
63 | |||
64 | To compile this driver as a module, choose M here: the | ||
65 | module will be called dabusb. | ||
66 | |||
53 | endmenu | 67 | endmenu |
54 | 68 | ||
diff --git a/drivers/media/common/saa7146_fops.c b/drivers/media/common/saa7146_fops.c index 3870fa948cc0..523ab3851c7b 100644 --- a/drivers/media/common/saa7146_fops.c +++ b/drivers/media/common/saa7146_fops.c | |||
@@ -50,14 +50,15 @@ void saa7146_res_free(struct saa7146_fh *fh, unsigned int bits) | |||
50 | /********************************************************************************/ | 50 | /********************************************************************************/ |
51 | /* common dma functions */ | 51 | /* common dma functions */ |
52 | 52 | ||
53 | void saa7146_dma_free(struct saa7146_dev *dev,struct saa7146_buf *buf) | 53 | void saa7146_dma_free(struct saa7146_dev *dev,struct videobuf_queue *q, |
54 | struct saa7146_buf *buf) | ||
54 | { | 55 | { |
55 | DEB_EE(("dev:%p, buf:%p\n",dev,buf)); | 56 | DEB_EE(("dev:%p, buf:%p\n",dev,buf)); |
56 | 57 | ||
57 | BUG_ON(in_interrupt()); | 58 | BUG_ON(in_interrupt()); |
58 | 59 | ||
59 | videobuf_waiton(&buf->vb,0,0); | 60 | videobuf_waiton(&buf->vb,0,0); |
60 | videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma); | 61 | videobuf_dma_unmap(q, &buf->vb.dma); |
61 | videobuf_dma_free(&buf->vb.dma); | 62 | videobuf_dma_free(&buf->vb.dma); |
62 | buf->vb.state = STATE_NEEDS_INIT; | 63 | buf->vb.state = STATE_NEEDS_INIT; |
63 | } | 64 | } |
diff --git a/drivers/media/common/saa7146_vbi.c b/drivers/media/common/saa7146_vbi.c index 500bd3f05e16..063608462ebe 100644 --- a/drivers/media/common/saa7146_vbi.c +++ b/drivers/media/common/saa7146_vbi.c | |||
@@ -236,7 +236,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e | |||
236 | } | 236 | } |
237 | 237 | ||
238 | if (buf->vb.size != size) | 238 | if (buf->vb.size != size) |
239 | saa7146_dma_free(dev,buf); | 239 | saa7146_dma_free(dev,q,buf); |
240 | 240 | ||
241 | if (STATE_NEEDS_INIT == buf->vb.state) { | 241 | if (STATE_NEEDS_INIT == buf->vb.state) { |
242 | buf->vb.width = llength; | 242 | buf->vb.width = llength; |
@@ -247,7 +247,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e | |||
247 | saa7146_pgtable_free(dev->pci, &buf->pt[2]); | 247 | saa7146_pgtable_free(dev->pci, &buf->pt[2]); |
248 | saa7146_pgtable_alloc(dev->pci, &buf->pt[2]); | 248 | saa7146_pgtable_alloc(dev->pci, &buf->pt[2]); |
249 | 249 | ||
250 | err = videobuf_iolock(dev->pci,&buf->vb, NULL); | 250 | err = videobuf_iolock(q,&buf->vb, NULL); |
251 | if (err) | 251 | if (err) |
252 | goto oops; | 252 | goto oops; |
253 | err = saa7146_pgtable_build_single(dev->pci, &buf->pt[2], buf->vb.dma.sglist, buf->vb.dma.sglen); | 253 | err = saa7146_pgtable_build_single(dev->pci, &buf->pt[2], buf->vb.dma.sglist, buf->vb.dma.sglen); |
@@ -261,7 +261,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb,e | |||
261 | 261 | ||
262 | oops: | 262 | oops: |
263 | DEB_VBI(("error out.\n")); | 263 | DEB_VBI(("error out.\n")); |
264 | saa7146_dma_free(dev,buf); | 264 | saa7146_dma_free(dev,q,buf); |
265 | 265 | ||
266 | return err; | 266 | return err; |
267 | } | 267 | } |
@@ -301,7 +301,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
301 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; | 301 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; |
302 | 302 | ||
303 | DEB_VBI(("vb:%p\n",vb)); | 303 | DEB_VBI(("vb:%p\n",vb)); |
304 | saa7146_dma_free(dev,buf); | 304 | saa7146_dma_free(dev,q,buf); |
305 | } | 305 | } |
306 | 306 | ||
307 | static struct videobuf_queue_ops vbi_qops = { | 307 | static struct videobuf_queue_ops vbi_qops = { |
diff --git a/drivers/media/common/saa7146_video.c b/drivers/media/common/saa7146_video.c index 6b42713d97f4..e7079d1bd537 100644 --- a/drivers/media/common/saa7146_video.c +++ b/drivers/media/common/saa7146_video.c | |||
@@ -1275,7 +1275,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1275 | buf->vb.field != field || | 1275 | buf->vb.field != field || |
1276 | buf->vb.field != fh->video_fmt.field || | 1276 | buf->vb.field != fh->video_fmt.field || |
1277 | buf->fmt != &fh->video_fmt) { | 1277 | buf->fmt != &fh->video_fmt) { |
1278 | saa7146_dma_free(dev,buf); | 1278 | saa7146_dma_free(dev,q,buf); |
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | if (STATE_NEEDS_INIT == buf->vb.state) { | 1281 | if (STATE_NEEDS_INIT == buf->vb.state) { |
@@ -1304,7 +1304,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1304 | saa7146_pgtable_alloc(dev->pci, &buf->pt[0]); | 1304 | saa7146_pgtable_alloc(dev->pci, &buf->pt[0]); |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | err = videobuf_iolock(dev->pci,&buf->vb, &vv->ov_fb); | 1307 | err = videobuf_iolock(q,&buf->vb, &vv->ov_fb); |
1308 | if (err) | 1308 | if (err) |
1309 | goto oops; | 1309 | goto oops; |
1310 | err = saa7146_pgtable_build(dev,buf); | 1310 | err = saa7146_pgtable_build(dev,buf); |
@@ -1318,7 +1318,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1318 | 1318 | ||
1319 | oops: | 1319 | oops: |
1320 | DEB_D(("error out.\n")); | 1320 | DEB_D(("error out.\n")); |
1321 | saa7146_dma_free(dev,buf); | 1321 | saa7146_dma_free(dev,q,buf); |
1322 | 1322 | ||
1323 | return err; | 1323 | return err; |
1324 | } | 1324 | } |
@@ -1363,7 +1363,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
1363 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; | 1363 | struct saa7146_buf *buf = (struct saa7146_buf *)vb; |
1364 | 1364 | ||
1365 | DEB_CAP(("vbuf:%p\n",vb)); | 1365 | DEB_CAP(("vbuf:%p\n",vb)); |
1366 | saa7146_dma_free(dev,buf); | 1366 | saa7146_dma_free(dev,q,buf); |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | static struct videobuf_queue_ops video_qops = { | 1369 | static struct videobuf_queue_ops video_qops = { |
diff --git a/drivers/media/dvb/b2c2/flexcop-usb.c b/drivers/media/dvb/b2c2/flexcop-usb.c index a6c91db40ad6..06ec9fff0ec1 100644 --- a/drivers/media/dvb/b2c2/flexcop-usb.c +++ b/drivers/media/dvb/b2c2/flexcop-usb.c | |||
@@ -541,6 +541,7 @@ static struct usb_device_id flexcop_usb_table [] = { | |||
541 | { USB_DEVICE(0x0af7, 0x0101) }, | 541 | { USB_DEVICE(0x0af7, 0x0101) }, |
542 | { } | 542 | { } |
543 | }; | 543 | }; |
544 | MODULE_DEVICE_TABLE (usb, flexcop_usb_table); | ||
544 | 545 | ||
545 | /* usb specific object needed to register this driver with the usb subsystem */ | 546 | /* usb specific object needed to register this driver with the usb subsystem */ |
546 | static struct usb_driver flexcop_usb_driver = { | 547 | static struct usb_driver flexcop_usb_driver = { |
diff --git a/drivers/media/dvb/bt8xx/Makefile b/drivers/media/dvb/bt8xx/Makefile index d188e4c670b5..9d197efb481d 100644 --- a/drivers/media/dvb/bt8xx/Makefile +++ b/drivers/media/dvb/bt8xx/Makefile | |||
@@ -1,3 +1,3 @@ | |||
1 | obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o | 1 | obj-$(CONFIG_DVB_BT8XX) += bt878.o dvb-bt8xx.o dst.o dst_ca.o |
2 | 2 | ||
3 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video -Idrivers/media/dvb/frontends | 3 | EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/video/bt8xx -Idrivers/media/dvb/frontends |
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c index e14bf43941e3..a14e737ec848 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.c +++ b/drivers/media/dvb/dvb-usb/cxusb.c | |||
@@ -81,18 +81,19 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | |||
81 | return -EAGAIN; | 81 | return -EAGAIN; |
82 | 82 | ||
83 | if (num > 2) | 83 | if (num > 2) |
84 | warn("more than 2 i2c messages at a time is not handled yet. TODO."); | 84 | warn("more than two i2c messages at a time is not handled yet. TODO."); |
85 | 85 | ||
86 | for (i = 0; i < num; i++) { | 86 | for (i = 0; i < num; i++) { |
87 | 87 | ||
88 | switch (msg[i].addr) { | 88 | if (d->udev->descriptor.idVendor == USB_VID_MEDION) |
89 | case 0x63: | 89 | switch (msg[i].addr) { |
90 | cxusb_gpio_tuner(d,0); | 90 | case 0x63: |
91 | break; | 91 | cxusb_gpio_tuner(d,0); |
92 | default: | 92 | break; |
93 | cxusb_gpio_tuner(d,1); | 93 | default: |
94 | break; | 94 | cxusb_gpio_tuner(d,1); |
95 | } | 95 | break; |
96 | } | ||
96 | 97 | ||
97 | /* read request */ | 98 | /* read request */ |
98 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { | 99 | if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) { |
@@ -108,7 +109,7 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | |||
108 | break; | 109 | break; |
109 | 110 | ||
110 | if (ibuf[0] != 0x08) | 111 | if (ibuf[0] != 0x08) |
111 | deb_info("i2c read could have been failed\n"); | 112 | deb_i2c("i2c read may have failed\n"); |
112 | 113 | ||
113 | memcpy(msg[i+1].buf,&ibuf[1],msg[i+1].len); | 114 | memcpy(msg[i+1].buf,&ibuf[1],msg[i+1].len); |
114 | 115 | ||
@@ -122,7 +123,7 @@ static int cxusb_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg msg[],int num) | |||
122 | if (cxusb_ctrl_msg(d,CMD_I2C_WRITE, obuf, 2+msg[i].len, &ibuf,1) < 0) | 123 | if (cxusb_ctrl_msg(d,CMD_I2C_WRITE, obuf, 2+msg[i].len, &ibuf,1) < 0) |
123 | break; | 124 | break; |
124 | if (ibuf != 0x08) | 125 | if (ibuf != 0x08) |
125 | deb_info("i2c write could have been failed\n"); | 126 | deb_i2c("i2c write may have failed\n"); |
126 | } | 127 | } |
127 | } | 128 | } |
128 | 129 | ||
@@ -410,7 +411,6 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const | |||
410 | if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) && | 411 | if (fw->data[BLUEBIRD_01_ID_OFFSET] == (USB_VID_DVICO & 0xff) && |
411 | fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) { | 412 | fw->data[BLUEBIRD_01_ID_OFFSET + 1] == USB_VID_DVICO >> 8) { |
412 | 413 | ||
413 | /* FIXME: are we allowed to change the fw-data ? */ | ||
414 | fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1; | 414 | fw->data[BLUEBIRD_01_ID_OFFSET + 2] = udev->descriptor.idProduct + 1; |
415 | fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8; | 415 | fw->data[BLUEBIRD_01_ID_OFFSET + 3] = udev->descriptor.idProduct >> 8; |
416 | 416 | ||
diff --git a/drivers/media/dvb/dvb-usb/cxusb.h b/drivers/media/dvb/dvb-usb/cxusb.h index 087c99427853..c8ef77554b00 100644 --- a/drivers/media/dvb/dvb-usb/cxusb.h +++ b/drivers/media/dvb/dvb-usb/cxusb.h | |||
@@ -6,6 +6,8 @@ | |||
6 | 6 | ||
7 | extern int dvb_usb_cxusb_debug; | 7 | extern int dvb_usb_cxusb_debug; |
8 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) | 8 | #define deb_info(args...) dprintk(dvb_usb_cxusb_debug,0x01,args) |
9 | #define deb_i2c(args...) if (d->udev->descriptor.idVendor == USB_VID_MEDION) \ | ||
10 | dprintk(dvb_usb_cxusb_debug,0x01,args) | ||
9 | 11 | ||
10 | /* usb commands - some of it are guesses, don't have a reference yet */ | 12 | /* usb commands - some of it are guesses, don't have a reference yet */ |
11 | #define CMD_I2C_WRITE 0x08 | 13 | #define CMD_I2C_WRITE 0x08 |
diff --git a/drivers/media/dvb/ttpci/av7110_v4l.c b/drivers/media/dvb/ttpci/av7110_v4l.c index 2f23ceab8d44..603a22e4bfe2 100644 --- a/drivers/media/dvb/ttpci/av7110_v4l.c +++ b/drivers/media/dvb/ttpci/av7110_v4l.c | |||
@@ -369,6 +369,11 @@ static int av7110_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
369 | fm_matrix = 0x3001; // stereo | 369 | fm_matrix = 0x3001; // stereo |
370 | src = 0x0020; | 370 | src = 0x0020; |
371 | break; | 371 | break; |
372 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
373 | dprintk(2, "VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1_LANG2\n"); | ||
374 | fm_matrix = 0x3000; // bilingual | ||
375 | src = 0x0020; | ||
376 | break; | ||
372 | case V4L2_TUNER_MODE_LANG1: | 377 | case V4L2_TUNER_MODE_LANG1: |
373 | dprintk(2, "VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1\n"); | 378 | dprintk(2, "VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1\n"); |
374 | fm_matrix = 0x3000; // mono | 379 | fm_matrix = 0x3000; // mono |
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index c622a4da5663..f31a19890b15 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig | |||
@@ -16,31 +16,7 @@ config VIDEO_ADV_DEBUG | |||
16 | V4L devices. | 16 | V4L devices. |
17 | In doubt, say N. | 17 | In doubt, say N. |
18 | 18 | ||
19 | config VIDEO_BT848 | 19 | source "drivers/media/video/bt8xx/Kconfig" |
20 | tristate "BT848 Video For Linux" | ||
21 | depends on VIDEO_DEV && PCI && I2C | ||
22 | select I2C_ALGOBIT | ||
23 | select FW_LOADER | ||
24 | select VIDEO_BTCX | ||
25 | select VIDEO_BUF | ||
26 | select VIDEO_IR | ||
27 | select VIDEO_TUNER | ||
28 | select VIDEO_TVEEPROM | ||
29 | select VIDEO_MSP3400 | ||
30 | ---help--- | ||
31 | Support for BT848 based frame grabber/overlay boards. This includes | ||
32 | the Miro, Hauppauge and STB boards. Please read the material in | ||
33 | <file:Documentation/video4linux/bttv/> for more information. | ||
34 | |||
35 | To compile this driver as a module, choose M here: the | ||
36 | module will be called bttv. | ||
37 | |||
38 | config VIDEO_BT848_DVB | ||
39 | bool "DVB/ATSC Support for bt878 based TV cards" | ||
40 | depends on VIDEO_BT848 && DVB_CORE | ||
41 | select DVB_BT8XX | ||
42 | ---help--- | ||
43 | This adds support for DVB/ATSC cards based on the BT878 chip. | ||
44 | 20 | ||
45 | config VIDEO_SAA6588 | 21 | config VIDEO_SAA6588 |
46 | tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards" | 22 | tristate "SAA6588 Radio Chip RDS decoder support on BT848 cards" |
@@ -315,8 +291,6 @@ config VIDEO_HEXIUM_GEMINI | |||
315 | 291 | ||
316 | source "drivers/media/video/cx88/Kconfig" | 292 | source "drivers/media/video/cx88/Kconfig" |
317 | 293 | ||
318 | source "drivers/media/video/em28xx/Kconfig" | ||
319 | |||
320 | config VIDEO_OVCAMCHIP | 294 | config VIDEO_OVCAMCHIP |
321 | tristate "OmniVision Camera Chip support" | 295 | tristate "OmniVision Camera Chip support" |
322 | depends on VIDEO_DEV && I2C | 296 | depends on VIDEO_DEV && I2C |
@@ -391,4 +365,234 @@ config VIDEO_SAA7127 | |||
391 | To compile this driver as a module, choose M here: the | 365 | To compile this driver as a module, choose M here: the |
392 | module will be called saa7127 | 366 | module will be called saa7127 |
393 | 367 | ||
368 | # | ||
369 | # USB Multimedia device configuration | ||
370 | # | ||
371 | |||
372 | menu "V4L USB devices" | ||
373 | depends on USB && VIDEO_DEV | ||
374 | |||
375 | source "drivers/media/video/em28xx/Kconfig" | ||
376 | |||
377 | config USB_VICAM | ||
378 | tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" | ||
379 | depends on USB && VIDEO_DEV && EXPERIMENTAL | ||
380 | ---help--- | ||
381 | Say Y here if you have 3com homeconnect camera (vicam). | ||
382 | |||
383 | This driver uses the Video For Linux API. You must say Y or M to | ||
384 | "Video For Linux" (under Multimedia Devices) to use this driver. | ||
385 | Information on this API and pointers to "v4l" programs may be found | ||
386 | at <file:Documentation/video4linux/API.html>. | ||
387 | |||
388 | To compile this driver as a module, choose M here: the | ||
389 | module will be called vicam. | ||
390 | |||
391 | config USB_DSBR | ||
392 | tristate "D-Link USB FM radio support (EXPERIMENTAL)" | ||
393 | depends on USB && VIDEO_DEV && EXPERIMENTAL | ||
394 | ---help--- | ||
395 | Say Y here if you want to connect this type of radio to your | ||
396 | computer's USB port. Note that the audio is not digital, and | ||
397 | you must connect the line out connector to a sound card or a | ||
398 | set of speakers. | ||
399 | |||
400 | This driver uses the Video For Linux API. You must enable | ||
401 | (Y or M in config) Video For Linux (under Character Devices) | ||
402 | to use this driver. Information on this API and pointers to | ||
403 | "v4l" programs may be found at | ||
404 | <file:Documentation/video4linux/API.html>. | ||
405 | |||
406 | To compile this driver as a module, choose M here: the | ||
407 | module will be called dsbr100. | ||
408 | |||
409 | config USB_ET61X251 | ||
410 | tristate "USB ET61X[12]51 PC Camera Controller support" | ||
411 | depends on USB && VIDEO_DEV | ||
412 | ---help--- | ||
413 | Say Y here if you want support for cameras based on Etoms ET61X151 | ||
414 | or ET61X251 PC Camera Controllers. | ||
415 | |||
416 | See <file:Documentation/usb/et61x251.txt> for more informations. | ||
417 | |||
418 | This driver uses the Video For Linux API. You must say Y or M to | ||
419 | "Video For Linux" to use this driver. | ||
420 | |||
421 | To compile this driver as a module, choose M here: the | ||
422 | module will be called et61x251. | ||
423 | |||
424 | config USB_IBMCAM | ||
425 | tristate "USB IBM (Xirlink) C-it Camera support" | ||
426 | depends on USB && VIDEO_DEV | ||
427 | ---help--- | ||
428 | Say Y here if you want to connect a IBM "C-It" camera, also known as | ||
429 | "Xirlink PC Camera" to your computer's USB port. For more | ||
430 | information, read <file:Documentation/usb/ibmcam.txt>. | ||
431 | |||
432 | This driver uses the Video For Linux API. You must enable | ||
433 | (Y or M in config) Video For Linux (under Character Devices) | ||
434 | to use this driver. Information on this API and pointers to | ||
435 | "v4l" programs may be found at | ||
436 | <file:Documentation/video4linux/API.html>. | ||
437 | |||
438 | To compile this driver as a module, choose M here: the | ||
439 | module will be called ibmcam. | ||
440 | |||
441 | This camera has several configuration options which | ||
442 | can be specified when you load the module. Read | ||
443 | <file:Documentation/usb/ibmcam.txt> to learn more. | ||
444 | |||
445 | config USB_KONICAWC | ||
446 | tristate "USB Konica Webcam support" | ||
447 | depends on USB && VIDEO_DEV | ||
448 | ---help--- | ||
449 | Say Y here if you want support for webcams based on a Konica | ||
450 | chipset. This is known to work with the Intel YC76 webcam. | ||
451 | |||
452 | This driver uses the Video For Linux API. You must enable | ||
453 | (Y or M in config) Video For Linux (under Character Devices) | ||
454 | to use this driver. Information on this API and pointers to | ||
455 | "v4l" programs may be found at | ||
456 | <file:Documentation/video4linux/API.html>. | ||
457 | |||
458 | To compile this driver as a module, choose M here: the | ||
459 | module will be called konicawc. | ||
460 | |||
461 | config USB_OV511 | ||
462 | tristate "USB OV511 Camera support" | ||
463 | depends on USB && VIDEO_DEV | ||
464 | ---help--- | ||
465 | Say Y here if you want to connect this type of camera to your | ||
466 | computer's USB port. See <file:Documentation/usb/ov511.txt> for more | ||
467 | information and for a list of supported cameras. | ||
468 | |||
469 | This driver uses the Video For Linux API. You must say Y or M to | ||
470 | "Video For Linux" (under Character Devices) to use this driver. | ||
471 | Information on this API and pointers to "v4l" programs may be found | ||
472 | at <file:Documentation/video4linux/API.html>. | ||
473 | |||
474 | To compile this driver as a module, choose M here: the | ||
475 | module will be called ov511. | ||
476 | |||
477 | config USB_SE401 | ||
478 | tristate "USB SE401 Camera support" | ||
479 | depends on USB && VIDEO_DEV | ||
480 | ---help--- | ||
481 | Say Y here if you want to connect this type of camera to your | ||
482 | computer's USB port. See <file:Documentation/usb/se401.txt> for more | ||
483 | information and for a list of supported cameras. | ||
484 | |||
485 | This driver uses the Video For Linux API. You must say Y or M to | ||
486 | "Video For Linux" (under Multimedia Devices) to use this driver. | ||
487 | Information on this API and pointers to "v4l" programs may be found | ||
488 | at <file:Documentation/video4linux/API.html>. | ||
489 | |||
490 | To compile this driver as a module, choose M here: the | ||
491 | module will be called se401. | ||
492 | |||
493 | config USB_SN9C102 | ||
494 | tristate "USB SN9C10x PC Camera Controller support" | ||
495 | depends on USB && VIDEO_DEV | ||
496 | ---help--- | ||
497 | Say Y here if you want support for cameras based on SONiX SN9C101, | ||
498 | SN9C102 or SN9C103 PC Camera Controllers. | ||
499 | |||
500 | See <file:Documentation/usb/sn9c102.txt> for more informations. | ||
501 | |||
502 | This driver uses the Video For Linux API. You must say Y or M to | ||
503 | "Video For Linux" to use this driver. | ||
504 | |||
505 | To compile this driver as a module, choose M here: the | ||
506 | module will be called sn9c102. | ||
507 | |||
508 | config USB_STV680 | ||
509 | tristate "USB STV680 (Pencam) Camera support" | ||
510 | depends on USB && VIDEO_DEV | ||
511 | ---help--- | ||
512 | Say Y here if you want to connect this type of camera to your | ||
513 | computer's USB port. This includes the Pencam line of cameras. | ||
514 | See <file:Documentation/usb/stv680.txt> for more information and for | ||
515 | a list of supported cameras. | ||
516 | |||
517 | This driver uses the Video For Linux API. You must say Y or M to | ||
518 | "Video For Linux" (under Multimedia Devices) to use this driver. | ||
519 | Information on this API and pointers to "v4l" programs may be found | ||
520 | at <file:Documentation/video4linux/API.html>. | ||
521 | |||
522 | To compile this driver as a module, choose M here: the | ||
523 | module will be called stv680. | ||
524 | |||
525 | config USB_W9968CF | ||
526 | tristate "USB W996[87]CF JPEG Dual Mode Camera support" | ||
527 | depends on USB && VIDEO_DEV && I2C && VIDEO_OVCAMCHIP | ||
528 | ---help--- | ||
529 | Say Y here if you want support for cameras based on OV681 or | ||
530 | Winbond W9967CF/W9968CF JPEG USB Dual Mode Camera Chips. | ||
531 | |||
532 | This driver has an optional plugin, which is distributed as a | ||
533 | separate module only (released under GPL). It allows to use higher | ||
534 | resolutions and framerates, but cannot be included in the official | ||
535 | Linux kernel for performance purposes. | ||
536 | |||
537 | See <file:Documentation/usb/w9968cf.txt> for more informations. | ||
538 | |||
539 | This driver uses the Video For Linux and the I2C APIs. It needs the | ||
540 | OmniVision Camera Chip support as well. You must say Y or M to | ||
541 | "Video For Linux", "I2C Support" and "OmniVision Camera Chip | ||
542 | support" to use this driver. | ||
543 | |||
544 | To compile this driver as a module, choose M here: the | ||
545 | module will be called w9968cf. | ||
546 | |||
547 | config USB_ZC0301 | ||
548 | tristate "USB ZC0301 Image Processor and Control Chip support" | ||
549 | depends on USB && VIDEO_DEV | ||
550 | ---help--- | ||
551 | Say Y here if you want support for cameras based on the ZC0301 | ||
552 | Image Processor and Control Chip. | ||
553 | |||
554 | See <file:Documentation/usb/zc0301.txt> for more informations. | ||
555 | |||
556 | This driver uses the Video For Linux API. You must say Y or M to | ||
557 | "Video For Linux" to use this driver. | ||
558 | |||
559 | To compile this driver as a module, choose M here: the | ||
560 | module will be called zc0301. | ||
561 | |||
562 | config USB_PWC | ||
563 | tristate "USB Philips Cameras" | ||
564 | depends on USB && VIDEO_DEV | ||
565 | ---help--- | ||
566 | Say Y or M here if you want to use one of these Philips & OEM | ||
567 | webcams: | ||
568 | * Philips PCA645, PCA646 | ||
569 | * Philips PCVC675, PCVC680, PCVC690 | ||
570 | * Philips PCVC720/40, PCVC730, PCVC740, PCVC750 | ||
571 | * Askey VC010 | ||
572 | * Logitech QuickCam Pro 3000, 4000, 'Zoom', 'Notebook Pro' | ||
573 | and 'Orbit'/'Sphere' | ||
574 | * Samsung MPC-C10, MPC-C30 | ||
575 | * Creative Webcam 5, Pro Ex | ||
576 | * SOTEC Afina Eye | ||
577 | * Visionite VCS-UC300, VCS-UM100 | ||
578 | |||
579 | The PCA635, PCVC665 and PCVC720/20 are not supported by this driver | ||
580 | and never will be, but the 665 and 720/20 are supported by other | ||
581 | drivers. | ||
582 | |||
583 | See <file:Documentation/usb/philips.txt> for more information and | ||
584 | installation instructions. | ||
585 | |||
586 | The built-in microphone is enabled by selecting USB Audio support. | ||
587 | |||
588 | This driver uses the Video For Linux API. You must say Y or M to | ||
589 | "Video For Linux" (under Character Devices) to use this driver. | ||
590 | Information on this API and pointers to "v4l" programs may be found | ||
591 | at <file:Documentation/video4linux/API.html>. | ||
592 | |||
593 | To compile this driver as a module, choose M here: the | ||
594 | module will be called pwc. | ||
595 | |||
596 | endmenu # V4L USB devices | ||
597 | |||
394 | endmenu | 598 | endmenu |
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index f2bd4c0c4f10..1c0e72e5a593 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile | |||
@@ -2,9 +2,6 @@ | |||
2 | # Makefile for the video capture/playback device drivers. | 2 | # Makefile for the video capture/playback device drivers. |
3 | # | 3 | # |
4 | 4 | ||
5 | bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ | ||
6 | bttv-risc.o bttv-vbi.o bttv-i2c.o bttv-gpio.o \ | ||
7 | bttv-input.o | ||
8 | zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o | 5 | zoran-objs := zr36120.o zr36120_i2c.o zr36120_mem.o |
9 | zr36067-objs := zoran_procfs.o zoran_device.o \ | 6 | zr36067-objs := zoran_procfs.o zoran_device.o \ |
10 | zoran_driver.o zoran_card.o | 7 | zoran_driver.o zoran_card.o |
@@ -15,8 +12,8 @@ msp3400-objs := msp3400-driver.o msp3400-kthreads.o | |||
15 | 12 | ||
16 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o compat_ioctl32.o | 13 | obj-$(CONFIG_VIDEO_DEV) += videodev.o v4l2-common.o v4l1-compat.o compat_ioctl32.o |
17 | 14 | ||
18 | obj-$(CONFIG_VIDEO_BT848) += bttv.o tvaudio.o \ | 15 | obj-$(CONFIG_VIDEO_BT848) += bt8xx/ |
19 | tda7432.o tda9875.o ir-kbd-i2c.o | 16 | obj-$(CONFIG_VIDEO_BT848) += tvaudio.o tda7432.o tda9875.o ir-kbd-i2c.o |
20 | obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o | 17 | obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o |
21 | 18 | ||
22 | obj-$(CONFIG_VIDEO_ZR36120) += zoran.o | 19 | obj-$(CONFIG_VIDEO_ZR36120) += zoran.o |
@@ -68,4 +65,23 @@ obj-$(CONFIG_VIDEO_CX25840) += cx25840/ | |||
68 | obj-$(CONFIG_VIDEO_SAA711X) += saa7115.o | 65 | obj-$(CONFIG_VIDEO_SAA711X) += saa7115.o |
69 | obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o | 66 | obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o |
70 | 67 | ||
68 | et61x251-objs := et61x251_core.o et61x251_tas5130d1b.o | ||
69 | zc0301-objs := zc0301_core.o zc0301_pas202bcb.o | ||
70 | |||
71 | obj-$(CONFIG_USB_DABUSB) += dabusb.o | ||
72 | obj-$(CONFIG_USB_DSBR) += dsbr100.o | ||
73 | obj-$(CONFIG_USB_OV511) += ov511.o | ||
74 | obj-$(CONFIG_USB_SE401) += se401.o | ||
75 | obj-$(CONFIG_USB_STV680) += stv680.o | ||
76 | obj-$(CONFIG_USB_W9968CF) += w9968cf.o | ||
77 | |||
78 | obj-$(CONFIG_USB_SN9C102) += sn9c102/ | ||
79 | obj-$(CONFIG_USB_ET61X251) += et61x251/ | ||
80 | obj-$(CONFIG_USB_PWC) += pwc/ | ||
81 | obj-$(CONFIG_USB_ZC0301) += zc0301/ | ||
82 | |||
83 | obj-$(CONFIG_USB_IBMCAM) += usbvideo/ | ||
84 | obj-$(CONFIG_USB_KONICAWC) += usbvideo/ | ||
85 | obj-$(CONFIG_USB_VICAM) += usbvideo/ | ||
86 | |||
71 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core | 87 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core |
diff --git a/drivers/media/video/adv7170.c b/drivers/media/video/adv7170.c index 671e36db224d..48709582a186 100644 --- a/drivers/media/video/adv7170.c +++ b/drivers/media/video/adv7170.c | |||
@@ -1,9 +1,9 @@ | |||
1 | /* | 1 | /* |
2 | * adv7170 - adv7170, adv7171 video encoder driver version 0.0.1 | 2 | * adv7170 - adv7170, adv7171 video encoder driver version 0.0.1 |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com> | 4 | * Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com> |
5 | * | 5 | * |
6 | * Based on adv7176 driver by: | 6 | * Based on adv7176 driver by: |
7 | * | 7 | * |
8 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> | 8 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> |
9 | * Copyright (C) 1999 Wolfgang Scherr <scherr@net4you.net> | 9 | * Copyright (C) 1999 Wolfgang Scherr <scherr@net4you.net> |
@@ -173,7 +173,7 @@ adv7170_write_block (struct i2c_client *client, | |||
173 | static const unsigned char init_NTSC[] = { | 173 | static const unsigned char init_NTSC[] = { |
174 | 0x00, 0x10, // MR0 | 174 | 0x00, 0x10, // MR0 |
175 | 0x01, 0x20, // MR1 | 175 | 0x01, 0x20, // MR1 |
176 | 0x02, 0x0e, // MR2 RTC control: bits 2 and 1 | 176 | 0x02, 0x0e, // MR2 RTC control: bits 2 and 1 |
177 | 0x03, 0x80, // MR3 | 177 | 0x03, 0x80, // MR3 |
178 | 0x04, 0x30, // MR4 | 178 | 0x04, 0x30, // MR4 |
179 | 0x05, 0x00, // Reserved | 179 | 0x05, 0x00, // Reserved |
@@ -196,7 +196,7 @@ static const unsigned char init_NTSC[] = { | |||
196 | 0x16, 0x00, // CGMS_WSS_0 | 196 | 0x16, 0x00, // CGMS_WSS_0 |
197 | 0x17, 0x00, // CGMS_WSS_1 | 197 | 0x17, 0x00, // CGMS_WSS_1 |
198 | 0x18, 0x00, // CGMS_WSS_2 | 198 | 0x18, 0x00, // CGMS_WSS_2 |
199 | 0x19, 0x00, // Teletext Ctl | 199 | 0x19, 0x00, // Teletext Ctl |
200 | }; | 200 | }; |
201 | 201 | ||
202 | static const unsigned char init_PAL[] = { | 202 | static const unsigned char init_PAL[] = { |
@@ -381,7 +381,7 @@ static unsigned short normal_i2c[] = | |||
381 | }; | 381 | }; |
382 | 382 | ||
383 | static unsigned short ignore = I2C_CLIENT_END; | 383 | static unsigned short ignore = I2C_CLIENT_END; |
384 | 384 | ||
385 | static struct i2c_client_address_data addr_data = { | 385 | static struct i2c_client_address_data addr_data = { |
386 | .normal_i2c = normal_i2c, | 386 | .normal_i2c = normal_i2c, |
387 | .probe = &ignore, | 387 | .probe = &ignore, |
diff --git a/drivers/media/video/adv7175.c b/drivers/media/video/adv7175.c index 085e8863cacb..68e7d7aff5e6 100644 --- a/drivers/media/video/adv7175.c +++ b/drivers/media/video/adv7175.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * adv7175 - adv7175a video encoder driver version 0.0.3 | 2 | * adv7175 - adv7175a video encoder driver version 0.0.3 |
3 | * | 3 | * |
4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> | 4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> |
@@ -233,7 +233,7 @@ adv7175_command (struct i2c_client *client, | |||
233 | sizeof(init_common)); | 233 | sizeof(init_common)); |
234 | adv7175_write(client, 0x07, TR0MODE | TR0RST); | 234 | adv7175_write(client, 0x07, TR0MODE | TR0RST); |
235 | adv7175_write(client, 0x07, TR0MODE); | 235 | adv7175_write(client, 0x07, TR0MODE); |
236 | break; | 236 | break; |
237 | 237 | ||
238 | case ENCODER_GET_CAPABILITIES: | 238 | case ENCODER_GET_CAPABILITIES: |
239 | { | 239 | { |
@@ -399,7 +399,7 @@ static unsigned short normal_i2c[] = | |||
399 | }; | 399 | }; |
400 | 400 | ||
401 | static unsigned short ignore = I2C_CLIENT_END; | 401 | static unsigned short ignore = I2C_CLIENT_END; |
402 | 402 | ||
403 | static struct i2c_client_address_data addr_data = { | 403 | static struct i2c_client_address_data addr_data = { |
404 | .normal_i2c = normal_i2c, | 404 | .normal_i2c = normal_i2c, |
405 | .probe = &ignore, | 405 | .probe = &ignore, |
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c index c586f64b6b7f..dbe025170599 100644 --- a/drivers/media/video/arv.c +++ b/drivers/media/video/arv.c | |||
@@ -161,39 +161,39 @@ void iic(int n, unsigned long addr, unsigned long data1, unsigned long data2, | |||
161 | { | 161 | { |
162 | int i; | 162 | int i; |
163 | 163 | ||
164 | /* Slave Address */ | 164 | /* Slave Address */ |
165 | ar_outl(addr, PLDI2CDATA); | 165 | ar_outl(addr, PLDI2CDATA); |
166 | wait_for_vsync(); | 166 | wait_for_vsync(); |
167 | 167 | ||
168 | /* Start */ | 168 | /* Start */ |
169 | ar_outl(1, PLDI2CCND); | 169 | ar_outl(1, PLDI2CCND); |
170 | wait_acknowledge(); | 170 | wait_acknowledge(); |
171 | 171 | ||
172 | /* Transfer data 1 */ | 172 | /* Transfer data 1 */ |
173 | ar_outl(data1, PLDI2CDATA); | 173 | ar_outl(data1, PLDI2CDATA); |
174 | wait_for_vsync(); | 174 | wait_for_vsync(); |
175 | ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); | 175 | ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); |
176 | wait_acknowledge(); | 176 | wait_acknowledge(); |
177 | 177 | ||
178 | /* Transfer data 2 */ | 178 | /* Transfer data 2 */ |
179 | ar_outl(data2, PLDI2CDATA); | 179 | ar_outl(data2, PLDI2CDATA); |
180 | wait_for_vsync(); | 180 | wait_for_vsync(); |
181 | ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); | 181 | ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); |
182 | wait_acknowledge(); | 182 | wait_acknowledge(); |
183 | 183 | ||
184 | if (n == 3) { | 184 | if (n == 3) { |
185 | /* Transfer data 3 */ | 185 | /* Transfer data 3 */ |
186 | ar_outl(data3, PLDI2CDATA); | 186 | ar_outl(data3, PLDI2CDATA); |
187 | wait_for_vsync(); | 187 | wait_for_vsync(); |
188 | ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); | 188 | ar_outl(PLDI2CSTEN_STEN, PLDI2CSTEN); |
189 | wait_acknowledge(); | 189 | wait_acknowledge(); |
190 | } | 190 | } |
191 | 191 | ||
192 | /* Stop */ | 192 | /* Stop */ |
193 | for (i = 0; i < 100; i++) | 193 | for (i = 0; i < 100; i++) |
194 | cpu_relax(); | 194 | cpu_relax(); |
195 | ar_outl(2, PLDI2CCND); | 195 | ar_outl(2, PLDI2CCND); |
196 | ar_outl(2, PLDI2CCND); | 196 | ar_outl(2, PLDI2CCND); |
197 | 197 | ||
198 | while (ar_inl(PLDI2CSTS) & PLDI2CSTS_BB) | 198 | while (ar_inl(PLDI2CSTS) & PLDI2CSTS_BB) |
199 | cpu_relax(); | 199 | cpu_relax(); |
@@ -204,24 +204,24 @@ void init_iic(void) | |||
204 | { | 204 | { |
205 | DEBUG(1, "init_iic:\n"); | 205 | DEBUG(1, "init_iic:\n"); |
206 | 206 | ||
207 | /* | 207 | /* |
208 | * ICU Setting (iic) | 208 | * ICU Setting (iic) |
209 | */ | 209 | */ |
210 | /* I2C Setting */ | 210 | /* I2C Setting */ |
211 | ar_outl(0x0, PLDI2CCR); /* I2CCR Disable */ | 211 | ar_outl(0x0, PLDI2CCR); /* I2CCR Disable */ |
212 | ar_outl(0x0300, PLDI2CMOD); /* I2CMOD ACK/8b-data/7b-addr/auto */ | 212 | ar_outl(0x0300, PLDI2CMOD); /* I2CMOD ACK/8b-data/7b-addr/auto */ |
213 | ar_outl(0x1, PLDI2CACK); /* I2CACK ACK */ | 213 | ar_outl(0x1, PLDI2CACK); /* I2CACK ACK */ |
214 | 214 | ||
215 | /* I2C CLK */ | 215 | /* I2C CLK */ |
216 | /* 50MH-100k */ | 216 | /* 50MH-100k */ |
217 | if (freq == 75) { | 217 | if (freq == 75) { |
218 | ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */ | 218 | ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */ |
219 | } else if (freq == 50) { | 219 | } else if (freq == 50) { |
220 | ar_outl(244, PLDI2CFREQ); /* BCLK = 50MHz */ | 220 | ar_outl(244, PLDI2CFREQ); /* BCLK = 50MHz */ |
221 | } else { | 221 | } else { |
222 | ar_outl(244, PLDI2CFREQ); /* default: BCLK = 50MHz */ | 222 | ar_outl(244, PLDI2CFREQ); /* default: BCLK = 50MHz */ |
223 | } | 223 | } |
224 | ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */ | 224 | ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */ |
225 | } | 225 | } |
226 | 226 | ||
227 | /************************************************************************** | 227 | /************************************************************************** |
@@ -253,7 +253,7 @@ static inline void wait_for_vertical_sync(int exp_line) | |||
253 | 253 | ||
254 | /* | 254 | /* |
255 | * check HCOUNT because we cannot check vertical sync. | 255 | * check HCOUNT because we cannot check vertical sync. |
256 | */ | 256 | */ |
257 | for (; tmout >= 0; tmout--) { | 257 | for (; tmout >= 0; tmout--) { |
258 | l = ar_inl(ARVHCOUNT); | 258 | l = ar_inl(ARVHCOUNT); |
259 | if (l == exp_line) | 259 | if (l == exp_line) |
@@ -562,8 +562,8 @@ static void ar_interrupt(int irq, void *dev, struct pt_regs *regs) | |||
562 | /* operations for interlace mode */ | 562 | /* operations for interlace mode */ |
563 | if ( line_count < (AR_HEIGHT_VGA/2) ) /* even line */ | 563 | if ( line_count < (AR_HEIGHT_VGA/2) ) /* even line */ |
564 | line_number = (line_count << 1); | 564 | line_number = (line_count << 1); |
565 | else /* odd line */ | 565 | else /* odd line */ |
566 | line_number = | 566 | line_number = |
567 | (((line_count - (AR_HEIGHT_VGA/2)) << 1) + 1); | 567 | (((line_count - (AR_HEIGHT_VGA/2)) << 1) + 1); |
568 | } else { | 568 | } else { |
569 | line_number = line_count; | 569 | line_number = line_count; |
@@ -651,7 +651,7 @@ static int ar_initialize(struct video_device *dev) | |||
651 | cr |= ARVCR1_NORMAL; | 651 | cr |= ARVCR1_NORMAL; |
652 | ar_outl(cr, ARVCR1); | 652 | ar_outl(cr, ARVCR1); |
653 | 653 | ||
654 | /* | 654 | /* |
655 | * Initialize IIC so that CPU can communicate with AR LSI, | 655 | * Initialize IIC so that CPU can communicate with AR LSI, |
656 | * and send boot commands to AR LSI. | 656 | * and send boot commands to AR LSI. |
657 | */ | 657 | */ |
@@ -846,7 +846,7 @@ static int __init ar_init(void) | |||
846 | * so register video device as a frame grabber type. | 846 | * so register video device as a frame grabber type. |
847 | * device is named "video[0-64]". | 847 | * device is named "video[0-64]". |
848 | * video_register_device() initializes h/w using ar_initialize(). | 848 | * video_register_device() initializes h/w using ar_initialize(). |
849 | */ | 849 | */ |
850 | if (video_register_device(ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) { | 850 | if (video_register_device(ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) { |
851 | /* return -1, -ENFILE(full) or others */ | 851 | /* return -1, -ENFILE(full) or others */ |
852 | printk("arv: register video (Colour AR) failed.\n"); | 852 | printk("arv: register video (Colour AR) failed.\n"); |
diff --git a/drivers/media/video/bt819.c b/drivers/media/video/bt819.c index d8a18a6a5bee..e7b38fdd5e3c 100644 --- a/drivers/media/video/bt819.c +++ b/drivers/media/video/bt819.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * bt819 - BT819A VideoStream Decoder (Rockwell Part) | 2 | * bt819 - BT819A VideoStream Decoder (Rockwell Part) |
3 | * | 3 | * |
4 | * Copyright (C) 1999 Mike Bernson <mike@mlb.org> | 4 | * Copyright (C) 1999 Mike Bernson <mike@mlb.org> |
@@ -6,7 +6,7 @@ | |||
6 | * | 6 | * |
7 | * Modifications for LML33/DC10plus unified driver | 7 | * Modifications for LML33/DC10plus unified driver |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Changes by Ronald Bultje <rbultje@ronald.bitfreak.net> | 10 | * Changes by Ronald Bultje <rbultje@ronald.bitfreak.net> |
11 | * - moved over to linux>=2.4.x i2c protocol (9/9/2002) | 11 | * - moved over to linux>=2.4.x i2c protocol (9/9/2002) |
12 | * | 12 | * |
@@ -206,9 +206,9 @@ bt819_init (struct i2c_client *client) | |||
206 | Bug in the bt819 stepping on my board? | 206 | Bug in the bt819 stepping on my board? |
207 | */ | 207 | */ |
208 | 0x14, 0x00, /* 0x14 Vertial Scaling lsb */ | 208 | 0x14, 0x00, /* 0x14 Vertial Scaling lsb */ |
209 | 0x16, 0x07, /* 0x16 Video Timing Polarity | 209 | 0x16, 0x07, /* 0x16 Video Timing Polarity |
210 | ACTIVE=active low | 210 | ACTIVE=active low |
211 | FIELD: high=odd, | 211 | FIELD: high=odd, |
212 | vreset=active high, | 212 | vreset=active high, |
213 | hreset=active high */ | 213 | hreset=active high */ |
214 | 0x18, 0x68, /* 0x18 AGC Delay */ | 214 | 0x18, 0x68, /* 0x18 AGC Delay */ |
@@ -497,7 +497,7 @@ static unsigned short normal_i2c[] = { | |||
497 | }; | 497 | }; |
498 | 498 | ||
499 | static unsigned short ignore = I2C_CLIENT_END; | 499 | static unsigned short ignore = I2C_CLIENT_END; |
500 | 500 | ||
501 | static struct i2c_client_address_data addr_data = { | 501 | static struct i2c_client_address_data addr_data = { |
502 | .normal_i2c = normal_i2c, | 502 | .normal_i2c = normal_i2c, |
503 | .probe = &ignore, | 503 | .probe = &ignore, |
diff --git a/drivers/media/video/bt856.c b/drivers/media/video/bt856.c index 4d47a0a0e974..af3b61d4fa7d 100644 --- a/drivers/media/video/bt856.c +++ b/drivers/media/video/bt856.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * bt856 - BT856A Digital Video Encoder (Rockwell Part) | 2 | * bt856 - BT856A Digital Video Encoder (Rockwell Part) |
3 | * | 3 | * |
4 | * Copyright (C) 1999 Mike Bernson <mike@mlb.org> | 4 | * Copyright (C) 1999 Mike Bernson <mike@mlb.org> |
@@ -285,7 +285,7 @@ bt856_command (struct i2c_client *client, | |||
285 | static unsigned short normal_i2c[] = { I2C_BT856 >> 1, I2C_CLIENT_END }; | 285 | static unsigned short normal_i2c[] = { I2C_BT856 >> 1, I2C_CLIENT_END }; |
286 | 286 | ||
287 | static unsigned short ignore = I2C_CLIENT_END; | 287 | static unsigned short ignore = I2C_CLIENT_END; |
288 | 288 | ||
289 | static struct i2c_client_address_data addr_data = { | 289 | static struct i2c_client_address_data addr_data = { |
290 | .normal_i2c = normal_i2c, | 290 | .normal_i2c = normal_i2c, |
291 | .probe = &ignore, | 291 | .probe = &ignore, |
diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig new file mode 100644 index 000000000000..085477c12612 --- /dev/null +++ b/drivers/media/video/bt8xx/Kconfig | |||
@@ -0,0 +1,25 @@ | |||
1 | config VIDEO_BT848 | ||
2 | tristate "BT848 Video For Linux" | ||
3 | depends on VIDEO_DEV && PCI && I2C | ||
4 | select I2C_ALGOBIT | ||
5 | select FW_LOADER | ||
6 | select VIDEO_BTCX | ||
7 | select VIDEO_BUF | ||
8 | select VIDEO_IR | ||
9 | select VIDEO_TUNER | ||
10 | select VIDEO_TVEEPROM | ||
11 | select VIDEO_MSP3400 | ||
12 | ---help--- | ||
13 | Support for BT848 based frame grabber/overlay boards. This includes | ||
14 | the Miro, Hauppauge and STB boards. Please read the material in | ||
15 | <file:Documentation/video4linux/bttv/> for more information. | ||
16 | |||
17 | To compile this driver as a module, choose M here: the | ||
18 | module will be called bttv. | ||
19 | |||
20 | config VIDEO_BT848_DVB | ||
21 | bool "DVB/ATSC Support for bt878 based TV cards" | ||
22 | depends on VIDEO_BT848 && DVB_CORE | ||
23 | select DVB_BT8XX | ||
24 | ---help--- | ||
25 | This adds support for DVB/ATSC cards based on the BT878 chip. | ||
diff --git a/drivers/media/video/bt8xx/Makefile b/drivers/media/video/bt8xx/Makefile new file mode 100644 index 000000000000..94350f21cdc0 --- /dev/null +++ b/drivers/media/video/bt8xx/Makefile | |||
@@ -0,0 +1,12 @@ | |||
1 | # | ||
2 | # Makefile for the video capture/playback device drivers. | ||
3 | # | ||
4 | |||
5 | bttv-objs := bttv-driver.o bttv-cards.o bttv-if.o \ | ||
6 | bttv-risc.o bttv-vbi.o bttv-i2c.o bttv-gpio.o \ | ||
7 | bttv-input.o | ||
8 | |||
9 | obj-$(CONFIG_VIDEO_BT848) += bttv.o | ||
10 | |||
11 | EXTRA_CFLAGS += -I$(src)/.. | ||
12 | EXTRA_CFLAGS += -I$(srctree)/drivers/media/dvb/dvb-core | ||
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt8xx/bt832.c index cc54b62f4601..a51876137880 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt8xx/bt832.c | |||
@@ -30,7 +30,6 @@ | |||
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/errno.h> | 31 | #include <linux/errno.h> |
32 | #include <linux/slab.h> | 32 | #include <linux/slab.h> |
33 | #include <media/audiochip.h> | ||
34 | #include <media/v4l2-common.h> | 33 | #include <media/v4l2-common.h> |
35 | 34 | ||
36 | #include "bttv.h" | 35 | #include "bttv.h" |
@@ -39,7 +38,7 @@ | |||
39 | MODULE_LICENSE("GPL"); | 38 | MODULE_LICENSE("GPL"); |
40 | 39 | ||
41 | /* Addresses to scan */ | 40 | /* Addresses to scan */ |
42 | static unsigned short normal_i2c[] = { I2C_BT832_ALT1>>1, I2C_BT832_ALT2>>1, | 41 | static unsigned short normal_i2c[] = { I2C_ADDR_BT832_ALT1>>1, I2C_ADDR_BT832_ALT2>>1, |
43 | I2C_CLIENT_END }; | 42 | I2C_CLIENT_END }; |
44 | I2C_CLIENT_INSMOD; | 43 | I2C_CLIENT_INSMOD; |
45 | 44 | ||
diff --git a/drivers/media/video/bt832.h b/drivers/media/video/bt8xx/bt832.h index 1ce8fa71f7db..1ce8fa71f7db 100644 --- a/drivers/media/video/bt832.h +++ b/drivers/media/video/bt8xx/bt832.h | |||
diff --git a/drivers/media/video/bt848.h b/drivers/media/video/bt8xx/bt848.h index 0bcd95303bb0..0bcd95303bb0 100644 --- a/drivers/media/video/bt848.h +++ b/drivers/media/video/bt8xx/bt848.h | |||
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c index abfa6ad857a0..f209a7492051 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bt8xx/bttv-cards.c | |||
@@ -39,6 +39,7 @@ | |||
39 | 39 | ||
40 | #include "bttvp.h" | 40 | #include "bttvp.h" |
41 | #include <media/v4l2-common.h> | 41 | #include <media/v4l2-common.h> |
42 | #include <media/tvaudio.h> | ||
42 | 43 | ||
43 | /* fwd decl */ | 44 | /* fwd decl */ |
44 | static void boot_msp34xx(struct bttv *btv, int pin); | 45 | static void boot_msp34xx(struct bttv *btv, int pin); |
@@ -336,7 +337,8 @@ struct tvcard bttv_tvcards[] = { | |||
336 | .svhs = 2, | 337 | .svhs = 2, |
337 | .gpiomask = 15, | 338 | .gpiomask = 15, |
338 | .muxsel = { 2, 3, 1, 1 }, | 339 | .muxsel = { 2, 3, 1, 1 }, |
339 | .audiomux = { 2, 0, 0, 0, 10 }, | 340 | .gpiomux = { 2, 0, 0, 0 }, |
341 | .gpiomute = 10, | ||
340 | .needs_tvaudio = 1, | 342 | .needs_tvaudio = 1, |
341 | .tuner_type = -1, | 343 | .tuner_type = -1, |
342 | .tuner_addr = ADDR_UNSET, | 344 | .tuner_addr = ADDR_UNSET, |
@@ -350,7 +352,8 @@ struct tvcard bttv_tvcards[] = { | |||
350 | .svhs = 2, | 352 | .svhs = 2, |
351 | .gpiomask = 7, | 353 | .gpiomask = 7, |
352 | .muxsel = { 2, 3, 1, 1 }, | 354 | .muxsel = { 2, 3, 1, 1 }, |
353 | .audiomux = { 0, 1, 2, 3, 4 }, | 355 | .gpiomux = { 0, 1, 2, 3 }, |
356 | .gpiomute = 4, | ||
354 | .needs_tvaudio = 1, | 357 | .needs_tvaudio = 1, |
355 | .tuner_type = -1, | 358 | .tuner_type = -1, |
356 | .tuner_addr = ADDR_UNSET, | 359 | .tuner_addr = ADDR_UNSET, |
@@ -364,7 +367,8 @@ struct tvcard bttv_tvcards[] = { | |||
364 | .svhs = 2, | 367 | .svhs = 2, |
365 | .gpiomask = 7, | 368 | .gpiomask = 7, |
366 | .muxsel = { 2, 3, 1, 1 }, | 369 | .muxsel = { 2, 3, 1, 1 }, |
367 | .audiomux = { 4, 0, 2, 3, 1 }, | 370 | .gpiomux = { 4, 0, 2, 3 }, |
371 | .gpiomute = 1, | ||
368 | .no_msp34xx = 1, | 372 | .no_msp34xx = 1, |
369 | .needs_tvaudio = 1, | 373 | .needs_tvaudio = 1, |
370 | .tuner_type = TUNER_PHILIPS_NTSC, | 374 | .tuner_type = TUNER_PHILIPS_NTSC, |
@@ -383,7 +387,7 @@ struct tvcard bttv_tvcards[] = { | |||
383 | .svhs = 2, | 387 | .svhs = 2, |
384 | .gpiomask = 0, | 388 | .gpiomask = 0, |
385 | .muxsel = { 2, 3, 1, 1 }, | 389 | .muxsel = { 2, 3, 1, 1 }, |
386 | .audiomux = { 0 }, | 390 | .gpiomux = { 0 }, |
387 | .needs_tvaudio = 0, | 391 | .needs_tvaudio = 0, |
388 | .tuner_type = 4, | 392 | .tuner_type = 4, |
389 | .tuner_addr = ADDR_UNSET, | 393 | .tuner_addr = ADDR_UNSET, |
@@ -397,7 +401,8 @@ struct tvcard bttv_tvcards[] = { | |||
397 | .svhs = 2, | 401 | .svhs = 2, |
398 | .gpiomask = 3, | 402 | .gpiomask = 3, |
399 | .muxsel = { 2, 3, 1, 0 }, | 403 | .muxsel = { 2, 3, 1, 0 }, |
400 | .audiomux = { 0, 1, 0, 1, 3 }, | 404 | .gpiomux = { 0, 1, 0, 1 }, |
405 | .gpiomute = 3, | ||
401 | .needs_tvaudio = 1, | 406 | .needs_tvaudio = 1, |
402 | .tuner_type = -1, | 407 | .tuner_type = -1, |
403 | .tuner_addr = ADDR_UNSET, | 408 | .tuner_addr = ADDR_UNSET, |
@@ -411,7 +416,7 @@ struct tvcard bttv_tvcards[] = { | |||
411 | .svhs = 3, | 416 | .svhs = 3, |
412 | .muxsel = { 2, 3, 1, 1 }, | 417 | .muxsel = { 2, 3, 1, 1 }, |
413 | .gpiomask = 0x0f, | 418 | .gpiomask = 0x0f, |
414 | .audiomux = { 0x0c, 0x04, 0x08, 0x04, 0 }, | 419 | .gpiomux = { 0x0c, 0x04, 0x08, 0x04 }, |
415 | /* 0x04 for some cards ?? */ | 420 | /* 0x04 for some cards ?? */ |
416 | .needs_tvaudio = 1, | 421 | .needs_tvaudio = 1, |
417 | .tuner_type = -1, | 422 | .tuner_type = -1, |
@@ -428,7 +433,7 @@ struct tvcard bttv_tvcards[] = { | |||
428 | .svhs = 3, | 433 | .svhs = 3, |
429 | .gpiomask = 0, | 434 | .gpiomask = 0, |
430 | .muxsel = { 2, 3, 1, 0, 0 }, | 435 | .muxsel = { 2, 3, 1, 0, 0 }, |
431 | .audiomux = { 0 }, | 436 | .gpiomux = { 0 }, |
432 | .needs_tvaudio = 1, | 437 | .needs_tvaudio = 1, |
433 | .tuner_type = -1, | 438 | .tuner_type = -1, |
434 | .tuner_addr = ADDR_UNSET, | 439 | .tuner_addr = ADDR_UNSET, |
@@ -444,7 +449,8 @@ struct tvcard bttv_tvcards[] = { | |||
444 | .svhs = 2, | 449 | .svhs = 2, |
445 | .gpiomask = 0xc00, | 450 | .gpiomask = 0xc00, |
446 | .muxsel = { 2, 3, 1, 1 }, | 451 | .muxsel = { 2, 3, 1, 1 }, |
447 | .audiomux = { 0, 0xc00, 0x800, 0x400, 0xc00, 0 }, | 452 | .gpiomux = { 0, 0xc00, 0x800, 0x400 }, |
453 | .gpiomute = 0xc00, | ||
448 | .needs_tvaudio = 1, | 454 | .needs_tvaudio = 1, |
449 | .pll = PLL_28, | 455 | .pll = PLL_28, |
450 | .tuner_type = -1, | 456 | .tuner_type = -1, |
@@ -459,7 +465,7 @@ struct tvcard bttv_tvcards[] = { | |||
459 | .svhs = 2, | 465 | .svhs = 2, |
460 | .gpiomask = 3, | 466 | .gpiomask = 3, |
461 | .muxsel = { 2, 3, 1, 1 }, | 467 | .muxsel = { 2, 3, 1, 1 }, |
462 | .audiomux = { 1, 1, 2, 3, 0 }, | 468 | .gpiomux = { 1, 1, 2, 3 }, |
463 | .needs_tvaudio = 0, | 469 | .needs_tvaudio = 0, |
464 | .pll = PLL_28, | 470 | .pll = PLL_28, |
465 | .tuner_type = TUNER_TEMIC_PAL, | 471 | .tuner_type = TUNER_TEMIC_PAL, |
@@ -474,7 +480,8 @@ struct tvcard bttv_tvcards[] = { | |||
474 | .svhs = 2, | 480 | .svhs = 2, |
475 | .gpiomask = 0x0f, /* old: 7 */ | 481 | .gpiomask = 0x0f, /* old: 7 */ |
476 | .muxsel = { 2, 0, 1, 1 }, | 482 | .muxsel = { 2, 0, 1, 1 }, |
477 | .audiomux = { 0, 1, 2, 3, 4 }, | 483 | .gpiomux = { 0, 1, 2, 3 }, |
484 | .gpiomute = 4, | ||
478 | .needs_tvaudio = 1, | 485 | .needs_tvaudio = 1, |
479 | .pll = PLL_28, | 486 | .pll = PLL_28, |
480 | .tuner_type = -1, | 487 | .tuner_type = -1, |
@@ -489,7 +496,8 @@ struct tvcard bttv_tvcards[] = { | |||
489 | .svhs = 2, | 496 | .svhs = 2, |
490 | .gpiomask = 0x3014f, | 497 | .gpiomask = 0x3014f, |
491 | .muxsel = { 2, 3, 1, 1 }, | 498 | .muxsel = { 2, 3, 1, 1 }, |
492 | .audiomux = { 0x20001,0x10001, 0, 0,10 }, | 499 | .gpiomux = { 0x20001,0x10001, 0, 0 }, |
500 | .gpiomute = 10, | ||
493 | .needs_tvaudio = 1, | 501 | .needs_tvaudio = 1, |
494 | .tuner_type = -1, | 502 | .tuner_type = -1, |
495 | .tuner_addr = ADDR_UNSET, | 503 | .tuner_addr = ADDR_UNSET, |
@@ -505,7 +513,7 @@ struct tvcard bttv_tvcards[] = { | |||
505 | .svhs = 2, | 513 | .svhs = 2, |
506 | .gpiomask = 15, | 514 | .gpiomask = 15, |
507 | .muxsel = { 2, 3, 1, 1 }, | 515 | .muxsel = { 2, 3, 1, 1 }, |
508 | .audiomux = { 13, 14, 11, 7, 0, 0 }, | 516 | .gpiomux = { 13, 14, 11, 7 }, |
509 | .needs_tvaudio = 1, | 517 | .needs_tvaudio = 1, |
510 | .tuner_type = -1, | 518 | .tuner_type = -1, |
511 | .tuner_addr = ADDR_UNSET, | 519 | .tuner_addr = ADDR_UNSET, |
@@ -519,7 +527,7 @@ struct tvcard bttv_tvcards[] = { | |||
519 | .svhs = 2, | 527 | .svhs = 2, |
520 | .gpiomask = 15, | 528 | .gpiomask = 15, |
521 | .muxsel = { 2, 3, 1, 1 }, | 529 | .muxsel = { 2, 3, 1, 1 }, |
522 | .audiomux = { 13, 14, 11, 7, 0, 0 }, | 530 | .gpiomux = { 13, 14, 11, 7 }, |
523 | .needs_tvaudio = 1, | 531 | .needs_tvaudio = 1, |
524 | .msp34xx_alt = 1, | 532 | .msp34xx_alt = 1, |
525 | .pll = PLL_28, | 533 | .pll = PLL_28, |
@@ -537,7 +545,8 @@ struct tvcard bttv_tvcards[] = { | |||
537 | .svhs = 2, | 545 | .svhs = 2, |
538 | .gpiomask = 7, | 546 | .gpiomask = 7, |
539 | .muxsel = { 2, 3, 1, 1 }, | 547 | .muxsel = { 2, 3, 1, 1 }, |
540 | .audiomux = { 0, 2, 1, 3, 4 }, /* old: {0, 1, 2, 3, 4} */ | 548 | .gpiomux = { 0, 2, 1, 3 }, /* old: {0, 1, 2, 3, 4} */ |
549 | .gpiomute = 4, | ||
541 | .needs_tvaudio = 1, | 550 | .needs_tvaudio = 1, |
542 | .pll = PLL_28, | 551 | .pll = PLL_28, |
543 | .tuner_type = -1, | 552 | .tuner_type = -1, |
@@ -552,7 +561,8 @@ struct tvcard bttv_tvcards[] = { | |||
552 | .svhs = 2, | 561 | .svhs = 2, |
553 | .gpiomask = 15, | 562 | .gpiomask = 15, |
554 | .muxsel = { 2, 3, 1, 1 }, | 563 | .muxsel = { 2, 3, 1, 1 }, |
555 | .audiomux = { 0 , 0, 1 , 0, 10 }, | 564 | .gpiomux = { 0, 0, 1, 0 }, |
565 | .gpiomute = 10, | ||
556 | .needs_tvaudio = 1, | 566 | .needs_tvaudio = 1, |
557 | .tuner_type = -1, | 567 | .tuner_type = -1, |
558 | .tuner_addr = ADDR_UNSET, | 568 | .tuner_addr = ADDR_UNSET, |
@@ -570,10 +580,11 @@ struct tvcard bttv_tvcards[] = { | |||
570 | .muxsel = { 2, 3, 1, 1 }, | 580 | .muxsel = { 2, 3, 1, 1 }, |
571 | #if 0 | 581 | #if 0 |
572 | /* old */ | 582 | /* old */ |
573 | .audiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 }, | 583 | .gpiomux = { 0x01c000, 0, 0x018000, 0x014000, 0x002000 }, |
574 | #else | 584 | #else |
575 | /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */ | 585 | /* 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru> */ |
576 | .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, | 586 | .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, |
587 | .gpiomute = 0x002000, | ||
577 | #endif | 588 | #endif |
578 | .needs_tvaudio = 1, | 589 | .needs_tvaudio = 1, |
579 | .pll = PLL_28, | 590 | .pll = PLL_28, |
@@ -587,7 +598,8 @@ struct tvcard bttv_tvcards[] = { | |||
587 | .svhs = 2, | 598 | .svhs = 2, |
588 | .gpiomask = 0x8300f8, | 599 | .gpiomask = 0x8300f8, |
589 | .muxsel = { 2, 3, 1, 1,0 }, | 600 | .muxsel = { 2, 3, 1, 1,0 }, |
590 | .audiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007,0xcfa007 }, | 601 | .gpiomux = { 0x4fa007,0xcfa007,0xcfa007,0xcfa007 }, |
602 | .gpiomute = 0xcfa007, | ||
591 | .needs_tvaudio = 1, | 603 | .needs_tvaudio = 1, |
592 | .tuner_type = -1, | 604 | .tuner_type = -1, |
593 | .tuner_addr = ADDR_UNSET, | 605 | .tuner_addr = ADDR_UNSET, |
@@ -603,7 +615,7 @@ struct tvcard bttv_tvcards[] = { | |||
603 | .svhs = 2, | 615 | .svhs = 2, |
604 | .gpiomask = 0, | 616 | .gpiomask = 0, |
605 | .muxsel = { 2, 3, 1, 1 }, | 617 | .muxsel = { 2, 3, 1, 1 }, |
606 | .audiomux = { 1, 0, 0, 0, 0 }, | 618 | .gpiomux = { 1, 0, 0, 0 }, |
607 | .needs_tvaudio = 1, | 619 | .needs_tvaudio = 1, |
608 | .tuner_type = -1, | 620 | .tuner_type = -1, |
609 | .tuner_addr = ADDR_UNSET, | 621 | .tuner_addr = ADDR_UNSET, |
@@ -617,7 +629,7 @@ struct tvcard bttv_tvcards[] = { | |||
617 | .svhs = -1, | 629 | .svhs = -1, |
618 | .gpiomask = 0x8dff00, | 630 | .gpiomask = 0x8dff00, |
619 | .muxsel = { 2, 3, 1, 1 }, | 631 | .muxsel = { 2, 3, 1, 1 }, |
620 | .audiomux = { 0 }, | 632 | .gpiomux = { 0 }, |
621 | .no_msp34xx = 1, | 633 | .no_msp34xx = 1, |
622 | .tuner_type = -1, | 634 | .tuner_type = -1, |
623 | .tuner_addr = ADDR_UNSET, | 635 | .tuner_addr = ADDR_UNSET, |
@@ -644,7 +656,8 @@ struct tvcard bttv_tvcards[] = { | |||
644 | .svhs = 2, | 656 | .svhs = 2, |
645 | .gpiomask = 0x1800, | 657 | .gpiomask = 0x1800, |
646 | .muxsel = { 2, 3, 1, 1 }, | 658 | .muxsel = { 2, 3, 1, 1 }, |
647 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800 }, | 659 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
660 | .gpiomute = 0x1800, | ||
648 | .pll = PLL_28, | 661 | .pll = PLL_28, |
649 | .tuner_type = TUNER_PHILIPS_PAL_I, | 662 | .tuner_type = TUNER_PHILIPS_PAL_I, |
650 | .tuner_addr = ADDR_UNSET, | 663 | .tuner_addr = ADDR_UNSET, |
@@ -658,7 +671,8 @@ struct tvcard bttv_tvcards[] = { | |||
658 | .svhs = 2, | 671 | .svhs = 2, |
659 | .gpiomask = 0xc00, | 672 | .gpiomask = 0xc00, |
660 | .muxsel = { 2, 3, 1, 1 }, | 673 | .muxsel = { 2, 3, 1, 1 }, |
661 | .audiomux = { 0, 1, 0x800, 0x400, 0xc00, 0 }, | 674 | .gpiomux = { 0, 1, 0x800, 0x400 }, |
675 | .gpiomute = 0xc00, | ||
662 | .needs_tvaudio = 1, | 676 | .needs_tvaudio = 1, |
663 | .pll = PLL_28, | 677 | .pll = PLL_28, |
664 | .tuner_type = -1, | 678 | .tuner_type = -1, |
@@ -674,7 +688,7 @@ struct tvcard bttv_tvcards[] = { | |||
674 | .gpiomask = 7, | 688 | .gpiomask = 7, |
675 | .muxsel = { 2, 3, -1 }, | 689 | .muxsel = { 2, 3, -1 }, |
676 | .digital_mode = DIGITAL_MODE_CAMERA, | 690 | .digital_mode = DIGITAL_MODE_CAMERA, |
677 | .audiomux = { 0, 0, 0, 0, 0 }, | 691 | .gpiomux = { 0, 0, 0, 0 }, |
678 | .no_msp34xx = 1, | 692 | .no_msp34xx = 1, |
679 | .pll = PLL_28, | 693 | .pll = PLL_28, |
680 | .tuner_type = TUNER_ALPS_TSBB5_PAL_I, | 694 | .tuner_type = TUNER_ALPS_TSBB5_PAL_I, |
@@ -691,7 +705,8 @@ struct tvcard bttv_tvcards[] = { | |||
691 | .svhs = 2, | 705 | .svhs = 2, |
692 | .gpiomask = 0xe00, | 706 | .gpiomask = 0xe00, |
693 | .muxsel = { 2, 3, 1, 1 }, | 707 | .muxsel = { 2, 3, 1, 1 }, |
694 | .audiomux = {0x400, 0x400, 0x400, 0x400, 0xc00 }, | 708 | .gpiomux = {0x400, 0x400, 0x400, 0x400 }, |
709 | .gpiomute = 0xc00, | ||
695 | .needs_tvaudio = 1, | 710 | .needs_tvaudio = 1, |
696 | .pll = PLL_28, | 711 | .pll = PLL_28, |
697 | .tuner_type = -1, | 712 | .tuner_type = -1, |
@@ -707,7 +722,8 @@ struct tvcard bttv_tvcards[] = { | |||
707 | .svhs = 2, | 722 | .svhs = 2, |
708 | .gpiomask = 0x1f0fff, | 723 | .gpiomask = 0x1f0fff, |
709 | .muxsel = { 2, 3, 1, 1 }, | 724 | .muxsel = { 2, 3, 1, 1 }, |
710 | .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000 }, | 725 | .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, |
726 | .gpiomute = 0x40000, | ||
711 | .needs_tvaudio = 0, | 727 | .needs_tvaudio = 0, |
712 | .tuner_type = TUNER_PHILIPS_PAL, | 728 | .tuner_type = TUNER_PHILIPS_PAL, |
713 | .tuner_addr = ADDR_UNSET, | 729 | .tuner_addr = ADDR_UNSET, |
@@ -722,7 +738,8 @@ struct tvcard bttv_tvcards[] = { | |||
722 | .svhs = 3, | 738 | .svhs = 3, |
723 | .gpiomask = 7, | 739 | .gpiomask = 7, |
724 | .muxsel = { 2, 0, 1, 1 }, | 740 | .muxsel = { 2, 0, 1, 1 }, |
725 | .audiomux = { 0, 1, 2, 3, 4 }, | 741 | .gpiomux = { 0, 1, 2, 3 }, |
742 | .gpiomute = 4, | ||
726 | .needs_tvaudio = 1, | 743 | .needs_tvaudio = 1, |
727 | .tuner_type = -1, | 744 | .tuner_type = -1, |
728 | .tuner_addr = ADDR_UNSET, | 745 | .tuner_addr = ADDR_UNSET, |
@@ -736,7 +753,8 @@ struct tvcard bttv_tvcards[] = { | |||
736 | .svhs = 2, | 753 | .svhs = 2, |
737 | .gpiomask = 0x1800, | 754 | .gpiomask = 0x1800, |
738 | .muxsel = { 2, 3, 1, 1 }, | 755 | .muxsel = { 2, 3, 1, 1 }, |
739 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800 }, | 756 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
757 | .gpiomute = 0x1800, | ||
740 | .pll = PLL_28, | 758 | .pll = PLL_28, |
741 | .tuner_type = TUNER_PHILIPS_SECAM, | 759 | .tuner_type = TUNER_PHILIPS_SECAM, |
742 | .tuner_addr = ADDR_UNSET, | 760 | .tuner_addr = ADDR_UNSET, |
@@ -752,7 +770,8 @@ struct tvcard bttv_tvcards[] = { | |||
752 | .svhs = 2, | 770 | .svhs = 2, |
753 | .gpiomask = 0x1f0fff, | 771 | .gpiomask = 0x1f0fff, |
754 | .muxsel = { 2, 3, 1, 1 }, | 772 | .muxsel = { 2, 3, 1, 1 }, |
755 | .audiomux = { 0x20000, 0x30000, 0x10000, 0x00000, 0x40000 }, | 773 | .gpiomux = { 0x20000, 0x30000, 0x10000, 0x00000 }, |
774 | .gpiomute = 0x40000, | ||
756 | .needs_tvaudio = 0, | 775 | .needs_tvaudio = 0, |
757 | .tuner_type = TUNER_PHILIPS_PAL, | 776 | .tuner_type = TUNER_PHILIPS_PAL, |
758 | .tuner_addr = ADDR_UNSET, | 777 | .tuner_addr = ADDR_UNSET, |
@@ -799,7 +818,7 @@ struct tvcard bttv_tvcards[] = { | |||
799 | .svhs = 1, /* was: 4 */ | 818 | .svhs = 1, /* was: 4 */ |
800 | .gpiomask = 0, | 819 | .gpiomask = 0, |
801 | .muxsel = { 2, 3, 1, 0, 0}, | 820 | .muxsel = { 2, 3, 1, 0, 0}, |
802 | .audiomux = { 0 }, | 821 | .gpiomux = { 0 }, |
803 | .needs_tvaudio = 1, | 822 | .needs_tvaudio = 1, |
804 | .tuner_type = -1, | 823 | .tuner_type = -1, |
805 | .tuner_addr = ADDR_UNSET, | 824 | .tuner_addr = ADDR_UNSET, |
@@ -815,7 +834,8 @@ struct tvcard bttv_tvcards[] = { | |||
815 | .svhs = 2, | 834 | .svhs = 2, |
816 | .gpiomask = 0x1800, /* 0x8dfe00 */ | 835 | .gpiomask = 0x1800, /* 0x8dfe00 */ |
817 | .muxsel = { 2, 3, 1, 1 }, | 836 | .muxsel = { 2, 3, 1, 1 }, |
818 | .audiomux = { 0, 0x0800, 0x1000, 0x1000, 0x1800, 0 }, | 837 | .gpiomux = { 0, 0x0800, 0x1000, 0x1000 }, |
838 | .gpiomute = 0x1800, | ||
819 | .pll = PLL_28, | 839 | .pll = PLL_28, |
820 | .tuner_type = -1, | 840 | .tuner_type = -1, |
821 | .tuner_addr = ADDR_UNSET, | 841 | .tuner_addr = ADDR_UNSET, |
@@ -829,7 +849,7 @@ struct tvcard bttv_tvcards[] = { | |||
829 | .svhs = 3, | 849 | .svhs = 3, |
830 | .gpiomask = 1, | 850 | .gpiomask = 1, |
831 | .muxsel = { 2, 3, 1, 1 }, | 851 | .muxsel = { 2, 3, 1, 1 }, |
832 | .audiomux = { 1, 0, 0, 0, 0 }, | 852 | .gpiomux = { 1, 0, 0, 0 }, |
833 | .pll = PLL_28, | 853 | .pll = PLL_28, |
834 | .tuner_type = TUNER_PHILIPS_PAL, | 854 | .tuner_type = TUNER_PHILIPS_PAL, |
835 | .tuner_addr = ADDR_UNSET, | 855 | .tuner_addr = ADDR_UNSET, |
@@ -845,7 +865,7 @@ struct tvcard bttv_tvcards[] = { | |||
845 | .svhs = 2, | 865 | .svhs = 2, |
846 | .gpiomask = 0, | 866 | .gpiomask = 0, |
847 | .muxsel = { 2, 3, 1, 1 }, | 867 | .muxsel = { 2, 3, 1, 1 }, |
848 | .audiomux = { 0 }, | 868 | .gpiomux = { 0 }, |
849 | .needs_tvaudio = 0, | 869 | .needs_tvaudio = 0, |
850 | .tuner_type = 4, | 870 | .tuner_type = 4, |
851 | .tuner_addr = ADDR_UNSET, | 871 | .tuner_addr = ADDR_UNSET, |
@@ -859,7 +879,8 @@ struct tvcard bttv_tvcards[] = { | |||
859 | .svhs = 2, | 879 | .svhs = 2, |
860 | .gpiomask = 0xffff00, | 880 | .gpiomask = 0xffff00, |
861 | .muxsel = { 2, 3, 1, 1 }, | 881 | .muxsel = { 2, 3, 1, 1 }, |
862 | .audiomux = { 0x500, 0, 0x300, 0x900, 0x900 }, | 882 | .gpiomux = { 0x500, 0, 0x300, 0x900 }, |
883 | .gpiomute = 0x900, | ||
863 | .needs_tvaudio = 1, | 884 | .needs_tvaudio = 1, |
864 | .pll = PLL_28, | 885 | .pll = PLL_28, |
865 | .tuner_type = TUNER_PHILIPS_PAL, | 886 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -875,11 +896,12 @@ struct tvcard bttv_tvcards[] = { | |||
875 | .muxsel = { 2, 3, 1, 1, 0 }, /* TV, CVid, SVid, CVid over SVid connector */ | 896 | .muxsel = { 2, 3, 1, 1, 0 }, /* TV, CVid, SVid, CVid over SVid connector */ |
876 | #if 0 | 897 | #if 0 |
877 | .gpiomask = 0xc33000, | 898 | .gpiomask = 0xc33000, |
878 | .audiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 }, | 899 | .gpiomux = { 0x422000,0x1000,0x0000,0x620000,0x800000 }, |
879 | #else | 900 | #else |
880 | /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ | 901 | /* Alexander Varakin <avarakin@hotmail.com> [stereo version] */ |
881 | .gpiomask = 0xb33000, | 902 | .gpiomask = 0xb33000, |
882 | .audiomux = { 0x122000,0x1000,0x0000,0x620000,0x800000 }, | 903 | .gpiomux = { 0x122000,0x1000,0x0000,0x620000 }, |
904 | .gpiomute = 0x800000, | ||
883 | #endif | 905 | #endif |
884 | /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) | 906 | /* Audio Routing for "WinFast 2000 XP" (no tv stereo !) |
885 | gpio23 -- hef4052:nEnable (0x800000) | 907 | gpio23 -- hef4052:nEnable (0x800000) |
@@ -909,7 +931,8 @@ struct tvcard bttv_tvcards[] = { | |||
909 | .svhs = 2, | 931 | .svhs = 2, |
910 | .gpiomask = 0x1800, | 932 | .gpiomask = 0x1800, |
911 | .muxsel = { 2, 3, 1, 1 }, | 933 | .muxsel = { 2, 3, 1, 1 }, |
912 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800 }, | 934 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
935 | .gpiomute = 0x1800, | ||
913 | .pll = PLL_28, | 936 | .pll = PLL_28, |
914 | .tuner_type = -1, | 937 | .tuner_type = -1, |
915 | .tuner_addr = ADDR_UNSET, | 938 | .tuner_addr = ADDR_UNSET, |
@@ -925,7 +948,8 @@ struct tvcard bttv_tvcards[] = { | |||
925 | .svhs = 2, | 948 | .svhs = 2, |
926 | .gpiomask = 0x1800, | 949 | .gpiomask = 0x1800, |
927 | .muxsel = { 2, 3, 1, 1 }, | 950 | .muxsel = { 2, 3, 1, 1 }, |
928 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, | 951 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
952 | .gpiomute = 0x1800, | ||
929 | .pll = PLL_28, | 953 | .pll = PLL_28, |
930 | .tuner_type = -1, | 954 | .tuner_type = -1, |
931 | .tuner_addr = ADDR_UNSET, | 955 | .tuner_addr = ADDR_UNSET, |
@@ -940,7 +964,8 @@ struct tvcard bttv_tvcards[] = { | |||
940 | .svhs = 2, | 964 | .svhs = 2, |
941 | .gpiomask = 0xff, | 965 | .gpiomask = 0xff, |
942 | .muxsel = { 2, 3, 1, 1 }, | 966 | .muxsel = { 2, 3, 1, 1 }, |
943 | .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 }, | 967 | .gpiomux = { 0x21, 0x20, 0x24, 0x2c }, |
968 | .gpiomute = 0x29, | ||
944 | .no_msp34xx = 1, | 969 | .no_msp34xx = 1, |
945 | .pll = PLL_28, | 970 | .pll = PLL_28, |
946 | .tuner_type = -1, | 971 | .tuner_type = -1, |
@@ -955,7 +980,8 @@ struct tvcard bttv_tvcards[] = { | |||
955 | .svhs = 2, | 980 | .svhs = 2, |
956 | .gpiomask = 0x551e00, | 981 | .gpiomask = 0x551e00, |
957 | .muxsel = { 2, 3, 1, 0 }, | 982 | .muxsel = { 2, 3, 1, 0 }, |
958 | .audiomux = { 0x551400, 0x551200, 0, 0, 0x551c00, 0x551200 }, | 983 | .gpiomux = { 0x551400, 0x551200, 0, 0 }, |
984 | .gpiomute = 0x551c00, | ||
959 | .needs_tvaudio = 1, | 985 | .needs_tvaudio = 1, |
960 | .pll = PLL_28, | 986 | .pll = PLL_28, |
961 | .tuner_type = 1, | 987 | .tuner_type = 1, |
@@ -971,7 +997,8 @@ struct tvcard bttv_tvcards[] = { | |||
971 | .svhs = 2, | 997 | .svhs = 2, |
972 | .gpiomask = 0x03000F, | 998 | .gpiomask = 0x03000F, |
973 | .muxsel = { 2, 3, 1, 1 }, | 999 | .muxsel = { 2, 3, 1, 1 }, |
974 | .audiomux = { 2, 0xd0001, 0, 0, 1 }, | 1000 | .gpiomux = { 2, 0xd0001, 0, 0 }, |
1001 | .gpiomute = 1, | ||
975 | .needs_tvaudio = 0, | 1002 | .needs_tvaudio = 0, |
976 | .pll = PLL_28, | 1003 | .pll = PLL_28, |
977 | .tuner_type = -1, | 1004 | .tuner_type = -1, |
@@ -988,7 +1015,8 @@ struct tvcard bttv_tvcards[] = { | |||
988 | .svhs = 2, | 1015 | .svhs = 2, |
989 | .gpiomask = 7, | 1016 | .gpiomask = 7, |
990 | .muxsel = { 2, 3, 1, 1 }, | 1017 | .muxsel = { 2, 3, 1, 1 }, |
991 | .audiomux = { 4, 0, 2, 3, 1 }, | 1018 | .gpiomux = { 4, 0, 2, 3 }, |
1019 | .gpiomute = 1, | ||
992 | .no_msp34xx = 1, | 1020 | .no_msp34xx = 1, |
993 | .needs_tvaudio = 1, | 1021 | .needs_tvaudio = 1, |
994 | .tuner_type = TUNER_PHILIPS_NTSC, | 1022 | .tuner_type = TUNER_PHILIPS_NTSC, |
@@ -1005,7 +1033,7 @@ struct tvcard bttv_tvcards[] = { | |||
1005 | .svhs = 2, | 1033 | .svhs = 2, |
1006 | .gpiomask = 15, | 1034 | .gpiomask = 15, |
1007 | .muxsel = { 2, 3, 1, 1 }, | 1035 | .muxsel = { 2, 3, 1, 1 }, |
1008 | .audiomux = { 13, 4, 11, 7, 0, 0 }, | 1036 | .gpiomux = { 13, 4, 11, 7 }, |
1009 | .needs_tvaudio = 1, | 1037 | .needs_tvaudio = 1, |
1010 | .pll = PLL_28, | 1038 | .pll = PLL_28, |
1011 | .tuner_type = -1, | 1039 | .tuner_type = -1, |
@@ -1022,7 +1050,7 @@ struct tvcard bttv_tvcards[] = { | |||
1022 | .svhs = 2, | 1050 | .svhs = 2, |
1023 | .gpiomask = 0, | 1051 | .gpiomask = 0, |
1024 | .muxsel = { 2, 3, 1, 1}, | 1052 | .muxsel = { 2, 3, 1, 1}, |
1025 | .audiomux = { 0, 0, 0, 0, 0}, | 1053 | .gpiomux = { 0, 0, 0, 0}, |
1026 | .needs_tvaudio = 1, | 1054 | .needs_tvaudio = 1, |
1027 | .no_msp34xx = 1, | 1055 | .no_msp34xx = 1, |
1028 | .pll = PLL_28, | 1056 | .pll = PLL_28, |
@@ -1038,7 +1066,8 @@ struct tvcard bttv_tvcards[] = { | |||
1038 | .svhs = 2, | 1066 | .svhs = 2, |
1039 | .gpiomask = 0xe00b, | 1067 | .gpiomask = 0xe00b, |
1040 | .muxsel = { 2, 3, 1, 1 }, | 1068 | .muxsel = { 2, 3, 1, 1 }, |
1041 | .audiomux = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0, 0xff3ffc }, | 1069 | .gpiomux = { 0xff9ff6, 0xff9ff6, 0xff1ff7, 0 }, |
1070 | .gpiomute = 0xff3ffc, | ||
1042 | .no_msp34xx = 1, | 1071 | .no_msp34xx = 1, |
1043 | .tuner_type = -1, | 1072 | .tuner_type = -1, |
1044 | .tuner_addr = ADDR_UNSET, | 1073 | .tuner_addr = ADDR_UNSET, |
@@ -1054,7 +1083,8 @@ struct tvcard bttv_tvcards[] = { | |||
1054 | .svhs = -1, | 1083 | .svhs = -1, |
1055 | .gpiomask = 3, | 1084 | .gpiomask = 3, |
1056 | .muxsel = { 2, 3, 1, 1 }, | 1085 | .muxsel = { 2, 3, 1, 1 }, |
1057 | .audiomux = { 1, 1, 0, 2, 3 }, | 1086 | .gpiomux = { 1, 1, 0, 2 }, |
1087 | .gpiomute = 3, | ||
1058 | .no_msp34xx = 1, | 1088 | .no_msp34xx = 1, |
1059 | .pll = PLL_NONE, | 1089 | .pll = PLL_NONE, |
1060 | .tuner_type = -1, | 1090 | .tuner_type = -1, |
@@ -1069,7 +1099,7 @@ struct tvcard bttv_tvcards[] = { | |||
1069 | .svhs = 3, | 1099 | .svhs = 3, |
1070 | .gpiomask = 0, | 1100 | .gpiomask = 0, |
1071 | .muxsel = { 2, 3, 1, 0, 0 }, | 1101 | .muxsel = { 2, 3, 1, 0, 0 }, |
1072 | .audiomux = { 0 }, | 1102 | .gpiomux = { 0 }, |
1073 | .no_msp34xx = 1, | 1103 | .no_msp34xx = 1, |
1074 | .pll = PLL_28, | 1104 | .pll = PLL_28, |
1075 | .tuner_type = -1, | 1105 | .tuner_type = -1, |
@@ -1084,7 +1114,8 @@ struct tvcard bttv_tvcards[] = { | |||
1084 | .svhs = 2, | 1114 | .svhs = 2, |
1085 | .gpiomask = 0xbcf03f, | 1115 | .gpiomask = 0xbcf03f, |
1086 | .muxsel = { 2, 3, 1, 1 }, | 1116 | .muxsel = { 2, 3, 1, 1 }, |
1087 | .audiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0, 0xbcb03f }, | 1117 | .gpiomux = { 0xbc803f, 0xbc903f, 0xbcb03f, 0 }, |
1118 | .gpiomute = 0xbcb03f, | ||
1088 | .no_msp34xx = 1, | 1119 | .no_msp34xx = 1, |
1089 | .pll = PLL_28, | 1120 | .pll = PLL_28, |
1090 | .tuner_type = 21, | 1121 | .tuner_type = 21, |
@@ -1099,7 +1130,8 @@ struct tvcard bttv_tvcards[] = { | |||
1099 | .svhs = 2, | 1130 | .svhs = 2, |
1100 | .gpiomask = 0x70000, | 1131 | .gpiomask = 0x70000, |
1101 | .muxsel = { 2, 3, 1, 1 }, | 1132 | .muxsel = { 2, 3, 1, 1 }, |
1102 | .audiomux = { 0x20000, 0x30000, 0x10000, 0, 0x40000, 0x20000 }, | 1133 | .gpiomux = { 0x20000, 0x30000, 0x10000, 0 }, |
1134 | .gpiomute = 0x40000, | ||
1103 | .needs_tvaudio = 1, | 1135 | .needs_tvaudio = 1, |
1104 | .no_msp34xx = 1, | 1136 | .no_msp34xx = 1, |
1105 | .pll = PLL_35, | 1137 | .pll = PLL_35, |
@@ -1118,7 +1150,8 @@ struct tvcard bttv_tvcards[] = { | |||
1118 | .svhs = 2, | 1150 | .svhs = 2, |
1119 | .gpiomask = 15, | 1151 | .gpiomask = 15, |
1120 | .muxsel = { 2, 3, 1, 1 }, | 1152 | .muxsel = { 2, 3, 1, 1 }, |
1121 | .audiomux = {2,0,0,0,1 }, | 1153 | .gpiomux = {2,0,0,0 }, |
1154 | .gpiomute = 1, | ||
1122 | .needs_tvaudio = 1, | 1155 | .needs_tvaudio = 1, |
1123 | .pll = PLL_28, | 1156 | .pll = PLL_28, |
1124 | .tuner_type = -1, | 1157 | .tuner_type = -1, |
@@ -1133,7 +1166,7 @@ struct tvcard bttv_tvcards[] = { | |||
1133 | .svhs = 2, | 1166 | .svhs = 2, |
1134 | .gpiomask = 0x010f00, | 1167 | .gpiomask = 0x010f00, |
1135 | .muxsel = {2, 3, 0, 0 }, | 1168 | .muxsel = {2, 3, 0, 0 }, |
1136 | .audiomux = {0x10000, 0, 0x10000, 0, 0, 0 }, | 1169 | .gpiomux = {0x10000, 0, 0x10000, 0 }, |
1137 | .no_msp34xx = 1, | 1170 | .no_msp34xx = 1, |
1138 | .pll = PLL_28, | 1171 | .pll = PLL_28, |
1139 | .tuner_type = TUNER_ALPS_TSHC6_NTSC, | 1172 | .tuner_type = TUNER_ALPS_TSHC6_NTSC, |
@@ -1150,7 +1183,8 @@ struct tvcard bttv_tvcards[] = { | |||
1150 | .gpiomask = 0xAA0000, | 1183 | .gpiomask = 0xAA0000, |
1151 | .muxsel = { 2,3,1,1,-1 }, | 1184 | .muxsel = { 2,3,1,1,-1 }, |
1152 | .digital_mode = DIGITAL_MODE_CAMERA, | 1185 | .digital_mode = DIGITAL_MODE_CAMERA, |
1153 | .audiomux = { 0x20000, 0, 0x80000, 0x80000, 0xa8000, 0x46000 }, | 1186 | .gpiomux = { 0x20000, 0, 0x80000, 0x80000 }, |
1187 | .gpiomute = 0xa8000, | ||
1154 | .no_msp34xx = 1, | 1188 | .no_msp34xx = 1, |
1155 | .pll = PLL_28, | 1189 | .pll = PLL_28, |
1156 | .tuner_type = TUNER_PHILIPS_PAL_I, | 1190 | .tuner_type = TUNER_PHILIPS_PAL_I, |
@@ -1175,7 +1209,8 @@ struct tvcard bttv_tvcards[] = { | |||
1175 | .svhs = 2, | 1209 | .svhs = 2, |
1176 | .gpiomask = 7, | 1210 | .gpiomask = 7, |
1177 | .muxsel = { 2, 0, 1, 1 }, | 1211 | .muxsel = { 2, 0, 1, 1 }, |
1178 | .audiomux = { 0, 1, 2, 3, 4 }, | 1212 | .gpiomux = { 0, 1, 2, 3 }, |
1213 | .gpiomute = 4, | ||
1179 | .pll = PLL_28, | 1214 | .pll = PLL_28, |
1180 | .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */, | 1215 | .tuner_type = -1 /* TUNER_ALPS_TMDH2_NTSC */, |
1181 | .tuner_addr = ADDR_UNSET, | 1216 | .tuner_addr = ADDR_UNSET, |
@@ -1192,7 +1227,8 @@ struct tvcard bttv_tvcards[] = { | |||
1192 | .svhs = 3, | 1227 | .svhs = 3, |
1193 | .gpiomask = 0x03000F, | 1228 | .gpiomask = 0x03000F, |
1194 | .muxsel = { 2, 3, 1, 1 }, | 1229 | .muxsel = { 2, 3, 1, 1 }, |
1195 | .audiomux = { 1, 0xd0001, 0, 0, 10 }, | 1230 | .gpiomux = { 1, 0xd0001, 0, 0 }, |
1231 | .gpiomute = 10, | ||
1196 | /* sound path (5 sources): | 1232 | /* sound path (5 sources): |
1197 | MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable) | 1233 | MUX1 (mask 0x03), Enable Pin 0x08 (0=enable, 1=disable) |
1198 | 0= ext. Audio IN | 1234 | 0= ext. Audio IN |
@@ -1218,7 +1254,8 @@ struct tvcard bttv_tvcards[] = { | |||
1218 | .svhs = 2, | 1254 | .svhs = 2, |
1219 | .gpiomask = 0x1c, | 1255 | .gpiomask = 0x1c, |
1220 | .muxsel = { 2, 3, 1, 1 }, | 1256 | .muxsel = { 2, 3, 1, 1 }, |
1221 | .audiomux = { 0, 0, 0x10, 8, 4 }, | 1257 | .gpiomux = { 0, 0, 0x10, 8 }, |
1258 | .gpiomute = 4, | ||
1222 | .needs_tvaudio = 1, | 1259 | .needs_tvaudio = 1, |
1223 | .pll = PLL_28, | 1260 | .pll = PLL_28, |
1224 | .tuner_type = TUNER_PHILIPS_PAL, | 1261 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -1230,7 +1267,7 @@ struct tvcard bttv_tvcards[] = { | |||
1230 | /* Tim Röstermundt <rosterm@uni-muenster.de> | 1267 | /* Tim Röstermundt <rosterm@uni-muenster.de> |
1231 | in de.comp.os.unix.linux.hardware: | 1268 | in de.comp.os.unix.linux.hardware: |
1232 | options bttv card=0 pll=1 radio=1 gpiomask=0x18e0 | 1269 | options bttv card=0 pll=1 radio=1 gpiomask=0x18e0 |
1233 | audiomux=0x44c71f,0x44d71f,0,0x44d71f,0x44dfff | 1270 | gpiomux =0x44c71f,0x44d71f,0,0x44d71f,0x44dfff |
1234 | options tuner type=5 */ | 1271 | options tuner type=5 */ |
1235 | .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]", | 1272 | .name = "Lifeview FlyVideo 2000 /FlyVideo A2/ Lifetec LT 9415 TV [LR90]", |
1236 | .video_inputs = 4, | 1273 | .video_inputs = 4, |
@@ -1239,7 +1276,8 @@ struct tvcard bttv_tvcards[] = { | |||
1239 | .svhs = 2, | 1276 | .svhs = 2, |
1240 | .gpiomask = 0x18e0, | 1277 | .gpiomask = 0x18e0, |
1241 | .muxsel = { 2, 3, 1, 1 }, | 1278 | .muxsel = { 2, 3, 1, 1 }, |
1242 | .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x18e0 }, | 1279 | .gpiomux = { 0x0000,0x0800,0x1000,0x1000 }, |
1280 | .gpiomute = 0x18e0, | ||
1243 | /* For cards with tda9820/tda9821: | 1281 | /* For cards with tda9820/tda9821: |
1244 | 0x0000: Tuner normal stereo | 1282 | 0x0000: Tuner normal stereo |
1245 | 0x0080: Tuner A2 SAP (second audio program = Zweikanalton) | 1283 | 0x0080: Tuner A2 SAP (second audio program = Zweikanalton) |
@@ -1259,7 +1297,8 @@ struct tvcard bttv_tvcards[] = { | |||
1259 | .svhs = 2, | 1297 | .svhs = 2, |
1260 | .gpiomask = 0xF, | 1298 | .gpiomask = 0xF, |
1261 | .muxsel = { 2, 3, 1, 0 }, | 1299 | .muxsel = { 2, 3, 1, 0 }, |
1262 | .audiomux = { 2, 0, 0, 0, 10 }, | 1300 | .gpiomux = { 2, 0, 0, 0 }, |
1301 | .gpiomute = 10, | ||
1263 | .needs_tvaudio = 0, | 1302 | .needs_tvaudio = 0, |
1264 | .pll = PLL_28, | 1303 | .pll = PLL_28, |
1265 | .tuner_type = TUNER_TEMIC_PAL, | 1304 | .tuner_type = TUNER_TEMIC_PAL, |
@@ -1277,7 +1316,8 @@ struct tvcard bttv_tvcards[] = { | |||
1277 | .svhs = 2, | 1316 | .svhs = 2, |
1278 | .gpiomask = 0x1800, | 1317 | .gpiomask = 0x1800, |
1279 | .muxsel = { 2, 3, 1, 1 }, | 1318 | .muxsel = { 2, 3, 1, 1 }, |
1280 | .audiomux = { 0, 0x800, 0x1000, 0x1000, 0x1800, 0 }, | 1319 | .gpiomux = { 0, 0x800, 0x1000, 0x1000 }, |
1320 | .gpiomute = 0x1800, | ||
1281 | .pll = PLL_28, | 1321 | .pll = PLL_28, |
1282 | .tuner_type = 5, | 1322 | .tuner_type = 5, |
1283 | .tuner_addr = ADDR_UNSET, | 1323 | .tuner_addr = ADDR_UNSET, |
@@ -1294,7 +1334,7 @@ struct tvcard bttv_tvcards[] = { | |||
1294 | .svhs = 1, | 1334 | .svhs = 1, |
1295 | .gpiomask = 0, | 1335 | .gpiomask = 0, |
1296 | .muxsel = { 3, 1 }, | 1336 | .muxsel = { 3, 1 }, |
1297 | .audiomux = { 0 }, | 1337 | .gpiomux = { 0 }, |
1298 | .needs_tvaudio = 0, | 1338 | .needs_tvaudio = 0, |
1299 | .no_msp34xx = 1, | 1339 | .no_msp34xx = 1, |
1300 | .pll = PLL_35, | 1340 | .pll = PLL_35, |
@@ -1311,7 +1351,8 @@ struct tvcard bttv_tvcards[] = { | |||
1311 | .svhs = 2, | 1351 | .svhs = 2, |
1312 | .gpiomask = 0xe00, | 1352 | .gpiomask = 0xe00, |
1313 | .muxsel = { 2, 3, 1, 1}, | 1353 | .muxsel = { 2, 3, 1, 1}, |
1314 | .audiomux = { 0x400, 0x400, 0x400, 0x400, 0x800, 0x400 }, | 1354 | .gpiomux = { 0x400, 0x400, 0x400, 0x400 }, |
1355 | .gpiomute = 0x800, | ||
1315 | .needs_tvaudio = 1, | 1356 | .needs_tvaudio = 1, |
1316 | .pll = PLL_28, | 1357 | .pll = PLL_28, |
1317 | .tuner_type = TUNER_TEMIC_4036FY5_NTSC, | 1358 | .tuner_type = TUNER_TEMIC_4036FY5_NTSC, |
@@ -1327,7 +1368,8 @@ struct tvcard bttv_tvcards[] = { | |||
1327 | .svhs = 2, | 1368 | .svhs = 2, |
1328 | .gpiomask = 0x03000F, | 1369 | .gpiomask = 0x03000F, |
1329 | .muxsel = { 2, 3, 1, 0 }, | 1370 | .muxsel = { 2, 3, 1, 0 }, |
1330 | .audiomux = { 2, 0, 0, 0, 1 }, | 1371 | .gpiomux = { 2, 0, 0, 0 }, |
1372 | .gpiomute = 1, | ||
1331 | .pll = PLL_28, | 1373 | .pll = PLL_28, |
1332 | .tuner_type = 0, | 1374 | .tuner_type = 0, |
1333 | .tuner_addr = ADDR_UNSET, | 1375 | .tuner_addr = ADDR_UNSET, |
@@ -1344,7 +1386,8 @@ struct tvcard bttv_tvcards[] = { | |||
1344 | .svhs = -1, | 1386 | .svhs = -1, |
1345 | .gpiomask = 11, | 1387 | .gpiomask = 11, |
1346 | .muxsel = { 2, 3, 1, 1 }, | 1388 | .muxsel = { 2, 3, 1, 1 }, |
1347 | .audiomux = { 2, 0, 0, 1, 8 }, | 1389 | .gpiomux = { 2, 0, 0, 1 }, |
1390 | .gpiomute = 8, | ||
1348 | .pll = PLL_35, | 1391 | .pll = PLL_35, |
1349 | .tuner_type = TUNER_TEMIC_PAL, | 1392 | .tuner_type = TUNER_TEMIC_PAL, |
1350 | .tuner_addr = ADDR_UNSET, | 1393 | .tuner_addr = ADDR_UNSET, |
@@ -1359,7 +1402,7 @@ struct tvcard bttv_tvcards[] = { | |||
1359 | .svhs = 1, | 1402 | .svhs = 1, |
1360 | .gpiomask = 0xF, | 1403 | .gpiomask = 0xF, |
1361 | .muxsel = { 2, 2 }, | 1404 | .muxsel = { 2, 2 }, |
1362 | .audiomux = { }, | 1405 | .gpiomux = { }, |
1363 | .no_msp34xx = 1, | 1406 | .no_msp34xx = 1, |
1364 | .needs_tvaudio = 0, | 1407 | .needs_tvaudio = 0, |
1365 | .pll = PLL_28, | 1408 | .pll = PLL_28, |
@@ -1378,7 +1421,8 @@ struct tvcard bttv_tvcards[] = { | |||
1378 | .svhs = 2, | 1421 | .svhs = 2, |
1379 | .gpiomask = 0xFF, | 1422 | .gpiomask = 0xFF, |
1380 | .muxsel = { 2, 3, 1, 0 }, | 1423 | .muxsel = { 2, 3, 1, 0 }, |
1381 | .audiomux = { 1, 0, 4, 4, 9 }, | 1424 | .gpiomux = { 1, 0, 4, 4 }, |
1425 | .gpiomute = 9, | ||
1382 | .needs_tvaudio = 0, | 1426 | .needs_tvaudio = 0, |
1383 | .pll = PLL_28, | 1427 | .pll = PLL_28, |
1384 | .tuner_type = TUNER_PHILIPS_PAL, | 1428 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -1394,7 +1438,8 @@ struct tvcard bttv_tvcards[] = { | |||
1394 | .svhs = 2, | 1438 | .svhs = 2, |
1395 | .gpiomask = 0xf03f, | 1439 | .gpiomask = 0xf03f, |
1396 | .muxsel = { 2, 3, 1, 0 }, | 1440 | .muxsel = { 2, 3, 1, 0 }, |
1397 | .audiomux = { 0xbffe, 0, 0xbfff, 0, 0xbffe }, | 1441 | .gpiomux = { 0xbffe, 0, 0xbfff, 0 }, |
1442 | .gpiomute = 0xbffe, | ||
1398 | .pll = PLL_28, | 1443 | .pll = PLL_28, |
1399 | .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, | 1444 | .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, |
1400 | .tuner_addr = ADDR_UNSET, | 1445 | .tuner_addr = ADDR_UNSET, |
@@ -1411,7 +1456,7 @@ struct tvcard bttv_tvcards[] = { | |||
1411 | .svhs = -1, | 1456 | .svhs = -1, |
1412 | .gpiomask = 1, | 1457 | .gpiomask = 1, |
1413 | .muxsel = { 2, 3, 0, 1 }, | 1458 | .muxsel = { 2, 3, 0, 1 }, |
1414 | .audiomux = { 0, 0, 1, 0, 0 }, | 1459 | .gpiomux = { 0, 0, 1, 0 }, |
1415 | .no_msp34xx = 1, | 1460 | .no_msp34xx = 1, |
1416 | .pll = PLL_28, | 1461 | .pll = PLL_28, |
1417 | .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, | 1462 | .tuner_type = TUNER_TEMIC_4006FN5_MULTI_PAL, |
@@ -1430,7 +1475,8 @@ struct tvcard bttv_tvcards[] = { | |||
1430 | /* Radio changed from 1e80 to 0x800 to make | 1475 | /* Radio changed from 1e80 to 0x800 to make |
1431 | FlyVideo2000S in .hu happy (gm)*/ | 1476 | FlyVideo2000S in .hu happy (gm)*/ |
1432 | /* -dk-???: set mute=0x1800 for tda9874h daughterboard */ | 1477 | /* -dk-???: set mute=0x1800 for tda9874h daughterboard */ |
1433 | .audiomux = { 0x0000,0x0800,0x1000,0x1000,0x1800, 0x1080 }, | 1478 | .gpiomux = { 0x0000,0x0800,0x1000,0x1000 }, |
1479 | .gpiomute = 0x1800, | ||
1434 | .audio_hook = fv2000s_audio, | 1480 | .audio_hook = fv2000s_audio, |
1435 | .no_msp34xx = 1, | 1481 | .no_msp34xx = 1, |
1436 | .no_tda9875 = 1, | 1482 | .no_tda9875 = 1, |
@@ -1448,7 +1494,8 @@ struct tvcard bttv_tvcards[] = { | |||
1448 | .svhs = 2, | 1494 | .svhs = 2, |
1449 | .gpiomask = 0xffff00, | 1495 | .gpiomask = 0xffff00, |
1450 | .muxsel = { 2, 3, 1, 1 }, | 1496 | .muxsel = { 2, 3, 1, 1 }, |
1451 | .audiomux = { 0x500, 0x500, 0x300, 0x900, 0x900 }, | 1497 | .gpiomux = { 0x500, 0x500, 0x300, 0x900 }, |
1498 | .gpiomute = 0x900, | ||
1452 | .needs_tvaudio = 1, | 1499 | .needs_tvaudio = 1, |
1453 | .pll = PLL_28, | 1500 | .pll = PLL_28, |
1454 | .tuner_type = TUNER_PHILIPS_PAL, | 1501 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -1465,7 +1512,7 @@ struct tvcard bttv_tvcards[] = { | |||
1465 | .svhs = 2, | 1512 | .svhs = 2, |
1466 | .gpiomask = 0x010f00, | 1513 | .gpiomask = 0x010f00, |
1467 | .muxsel = {2, 3, 0, 0 }, | 1514 | .muxsel = {2, 3, 0, 0 }, |
1468 | .audiomux = {0x10000, 0, 0x10000, 0, 0, 0 }, | 1515 | .gpiomux = {0x10000, 0, 0x10000, 0 }, |
1469 | .no_msp34xx = 1, | 1516 | .no_msp34xx = 1, |
1470 | .pll = PLL_28, | 1517 | .pll = PLL_28, |
1471 | .tuner_type = TUNER_SHARP_2U5JF5540_NTSC, | 1518 | .tuner_type = TUNER_SHARP_2U5JF5540_NTSC, |
@@ -1486,7 +1533,8 @@ struct tvcard bttv_tvcards[] = { | |||
1486 | .gpiomask = 0x4f8a00, | 1533 | .gpiomask = 0x4f8a00, |
1487 | /* 0x100000: 1=MSP enabled (0=disable again) | 1534 | /* 0x100000: 1=MSP enabled (0=disable again) |
1488 | * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */ | 1535 | * 0x010000: Connected to "S0" on tda9880 (0=Pal/BG, 1=NTSC) */ |
1489 | .audiomux = {0x947fff, 0x987fff,0x947fff,0x947fff, 0x947fff}, | 1536 | .gpiomux = {0x947fff, 0x987fff,0x947fff,0x947fff }, |
1537 | .gpiomute = 0x947fff, | ||
1490 | /* tvtuner, radio, external,internal, mute, stereo | 1538 | /* tvtuner, radio, external,internal, mute, stereo |
1491 | * tuner, Composit, SVid, Composit-on-Svid-adapter */ | 1539 | * tuner, Composit, SVid, Composit-on-Svid-adapter */ |
1492 | .muxsel = { 2, 3 ,0 ,1 }, | 1540 | .muxsel = { 2, 3 ,0 ,1 }, |
@@ -1518,7 +1566,8 @@ struct tvcard bttv_tvcards[] = { | |||
1518 | .svhs = 2, | 1566 | .svhs = 2, |
1519 | .gpiomask = 15, | 1567 | .gpiomask = 15, |
1520 | .muxsel = { 2, 3, 1, 1 }, | 1568 | .muxsel = { 2, 3, 1, 1 }, |
1521 | .audiomux = { 0, 0, 11, 7, 13, 0 }, /* TV and Radio with same GPIO ! */ | 1569 | .gpiomux = { 0, 0, 11, 7 }, /* TV and Radio with same GPIO ! */ |
1570 | .gpiomute = 13, | ||
1522 | .needs_tvaudio = 1, | 1571 | .needs_tvaudio = 1, |
1523 | .pll = PLL_28, | 1572 | .pll = PLL_28, |
1524 | .tuner_type = 25, | 1573 | .tuner_type = 25, |
@@ -1557,7 +1606,8 @@ struct tvcard bttv_tvcards[] = { | |||
1557 | .svhs = 2, | 1606 | .svhs = 2, |
1558 | .gpiomask = 0x3f, | 1607 | .gpiomask = 0x3f, |
1559 | .muxsel = { 2, 3, 1, 1 }, | 1608 | .muxsel = { 2, 3, 1, 1 }, |
1560 | .audiomux = { 0x01, 0x00, 0x03, 0x03, 0x09, 0x02 }, | 1609 | .gpiomux = { 0x01, 0x00, 0x03, 0x03 }, |
1610 | .gpiomute = 0x09, | ||
1561 | .needs_tvaudio = 1, | 1611 | .needs_tvaudio = 1, |
1562 | .no_msp34xx = 1, | 1612 | .no_msp34xx = 1, |
1563 | .no_tda9875 = 1, | 1613 | .no_tda9875 = 1, |
@@ -1586,7 +1636,7 @@ struct tvcard bttv_tvcards[] = { | |||
1586 | .svhs = 4, | 1636 | .svhs = 4, |
1587 | .gpiomask = 0, | 1637 | .gpiomask = 0, |
1588 | .muxsel = { 2, 3, 1, 0, 0 }, | 1638 | .muxsel = { 2, 3, 1, 0, 0 }, |
1589 | .audiomux = { 0 }, | 1639 | .gpiomux = { 0 }, |
1590 | .needs_tvaudio = 0, | 1640 | .needs_tvaudio = 0, |
1591 | .tuner_type = -1, | 1641 | .tuner_type = -1, |
1592 | .tuner_addr = ADDR_UNSET, | 1642 | .tuner_addr = ADDR_UNSET, |
@@ -1618,7 +1668,8 @@ struct tvcard bttv_tvcards[] = { | |||
1618 | .svhs = 2, | 1668 | .svhs = 2, |
1619 | .gpiomask = 0x1C800F, /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */ | 1669 | .gpiomask = 0x1C800F, /* Bit0-2: Audio select, 8-12:remote control 14:remote valid 15:remote reset */ |
1620 | .muxsel = { 2, 1, 1, }, | 1670 | .muxsel = { 2, 1, 1, }, |
1621 | .audiomux = { 0, 1, 2, 2, 4 }, | 1671 | .gpiomux = { 0, 1, 2, 2 }, |
1672 | .gpiomute = 4, | ||
1622 | .needs_tvaudio = 0, | 1673 | .needs_tvaudio = 0, |
1623 | .tuner_type = TUNER_PHILIPS_PAL, | 1674 | .tuner_type = TUNER_PHILIPS_PAL, |
1624 | .tuner_addr = ADDR_UNSET, | 1675 | .tuner_addr = ADDR_UNSET, |
@@ -1637,7 +1688,8 @@ struct tvcard bttv_tvcards[] = { | |||
1637 | .svhs = 2, | 1688 | .svhs = 2, |
1638 | .gpiomask = 0x140007, | 1689 | .gpiomask = 0x140007, |
1639 | .muxsel = { 2, 3, 1, 1 }, | 1690 | .muxsel = { 2, 3, 1, 1 }, |
1640 | .audiomux = { 0, 1, 2, 3, 4, 0 }, | 1691 | .gpiomux = { 0, 1, 2, 3 }, |
1692 | .gpiomute = 4, | ||
1641 | .tuner_type = TUNER_PHILIPS_NTSC, | 1693 | .tuner_type = TUNER_PHILIPS_NTSC, |
1642 | .tuner_addr = ADDR_UNSET, | 1694 | .tuner_addr = ADDR_UNSET, |
1643 | .radio_addr = ADDR_UNSET, | 1695 | .radio_addr = ADDR_UNSET, |
@@ -1651,7 +1703,7 @@ struct tvcard bttv_tvcards[] = { | |||
1651 | .svhs = -1, | 1703 | .svhs = -1, |
1652 | .gpiomask = 0, | 1704 | .gpiomask = 0, |
1653 | .muxsel = { 2, 3, 1, 0 }, | 1705 | .muxsel = { 2, 3, 1, 0 }, |
1654 | .audiomux = { 0 }, | 1706 | .gpiomux = { 0 }, |
1655 | .needs_tvaudio = 0, | 1707 | .needs_tvaudio = 0, |
1656 | .no_msp34xx = 1, | 1708 | .no_msp34xx = 1, |
1657 | .pll = PLL_28, | 1709 | .pll = PLL_28, |
@@ -1667,13 +1719,14 @@ struct tvcard bttv_tvcards[] = { | |||
1667 | .svhs = 2, | 1719 | .svhs = 2, |
1668 | .gpiomask = 7, | 1720 | .gpiomask = 7, |
1669 | .muxsel = { 2, 3, 1, 1 }, /* Tuner, SVid, SVHS, SVid to SVHS connector */ | 1721 | .muxsel = { 2, 3, 1, 1 }, /* Tuner, SVid, SVHS, SVid to SVHS connector */ |
1670 | .audiomux = { 0 ,0 ,4, 4,4,4},/* Yes, this tuner uses the same audio output for TV and FM radio! | 1722 | .gpiomux = { 0, 0, 4, 4 },/* Yes, this tuner uses the same audio output for TV and FM radio! |
1671 | * This card lacks external Audio In, so we mute it on Ext. & Int. | 1723 | * This card lacks external Audio In, so we mute it on Ext. & Int. |
1672 | * The PCB can take a sbx1637/sbx1673, wiring unknown. | 1724 | * The PCB can take a sbx1637/sbx1673, wiring unknown. |
1673 | * This card lacks PCI subsystem ID, sigh. | 1725 | * This card lacks PCI subsystem ID, sigh. |
1674 | * audiomux=1: lower volume, 2+3: mute | 1726 | * gpiomux =1: lower volume, 2+3: mute |
1675 | * btwincap uses 0x80000/0x80003 | 1727 | * btwincap uses 0x80000/0x80003 |
1676 | */ | 1728 | */ |
1729 | .gpiomute = 4, | ||
1677 | .needs_tvaudio = 0, | 1730 | .needs_tvaudio = 0, |
1678 | .no_msp34xx = 1, | 1731 | .no_msp34xx = 1, |
1679 | .pll = PLL_28, | 1732 | .pll = PLL_28, |
@@ -1720,7 +1773,7 @@ struct tvcard bttv_tvcards[] = { | |||
1720 | .radio_addr = ADDR_UNSET, | 1773 | .radio_addr = ADDR_UNSET, |
1721 | 1774 | ||
1722 | .gpiomask = 7, | 1775 | .gpiomask = 7, |
1723 | .audiomux = {7}, | 1776 | .gpiomux = {7}, |
1724 | }, | 1777 | }, |
1725 | [BTTV_BOARD_GVBCTV5PCI] = { | 1778 | [BTTV_BOARD_GVBCTV5PCI] = { |
1726 | .name = "IODATA GV-BCTV5/PCI", | 1779 | .name = "IODATA GV-BCTV5/PCI", |
@@ -1730,7 +1783,8 @@ struct tvcard bttv_tvcards[] = { | |||
1730 | .svhs = 2, | 1783 | .svhs = 2, |
1731 | .gpiomask = 0x0f0f80, | 1784 | .gpiomask = 0x0f0f80, |
1732 | .muxsel = {2, 3, 1, 0 }, | 1785 | .muxsel = {2, 3, 1, 0 }, |
1733 | .audiomux = {0x030000, 0x010000, 0, 0, 0x020000, 0}, | 1786 | .gpiomux = {0x030000, 0x010000, 0, 0 }, |
1787 | .gpiomute = 0x020000, | ||
1734 | .no_msp34xx = 1, | 1788 | .no_msp34xx = 1, |
1735 | .pll = PLL_28, | 1789 | .pll = PLL_28, |
1736 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 1790 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
@@ -1960,7 +2014,7 @@ struct tvcard bttv_tvcards[] = { | |||
1960 | .gpiomask = 2, | 2014 | .gpiomask = 2, |
1961 | /* TV, Comp1, Composite over SVID con, SVID */ | 2015 | /* TV, Comp1, Composite over SVID con, SVID */ |
1962 | .muxsel = { 2, 3, 1, 1 }, | 2016 | .muxsel = { 2, 3, 1, 1 }, |
1963 | .audiomux = { 2, 2, 0, 0, 0 }, | 2017 | .gpiomux = { 2, 2, 0, 0 }, |
1964 | .pll = PLL_28, | 2018 | .pll = PLL_28, |
1965 | .has_radio = 1, | 2019 | .has_radio = 1, |
1966 | .tuner_type = TUNER_PHILIPS_PAL, | 2020 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -1984,7 +2038,8 @@ struct tvcard bttv_tvcards[] = { | |||
1984 | .svhs = -1, | 2038 | .svhs = -1, |
1985 | .gpiomask = 7, | 2039 | .gpiomask = 7, |
1986 | .muxsel = { 2, 3, 1, 1}, | 2040 | .muxsel = { 2, 3, 1, 1}, |
1987 | .audiomux = { 0, 1, 2, 3, 4}, | 2041 | .gpiomux = { 0, 1, 2, 3}, |
2042 | .gpiomute = 4, | ||
1988 | .needs_tvaudio = 1, | 2043 | .needs_tvaudio = 1, |
1989 | .tuner_type = 5, | 2044 | .tuner_type = 5, |
1990 | .tuner_addr = ADDR_UNSET, | 2045 | .tuner_addr = ADDR_UNSET, |
@@ -2016,7 +2071,7 @@ struct tvcard bttv_tvcards[] = { | |||
2016 | .svhs = -1, | 2071 | .svhs = -1, |
2017 | .gpiomask = 0, | 2072 | .gpiomask = 0, |
2018 | .muxsel = { 2, 3 }, | 2073 | .muxsel = { 2, 3 }, |
2019 | .audiomux = { 0 }, | 2074 | .gpiomux = { 0 }, |
2020 | .needs_tvaudio = 0, | 2075 | .needs_tvaudio = 0, |
2021 | .no_msp34xx = 1, | 2076 | .no_msp34xx = 1, |
2022 | .pll = PLL_28, | 2077 | .pll = PLL_28, |
@@ -2035,7 +2090,8 @@ struct tvcard bttv_tvcards[] = { | |||
2035 | .gpiomask = 0x001e8007, | 2090 | .gpiomask = 0x001e8007, |
2036 | .muxsel = { 2, 3, 1, 0 }, | 2091 | .muxsel = { 2, 3, 1, 0 }, |
2037 | /* Tuner, Radio, external, internal, off, on */ | 2092 | /* Tuner, Radio, external, internal, off, on */ |
2038 | .audiomux = { 0x08, 0x0f, 0x0a, 0x08, 0x0f, 0x08 }, | 2093 | .gpiomux = { 0x08, 0x0f, 0x0a, 0x08 }, |
2094 | .gpiomute = 0x0f, | ||
2039 | .needs_tvaudio = 0, | 2095 | .needs_tvaudio = 0, |
2040 | .no_msp34xx = 1, | 2096 | .no_msp34xx = 1, |
2041 | .pll = PLL_28, | 2097 | .pll = PLL_28, |
@@ -2152,7 +2208,7 @@ struct tvcard bttv_tvcards[] = { | |||
2152 | .svhs = -1, | 2208 | .svhs = -1, |
2153 | .gpiomask = 0, | 2209 | .gpiomask = 0, |
2154 | .muxsel = { 2, 3, 1, 0 }, | 2210 | .muxsel = { 2, 3, 1, 0 }, |
2155 | .audiomux = { 0 }, | 2211 | .gpiomux = { 0 }, |
2156 | .needs_tvaudio = 0, | 2212 | .needs_tvaudio = 0, |
2157 | .no_msp34xx = 1, | 2213 | .no_msp34xx = 1, |
2158 | .pll = PLL_28, | 2214 | .pll = PLL_28, |
@@ -2169,7 +2225,7 @@ struct tvcard bttv_tvcards[] = { | |||
2169 | .svhs = 3, | 2225 | .svhs = 3, |
2170 | .gpiomask = 0x00, | 2226 | .gpiomask = 0x00, |
2171 | .muxsel = { 2, 3, 1, 0 }, | 2227 | .muxsel = { 2, 3, 1, 0 }, |
2172 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ | 2228 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2173 | .needs_tvaudio = 1, | 2229 | .needs_tvaudio = 1, |
2174 | .pll = PLL_28, | 2230 | .pll = PLL_28, |
2175 | .tuner_type = -1, | 2231 | .tuner_type = -1, |
@@ -2184,7 +2240,7 @@ struct tvcard bttv_tvcards[] = { | |||
2184 | .svhs = 3, | 2240 | .svhs = 3, |
2185 | .gpiomask = 0x00, | 2241 | .gpiomask = 0x00, |
2186 | .muxsel = { 2, 3, 1, 1 }, | 2242 | .muxsel = { 2, 3, 1, 1 }, |
2187 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ | 2243 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2188 | .needs_tvaudio = 1, | 2244 | .needs_tvaudio = 1, |
2189 | .pll = PLL_28, | 2245 | .pll = PLL_28, |
2190 | .tuner_type = -1, | 2246 | .tuner_type = -1, |
@@ -2204,7 +2260,7 @@ struct tvcard bttv_tvcards[] = { | |||
2204 | via the upper nibble of muxsel. here: used for | 2260 | via the upper nibble of muxsel. here: used for |
2205 | xternal video-mux */ | 2261 | xternal video-mux */ |
2206 | .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 }, | 2262 | .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x00 }, |
2207 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ | 2263 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2208 | .needs_tvaudio = 1, | 2264 | .needs_tvaudio = 1, |
2209 | .pll = PLL_28, | 2265 | .pll = PLL_28, |
2210 | .tuner_type = -1, | 2266 | .tuner_type = -1, |
@@ -2222,7 +2278,7 @@ struct tvcard bttv_tvcards[] = { | |||
2222 | via the upper nibble of muxsel. here: used for | 2278 | via the upper nibble of muxsel. here: used for |
2223 | xternal video-mux */ | 2279 | xternal video-mux */ |
2224 | .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 }, | 2280 | .muxsel = { 0x02, 0x12, 0x22, 0x32, 0x03, 0x13, 0x23, 0x33, 0x01, 0x01 }, |
2225 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ | 2281 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2226 | .needs_tvaudio = 1, | 2282 | .needs_tvaudio = 1, |
2227 | .pll = PLL_28, | 2283 | .pll = PLL_28, |
2228 | .tuner_type = -1, | 2284 | .tuner_type = -1, |
@@ -2310,7 +2366,7 @@ struct tvcard bttv_tvcards[] = { | |||
2310 | .svhs = 2, | 2366 | .svhs = 2, |
2311 | .gpiomask = 3, | 2367 | .gpiomask = 3, |
2312 | .muxsel = { 2, 3, 1, 1 }, | 2368 | .muxsel = { 2, 3, 1, 1 }, |
2313 | .audiomux = { 1, 1, 1, 1, 0 }, | 2369 | .gpiomux = { 1, 1, 1, 1 }, |
2314 | .needs_tvaudio = 1, | 2370 | .needs_tvaudio = 1, |
2315 | .tuner_type = TUNER_PHILIPS_PAL, | 2371 | .tuner_type = TUNER_PHILIPS_PAL, |
2316 | .tuner_addr = ADDR_UNSET, | 2372 | .tuner_addr = ADDR_UNSET, |
@@ -2341,7 +2397,8 @@ struct tvcard bttv_tvcards[] = { | |||
2341 | .svhs = 2, | 2397 | .svhs = 2, |
2342 | .gpiomask = 0x008007, | 2398 | .gpiomask = 0x008007, |
2343 | .muxsel = { 2, 3, 0, 0 }, | 2399 | .muxsel = { 2, 3, 0, 0 }, |
2344 | .audiomux = { 0, 0, 0, 0, 0x000003, 0 }, | 2400 | .gpiomux = { 0, 0, 0, 0 }, |
2401 | .gpiomute = 0x000003, | ||
2345 | .pll = PLL_28, | 2402 | .pll = PLL_28, |
2346 | .tuner_type = TUNER_PHILIPS_PAL, | 2403 | .tuner_type = TUNER_PHILIPS_PAL, |
2347 | .tuner_addr = ADDR_UNSET, | 2404 | .tuner_addr = ADDR_UNSET, |
@@ -2377,7 +2434,7 @@ struct tvcard bttv_tvcards[] = { | |||
2377 | .needs_tvaudio = 0, | 2434 | .needs_tvaudio = 0, |
2378 | .gpiomask = 0x68, | 2435 | .gpiomask = 0x68, |
2379 | .muxsel = { 2, 3, 1 }, | 2436 | .muxsel = { 2, 3, 1 }, |
2380 | .audiomux = { 0x68, 0x68, 0x61, 0x61, 0x00 }, | 2437 | .gpiomux = { 0x68, 0x68, 0x61, 0x61 }, |
2381 | .pll = PLL_28, | 2438 | .pll = PLL_28, |
2382 | }, | 2439 | }, |
2383 | 2440 | ||
@@ -2392,7 +2449,8 @@ struct tvcard bttv_tvcards[] = { | |||
2392 | .svhs = 2, | 2449 | .svhs = 2, |
2393 | .gpiomask = 0x008007, | 2450 | .gpiomask = 0x008007, |
2394 | .muxsel = { 2, 3, 1, 1 }, | 2451 | .muxsel = { 2, 3, 1, 1 }, |
2395 | .audiomux = { 0, 1, 2, 2, 3 }, | 2452 | .gpiomux = { 0, 1, 2, 2 }, |
2453 | .gpiomute = 3, | ||
2396 | .needs_tvaudio = 0, | 2454 | .needs_tvaudio = 0, |
2397 | .pll = PLL_28, | 2455 | .pll = PLL_28, |
2398 | .tuner_type = TUNER_PHILIPS_PAL, | 2456 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -2417,7 +2475,7 @@ struct tvcard bttv_tvcards[] = { | |||
2417 | .no_tda9875 = 1, | 2475 | .no_tda9875 = 1, |
2418 | .no_tda7432 = 1, | 2476 | .no_tda7432 = 1, |
2419 | .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/ | 2477 | .muxsel = {2,2,2,2},/*878A input is always MUX0, see above.*/ |
2420 | .audiomux = { 0, 0, 0, 0, 0, 0 }, /* card has no audio */ | 2478 | .gpiomux = { 0, 0, 0, 0 }, /* card has no audio */ |
2421 | .pll = PLL_28, | 2479 | .pll = PLL_28, |
2422 | .needs_tvaudio = 0, | 2480 | .needs_tvaudio = 0, |
2423 | .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ | 2481 | .muxsel_hook = picolo_tetra_muxsel,/*Required as it doesn't follow the classic input selection policy*/ |
@@ -2435,7 +2493,7 @@ struct tvcard bttv_tvcards[] = { | |||
2435 | .svhs = 2, | 2493 | .svhs = 2, |
2436 | .gpiomask = 0x0000000f, | 2494 | .gpiomask = 0x0000000f, |
2437 | .muxsel = { 2, 1, 1 }, | 2495 | .muxsel = { 2, 1, 1 }, |
2438 | .audiomux = { 0x02, 0x00, 0x00, 0x00, 0x00 }, | 2496 | .gpiomux = { 0x02, 0x00, 0x00, 0x00 }, |
2439 | .tuner_type = TUNER_TEMIC_PAL, | 2497 | .tuner_type = TUNER_TEMIC_PAL, |
2440 | .tuner_addr = ADDR_UNSET, | 2498 | .tuner_addr = ADDR_UNSET, |
2441 | .radio_addr = ADDR_UNSET, | 2499 | .radio_addr = ADDR_UNSET, |
@@ -2491,7 +2549,7 @@ struct tvcard bttv_tvcards[] = { | |||
2491 | .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, | 2549 | .muxsel = { 2, 2, 2, 2, 2, 2, 2, 2, |
2492 | 3, 3, 3, 3, 3, 3, 3, 3 }, | 2550 | 3, 3, 3, 3, 3, 3, 3, 3 }, |
2493 | .muxsel_hook = sigmaSQ_muxsel, | 2551 | .muxsel_hook = sigmaSQ_muxsel, |
2494 | .audiomux = { 0 }, | 2552 | .gpiomux = { 0 }, |
2495 | .no_msp34xx = 1, | 2553 | .no_msp34xx = 1, |
2496 | .pll = PLL_28, | 2554 | .pll = PLL_28, |
2497 | .tuner_type = -1, | 2555 | .tuner_type = -1, |
@@ -2508,7 +2566,7 @@ struct tvcard bttv_tvcards[] = { | |||
2508 | .gpiomask = 0x0, | 2566 | .gpiomask = 0x0, |
2509 | .muxsel = { 2, 2, 2, 2 }, | 2567 | .muxsel = { 2, 2, 2, 2 }, |
2510 | .muxsel_hook = sigmaSLC_muxsel, | 2568 | .muxsel_hook = sigmaSLC_muxsel, |
2511 | .audiomux = { 0 }, | 2569 | .gpiomux = { 0 }, |
2512 | .no_msp34xx = 1, | 2570 | .no_msp34xx = 1, |
2513 | .pll = PLL_28, | 2571 | .pll = PLL_28, |
2514 | .tuner_type = -1, | 2572 | .tuner_type = -1, |
@@ -2526,7 +2584,8 @@ struct tvcard bttv_tvcards[] = { | |||
2526 | .svhs = -1, | 2584 | .svhs = -1, |
2527 | .gpiomask = 0xFF, | 2585 | .gpiomask = 0xFF, |
2528 | .muxsel = { 2, 3, 1, 1 }, | 2586 | .muxsel = { 2, 3, 1, 1 }, |
2529 | .audiomux = { 2, 0, 0, 0, 10 }, | 2587 | .gpiomux = { 2, 0, 0, 0 }, |
2588 | .gpiomute = 10, | ||
2530 | .needs_tvaudio = 0, | 2589 | .needs_tvaudio = 0, |
2531 | .pll = PLL_28, | 2590 | .pll = PLL_28, |
2532 | .tuner_type = TUNER_PHILIPS_PAL, | 2591 | .tuner_type = TUNER_PHILIPS_PAL, |
@@ -2560,7 +2619,8 @@ struct tvcard bttv_tvcards[] = { | |||
2560 | .svhs = 2, | 2619 | .svhs = 2, |
2561 | .gpiomask = 0x3f, | 2620 | .gpiomask = 0x3f, |
2562 | .muxsel = {2, 3, 1, 0 }, | 2621 | .muxsel = {2, 3, 1, 0 }, |
2563 | .audiomux = {0x31, 0x31, 0x31, 0x31, 0x31, 0x31 }, | 2622 | .gpiomux = {0x31, 0x31, 0x31, 0x31 }, |
2623 | .gpiomute = 0x31, | ||
2564 | .no_msp34xx = 1, | 2624 | .no_msp34xx = 1, |
2565 | .pll = PLL_28, | 2625 | .pll = PLL_28, |
2566 | .tuner_type = TUNER_PHILIPS_NTSC_M, | 2626 | .tuner_type = TUNER_PHILIPS_NTSC_M, |
@@ -2583,7 +2643,7 @@ struct tvcard bttv_tvcards[] = { | |||
2583 | .tuner_addr = ADDR_UNSET, | 2643 | .tuner_addr = ADDR_UNSET, |
2584 | .radio_addr = ADDR_UNSET, | 2644 | .radio_addr = ADDR_UNSET, |
2585 | .gpiomask = 0x008007, | 2645 | .gpiomask = 0x008007, |
2586 | .audiomux = { 0, 0x000001,0,0, 0 }, | 2646 | .gpiomux = { 0, 0x000001,0,0 }, |
2587 | .needs_tvaudio = 1, | 2647 | .needs_tvaudio = 1, |
2588 | .has_radio = 1, | 2648 | .has_radio = 1, |
2589 | }, | 2649 | }, |
@@ -2693,7 +2753,8 @@ struct tvcard bttv_tvcards[] = { | |||
2693 | .svhs = 2, | 2753 | .svhs = 2, |
2694 | .muxsel = { 2, 3, 1 }, | 2754 | .muxsel = { 2, 3, 1 }, |
2695 | .gpiomask = 0x00e00007, | 2755 | .gpiomask = 0x00e00007, |
2696 | .audiomux = { 0x00400005, 0, 0x00000001, 0, 0x00c00007, 0 }, | 2756 | .gpiomux = { 0x00400005, 0, 0x00000001, 0 }, |
2757 | .gpiomute = 0x00c00007, | ||
2697 | .no_msp34xx = 1, | 2758 | .no_msp34xx = 1, |
2698 | .no_tda9875 = 1, | 2759 | .no_tda9875 = 1, |
2699 | .no_tda7432 = 1, | 2760 | .no_tda7432 = 1, |
@@ -2709,7 +2770,8 @@ struct tvcard bttv_tvcards[] = { | |||
2709 | .svhs = 2, | 2770 | .svhs = 2, |
2710 | .gpiomask = 0x01fe00, | 2771 | .gpiomask = 0x01fe00, |
2711 | .muxsel = { 2, 3, 1, 1 }, | 2772 | .muxsel = { 2, 3, 1, 1 }, |
2712 | .audiomux = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 }, | 2773 | .gpiomux = { 0x001e00, 0, 0x018000, 0x014000 }, |
2774 | .gpiomute = 0x002000, | ||
2713 | .needs_tvaudio = 1, | 2775 | .needs_tvaudio = 1, |
2714 | .pll = PLL_28, | 2776 | .pll = PLL_28, |
2715 | .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, | 2777 | .tuner_type = TUNER_YMEC_TVF66T5_B_DFF, |
@@ -2726,7 +2788,8 @@ struct tvcard bttv_tvcards[] = { | |||
2726 | .svhs = 2, | 2788 | .svhs = 2, |
2727 | .gpiomask = 0x001c0007, | 2789 | .gpiomask = 0x001c0007, |
2728 | .muxsel = { 2, 3, 1, 1 }, | 2790 | .muxsel = { 2, 3, 1, 1 }, |
2729 | .audiomux = { 0, 1, 2, 2, 3 }, | 2791 | .gpiomux = { 0, 1, 2, 2 }, |
2792 | .gpiomute = 3, | ||
2730 | .needs_tvaudio = 0, | 2793 | .needs_tvaudio = 0, |
2731 | .pll = PLL_28, | 2794 | .pll = PLL_28, |
2732 | .tuner_type = TUNER_TENA_9533_DI, | 2795 | .tuner_type = TUNER_TENA_9533_DI, |
@@ -2745,7 +2808,8 @@ struct tvcard bttv_tvcards[] = { | |||
2745 | .gpiomask = 0x01fe00, | 2808 | .gpiomask = 0x01fe00, |
2746 | .muxsel = { 2,3,1,1,-1 }, | 2809 | .muxsel = { 2,3,1,1,-1 }, |
2747 | .digital_mode = DIGITAL_MODE_CAMERA, | 2810 | .digital_mode = DIGITAL_MODE_CAMERA, |
2748 | .audiomux = { 0x00400, 0x10400, 0x04400, 0x80000, 0x12400, 0x46000 }, | 2811 | .gpiomux = { 0x00400, 0x10400, 0x04400, 0x80000 }, |
2812 | .gpiomute = 0x12400, | ||
2749 | .no_msp34xx = 1, | 2813 | .no_msp34xx = 1, |
2750 | .pll = PLL_28, | 2814 | .pll = PLL_28, |
2751 | .tuner_type = TUNER_LG_PAL_FM, | 2815 | .tuner_type = TUNER_LG_PAL_FM, |
@@ -2763,7 +2827,8 @@ struct tvcard bttv_tvcards[] = { | |||
2763 | .svhs = 2, | 2827 | .svhs = 2, |
2764 | .gpiomask = 0x3f, | 2828 | .gpiomask = 0x3f, |
2765 | .muxsel = { 2, 3, 1, 1 }, | 2829 | .muxsel = { 2, 3, 1, 1 }, |
2766 | .audiomux = { 0x21, 0x20, 0x24, 0x2c, 0x29, 0x29 }, | 2830 | .gpiomux = { 0x21, 0x20, 0x24, 0x2c }, |
2831 | .gpiomute = 0x29, | ||
2767 | .no_msp34xx = 1, | 2832 | .no_msp34xx = 1, |
2768 | .pll = PLL_28, | 2833 | .pll = PLL_28, |
2769 | .tuner_type = TUNER_YMEC_TVF_5533MF, | 2834 | .tuner_type = TUNER_YMEC_TVF_5533MF, |
@@ -2797,7 +2862,8 @@ struct tvcard bttv_tvcards[] = { | |||
2797 | .svhs = 2, | 2862 | .svhs = 2, |
2798 | .gpiomask = 15, | 2863 | .gpiomask = 15, |
2799 | .muxsel = { 2, 3, 1, 1 }, | 2864 | .muxsel = { 2, 3, 1, 1 }, |
2800 | .audiomux = { 2, 0, 0, 0, 1 }, | 2865 | .gpiomux = { 2, 0, 0, 0 }, |
2866 | .gpiomute = 1, | ||
2801 | .needs_tvaudio = 1, | 2867 | .needs_tvaudio = 1, |
2802 | .pll = PLL_28, | 2868 | .pll = PLL_28, |
2803 | .tuner_type = 2, | 2869 | .tuner_type = 2, |
@@ -2813,7 +2879,7 @@ struct tvcard bttv_tvcards[] = { | |||
2813 | .svhs = 2, | 2879 | .svhs = 2, |
2814 | .gpiomask = 0x108007, | 2880 | .gpiomask = 0x108007, |
2815 | .muxsel = { 2, 3, 1, 1 }, | 2881 | .muxsel = { 2, 3, 1, 1 }, |
2816 | .audiomux = { 100000, 100002, 100002, 100000 }, | 2882 | .gpiomux = { 100000, 100002, 100002, 100000 }, |
2817 | .no_msp34xx = 1, | 2883 | .no_msp34xx = 1, |
2818 | .no_tda9875 = 1, | 2884 | .no_tda9875 = 1, |
2819 | .no_tda7432 = 1, | 2885 | .no_tda7432 = 1, |
@@ -2853,7 +2919,8 @@ struct tvcard bttv_tvcards[] = { | |||
2853 | .svhs = 2, | 2919 | .svhs = 2, |
2854 | .gpiomask = 7, | 2920 | .gpiomask = 7, |
2855 | .muxsel = { 2, 3, 1, 1 }, | 2921 | .muxsel = { 2, 3, 1, 1 }, |
2856 | .audiomux = { 0, 1, 2, 3, 4 }, | 2922 | .gpiomux = { 0, 1, 2, 3 }, |
2923 | .gpiomute = 4, | ||
2857 | .tuner_type = TUNER_TEMIC_4009FR5_PAL, | 2924 | .tuner_type = TUNER_TEMIC_4009FR5_PAL, |
2858 | .tuner_addr = ADDR_UNSET, | 2925 | .tuner_addr = ADDR_UNSET, |
2859 | .radio_addr = ADDR_UNSET, | 2926 | .radio_addr = ADDR_UNSET, |
@@ -2925,20 +2992,20 @@ void __devinit bttv_idcard(struct bttv *btv) | |||
2925 | if (UNSET != audiomux[0]) { | 2992 | if (UNSET != audiomux[0]) { |
2926 | gpiobits = 0; | 2993 | gpiobits = 0; |
2927 | for (i = 0; i < 5; i++) { | 2994 | for (i = 0; i < 5; i++) { |
2928 | bttv_tvcards[btv->c.type].audiomux[i] = audiomux[i]; | 2995 | bttv_tvcards[btv->c.type].gpiomux[i] = audiomux[i]; |
2929 | gpiobits |= audiomux[i]; | 2996 | gpiobits |= audiomux[i]; |
2930 | } | 2997 | } |
2931 | } else { | 2998 | } else { |
2932 | gpiobits = audioall; | 2999 | gpiobits = audioall; |
2933 | for (i = 0; i < 5; i++) { | 3000 | for (i = 0; i < 5; i++) { |
2934 | bttv_tvcards[btv->c.type].audiomux[i] = audioall; | 3001 | bttv_tvcards[btv->c.type].gpiomux[i] = audioall; |
2935 | } | 3002 | } |
2936 | } | 3003 | } |
2937 | bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits; | 3004 | bttv_tvcards[btv->c.type].gpiomask = (UNSET != gpiomask) ? gpiomask : gpiobits; |
2938 | printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=", | 3005 | printk(KERN_INFO "bttv%d: gpio config override: mask=0x%x, mux=", |
2939 | btv->c.nr,bttv_tvcards[btv->c.type].gpiomask); | 3006 | btv->c.nr,bttv_tvcards[btv->c.type].gpiomask); |
2940 | for (i = 0; i < 5; i++) { | 3007 | for (i = 0; i < 5; i++) { |
2941 | printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].audiomux[i]); | 3008 | printk("%s0x%x", i ? "," : "", bttv_tvcards[btv->c.type].gpiomux[i]); |
2942 | } | 3009 | } |
2943 | printk("\n"); | 3010 | printk("\n"); |
2944 | } | 3011 | } |
@@ -3046,7 +3113,7 @@ static void miro_pinnacle_gpio(struct bttv *btv) | |||
3046 | gpio_inout(0xffffff, 0); | 3113 | gpio_inout(0xffffff, 0); |
3047 | gpio = gpio_read(); | 3114 | gpio = gpio_read(); |
3048 | id = ((gpio>>10) & 63) -1; | 3115 | id = ((gpio>>10) & 63) -1; |
3049 | msp = bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx"); | 3116 | msp = bttv_I2CRead(btv, I2C_ADDR_MSP3400, "MSP34xx"); |
3050 | if (id < 32) { | 3117 | if (id < 32) { |
3051 | btv->tuner_type = miro_tunermap[id]; | 3118 | btv->tuner_type = miro_tunermap[id]; |
3052 | if (0 == (gpio & 0x20)) { | 3119 | if (0 == (gpio & 0x20)) { |
@@ -3442,8 +3509,8 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3442 | 3509 | ||
3443 | if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) { | 3510 | if (bttv_tvcards[btv->c.type].digital_mode == DIGITAL_MODE_CAMERA) { |
3444 | /* detect Bt832 chip for quartzsight digital camera */ | 3511 | /* detect Bt832 chip for quartzsight digital camera */ |
3445 | if ((bttv_I2CRead(btv, I2C_BT832_ALT1, "Bt832") >=0) || | 3512 | if ((bttv_I2CRead(btv, I2C_ADDR_BT832_ALT1, "Bt832") >=0) || |
3446 | (bttv_I2CRead(btv, I2C_BT832_ALT2, "Bt832") >=0)) | 3513 | (bttv_I2CRead(btv, I2C_ADDR_BT832_ALT2, "Bt832") >=0)) |
3447 | boot_bt832(btv); | 3514 | boot_bt832(btv); |
3448 | } | 3515 | } |
3449 | 3516 | ||
@@ -3452,19 +3519,19 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3452 | 3519 | ||
3453 | /* try to detect audio/fader chips */ | 3520 | /* try to detect audio/fader chips */ |
3454 | if (!bttv_tvcards[btv->c.type].no_msp34xx && | 3521 | if (!bttv_tvcards[btv->c.type].no_msp34xx && |
3455 | bttv_I2CRead(btv, I2C_MSP3400, "MSP34xx") >=0) | 3522 | bttv_I2CRead(btv, I2C_ADDR_MSP3400, "MSP34xx") >=0) |
3456 | request_module("msp3400"); | 3523 | request_module("msp3400"); |
3457 | 3524 | ||
3458 | if (bttv_tvcards[btv->c.type].msp34xx_alt && | 3525 | if (bttv_tvcards[btv->c.type].msp34xx_alt && |
3459 | bttv_I2CRead(btv, I2C_MSP3400_ALT, "MSP34xx (alternate address)") >=0) | 3526 | bttv_I2CRead(btv, I2C_ADDR_MSP3400_ALT, "MSP34xx (alternate address)") >=0) |
3460 | request_module("msp3400"); | 3527 | request_module("msp3400"); |
3461 | 3528 | ||
3462 | if (!bttv_tvcards[btv->c.type].no_tda9875 && | 3529 | if (!bttv_tvcards[btv->c.type].no_tda9875 && |
3463 | bttv_I2CRead(btv, I2C_TDA9875, "TDA9875") >=0) | 3530 | bttv_I2CRead(btv, I2C_ADDR_TDA9875, "TDA9875") >=0) |
3464 | request_module("tda9875"); | 3531 | request_module("tda9875"); |
3465 | 3532 | ||
3466 | if (!bttv_tvcards[btv->c.type].no_tda7432 && | 3533 | if (!bttv_tvcards[btv->c.type].no_tda7432 && |
3467 | bttv_I2CRead(btv, I2C_TDA7432, "TDA7432") >=0) | 3534 | bttv_I2CRead(btv, I2C_ADDR_TDA7432, "TDA7432") >=0) |
3468 | request_module("tda7432"); | 3535 | request_module("tda7432"); |
3469 | 3536 | ||
3470 | if (bttv_tvcards[btv->c.type].needs_tvaudio) | 3537 | if (bttv_tvcards[btv->c.type].needs_tvaudio) |
@@ -3475,7 +3542,7 @@ void __devinit bttv_init_card2(struct bttv *btv) | |||
3475 | if (btv->tda9887_conf) | 3542 | if (btv->tda9887_conf) |
3476 | tda9887 = 1; | 3543 | tda9887 = 1; |
3477 | if (0 == tda9887 && 0 == bttv_tvcards[btv->c.type].has_dvb && | 3544 | if (0 == tda9887 && 0 == bttv_tvcards[btv->c.type].has_dvb && |
3478 | bttv_I2CRead(btv, I2C_TDA9887, "TDA9887") >=0) | 3545 | bttv_I2CRead(btv, I2C_ADDR_TDA9887, "TDA9887") >=0) |
3479 | tda9887 = 1; | 3546 | tda9887 = 1; |
3480 | /* Hybrid DVB card, DOES have a tda9887 */ | 3547 | /* Hybrid DVB card, DOES have a tda9887 */ |
3481 | if (btv->c.type == BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE) | 3548 | if (btv->c.type == BTTV_BOARD_DVICO_FUSIONHDTV_5_LITE) |
@@ -3796,18 +3863,18 @@ void bttv_tda9880_setnorm(struct bttv *btv, int norm) | |||
3796 | { | 3863 | { |
3797 | /* fix up our card entry */ | 3864 | /* fix up our card entry */ |
3798 | if(norm==VIDEO_MODE_NTSC) { | 3865 | if(norm==VIDEO_MODE_NTSC) { |
3799 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x957fff; | 3866 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x957fff; |
3800 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x957fff; | 3867 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x957fff; |
3801 | dprintk("bttv_tda9880_setnorm to NTSC\n"); | 3868 | dprintk("bttv_tda9880_setnorm to NTSC\n"); |
3802 | } | 3869 | } |
3803 | else { | 3870 | else { |
3804 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[0]=0x947fff; | 3871 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomux[TVAUDIO_INPUT_TUNER]=0x947fff; |
3805 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].audiomux[4]=0x947fff; | 3872 | bttv_tvcards[BTTV_BOARD_VOODOOTV_FM].gpiomute=0x947fff; |
3806 | dprintk("bttv_tda9880_setnorm to PAL\n"); | 3873 | dprintk("bttv_tda9880_setnorm to PAL\n"); |
3807 | } | 3874 | } |
3808 | /* set GPIO according */ | 3875 | /* set GPIO according */ |
3809 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask, | 3876 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask, |
3810 | bttv_tvcards[btv->c.type].audiomux[btv->audio]); | 3877 | bttv_tvcards[btv->c.type].gpiomux[btv->audio]); |
3811 | } | 3878 | } |
3812 | 3879 | ||
3813 | 3880 | ||
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index c0415d6e7fee..74def9c23952 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bt8xx/bttv-driver.c | |||
@@ -36,13 +36,15 @@ | |||
36 | #include <linux/kdev_t.h> | 36 | #include <linux/kdev_t.h> |
37 | #include "bttvp.h" | 37 | #include "bttvp.h" |
38 | #include <media/v4l2-common.h> | 38 | #include <media/v4l2-common.h> |
39 | #include <media/tvaudio.h> | ||
40 | #include <media/msp3400.h> | ||
39 | 41 | ||
40 | #include <linux/dma-mapping.h> | 42 | #include <linux/dma-mapping.h> |
41 | 43 | ||
42 | #include <asm/io.h> | 44 | #include <asm/io.h> |
43 | #include <asm/byteorder.h> | 45 | #include <asm/byteorder.h> |
44 | 46 | ||
45 | #include "rds.h" | 47 | #include <media/rds.h> |
46 | 48 | ||
47 | 49 | ||
48 | unsigned int bttv_num; /* number of Bt848s in use */ | 50 | unsigned int bttv_num; /* number of Bt848s in use */ |
@@ -926,45 +928,98 @@ video_mux(struct bttv *btv, unsigned int input) | |||
926 | 928 | ||
927 | static char *audio_modes[] = { | 929 | static char *audio_modes[] = { |
928 | "audio: tuner", "audio: radio", "audio: extern", | 930 | "audio: tuner", "audio: radio", "audio: extern", |
929 | "audio: intern", "audio: off" | 931 | "audio: intern", "audio: mute" |
930 | }; | 932 | }; |
931 | 933 | ||
932 | static int | 934 | static int |
933 | audio_mux(struct bttv *btv, int mode) | 935 | audio_mux(struct bttv *btv, int input, int mute) |
934 | { | 936 | { |
935 | int val,mux,i2c_mux,signal; | 937 | int gpio_val, signal; |
938 | struct v4l2_control ctrl; | ||
939 | struct i2c_client *c; | ||
936 | 940 | ||
937 | gpio_inout(bttv_tvcards[btv->c.type].gpiomask, | 941 | gpio_inout(bttv_tvcards[btv->c.type].gpiomask, |
938 | bttv_tvcards[btv->c.type].gpiomask); | 942 | bttv_tvcards[btv->c.type].gpiomask); |
939 | signal = btread(BT848_DSTATUS) & BT848_DSTATUS_HLOC; | 943 | signal = btread(BT848_DSTATUS) & BT848_DSTATUS_HLOC; |
940 | 944 | ||
941 | switch (mode) { | 945 | btv->mute = mute; |
942 | case AUDIO_MUTE: | 946 | btv->audio = input; |
943 | btv->audio |= AUDIO_MUTE; | 947 | |
944 | break; | 948 | /* automute */ |
945 | case AUDIO_UNMUTE: | 949 | mute = mute || (btv->opt_automute && !signal && !btv->radio_user); |
946 | btv->audio &= ~AUDIO_MUTE; | 950 | |
947 | break; | 951 | if (mute) |
948 | case AUDIO_TUNER: | 952 | gpio_val = bttv_tvcards[btv->c.type].gpiomute; |
949 | case AUDIO_RADIO: | 953 | else |
950 | case AUDIO_EXTERN: | 954 | gpio_val = bttv_tvcards[btv->c.type].gpiomux[input]; |
951 | case AUDIO_INTERN: | 955 | |
952 | btv->audio &= AUDIO_MUTE; | 956 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask, gpio_val); |
953 | btv->audio |= mode; | ||
954 | } | ||
955 | i2c_mux = mux = (btv->audio & AUDIO_MUTE) ? AUDIO_OFF : btv->audio; | ||
956 | if (btv->opt_automute && !signal && !btv->radio_user) | ||
957 | mux = AUDIO_OFF; | ||
958 | |||
959 | val = bttv_tvcards[btv->c.type].audiomux[mux]; | ||
960 | gpio_bits(bttv_tvcards[btv->c.type].gpiomask,val); | ||
961 | if (bttv_gpio) | 957 | if (bttv_gpio) |
962 | bttv_gpio_tracking(btv,audio_modes[mux]); | 958 | bttv_gpio_tracking(btv, audio_modes[mute ? 4 : input]); |
963 | if (!in_interrupt()) | 959 | if (in_interrupt()) |
964 | bttv_call_i2c_clients(btv,AUDC_SET_INPUT,&(i2c_mux)); | 960 | return 0; |
961 | |||
962 | ctrl.id = V4L2_CID_AUDIO_MUTE; | ||
963 | ctrl.value = btv->mute; | ||
964 | bttv_call_i2c_clients(btv, VIDIOC_S_CTRL, &ctrl); | ||
965 | c = btv->i2c_msp34xx_client; | ||
966 | if (c) { | ||
967 | struct v4l2_routing route; | ||
968 | |||
969 | /* Note: the inputs tuner/radio/extern/intern are translated | ||
970 | to msp routings. This assumes common behavior for all msp3400 | ||
971 | based TV cards. When this assumption fails, then the | ||
972 | specific MSP routing must be added to the card table. | ||
973 | For now this is sufficient. */ | ||
974 | switch (input) { | ||
975 | case TVAUDIO_INPUT_RADIO: | ||
976 | route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1, | ||
977 | MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); | ||
978 | break; | ||
979 | case TVAUDIO_INPUT_EXTERN: | ||
980 | route.input = MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, | ||
981 | MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); | ||
982 | break; | ||
983 | case TVAUDIO_INPUT_INTERN: | ||
984 | /* Yes, this is the same input as for RADIO. I doubt | ||
985 | if this is ever used. The only board with an INTERN | ||
986 | input is the BTTV_BOARD_AVERMEDIA98. I wonder how | ||
987 | that was tested. My guess is that the whole INTERN | ||
988 | input does not work. */ | ||
989 | route.input = MSP_INPUT(MSP_IN_SCART_2, MSP_IN_TUNER_1, | ||
990 | MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART); | ||
991 | break; | ||
992 | case TVAUDIO_INPUT_TUNER: | ||
993 | default: | ||
994 | route.input = MSP_INPUT_DEFAULT; | ||
995 | break; | ||
996 | } | ||
997 | route.output = MSP_OUTPUT_DEFAULT; | ||
998 | c->driver->command(c, VIDIOC_INT_S_AUDIO_ROUTING, &route); | ||
999 | } | ||
1000 | c = btv->i2c_tvaudio_client; | ||
1001 | if (c) { | ||
1002 | struct v4l2_routing route; | ||
1003 | |||
1004 | route.input = input; | ||
1005 | route.output = 0; | ||
1006 | c->driver->command(c, VIDIOC_INT_S_AUDIO_ROUTING, &route); | ||
1007 | } | ||
965 | return 0; | 1008 | return 0; |
966 | } | 1009 | } |
967 | 1010 | ||
1011 | static inline int | ||
1012 | audio_mute(struct bttv *btv, int mute) | ||
1013 | { | ||
1014 | return audio_mux(btv, btv->audio, mute); | ||
1015 | } | ||
1016 | |||
1017 | static inline int | ||
1018 | audio_input(struct bttv *btv, int input) | ||
1019 | { | ||
1020 | return audio_mux(btv, input, btv->mute); | ||
1021 | } | ||
1022 | |||
968 | static void | 1023 | static void |
969 | i2c_vidiocschan(struct bttv *btv) | 1024 | i2c_vidiocschan(struct bttv *btv) |
970 | { | 1025 | { |
@@ -1023,8 +1078,8 @@ set_input(struct bttv *btv, unsigned int input) | |||
1023 | } else { | 1078 | } else { |
1024 | video_mux(btv,input); | 1079 | video_mux(btv,input); |
1025 | } | 1080 | } |
1026 | audio_mux(btv,(input == bttv_tvcards[btv->c.type].tuner ? | 1081 | audio_input(btv,(input == bttv_tvcards[btv->c.type].tuner ? |
1027 | AUDIO_TUNER : AUDIO_EXTERN)); | 1082 | TVAUDIO_INPUT_TUNER : TVAUDIO_INPUT_EXTERN)); |
1028 | set_tvnorm(btv,btv->tvnorm); | 1083 | set_tvnorm(btv,btv->tvnorm); |
1029 | i2c_vidiocschan(btv); | 1084 | i2c_vidiocschan(btv); |
1030 | } | 1085 | } |
@@ -1236,10 +1291,10 @@ static int set_control(struct bttv *btv, struct v4l2_control *c) | |||
1236 | case V4L2_CID_AUDIO_MUTE: | 1291 | case V4L2_CID_AUDIO_MUTE: |
1237 | if (c->value) { | 1292 | if (c->value) { |
1238 | va.flags |= VIDEO_AUDIO_MUTE; | 1293 | va.flags |= VIDEO_AUDIO_MUTE; |
1239 | audio_mux(btv, AUDIO_MUTE); | 1294 | audio_mute(btv, 1); |
1240 | } else { | 1295 | } else { |
1241 | va.flags &= ~VIDEO_AUDIO_MUTE; | 1296 | va.flags &= ~VIDEO_AUDIO_MUTE; |
1242 | audio_mux(btv, AUDIO_UNMUTE); | 1297 | audio_mute(btv, 0); |
1243 | } | 1298 | } |
1244 | break; | 1299 | break; |
1245 | 1300 | ||
@@ -1397,7 +1452,7 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh, | |||
1397 | free_btres(btv,fh,RESOURCE_OVERLAY); | 1452 | free_btres(btv,fh,RESOURCE_OVERLAY); |
1398 | if (NULL != old) { | 1453 | if (NULL != old) { |
1399 | dprintk("switch_overlay: old=%p state is %d\n",old,old->vb.state); | 1454 | dprintk("switch_overlay: old=%p state is %d\n",old,old->vb.state); |
1400 | bttv_dma_free(btv, old); | 1455 | bttv_dma_free(&fh->cap,btv, old); |
1401 | kfree(old); | 1456 | kfree(old); |
1402 | } | 1457 | } |
1403 | dprintk("switch_overlay: done\n"); | 1458 | dprintk("switch_overlay: done\n"); |
@@ -1407,7 +1462,8 @@ bttv_switch_overlay(struct bttv *btv, struct bttv_fh *fh, | |||
1407 | /* ----------------------------------------------------------------------- */ | 1462 | /* ----------------------------------------------------------------------- */ |
1408 | /* video4linux (1) interface */ | 1463 | /* video4linux (1) interface */ |
1409 | 1464 | ||
1410 | static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, | 1465 | static int bttv_prepare_buffer(struct videobuf_queue *q,struct bttv *btv, |
1466 | struct bttv_buffer *buf, | ||
1411 | const struct bttv_format *fmt, | 1467 | const struct bttv_format *fmt, |
1412 | unsigned int width, unsigned int height, | 1468 | unsigned int width, unsigned int height, |
1413 | enum v4l2_field field) | 1469 | enum v4l2_field field) |
@@ -1450,7 +1506,7 @@ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, | |||
1450 | /* alloc risc memory */ | 1506 | /* alloc risc memory */ |
1451 | if (STATE_NEEDS_INIT == buf->vb.state) { | 1507 | if (STATE_NEEDS_INIT == buf->vb.state) { |
1452 | redo_dma_risc = 1; | 1508 | redo_dma_risc = 1; |
1453 | if (0 != (rc = videobuf_iolock(btv->c.pci,&buf->vb,&btv->fbuf))) | 1509 | if (0 != (rc = videobuf_iolock(q,&buf->vb,&btv->fbuf))) |
1454 | goto fail; | 1510 | goto fail; |
1455 | } | 1511 | } |
1456 | 1512 | ||
@@ -1462,7 +1518,7 @@ static int bttv_prepare_buffer(struct bttv *btv, struct bttv_buffer *buf, | |||
1462 | return 0; | 1518 | return 0; |
1463 | 1519 | ||
1464 | fail: | 1520 | fail: |
1465 | bttv_dma_free(btv,buf); | 1521 | bttv_dma_free(q,btv,buf); |
1466 | return rc; | 1522 | return rc; |
1467 | } | 1523 | } |
1468 | 1524 | ||
@@ -1486,7 +1542,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
1486 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); | 1542 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); |
1487 | struct bttv_fh *fh = q->priv_data; | 1543 | struct bttv_fh *fh = q->priv_data; |
1488 | 1544 | ||
1489 | return bttv_prepare_buffer(fh->btv, buf, fh->fmt, | 1545 | return bttv_prepare_buffer(q,fh->btv, buf, fh->fmt, |
1490 | fh->width, fh->height, field); | 1546 | fh->width, fh->height, field); |
1491 | } | 1547 | } |
1492 | 1548 | ||
@@ -1510,7 +1566,7 @@ static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
1510 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); | 1566 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); |
1511 | struct bttv_fh *fh = q->priv_data; | 1567 | struct bttv_fh *fh = q->priv_data; |
1512 | 1568 | ||
1513 | bttv_dma_free(fh->btv,buf); | 1569 | bttv_dma_free(&fh->cap,fh->btv,buf); |
1514 | } | 1570 | } |
1515 | 1571 | ||
1516 | static struct videobuf_queue_ops bttv_video_qops = { | 1572 | static struct videobuf_queue_ops bttv_video_qops = { |
@@ -1653,7 +1709,7 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) | |||
1653 | return -EINVAL; | 1709 | return -EINVAL; |
1654 | 1710 | ||
1655 | mutex_lock(&btv->lock); | 1711 | mutex_lock(&btv->lock); |
1656 | audio_mux(btv, (v->flags&VIDEO_AUDIO_MUTE) ? AUDIO_MUTE : AUDIO_UNMUTE); | 1712 | audio_mute(btv, (v->flags&VIDEO_AUDIO_MUTE) ? 1 : 0); |
1657 | bttv_call_i2c_clients(btv,cmd,v); | 1713 | bttv_call_i2c_clients(btv,cmd,v); |
1658 | 1714 | ||
1659 | /* card specific hooks */ | 1715 | /* card specific hooks */ |
@@ -1822,7 +1878,8 @@ static int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) | |||
1822 | bttv_call_i2c_clients(btv, VIDIOCGAUDIO, &va); | 1878 | bttv_call_i2c_clients(btv, VIDIOCGAUDIO, &va); |
1823 | if (t->audmode == V4L2_TUNER_MODE_MONO) | 1879 | if (t->audmode == V4L2_TUNER_MODE_MONO) |
1824 | va.mode = VIDEO_SOUND_MONO; | 1880 | va.mode = VIDEO_SOUND_MONO; |
1825 | else if (t->audmode == V4L2_TUNER_MODE_STEREO) | 1881 | else if (t->audmode == V4L2_TUNER_MODE_STEREO || |
1882 | t->audmode == V4L2_TUNER_MODE_LANG1_LANG2) | ||
1826 | va.mode = VIDEO_SOUND_STEREO; | 1883 | va.mode = VIDEO_SOUND_STEREO; |
1827 | else if (t->audmode == V4L2_TUNER_MODE_LANG1) | 1884 | else if (t->audmode == V4L2_TUNER_MODE_LANG1) |
1828 | va.mode = VIDEO_SOUND_LANG1; | 1885 | va.mode = VIDEO_SOUND_LANG1; |
@@ -2496,7 +2553,7 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2496 | field = (vm->height > bttv_tvnorms[btv->tvnorm].sheight/2) | 2553 | field = (vm->height > bttv_tvnorms[btv->tvnorm].sheight/2) |
2497 | ? V4L2_FIELD_INTERLACED | 2554 | ? V4L2_FIELD_INTERLACED |
2498 | : V4L2_FIELD_BOTTOM; | 2555 | : V4L2_FIELD_BOTTOM; |
2499 | retval = bttv_prepare_buffer(btv,buf, | 2556 | retval = bttv_prepare_buffer(&fh->cap,btv,buf, |
2500 | format_by_palette(vm->format), | 2557 | format_by_palette(vm->format), |
2501 | vm->width,vm->height,field); | 2558 | vm->width,vm->height,field); |
2502 | if (0 != retval) | 2559 | if (0 != retval) |
@@ -2528,8 +2585,8 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file, | |||
2528 | retval = -EIO; | 2585 | retval = -EIO; |
2529 | /* fall through */ | 2586 | /* fall through */ |
2530 | case STATE_DONE: | 2587 | case STATE_DONE: |
2531 | videobuf_dma_pci_sync(btv->c.pci,&buf->vb.dma); | 2588 | videobuf_dma_sync(&fh->cap,&buf->vb.dma); |
2532 | bttv_dma_free(btv,buf); | 2589 | bttv_dma_free(&fh->cap,btv,buf); |
2533 | break; | 2590 | break; |
2534 | default: | 2591 | default: |
2535 | retval = -EINVAL; | 2592 | retval = -EINVAL; |
@@ -3162,8 +3219,8 @@ static int radio_open(struct inode *inode, struct file *file) | |||
3162 | 3219 | ||
3163 | file->private_data = btv; | 3220 | file->private_data = btv; |
3164 | 3221 | ||
3165 | bttv_call_i2c_clients(btv,AUDC_SET_RADIO,&btv->tuner_type); | 3222 | bttv_call_i2c_clients(btv,AUDC_SET_RADIO,NULL); |
3166 | audio_mux(btv,AUDIO_RADIO); | 3223 | audio_input(btv,TVAUDIO_INPUT_RADIO); |
3167 | 3224 | ||
3168 | mutex_unlock(&btv->lock); | 3225 | mutex_unlock(&btv->lock); |
3169 | return 0; | 3226 | return 0; |
@@ -3749,7 +3806,7 @@ static irqreturn_t bttv_irq(int irq, void *dev_id, struct pt_regs * regs) | |||
3749 | bttv_irq_switch_video(btv); | 3806 | bttv_irq_switch_video(btv); |
3750 | 3807 | ||
3751 | if ((astat & BT848_INT_HLOCK) && btv->opt_automute) | 3808 | if ((astat & BT848_INT_HLOCK) && btv->opt_automute) |
3752 | audio_mux(btv, -1); | 3809 | audio_mute(btv, btv->mute); /* trigger automute */ |
3753 | 3810 | ||
3754 | if (astat & (BT848_INT_SCERR|BT848_INT_OCERR)) { | 3811 | if (astat & (BT848_INT_SCERR|BT848_INT_OCERR)) { |
3755 | printk(KERN_INFO "bttv%d: %s%s @ %08x,",btv->c.nr, | 3812 | printk(KERN_INFO "bttv%d: %s%s @ %08x,",btv->c.nr, |
@@ -4050,7 +4107,7 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
4050 | bt848_contrast(btv,32768); | 4107 | bt848_contrast(btv,32768); |
4051 | bt848_hue(btv,32768); | 4108 | bt848_hue(btv,32768); |
4052 | bt848_sat(btv,32768); | 4109 | bt848_sat(btv,32768); |
4053 | audio_mux(btv,AUDIO_MUTE); | 4110 | audio_mute(btv, 1); |
4054 | set_input(btv,0); | 4111 | set_input(btv,0); |
4055 | } | 4112 | } |
4056 | 4113 | ||
diff --git a/drivers/media/video/bttv-gpio.c b/drivers/media/video/bt8xx/bttv-gpio.c index c4d5e2b70c28..c4d5e2b70c28 100644 --- a/drivers/media/video/bttv-gpio.c +++ b/drivers/media/video/bt8xx/bttv-gpio.c | |||
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bt8xx/bttv-i2c.c index 614c12018557..4b562b386fcf 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bt8xx/bttv-i2c.c | |||
@@ -302,6 +302,10 @@ static int attach_inform(struct i2c_client *client) | |||
302 | if (!client->driver->command) | 302 | if (!client->driver->command) |
303 | return 0; | 303 | return 0; |
304 | 304 | ||
305 | if (client->driver->id == I2C_DRIVERID_MSP3400) | ||
306 | btv->i2c_msp34xx_client = client; | ||
307 | if (client->driver->id == I2C_DRIVERID_TVAUDIO) | ||
308 | btv->i2c_tvaudio_client = client; | ||
305 | if (btv->tuner_type != UNSET) { | 309 | if (btv->tuner_type != UNSET) { |
306 | struct tuner_setup tun_setup; | 310 | struct tuner_setup tun_setup; |
307 | 311 | ||
diff --git a/drivers/media/video/bttv-if.c b/drivers/media/video/bt8xx/bttv-if.c index 19b564ab0e92..19b564ab0e92 100644 --- a/drivers/media/video/bttv-if.c +++ b/drivers/media/video/bt8xx/bttv-if.c | |||
diff --git a/drivers/media/video/bttv-input.c b/drivers/media/video/bt8xx/bttv-input.c index 69efa0e5174d..69efa0e5174d 100644 --- a/drivers/media/video/bttv-input.c +++ b/drivers/media/video/bt8xx/bttv-input.c | |||
diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bt8xx/bttv-risc.c index 344f84e9af04..16323a5d68ac 100644 --- a/drivers/media/video/bttv-risc.c +++ b/drivers/media/video/bt8xx/bttv-risc.c | |||
@@ -509,11 +509,11 @@ bttv_risc_hook(struct bttv *btv, int slot, struct btcx_riscmem *risc, | |||
509 | } | 509 | } |
510 | 510 | ||
511 | void | 511 | void |
512 | bttv_dma_free(struct bttv *btv, struct bttv_buffer *buf) | 512 | bttv_dma_free(struct videobuf_queue *q,struct bttv *btv, struct bttv_buffer *buf) |
513 | { | 513 | { |
514 | BUG_ON(in_interrupt()); | 514 | BUG_ON(in_interrupt()); |
515 | videobuf_waiton(&buf->vb,0,0); | 515 | videobuf_waiton(&buf->vb,0,0); |
516 | videobuf_dma_pci_unmap(btv->c.pci, &buf->vb.dma); | 516 | videobuf_dma_unmap(q, &buf->vb.dma); |
517 | videobuf_dma_free(&buf->vb.dma); | 517 | videobuf_dma_free(&buf->vb.dma); |
518 | btcx_riscmem_free(btv->c.pci,&buf->bottom); | 518 | btcx_riscmem_free(btv->c.pci,&buf->bottom); |
519 | btcx_riscmem_free(btv->c.pci,&buf->top); | 519 | btcx_riscmem_free(btv->c.pci,&buf->top); |
diff --git a/drivers/media/video/bttv-vbi.c b/drivers/media/video/bt8xx/bttv-vbi.c index 72afdd64b882..e20ff238e409 100644 --- a/drivers/media/video/bttv-vbi.c +++ b/drivers/media/video/bt8xx/bttv-vbi.c | |||
@@ -96,7 +96,7 @@ static int vbi_buffer_prepare(struct videobuf_queue *q, | |||
96 | return -EINVAL; | 96 | return -EINVAL; |
97 | 97 | ||
98 | if (STATE_NEEDS_INIT == buf->vb.state) { | 98 | if (STATE_NEEDS_INIT == buf->vb.state) { |
99 | if (0 != (rc = videobuf_iolock(btv->c.pci, &buf->vb, NULL))) | 99 | if (0 != (rc = videobuf_iolock(q, &buf->vb, NULL))) |
100 | goto fail; | 100 | goto fail; |
101 | if (0 != (rc = vbi_buffer_risc(btv,buf,fh->lines))) | 101 | if (0 != (rc = vbi_buffer_risc(btv,buf,fh->lines))) |
102 | goto fail; | 102 | goto fail; |
@@ -109,7 +109,7 @@ static int vbi_buffer_prepare(struct videobuf_queue *q, | |||
109 | return 0; | 109 | return 0; |
110 | 110 | ||
111 | fail: | 111 | fail: |
112 | bttv_dma_free(btv,buf); | 112 | bttv_dma_free(q,btv,buf); |
113 | return rc; | 113 | return rc; |
114 | } | 114 | } |
115 | 115 | ||
@@ -136,7 +136,7 @@ static void vbi_buffer_release(struct videobuf_queue *q, struct videobuf_buffer | |||
136 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); | 136 | struct bttv_buffer *buf = container_of(vb,struct bttv_buffer,vb); |
137 | 137 | ||
138 | dprintk("free %p\n",vb); | 138 | dprintk("free %p\n",vb); |
139 | bttv_dma_free(fh->btv,buf); | 139 | bttv_dma_free(&fh->cap,fh->btv,buf); |
140 | } | 140 | } |
141 | 141 | ||
142 | struct videobuf_queue_ops bttv_vbi_qops = { | 142 | struct videobuf_queue_ops bttv_vbi_qops = { |
diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bt8xx/bttv.h index 9908c8e0c951..3a23265c1538 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bt8xx/bttv.h | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/i2c.h> | 18 | #include <linux/i2c.h> |
19 | #include <media/ir-common.h> | 19 | #include <media/ir-common.h> |
20 | #include <media/ir-kbd-i2c.h> | 20 | #include <media/ir-kbd-i2c.h> |
21 | #include <media/i2c-addr.h> | ||
21 | 22 | ||
22 | /* ---------------------------------------------------------- */ | 23 | /* ---------------------------------------------------------- */ |
23 | /* exported by bttv-cards.c */ | 24 | /* exported by bttv-cards.c */ |
@@ -168,25 +169,6 @@ | |||
168 | #define BTTV_BOARD_HAUPPAUGE_IMPACTVCB 0x8f | 169 | #define BTTV_BOARD_HAUPPAUGE_IMPACTVCB 0x8f |
169 | #define BTTV_BOARD_MACHTV_MAGICTV 0x90 | 170 | #define BTTV_BOARD_MACHTV_MAGICTV 0x90 |
170 | 171 | ||
171 | /* i2c address list */ | ||
172 | #define I2C_TSA5522 0xc2 | ||
173 | #define I2C_TDA7432 0x8a | ||
174 | #define I2C_BT832_ALT1 0x88 | ||
175 | #define I2C_BT832_ALT2 0x8a // alternate setting | ||
176 | #define I2C_TDA8425 0x82 | ||
177 | #define I2C_TDA9840 0x84 | ||
178 | #define I2C_TDA9850 0xb6 /* also used by 9855,9873 */ | ||
179 | #define I2C_TDA9874 0xb0 /* also used by 9875 */ | ||
180 | #define I2C_TDA9875 0xb0 | ||
181 | #define I2C_HAUPEE 0xa0 | ||
182 | #define I2C_STBEE 0xae | ||
183 | #define I2C_VHX 0xc0 | ||
184 | #define I2C_MSP3400 0x80 | ||
185 | #define I2C_MSP3400_ALT 0x88 | ||
186 | #define I2C_TEA6300 0x80 /* also used by 6320 */ | ||
187 | #define I2C_DPL3518 0x84 | ||
188 | #define I2C_TDA9887 0x86 | ||
189 | |||
190 | /* more card-specific defines */ | 172 | /* more card-specific defines */ |
191 | #define PT2254_L_CHANNEL 0x10 | 173 | #define PT2254_L_CHANNEL 0x10 |
192 | #define PT2254_R_CHANNEL 0x08 | 174 | #define PT2254_R_CHANNEL 0x08 |
@@ -252,7 +234,8 @@ struct tvcard | |||
252 | unsigned int digital_mode; // DIGITAL_MODE_CAMERA or DIGITAL_MODE_VIDEO | 234 | unsigned int digital_mode; // DIGITAL_MODE_CAMERA or DIGITAL_MODE_VIDEO |
253 | u32 gpiomask; | 235 | u32 gpiomask; |
254 | u32 muxsel[16]; | 236 | u32 muxsel[16]; |
255 | u32 audiomux[6]; /* Tuner, Radio, external, internal, mute, stereo */ | 237 | u32 gpiomux[4]; /* Tuner, Radio, external, internal */ |
238 | u32 gpiomute; /* GPIO mute setting */ | ||
256 | u32 gpiomask2; /* GPIO MUX mask */ | 239 | u32 gpiomask2; /* GPIO MUX mask */ |
257 | 240 | ||
258 | /* i2c audio flags */ | 241 | /* i2c audio flags */ |
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bt8xx/bttvp.h index 9cb72f176f7d..ee989d2e15d9 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bt8xx/bttvp.h | |||
@@ -41,7 +41,6 @@ | |||
41 | 41 | ||
42 | #include <linux/device.h> | 42 | #include <linux/device.h> |
43 | #include <media/video-buf.h> | 43 | #include <media/video-buf.h> |
44 | #include <media/audiochip.h> | ||
45 | #include <media/tuner.h> | 44 | #include <media/tuner.h> |
46 | #include <media/tveeprom.h> | 45 | #include <media/tveeprom.h> |
47 | #include <media/ir-common.h> | 46 | #include <media/ir-common.h> |
@@ -190,7 +189,8 @@ int bttv_buffer_activate_video(struct bttv *btv, | |||
190 | struct bttv_buffer_set *set); | 189 | struct bttv_buffer_set *set); |
191 | int bttv_buffer_activate_vbi(struct bttv *btv, | 190 | int bttv_buffer_activate_vbi(struct bttv *btv, |
192 | struct bttv_buffer *vbi); | 191 | struct bttv_buffer *vbi); |
193 | void bttv_dma_free(struct bttv *btv, struct bttv_buffer *buf); | 192 | void bttv_dma_free(struct videobuf_queue *q, struct bttv *btv, |
193 | struct bttv_buffer *buf); | ||
194 | 194 | ||
195 | /* overlay handling */ | 195 | /* overlay handling */ |
196 | int bttv_overlay_risc(struct bttv *btv, struct bttv_overlay *ov, | 196 | int bttv_overlay_risc(struct bttv *btv, struct bttv_overlay *ov, |
@@ -298,6 +298,8 @@ struct bttv { | |||
298 | int i2c_state, i2c_rc; | 298 | int i2c_state, i2c_rc; |
299 | int i2c_done; | 299 | int i2c_done; |
300 | wait_queue_head_t i2c_queue; | 300 | wait_queue_head_t i2c_queue; |
301 | struct i2c_client *i2c_msp34xx_client; | ||
302 | struct i2c_client *i2c_tvaudio_client; | ||
301 | 303 | ||
302 | /* video4linux (1) */ | 304 | /* video4linux (1) */ |
303 | struct video_device *video_dev; | 305 | struct video_device *video_dev; |
@@ -320,6 +322,7 @@ struct bttv { | |||
320 | /* video state */ | 322 | /* video state */ |
321 | unsigned int input; | 323 | unsigned int input; |
322 | unsigned int audio; | 324 | unsigned int audio; |
325 | unsigned int mute; | ||
323 | unsigned long freq; | 326 | unsigned long freq; |
324 | int tvnorm,hue,contrast,bright,saturation; | 327 | int tvnorm,hue,contrast,bright,saturation; |
325 | struct v4l2_framebuffer fbuf; | 328 | struct v4l2_framebuffer fbuf; |
diff --git a/drivers/media/video/bw-qcam.c b/drivers/media/video/bw-qcam.c index d97b7d8ac33d..cf61c590f4ad 100644 --- a/drivers/media/video/bw-qcam.c +++ b/drivers/media/video/bw-qcam.c | |||
@@ -150,7 +150,7 @@ static int qc_calibrate(struct qcam_device *q) | |||
150 | static struct qcam_device *qcam_init(struct parport *port) | 150 | static struct qcam_device *qcam_init(struct parport *port) |
151 | { | 151 | { |
152 | struct qcam_device *q; | 152 | struct qcam_device *q; |
153 | 153 | ||
154 | q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); | 154 | q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); |
155 | if(q==NULL) | 155 | if(q==NULL) |
156 | return NULL; | 156 | return NULL; |
@@ -158,16 +158,16 @@ static struct qcam_device *qcam_init(struct parport *port) | |||
158 | q->pport = port; | 158 | q->pport = port; |
159 | q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL, | 159 | q->pdev = parport_register_device(port, "bw-qcam", NULL, NULL, |
160 | NULL, 0, NULL); | 160 | NULL, 0, NULL); |
161 | if (q->pdev == NULL) | 161 | if (q->pdev == NULL) |
162 | { | 162 | { |
163 | printk(KERN_ERR "bw-qcam: couldn't register for %s.\n", | 163 | printk(KERN_ERR "bw-qcam: couldn't register for %s.\n", |
164 | port->name); | 164 | port->name); |
165 | kfree(q); | 165 | kfree(q); |
166 | return NULL; | 166 | return NULL; |
167 | } | 167 | } |
168 | 168 | ||
169 | memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); | 169 | memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); |
170 | 170 | ||
171 | mutex_init(&q->lock); | 171 | mutex_init(&q->lock); |
172 | 172 | ||
173 | q->port_mode = (QC_ANY | QC_NOTSET); | 173 | q->port_mode = (QC_ANY | QC_NOTSET); |
@@ -236,12 +236,12 @@ static int qc_waithand(struct qcam_device *q, int val) | |||
236 | while (!((status = read_lpstatus(q)) & 8)) | 236 | while (!((status = read_lpstatus(q)) & 8)) |
237 | { | 237 | { |
238 | /* 1000 is enough spins on the I/O for all normal | 238 | /* 1000 is enough spins on the I/O for all normal |
239 | cases, at that point we start to poll slowly | 239 | cases, at that point we start to poll slowly |
240 | until the camera wakes up. However, we are | 240 | until the camera wakes up. However, we are |
241 | busy blocked until the camera responds, so | 241 | busy blocked until the camera responds, so |
242 | setting it lower is much better for interactive | 242 | setting it lower is much better for interactive |
243 | response. */ | 243 | response. */ |
244 | 244 | ||
245 | if(runs++>maxpoll) | 245 | if(runs++>maxpoll) |
246 | { | 246 | { |
247 | msleep_interruptible(5); | 247 | msleep_interruptible(5); |
@@ -255,12 +255,12 @@ static int qc_waithand(struct qcam_device *q, int val) | |||
255 | while (((status = read_lpstatus(q)) & 8)) | 255 | while (((status = read_lpstatus(q)) & 8)) |
256 | { | 256 | { |
257 | /* 1000 is enough spins on the I/O for all normal | 257 | /* 1000 is enough spins on the I/O for all normal |
258 | cases, at that point we start to poll slowly | 258 | cases, at that point we start to poll slowly |
259 | until the camera wakes up. However, we are | 259 | until the camera wakes up. However, we are |
260 | busy blocked until the camera responds, so | 260 | busy blocked until the camera responds, so |
261 | setting it lower is much better for interactive | 261 | setting it lower is much better for interactive |
262 | response. */ | 262 | response. */ |
263 | 263 | ||
264 | if(runs++>maxpoll) | 264 | if(runs++>maxpoll) |
265 | { | 265 | { |
266 | msleep_interruptible(5); | 266 | msleep_interruptible(5); |
@@ -282,17 +282,17 @@ static unsigned int qc_waithand2(struct qcam_device *q, int val) | |||
282 | { | 282 | { |
283 | unsigned int status; | 283 | unsigned int status; |
284 | int runs=0; | 284 | int runs=0; |
285 | 285 | ||
286 | do | 286 | do |
287 | { | 287 | { |
288 | status = read_lpdata(q); | 288 | status = read_lpdata(q); |
289 | /* 1000 is enough spins on the I/O for all normal | 289 | /* 1000 is enough spins on the I/O for all normal |
290 | cases, at that point we start to poll slowly | 290 | cases, at that point we start to poll slowly |
291 | until the camera wakes up. However, we are | 291 | until the camera wakes up. However, we are |
292 | busy blocked until the camera responds, so | 292 | busy blocked until the camera responds, so |
293 | setting it lower is much better for interactive | 293 | setting it lower is much better for interactive |
294 | response. */ | 294 | response. */ |
295 | 295 | ||
296 | if(runs++>maxpoll) | 296 | if(runs++>maxpoll) |
297 | { | 297 | { |
298 | msleep_interruptible(5); | 298 | msleep_interruptible(5); |
@@ -321,7 +321,7 @@ static int qc_detect(struct qcam_device *q) | |||
321 | 321 | ||
322 | lastreg = reg = read_lpstatus(q) & 0xf0; | 322 | lastreg = reg = read_lpstatus(q) & 0xf0; |
323 | 323 | ||
324 | for (i = 0; i < 500; i++) | 324 | for (i = 0; i < 500; i++) |
325 | { | 325 | { |
326 | reg = read_lpstatus(q) & 0xf0; | 326 | reg = read_lpstatus(q) & 0xf0; |
327 | if (reg != lastreg) | 327 | if (reg != lastreg) |
@@ -357,7 +357,7 @@ static int qc_detect(struct qcam_device *q) | |||
357 | 357 | ||
358 | static void qc_reset(struct qcam_device *q) | 358 | static void qc_reset(struct qcam_device *q) |
359 | { | 359 | { |
360 | switch (q->port_mode & QC_FORCE_MASK) | 360 | switch (q->port_mode & QC_FORCE_MASK) |
361 | { | 361 | { |
362 | case QC_FORCE_UNIDIR: | 362 | case QC_FORCE_UNIDIR: |
363 | q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; | 363 | q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_UNIDIR; |
@@ -370,7 +370,7 @@ static void qc_reset(struct qcam_device *q) | |||
370 | case QC_ANY: | 370 | case QC_ANY: |
371 | write_lpcontrol(q, 0x20); | 371 | write_lpcontrol(q, 0x20); |
372 | write_lpdata(q, 0x75); | 372 | write_lpdata(q, 0x75); |
373 | 373 | ||
374 | if (read_lpdata(q) != 0x75) { | 374 | if (read_lpdata(q) != 0x75) { |
375 | q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; | 375 | q->port_mode = (q->port_mode & ~QC_MODE_MASK) | QC_BIDIR; |
376 | } else { | 376 | } else { |
@@ -398,8 +398,8 @@ static void qc_reset(struct qcam_device *q) | |||
398 | static int qc_setscanmode(struct qcam_device *q) | 398 | static int qc_setscanmode(struct qcam_device *q) |
399 | { | 399 | { |
400 | int old_mode = q->mode; | 400 | int old_mode = q->mode; |
401 | 401 | ||
402 | switch (q->transfer_scale) | 402 | switch (q->transfer_scale) |
403 | { | 403 | { |
404 | case 1: | 404 | case 1: |
405 | q->mode = 0; | 405 | q->mode = 0; |
@@ -412,7 +412,7 @@ static int qc_setscanmode(struct qcam_device *q) | |||
412 | break; | 412 | break; |
413 | } | 413 | } |
414 | 414 | ||
415 | switch (q->bpp) | 415 | switch (q->bpp) |
416 | { | 416 | { |
417 | case 4: | 417 | case 4: |
418 | break; | 418 | break; |
@@ -421,7 +421,7 @@ static int qc_setscanmode(struct qcam_device *q) | |||
421 | break; | 421 | break; |
422 | } | 422 | } |
423 | 423 | ||
424 | switch (q->port_mode & QC_MODE_MASK) | 424 | switch (q->port_mode & QC_MODE_MASK) |
425 | { | 425 | { |
426 | case QC_BIDIR: | 426 | case QC_BIDIR: |
427 | q->mode += 1; | 427 | q->mode += 1; |
@@ -430,10 +430,10 @@ static int qc_setscanmode(struct qcam_device *q) | |||
430 | case QC_UNIDIR: | 430 | case QC_UNIDIR: |
431 | break; | 431 | break; |
432 | } | 432 | } |
433 | 433 | ||
434 | if (q->mode != old_mode) | 434 | if (q->mode != old_mode) |
435 | q->status |= QC_PARAM_CHANGE; | 435 | q->status |= QC_PARAM_CHANGE; |
436 | 436 | ||
437 | return 0; | 437 | return 0; |
438 | } | 438 | } |
439 | 439 | ||
@@ -451,7 +451,7 @@ static void qc_set(struct qcam_device *q) | |||
451 | /* Set the brightness. Yes, this is repetitive, but it works. | 451 | /* Set the brightness. Yes, this is repetitive, but it works. |
452 | * Shorter versions seem to fail subtly. Feel free to try :-). */ | 452 | * Shorter versions seem to fail subtly. Feel free to try :-). */ |
453 | /* I think the problem was in qc_command, not here -- bls */ | 453 | /* I think the problem was in qc_command, not here -- bls */ |
454 | 454 | ||
455 | qc_command(q, 0xb); | 455 | qc_command(q, 0xb); |
456 | qc_command(q, q->brightness); | 456 | qc_command(q, q->brightness); |
457 | 457 | ||
@@ -502,13 +502,13 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) | |||
502 | unsigned int hi2, lo2; | 502 | unsigned int hi2, lo2; |
503 | static int state = 0; | 503 | static int state = 0; |
504 | 504 | ||
505 | if (buffer == NULL) | 505 | if (buffer == NULL) |
506 | { | 506 | { |
507 | state = 0; | 507 | state = 0; |
508 | return 0; | 508 | return 0; |
509 | } | 509 | } |
510 | 510 | ||
511 | switch (q->port_mode & QC_MODE_MASK) | 511 | switch (q->port_mode & QC_MODE_MASK) |
512 | { | 512 | { |
513 | case QC_BIDIR: /* Bi-directional Port */ | 513 | case QC_BIDIR: /* Bi-directional Port */ |
514 | write_lpcontrol(q, 0x26); | 514 | write_lpcontrol(q, 0x26); |
@@ -517,7 +517,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) | |||
517 | write_lpcontrol(q, 0x2e); | 517 | write_lpcontrol(q, 0x2e); |
518 | lo2 = (qc_waithand2(q, 0) >> 1); | 518 | lo2 = (qc_waithand2(q, 0) >> 1); |
519 | hi2 = (read_lpstatus(q) >> 3) & 0x1f; | 519 | hi2 = (read_lpstatus(q) >> 3) & 0x1f; |
520 | switch (q->bpp) | 520 | switch (q->bpp) |
521 | { | 521 | { |
522 | case 4: | 522 | case 4: |
523 | buffer[0] = lo & 0xf; | 523 | buffer[0] = lo & 0xf; |
@@ -544,7 +544,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) | |||
544 | write_lpcontrol(q, 0xe); | 544 | write_lpcontrol(q, 0xe); |
545 | hi = (qc_waithand(q, 0) & 0xf0) >> 4; | 545 | hi = (qc_waithand(q, 0) & 0xf0) >> 4; |
546 | 546 | ||
547 | switch (q->bpp) | 547 | switch (q->bpp) |
548 | { | 548 | { |
549 | case 4: | 549 | case 4: |
550 | buffer[0] = lo; | 550 | buffer[0] = lo; |
@@ -552,7 +552,7 @@ static inline int qc_readbytes(struct qcam_device *q, char buffer[]) | |||
552 | ret = 2; | 552 | ret = 2; |
553 | break; | 553 | break; |
554 | case 6: | 554 | case 6: |
555 | switch (state) | 555 | switch (state) |
556 | { | 556 | { |
557 | case 0: | 557 | case 0: |
558 | buffer[0] = (lo << 2) | ((hi & 0xc) >> 2); | 558 | buffer[0] = (lo << 2) | ((hi & 0xc) >> 2); |
@@ -604,13 +604,13 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l | |||
604 | int shift=8-q->bpp; | 604 | int shift=8-q->bpp; |
605 | char invert; | 605 | char invert; |
606 | 606 | ||
607 | if (q->mode == -1) | 607 | if (q->mode == -1) |
608 | return -ENXIO; | 608 | return -ENXIO; |
609 | 609 | ||
610 | qc_command(q, 0x7); | 610 | qc_command(q, 0x7); |
611 | qc_command(q, q->mode); | 611 | qc_command(q, q->mode); |
612 | 612 | ||
613 | if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) | 613 | if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) |
614 | { | 614 | { |
615 | write_lpcontrol(q, 0x2e); /* turn port around */ | 615 | write_lpcontrol(q, 0x2e); /* turn port around */ |
616 | write_lpcontrol(q, 0x26); | 616 | write_lpcontrol(q, 0x26); |
@@ -618,7 +618,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l | |||
618 | write_lpcontrol(q, 0x2e); | 618 | write_lpcontrol(q, 0x2e); |
619 | (void) qc_waithand(q, 0); | 619 | (void) qc_waithand(q, 0); |
620 | } | 620 | } |
621 | 621 | ||
622 | /* strange -- should be 15:63 below, but 4bpp is odd */ | 622 | /* strange -- should be 15:63 below, but 4bpp is odd */ |
623 | invert = (q->bpp == 4) ? 16 : 63; | 623 | invert = (q->bpp == 4) ? 16 : 63; |
624 | 624 | ||
@@ -629,15 +629,15 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l | |||
629 | q->transfer_scale; | 629 | q->transfer_scale; |
630 | transperline = (transperline + divisor - 1) / divisor; | 630 | transperline = (transperline + divisor - 1) / divisor; |
631 | 631 | ||
632 | for (i = 0, yield = yieldlines; i < linestotrans; i++) | 632 | for (i = 0, yield = yieldlines; i < linestotrans; i++) |
633 | { | 633 | { |
634 | for (pixels_read = j = 0; j < transperline; j++) | 634 | for (pixels_read = j = 0; j < transperline; j++) |
635 | { | 635 | { |
636 | bytes = qc_readbytes(q, buffer); | 636 | bytes = qc_readbytes(q, buffer); |
637 | for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) | 637 | for (k = 0; k < bytes && (pixels_read + k) < pixels_per_line; k++) |
638 | { | 638 | { |
639 | int o; | 639 | int o; |
640 | if (buffer[k] == 0 && invert == 16) | 640 | if (buffer[k] == 0 && invert == 16) |
641 | { | 641 | { |
642 | /* 4bpp is odd (again) -- inverter is 16, not 15, but output | 642 | /* 4bpp is odd (again) -- inverter is 16, not 15, but output |
643 | must be 0-15 -- bls */ | 643 | must be 0-15 -- bls */ |
@@ -653,7 +653,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l | |||
653 | pixels_read += bytes; | 653 | pixels_read += bytes; |
654 | } | 654 | } |
655 | (void) qc_readbytes(q, NULL); /* reset state machine */ | 655 | (void) qc_readbytes(q, NULL); /* reset state machine */ |
656 | 656 | ||
657 | /* Grabbing an entire frame from the quickcam is a lengthy | 657 | /* Grabbing an entire frame from the quickcam is a lengthy |
658 | process. We don't (usually) want to busy-block the | 658 | process. We don't (usually) want to busy-block the |
659 | processor for the entire frame. yieldlines is a module | 659 | processor for the entire frame. yieldlines is a module |
@@ -666,7 +666,7 @@ static long qc_capture(struct qcam_device * q, char __user *buf, unsigned long l | |||
666 | } | 666 | } |
667 | } | 667 | } |
668 | 668 | ||
669 | if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) | 669 | if ((q->port_mode & QC_MODE_MASK) == QC_BIDIR) |
670 | { | 670 | { |
671 | write_lpcontrol(q, 2); | 671 | write_lpcontrol(q, 2); |
672 | write_lpcontrol(q, 6); | 672 | write_lpcontrol(q, 6); |
@@ -687,7 +687,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
687 | { | 687 | { |
688 | struct video_device *dev = video_devdata(file); | 688 | struct video_device *dev = video_devdata(file); |
689 | struct qcam_device *qcam=(struct qcam_device *)dev; | 689 | struct qcam_device *qcam=(struct qcam_device *)dev; |
690 | 690 | ||
691 | switch(cmd) | 691 | switch(cmd) |
692 | { | 692 | { |
693 | case VIDIOCGCAP: | 693 | case VIDIOCGCAP: |
@@ -762,7 +762,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
762 | return -EINVAL; | 762 | return -EINVAL; |
763 | if(p->depth!=4 && p->depth!=6) | 763 | if(p->depth!=4 && p->depth!=6) |
764 | return -EINVAL; | 764 | return -EINVAL; |
765 | 765 | ||
766 | /* | 766 | /* |
767 | * Now load the camera. | 767 | * Now load the camera. |
768 | */ | 768 | */ |
@@ -790,11 +790,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
790 | return -EINVAL; | 790 | return -EINVAL; |
791 | if(vw->width<80||vw->width>320) | 791 | if(vw->width<80||vw->width>320) |
792 | return -EINVAL; | 792 | return -EINVAL; |
793 | 793 | ||
794 | qcam->width = 320; | 794 | qcam->width = 320; |
795 | qcam->height = 240; | 795 | qcam->height = 240; |
796 | qcam->transfer_scale = 4; | 796 | qcam->transfer_scale = 4; |
797 | 797 | ||
798 | if(vw->width>=160 && vw->height>=120) | 798 | if(vw->width>=160 && vw->height>=120) |
799 | { | 799 | { |
800 | qcam->transfer_scale = 2; | 800 | qcam->transfer_scale = 2; |
@@ -808,11 +808,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
808 | mutex_lock(&qcam->lock); | 808 | mutex_lock(&qcam->lock); |
809 | qc_setscanmode(qcam); | 809 | qc_setscanmode(qcam); |
810 | mutex_unlock(&qcam->lock); | 810 | mutex_unlock(&qcam->lock); |
811 | 811 | ||
812 | /* We must update the camera before we grab. We could | 812 | /* We must update the camera before we grab. We could |
813 | just have changed the grab size */ | 813 | just have changed the grab size */ |
814 | qcam->status |= QC_PARAM_CHANGE; | 814 | qcam->status |= QC_PARAM_CHANGE; |
815 | 815 | ||
816 | /* Ok we figured out what to use from our wide choice */ | 816 | /* Ok we figured out what to use from our wide choice */ |
817 | return 0; | 817 | return 0; |
818 | } | 818 | } |
@@ -853,9 +853,9 @@ static ssize_t qcam_read(struct file *file, char __user *buf, | |||
853 | struct qcam_device *qcam=(struct qcam_device *)v; | 853 | struct qcam_device *qcam=(struct qcam_device *)v; |
854 | int len; | 854 | int len; |
855 | parport_claim_or_block(qcam->pdev); | 855 | parport_claim_or_block(qcam->pdev); |
856 | 856 | ||
857 | mutex_lock(&qcam->lock); | 857 | mutex_lock(&qcam->lock); |
858 | 858 | ||
859 | qc_reset(qcam); | 859 | qc_reset(qcam); |
860 | 860 | ||
861 | /* Update the camera parameters if we need to */ | 861 | /* Update the camera parameters if we need to */ |
@@ -863,13 +863,13 @@ static ssize_t qcam_read(struct file *file, char __user *buf, | |||
863 | qc_set(qcam); | 863 | qc_set(qcam); |
864 | 864 | ||
865 | len=qc_capture(qcam, buf,count); | 865 | len=qc_capture(qcam, buf,count); |
866 | 866 | ||
867 | mutex_unlock(&qcam->lock); | 867 | mutex_unlock(&qcam->lock); |
868 | 868 | ||
869 | parport_release(qcam->pdev); | 869 | parport_release(qcam->pdev); |
870 | return len; | 870 | return len; |
871 | } | 871 | } |
872 | 872 | ||
873 | static struct file_operations qcam_fops = { | 873 | static struct file_operations qcam_fops = { |
874 | .owner = THIS_MODULE, | 874 | .owner = THIS_MODULE, |
875 | .open = video_exclusive_open, | 875 | .open = video_exclusive_open, |
@@ -905,11 +905,11 @@ static int init_bwqcam(struct parport *port) | |||
905 | qcam=qcam_init(port); | 905 | qcam=qcam_init(port); |
906 | if(qcam==NULL) | 906 | if(qcam==NULL) |
907 | return -ENODEV; | 907 | return -ENODEV; |
908 | 908 | ||
909 | parport_claim_or_block(qcam->pdev); | 909 | parport_claim_or_block(qcam->pdev); |
910 | 910 | ||
911 | qc_reset(qcam); | 911 | qc_reset(qcam); |
912 | 912 | ||
913 | if(qc_detect(qcam)==0) | 913 | if(qc_detect(qcam)==0) |
914 | { | 914 | { |
915 | parport_release(qcam->pdev); | 915 | parport_release(qcam->pdev); |
@@ -920,9 +920,9 @@ static int init_bwqcam(struct parport *port) | |||
920 | qc_calibrate(qcam); | 920 | qc_calibrate(qcam); |
921 | 921 | ||
922 | parport_release(qcam->pdev); | 922 | parport_release(qcam->pdev); |
923 | 923 | ||
924 | printk(KERN_INFO "Connectix Quickcam on %s\n", qcam->pport->name); | 924 | printk(KERN_INFO "Connectix Quickcam on %s\n", qcam->pport->name); |
925 | 925 | ||
926 | if(video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) | 926 | if(video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) |
927 | { | 927 | { |
928 | parport_unregister_device(qcam->pdev); | 928 | parport_unregister_device(qcam->pdev); |
@@ -1013,7 +1013,7 @@ static int __init init_bw_qcams(void) | |||
1013 | printk("Connectix Quickcam max-poll was above 5000. Using 5000.\n"); | 1013 | printk("Connectix Quickcam max-poll was above 5000. Using 5000.\n"); |
1014 | maxpoll = 5000; | 1014 | maxpoll = 5000; |
1015 | } | 1015 | } |
1016 | 1016 | ||
1017 | if (yieldlines < 1) { | 1017 | if (yieldlines < 1) { |
1018 | printk("Connectix Quickcam yieldlines was less than 1. Using 1.\n"); | 1018 | printk("Connectix Quickcam yieldlines was less than 1. Using 1.\n"); |
1019 | yieldlines = 1; | 1019 | yieldlines = 1; |
diff --git a/drivers/media/video/c-qcam.c b/drivers/media/video/c-qcam.c index 8211fd8d7cbf..22a7386bbea6 100644 --- a/drivers/media/video/c-qcam.c +++ b/drivers/media/video/c-qcam.c | |||
@@ -16,7 +16,7 @@ | |||
16 | * | 16 | * |
17 | * The parport parameter controls which parports will be scanned. | 17 | * The parport parameter controls which parports will be scanned. |
18 | * Scanning all parports causes some printers to print a garbage page. | 18 | * Scanning all parports causes some printers to print a garbage page. |
19 | * -- March 14, 1999 Billy Donahue <billy@escape.com> | 19 | * -- March 14, 1999 Billy Donahue <billy@escape.com> |
20 | * | 20 | * |
21 | * Fixed data format to BGR, added force_rgb parameter. Added missing | 21 | * Fixed data format to BGR, added force_rgb parameter. Added missing |
22 | * parport_unregister_driver() on module removal. | 22 | * parport_unregister_driver() on module removal. |
@@ -88,7 +88,7 @@ static inline unsigned int qcam_ready2(struct qcam_device *qcam) | |||
88 | return (parport_read_data(qcam->pport) & 0x1)?1:0; | 88 | return (parport_read_data(qcam->pport) & 0x1)?1:0; |
89 | } | 89 | } |
90 | 90 | ||
91 | static unsigned int qcam_await_ready1(struct qcam_device *qcam, | 91 | static unsigned int qcam_await_ready1(struct qcam_device *qcam, |
92 | int value) | 92 | int value) |
93 | { | 93 | { |
94 | unsigned long oldjiffies = jiffies; | 94 | unsigned long oldjiffies = jiffies; |
@@ -98,7 +98,7 @@ static unsigned int qcam_await_ready1(struct qcam_device *qcam, | |||
98 | if (qcam_ready1(qcam) == value) | 98 | if (qcam_ready1(qcam) == value) |
99 | return 0; | 99 | return 0; |
100 | 100 | ||
101 | /* If the camera didn't respond within 1/25 second, poll slowly | 101 | /* If the camera didn't respond within 1/25 second, poll slowly |
102 | for a while. */ | 102 | for a while. */ |
103 | for (i = 0; i < 50; i++) | 103 | for (i = 0; i < 50; i++) |
104 | { | 104 | { |
@@ -123,7 +123,7 @@ static unsigned int qcam_await_ready2(struct qcam_device *qcam, int value) | |||
123 | if (qcam_ready2(qcam) == value) | 123 | if (qcam_ready2(qcam) == value) |
124 | return 0; | 124 | return 0; |
125 | 125 | ||
126 | /* If the camera didn't respond within 1/25 second, poll slowly | 126 | /* If the camera didn't respond within 1/25 second, poll slowly |
127 | for a while. */ | 127 | for a while. */ |
128 | for (i = 0; i < 50; i++) | 128 | for (i = 0; i < 50; i++) |
129 | { | 129 | { |
@@ -157,12 +157,12 @@ static int qcam_write_data(struct qcam_device *qcam, unsigned int data) | |||
157 | unsigned int idata; | 157 | unsigned int idata; |
158 | parport_write_data(qcam->pport, data); | 158 | parport_write_data(qcam->pport, data); |
159 | idata = qcam_read_data(qcam); | 159 | idata = qcam_read_data(qcam); |
160 | if (data != idata) | 160 | if (data != idata) |
161 | { | 161 | { |
162 | printk(KERN_WARNING "cqcam: sent %x but received %x\n", data, | 162 | printk(KERN_WARNING "cqcam: sent %x but received %x\n", data, |
163 | idata); | 163 | idata); |
164 | return 1; | 164 | return 1; |
165 | } | 165 | } |
166 | return 0; | 166 | return 0; |
167 | } | 167 | } |
168 | 168 | ||
@@ -193,12 +193,12 @@ static int qc_detect(struct qcam_device *qcam) | |||
193 | no device was found". Fix this one day. */ | 193 | no device was found". Fix this one day. */ |
194 | if (qcam->pport->probe_info[0].class == PARPORT_CLASS_MEDIA | 194 | if (qcam->pport->probe_info[0].class == PARPORT_CLASS_MEDIA |
195 | && qcam->pport->probe_info[0].model | 195 | && qcam->pport->probe_info[0].model |
196 | && !strcmp(qcam->pdev->port->probe_info[0].model, | 196 | && !strcmp(qcam->pdev->port->probe_info[0].model, |
197 | "Color QuickCam 2.0")) { | 197 | "Color QuickCam 2.0")) { |
198 | printk(KERN_DEBUG "QuickCam: Found by IEEE1284 probe.\n"); | 198 | printk(KERN_DEBUG "QuickCam: Found by IEEE1284 probe.\n"); |
199 | return 1; | 199 | return 1; |
200 | } | 200 | } |
201 | 201 | ||
202 | if (probe < 2) | 202 | if (probe < 2) |
203 | return 0; | 203 | return 0; |
204 | 204 | ||
@@ -206,11 +206,11 @@ static int qc_detect(struct qcam_device *qcam) | |||
206 | 206 | ||
207 | /* look for a heartbeat */ | 207 | /* look for a heartbeat */ |
208 | ostat = stat = parport_read_status(qcam->pport); | 208 | ostat = stat = parport_read_status(qcam->pport); |
209 | for (i=0; i<250; i++) | 209 | for (i=0; i<250; i++) |
210 | { | 210 | { |
211 | mdelay(1); | 211 | mdelay(1); |
212 | stat = parport_read_status(qcam->pport); | 212 | stat = parport_read_status(qcam->pport); |
213 | if (ostat != stat) | 213 | if (ostat != stat) |
214 | { | 214 | { |
215 | if (++count >= 3) return 1; | 215 | if (++count >= 3) return 1; |
216 | ostat = stat; | 216 | ostat = stat; |
@@ -226,11 +226,11 @@ static int qc_detect(struct qcam_device *qcam) | |||
226 | count = 0; | 226 | count = 0; |
227 | 227 | ||
228 | ostat = stat = parport_read_status(qcam->pport); | 228 | ostat = stat = parport_read_status(qcam->pport); |
229 | for (i=0; i<250; i++) | 229 | for (i=0; i<250; i++) |
230 | { | 230 | { |
231 | mdelay(1); | 231 | mdelay(1); |
232 | stat = parport_read_status(qcam->pport); | 232 | stat = parport_read_status(qcam->pport); |
233 | if (ostat != stat) | 233 | if (ostat != stat) |
234 | { | 234 | { |
235 | if (++count >= 3) return 1; | 235 | if (++count >= 3) return 1; |
236 | ostat = stat; | 236 | ostat = stat; |
@@ -247,7 +247,7 @@ static void qc_reset(struct qcam_device *qcam) | |||
247 | parport_write_control(qcam->pport, 0x8); | 247 | parport_write_control(qcam->pport, 0x8); |
248 | mdelay(1); | 248 | mdelay(1); |
249 | parport_write_control(qcam->pport, 0xc); | 249 | parport_write_control(qcam->pport, 0xc); |
250 | mdelay(1); | 250 | mdelay(1); |
251 | } | 251 | } |
252 | 252 | ||
253 | /* Reset the QuickCam and program for brightness, contrast, | 253 | /* Reset the QuickCam and program for brightness, contrast, |
@@ -258,7 +258,7 @@ static void qc_setup(struct qcam_device *q) | |||
258 | qc_reset(q); | 258 | qc_reset(q); |
259 | 259 | ||
260 | /* Set the brightness. */ | 260 | /* Set the brightness. */ |
261 | qcam_set(q, 11, q->brightness); | 261 | qcam_set(q, 11, q->brightness); |
262 | 262 | ||
263 | /* Set the height and width. These refer to the actual | 263 | /* Set the height and width. These refer to the actual |
264 | CCD area *before* applying the selected decimation. */ | 264 | CCD area *before* applying the selected decimation. */ |
@@ -272,12 +272,12 @@ static void qc_setup(struct qcam_device *q) | |||
272 | /* Set contrast and white balance. */ | 272 | /* Set contrast and white balance. */ |
273 | qcam_set(q, 0x19, q->contrast); | 273 | qcam_set(q, 0x19, q->contrast); |
274 | qcam_set(q, 0x1f, q->whitebal); | 274 | qcam_set(q, 0x1f, q->whitebal); |
275 | 275 | ||
276 | /* Set the speed. */ | 276 | /* Set the speed. */ |
277 | qcam_set(q, 45, 2); | 277 | qcam_set(q, 45, 2); |
278 | } | 278 | } |
279 | 279 | ||
280 | /* Read some bytes from the camera and put them in the buffer. | 280 | /* Read some bytes from the camera and put them in the buffer. |
281 | nbytes should be a multiple of 3, because bidirectional mode gives | 281 | nbytes should be a multiple of 3, because bidirectional mode gives |
282 | us three bytes at a time. */ | 282 | us three bytes at a time. */ |
283 | 283 | ||
@@ -383,7 +383,7 @@ static long qc_capture(struct qcam_device *q, char __user *buf, unsigned long le | |||
383 | 383 | ||
384 | if (qcam_set(q, 7, (q->mode | (is_bi_dir?1:0)) + 1)) | 384 | if (qcam_set(q, 7, (q->mode | (is_bi_dir?1:0)) + 1)) |
385 | return -EIO; | 385 | return -EIO; |
386 | 386 | ||
387 | lines = q->height; | 387 | lines = q->height; |
388 | pixelsperline = q->width; | 388 | pixelsperline = q->width; |
389 | bitsperxfer = (is_bi_dir) ? 24 : 8; | 389 | bitsperxfer = (is_bi_dir) ? 24 : 8; |
@@ -499,7 +499,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
499 | { | 499 | { |
500 | struct video_device *dev = video_devdata(file); | 500 | struct video_device *dev = video_devdata(file); |
501 | struct qcam_device *qcam=(struct qcam_device *)dev; | 501 | struct qcam_device *qcam=(struct qcam_device *)dev; |
502 | 502 | ||
503 | switch(cmd) | 503 | switch(cmd) |
504 | { | 504 | { |
505 | case VIDIOCGCAP: | 505 | case VIDIOCGCAP: |
@@ -574,7 +574,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
574 | */ | 574 | */ |
575 | if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24) | 575 | if (p->depth != 24 || p->palette != VIDEO_PALETTE_RGB24) |
576 | return -EINVAL; | 576 | return -EINVAL; |
577 | 577 | ||
578 | /* | 578 | /* |
579 | * Now load the camera. | 579 | * Now load the camera. |
580 | */ | 580 | */ |
@@ -584,7 +584,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
584 | 584 | ||
585 | mutex_lock(&qcam->lock); | 585 | mutex_lock(&qcam->lock); |
586 | parport_claim_or_block(qcam->pdev); | 586 | parport_claim_or_block(qcam->pdev); |
587 | qc_setup(qcam); | 587 | qc_setup(qcam); |
588 | parport_release(qcam->pdev); | 588 | parport_release(qcam->pdev); |
589 | mutex_unlock(&qcam->lock); | 589 | mutex_unlock(&qcam->lock); |
590 | return 0; | 590 | return 0; |
@@ -601,11 +601,11 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
601 | return -EINVAL; | 601 | return -EINVAL; |
602 | if(vw->width<80||vw->width>320) | 602 | if(vw->width<80||vw->width>320) |
603 | return -EINVAL; | 603 | return -EINVAL; |
604 | 604 | ||
605 | qcam->width = 80; | 605 | qcam->width = 80; |
606 | qcam->height = 60; | 606 | qcam->height = 60; |
607 | qcam->mode = QC_DECIMATION_4; | 607 | qcam->mode = QC_DECIMATION_4; |
608 | 608 | ||
609 | if(vw->width>=160 && vw->height>=120) | 609 | if(vw->width>=160 && vw->height>=120) |
610 | { | 610 | { |
611 | qcam->width = 160; | 611 | qcam->width = 160; |
@@ -627,7 +627,7 @@ static int qcam_do_ioctl(struct inode *inode, struct file *file, | |||
627 | qcam->mode = QC_BILLIONS | QC_DECIMATION_1; | 627 | qcam->mode = QC_BILLIONS | QC_DECIMATION_1; |
628 | } | 628 | } |
629 | #endif | 629 | #endif |
630 | /* Ok we figured out what to use from our | 630 | /* Ok we figured out what to use from our |
631 | wide choice */ | 631 | wide choice */ |
632 | mutex_lock(&qcam->lock); | 632 | mutex_lock(&qcam->lock); |
633 | parport_claim_or_block(qcam->pdev); | 633 | parport_claim_or_block(qcam->pdev); |
@@ -676,7 +676,7 @@ static ssize_t qcam_read(struct file *file, char __user *buf, | |||
676 | mutex_lock(&qcam->lock); | 676 | mutex_lock(&qcam->lock); |
677 | parport_claim_or_block(qcam->pdev); | 677 | parport_claim_or_block(qcam->pdev); |
678 | /* Probably should have a semaphore against multiple users */ | 678 | /* Probably should have a semaphore against multiple users */ |
679 | len = qc_capture(qcam, buf,count); | 679 | len = qc_capture(qcam, buf,count); |
680 | parport_release(qcam->pdev); | 680 | parport_release(qcam->pdev); |
681 | mutex_unlock(&qcam->lock); | 681 | mutex_unlock(&qcam->lock); |
682 | return len; | 682 | return len; |
@@ -707,7 +707,7 @@ static struct video_device qcam_template= | |||
707 | static struct qcam_device *qcam_init(struct parport *port) | 707 | static struct qcam_device *qcam_init(struct parport *port) |
708 | { | 708 | { |
709 | struct qcam_device *q; | 709 | struct qcam_device *q; |
710 | 710 | ||
711 | q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); | 711 | q = kmalloc(sizeof(struct qcam_device), GFP_KERNEL); |
712 | if(q==NULL) | 712 | if(q==NULL) |
713 | return NULL; | 713 | return NULL; |
@@ -718,14 +718,14 @@ static struct qcam_device *qcam_init(struct parport *port) | |||
718 | 718 | ||
719 | q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE)?1:0; | 719 | q->bidirectional = (q->pport->modes & PARPORT_MODE_TRISTATE)?1:0; |
720 | 720 | ||
721 | if (q->pdev == NULL) | 721 | if (q->pdev == NULL) |
722 | { | 722 | { |
723 | printk(KERN_ERR "c-qcam: couldn't register for %s.\n", | 723 | printk(KERN_ERR "c-qcam: couldn't register for %s.\n", |
724 | port->name); | 724 | port->name); |
725 | kfree(q); | 725 | kfree(q); |
726 | return NULL; | 726 | return NULL; |
727 | } | 727 | } |
728 | 728 | ||
729 | memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); | 729 | memcpy(&q->vdev, &qcam_template, sizeof(qcam_template)); |
730 | 730 | ||
731 | mutex_init(&q->lock); | 731 | mutex_init(&q->lock); |
@@ -766,11 +766,11 @@ static int init_cqcam(struct parport *port) | |||
766 | qcam = qcam_init(port); | 766 | qcam = qcam_init(port); |
767 | if (qcam==NULL) | 767 | if (qcam==NULL) |
768 | return -ENODEV; | 768 | return -ENODEV; |
769 | 769 | ||
770 | parport_claim_or_block(qcam->pdev); | 770 | parport_claim_or_block(qcam->pdev); |
771 | 771 | ||
772 | qc_reset(qcam); | 772 | qc_reset(qcam); |
773 | 773 | ||
774 | if (probe && qc_detect(qcam)==0) | 774 | if (probe && qc_detect(qcam)==0) |
775 | { | 775 | { |
776 | parport_release(qcam->pdev); | 776 | parport_release(qcam->pdev); |
@@ -782,7 +782,7 @@ static int init_cqcam(struct parport *port) | |||
782 | qc_setup(qcam); | 782 | qc_setup(qcam); |
783 | 783 | ||
784 | parport_release(qcam->pdev); | 784 | parport_release(qcam->pdev); |
785 | 785 | ||
786 | if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) | 786 | if (video_register_device(&qcam->vdev, VFL_TYPE_GRABBER, video_nr)==-1) |
787 | { | 787 | { |
788 | printk(KERN_ERR "Unable to register Colour QuickCam on %s\n", | 788 | printk(KERN_ERR "Unable to register Colour QuickCam on %s\n", |
@@ -792,9 +792,9 @@ static int init_cqcam(struct parport *port) | |||
792 | return -ENODEV; | 792 | return -ENODEV; |
793 | } | 793 | } |
794 | 794 | ||
795 | printk(KERN_INFO "video%d: Colour QuickCam found on %s\n", | 795 | printk(KERN_INFO "video%d: Colour QuickCam found on %s\n", |
796 | qcam->vdev.minor, qcam->pport->name); | 796 | qcam->vdev.minor, qcam->pport->name); |
797 | 797 | ||
798 | qcams[num_cams++] = qcam; | 798 | qcams[num_cams++] = qcam; |
799 | 799 | ||
800 | return 0; | 800 | return 0; |
diff --git a/drivers/media/video/cpia.c b/drivers/media/video/cpia.c index 3cebfa91ca14..2227c5640c12 100644 --- a/drivers/media/video/cpia.c +++ b/drivers/media/video/cpia.c | |||
@@ -24,7 +24,7 @@ | |||
24 | */ | 24 | */ |
25 | 25 | ||
26 | /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ | 26 | /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ |
27 | /* #define _CPIA_DEBUG_ 1 */ | 27 | /* #define _CPIA_DEBUG_ 1 */ |
28 | 28 | ||
29 | #include <linux/config.h> | 29 | #include <linux/config.h> |
30 | 30 | ||
@@ -67,11 +67,11 @@ MODULE_SUPPORTED_DEVICE("video"); | |||
67 | static unsigned short colorspace_conv = 0; | 67 | static unsigned short colorspace_conv = 0; |
68 | module_param(colorspace_conv, ushort, 0444); | 68 | module_param(colorspace_conv, ushort, 0444); |
69 | MODULE_PARM_DESC(colorspace_conv, | 69 | MODULE_PARM_DESC(colorspace_conv, |
70 | "\n<n> Colorspace conversion:" | 70 | "\n<n> Colorspace conversion:" |
71 | "\n0 = disable" | 71 | "\n0 = disable" |
72 | "\n1 = enable" | 72 | "\n1 = enable" |
73 | "\nDefault value is 0" | 73 | "\nDefault value is 0" |
74 | "\n"); | 74 | "\n"); |
75 | 75 | ||
76 | #define ABOUT "V4L-Driver for Vision CPiA based cameras" | 76 | #define ABOUT "V4L-Driver for Vision CPiA based cameras" |
77 | 77 | ||
@@ -189,8 +189,8 @@ enum { | |||
189 | #define TC 94 | 189 | #define TC 94 |
190 | #define EXP_ACC_DARK 50 | 190 | #define EXP_ACC_DARK 50 |
191 | #define EXP_ACC_LIGHT 90 | 191 | #define EXP_ACC_LIGHT 90 |
192 | #define HIGH_COMP_102 160 | 192 | #define HIGH_COMP_102 160 |
193 | #define MAX_COMP 239 | 193 | #define MAX_COMP 239 |
194 | #define DARK_TIME 3 | 194 | #define DARK_TIME 3 |
195 | #define LIGHT_TIME 3 | 195 | #define LIGHT_TIME 3 |
196 | 196 | ||
@@ -208,7 +208,7 @@ static u8 flicker_jumps[2][2][4] = | |||
208 | static void reset_camera_struct(struct cam_data *cam); | 208 | static void reset_camera_struct(struct cam_data *cam); |
209 | static int find_over_exposure(int brightness); | 209 | static int find_over_exposure(int brightness); |
210 | static void set_flicker(struct cam_params *params, volatile u32 *command_flags, | 210 | static void set_flicker(struct cam_params *params, volatile u32 *command_flags, |
211 | int on); | 211 | int on); |
212 | 212 | ||
213 | 213 | ||
214 | /********************************************************************** | 214 | /********************************************************************** |
@@ -262,7 +262,7 @@ static void rvfree(void *mem, unsigned long size) | |||
262 | static struct proc_dir_entry *cpia_proc_root=NULL; | 262 | static struct proc_dir_entry *cpia_proc_root=NULL; |
263 | 263 | ||
264 | static int cpia_read_proc(char *page, char **start, off_t off, | 264 | static int cpia_read_proc(char *page, char **start, off_t off, |
265 | int count, int *eof, void *data) | 265 | int count, int *eof, void *data) |
266 | { | 266 | { |
267 | char *out = page; | 267 | char *out = page; |
268 | int len, tmp; | 268 | int len, tmp; |
@@ -276,58 +276,58 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
276 | out += sprintf(out, "V4L Driver version: %d.%d.%d\n", | 276 | out += sprintf(out, "V4L Driver version: %d.%d.%d\n", |
277 | CPIA_MAJ_VER, CPIA_MIN_VER, CPIA_PATCH_VER); | 277 | CPIA_MAJ_VER, CPIA_MIN_VER, CPIA_PATCH_VER); |
278 | out += sprintf(out, "CPIA Version: %d.%02d (%d.%d)\n", | 278 | out += sprintf(out, "CPIA Version: %d.%02d (%d.%d)\n", |
279 | cam->params.version.firmwareVersion, | 279 | cam->params.version.firmwareVersion, |
280 | cam->params.version.firmwareRevision, | 280 | cam->params.version.firmwareRevision, |
281 | cam->params.version.vcVersion, | 281 | cam->params.version.vcVersion, |
282 | cam->params.version.vcRevision); | 282 | cam->params.version.vcRevision); |
283 | out += sprintf(out, "CPIA PnP-ID: %04x:%04x:%04x\n", | 283 | out += sprintf(out, "CPIA PnP-ID: %04x:%04x:%04x\n", |
284 | cam->params.pnpID.vendor, cam->params.pnpID.product, | 284 | cam->params.pnpID.vendor, cam->params.pnpID.product, |
285 | cam->params.pnpID.deviceRevision); | 285 | cam->params.pnpID.deviceRevision); |
286 | out += sprintf(out, "VP-Version: %d.%d %04x\n", | 286 | out += sprintf(out, "VP-Version: %d.%d %04x\n", |
287 | cam->params.vpVersion.vpVersion, | 287 | cam->params.vpVersion.vpVersion, |
288 | cam->params.vpVersion.vpRevision, | 288 | cam->params.vpVersion.vpRevision, |
289 | cam->params.vpVersion.cameraHeadID); | 289 | cam->params.vpVersion.cameraHeadID); |
290 | 290 | ||
291 | out += sprintf(out, "system_state: %#04x\n", | 291 | out += sprintf(out, "system_state: %#04x\n", |
292 | cam->params.status.systemState); | 292 | cam->params.status.systemState); |
293 | out += sprintf(out, "grab_state: %#04x\n", | 293 | out += sprintf(out, "grab_state: %#04x\n", |
294 | cam->params.status.grabState); | 294 | cam->params.status.grabState); |
295 | out += sprintf(out, "stream_state: %#04x\n", | 295 | out += sprintf(out, "stream_state: %#04x\n", |
296 | cam->params.status.streamState); | 296 | cam->params.status.streamState); |
297 | out += sprintf(out, "fatal_error: %#04x\n", | 297 | out += sprintf(out, "fatal_error: %#04x\n", |
298 | cam->params.status.fatalError); | 298 | cam->params.status.fatalError); |
299 | out += sprintf(out, "cmd_error: %#04x\n", | 299 | out += sprintf(out, "cmd_error: %#04x\n", |
300 | cam->params.status.cmdError); | 300 | cam->params.status.cmdError); |
301 | out += sprintf(out, "debug_flags: %#04x\n", | 301 | out += sprintf(out, "debug_flags: %#04x\n", |
302 | cam->params.status.debugFlags); | 302 | cam->params.status.debugFlags); |
303 | out += sprintf(out, "vp_status: %#04x\n", | 303 | out += sprintf(out, "vp_status: %#04x\n", |
304 | cam->params.status.vpStatus); | 304 | cam->params.status.vpStatus); |
305 | out += sprintf(out, "error_code: %#04x\n", | 305 | out += sprintf(out, "error_code: %#04x\n", |
306 | cam->params.status.errorCode); | 306 | cam->params.status.errorCode); |
307 | /* QX3 specific entries */ | 307 | /* QX3 specific entries */ |
308 | if (cam->params.qx3.qx3_detected) { | 308 | if (cam->params.qx3.qx3_detected) { |
309 | out += sprintf(out, "button: %4d\n", | 309 | out += sprintf(out, "button: %4d\n", |
310 | cam->params.qx3.button); | 310 | cam->params.qx3.button); |
311 | out += sprintf(out, "cradled: %4d\n", | 311 | out += sprintf(out, "cradled: %4d\n", |
312 | cam->params.qx3.cradled); | 312 | cam->params.qx3.cradled); |
313 | } | 313 | } |
314 | out += sprintf(out, "video_size: %s\n", | 314 | out += sprintf(out, "video_size: %s\n", |
315 | cam->params.format.videoSize == VIDEOSIZE_CIF ? | 315 | cam->params.format.videoSize == VIDEOSIZE_CIF ? |
316 | "CIF " : "QCIF"); | 316 | "CIF " : "QCIF"); |
317 | out += sprintf(out, "roi: (%3d, %3d) to (%3d, %3d)\n", | 317 | out += sprintf(out, "roi: (%3d, %3d) to (%3d, %3d)\n", |
318 | cam->params.roi.colStart*8, | 318 | cam->params.roi.colStart*8, |
319 | cam->params.roi.rowStart*4, | 319 | cam->params.roi.rowStart*4, |
320 | cam->params.roi.colEnd*8, | 320 | cam->params.roi.colEnd*8, |
321 | cam->params.roi.rowEnd*4); | 321 | cam->params.roi.rowEnd*4); |
322 | out += sprintf(out, "actual_fps: %3d\n", cam->fps); | 322 | out += sprintf(out, "actual_fps: %3d\n", cam->fps); |
323 | out += sprintf(out, "transfer_rate: %4dkB/s\n", | 323 | out += sprintf(out, "transfer_rate: %4dkB/s\n", |
324 | cam->transfer_rate); | 324 | cam->transfer_rate); |
325 | 325 | ||
326 | out += sprintf(out, "\nread-write\n"); | 326 | out += sprintf(out, "\nread-write\n"); |
327 | out += sprintf(out, "----------------------- current min" | 327 | out += sprintf(out, "----------------------- current min" |
328 | " max default comment\n"); | 328 | " max default comment\n"); |
329 | out += sprintf(out, "brightness: %8d %8d %8d %8d\n", | 329 | out += sprintf(out, "brightness: %8d %8d %8d %8d\n", |
330 | cam->params.colourParams.brightness, 0, 100, 50); | 330 | cam->params.colourParams.brightness, 0, 100, 50); |
331 | if (cam->params.version.firmwareVersion == 1 && | 331 | if (cam->params.version.firmwareVersion == 1 && |
332 | cam->params.version.firmwareRevision == 2) | 332 | cam->params.version.firmwareRevision == 2) |
333 | /* 1-02 firmware limits contrast to 80 */ | 333 | /* 1-02 firmware limits contrast to 80 */ |
@@ -336,26 +336,26 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
336 | tmp = 96; | 336 | tmp = 96; |
337 | 337 | ||
338 | out += sprintf(out, "contrast: %8d %8d %8d %8d" | 338 | out += sprintf(out, "contrast: %8d %8d %8d %8d" |
339 | " steps of 8\n", | 339 | " steps of 8\n", |
340 | cam->params.colourParams.contrast, 0, tmp, 48); | 340 | cam->params.colourParams.contrast, 0, tmp, 48); |
341 | out += sprintf(out, "saturation: %8d %8d %8d %8d\n", | 341 | out += sprintf(out, "saturation: %8d %8d %8d %8d\n", |
342 | cam->params.colourParams.saturation, 0, 100, 50); | 342 | cam->params.colourParams.saturation, 0, 100, 50); |
343 | tmp = (25000+5000*cam->params.sensorFps.baserate)/ | 343 | tmp = (25000+5000*cam->params.sensorFps.baserate)/ |
344 | (1<<cam->params.sensorFps.divisor); | 344 | (1<<cam->params.sensorFps.divisor); |
345 | out += sprintf(out, "sensor_fps: %4d.%03d %8d %8d %8d\n", | 345 | out += sprintf(out, "sensor_fps: %4d.%03d %8d %8d %8d\n", |
346 | tmp/1000, tmp%1000, 3, 30, 15); | 346 | tmp/1000, tmp%1000, 3, 30, 15); |
347 | out += sprintf(out, "stream_start_line: %8d %8d %8d %8d\n", | 347 | out += sprintf(out, "stream_start_line: %8d %8d %8d %8d\n", |
348 | 2*cam->params.streamStartLine, 0, | 348 | 2*cam->params.streamStartLine, 0, |
349 | cam->params.format.videoSize == VIDEOSIZE_CIF ? 288:144, | 349 | cam->params.format.videoSize == VIDEOSIZE_CIF ? 288:144, |
350 | cam->params.format.videoSize == VIDEOSIZE_CIF ? 240:120); | 350 | cam->params.format.videoSize == VIDEOSIZE_CIF ? 240:120); |
351 | out += sprintf(out, "sub_sample: %8s %8s %8s %8s\n", | 351 | out += sprintf(out, "sub_sample: %8s %8s %8s %8s\n", |
352 | cam->params.format.subSample == SUBSAMPLE_420 ? | 352 | cam->params.format.subSample == SUBSAMPLE_420 ? |
353 | "420" : "422", "420", "422", "422"); | 353 | "420" : "422", "420", "422", "422"); |
354 | out += sprintf(out, "yuv_order: %8s %8s %8s %8s\n", | 354 | out += sprintf(out, "yuv_order: %8s %8s %8s %8s\n", |
355 | cam->params.format.yuvOrder == YUVORDER_YUYV ? | 355 | cam->params.format.yuvOrder == YUVORDER_YUYV ? |
356 | "YUYV" : "UYVY", "YUYV" , "UYVY", "YUYV"); | 356 | "YUYV" : "UYVY", "YUYV" , "UYVY", "YUYV"); |
357 | out += sprintf(out, "ecp_timing: %8s %8s %8s %8s\n", | 357 | out += sprintf(out, "ecp_timing: %8s %8s %8s %8s\n", |
358 | cam->params.ecpTiming ? "slow" : "normal", "slow", | 358 | cam->params.ecpTiming ? "slow" : "normal", "slow", |
359 | "normal", "normal"); | 359 | "normal", "normal"); |
360 | 360 | ||
361 | if (cam->params.colourBalance.balanceMode == 2) { | 361 | if (cam->params.colourBalance.balanceMode == 2) { |
@@ -366,11 +366,11 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
366 | out += sprintf(out, "color_balance_mode: %8s %8s %8s" | 366 | out += sprintf(out, "color_balance_mode: %8s %8s %8s" |
367 | " %8s\n", tmpstr, "manual", "auto", "auto"); | 367 | " %8s\n", tmpstr, "manual", "auto", "auto"); |
368 | out += sprintf(out, "red_gain: %8d %8d %8d %8d\n", | 368 | out += sprintf(out, "red_gain: %8d %8d %8d %8d\n", |
369 | cam->params.colourBalance.redGain, 0, 212, 32); | 369 | cam->params.colourBalance.redGain, 0, 212, 32); |
370 | out += sprintf(out, "green_gain: %8d %8d %8d %8d\n", | 370 | out += sprintf(out, "green_gain: %8d %8d %8d %8d\n", |
371 | cam->params.colourBalance.greenGain, 0, 212, 6); | 371 | cam->params.colourBalance.greenGain, 0, 212, 6); |
372 | out += sprintf(out, "blue_gain: %8d %8d %8d %8d\n", | 372 | out += sprintf(out, "blue_gain: %8d %8d %8d %8d\n", |
373 | cam->params.colourBalance.blueGain, 0, 212, 92); | 373 | cam->params.colourBalance.blueGain, 0, 212, 92); |
374 | 374 | ||
375 | if (cam->params.version.firmwareVersion == 1 && | 375 | if (cam->params.version.firmwareVersion == 1 && |
376 | cam->params.version.firmwareRevision == 2) | 376 | cam->params.version.firmwareRevision == 2) |
@@ -381,11 +381,11 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
381 | 381 | ||
382 | if (cam->params.exposure.gainMode == 0) | 382 | if (cam->params.exposure.gainMode == 0) |
383 | out += sprintf(out, "max_gain: unknown %28s" | 383 | out += sprintf(out, "max_gain: unknown %28s" |
384 | " powers of 2\n", tmpstr); | 384 | " powers of 2\n", tmpstr); |
385 | else | 385 | else |
386 | out += sprintf(out, "max_gain: %8d %28s" | 386 | out += sprintf(out, "max_gain: %8d %28s" |
387 | " 1,2,4 or 8 \n", | 387 | " 1,2,4 or 8 \n", |
388 | 1<<(cam->params.exposure.gainMode-1), tmpstr); | 388 | 1<<(cam->params.exposure.gainMode-1), tmpstr); |
389 | 389 | ||
390 | switch(cam->params.exposure.expMode) { | 390 | switch(cam->params.exposure.expMode) { |
391 | case 1: | 391 | case 1: |
@@ -402,10 +402,10 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
402 | out += sprintf(out, "exposure_mode: %8s %8s %8s" | 402 | out += sprintf(out, "exposure_mode: %8s %8s %8s" |
403 | " %8s\n", tmpstr, "manual", "auto", "auto"); | 403 | " %8s\n", tmpstr, "manual", "auto", "auto"); |
404 | out += sprintf(out, "centre_weight: %8s %8s %8s %8s\n", | 404 | out += sprintf(out, "centre_weight: %8s %8s %8s %8s\n", |
405 | (2-cam->params.exposure.centreWeight) ? "on" : "off", | 405 | (2-cam->params.exposure.centreWeight) ? "on" : "off", |
406 | "off", "on", "on"); | 406 | "off", "on", "on"); |
407 | out += sprintf(out, "gain: %8d %8d max_gain %8d 1,2,4,8 possible\n", | 407 | out += sprintf(out, "gain: %8d %8d max_gain %8d 1,2,4,8 possible\n", |
408 | 1<<cam->params.exposure.gain, 1, 1); | 408 | 1<<cam->params.exposure.gain, 1, 1); |
409 | if (cam->params.version.firmwareVersion == 1 && | 409 | if (cam->params.version.firmwareVersion == 1 && |
410 | cam->params.version.firmwareRevision == 2) | 410 | cam->params.version.firmwareRevision == 2) |
411 | /* 1-02 firmware limits fineExp/2 to 127 */ | 411 | /* 1-02 firmware limits fineExp/2 to 127 */ |
@@ -414,7 +414,7 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
414 | tmp = 510; | 414 | tmp = 510; |
415 | 415 | ||
416 | out += sprintf(out, "fine_exp: %8d %8d %8d %8d\n", | 416 | out += sprintf(out, "fine_exp: %8d %8d %8d %8d\n", |
417 | cam->params.exposure.fineExp*2, 0, tmp, 0); | 417 | cam->params.exposure.fineExp*2, 0, tmp, 0); |
418 | if (cam->params.version.firmwareVersion == 1 && | 418 | if (cam->params.version.firmwareVersion == 1 && |
419 | cam->params.version.firmwareRevision == 2) | 419 | cam->params.version.firmwareRevision == 2) |
420 | /* 1-02 firmware limits coarseExpHi to 0 */ | 420 | /* 1-02 firmware limits coarseExpHi to 0 */ |
@@ -426,46 +426,46 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
426 | " %8d\n", cam->params.exposure.coarseExpLo+ | 426 | " %8d\n", cam->params.exposure.coarseExpLo+ |
427 | 256*cam->params.exposure.coarseExpHi, 0, tmp, 185); | 427 | 256*cam->params.exposure.coarseExpHi, 0, tmp, 185); |
428 | out += sprintf(out, "red_comp: %8d %8d %8d %8d\n", | 428 | out += sprintf(out, "red_comp: %8d %8d %8d %8d\n", |
429 | cam->params.exposure.redComp, COMP_RED, 255, COMP_RED); | 429 | cam->params.exposure.redComp, COMP_RED, 255, COMP_RED); |
430 | out += sprintf(out, "green1_comp: %8d %8d %8d %8d\n", | 430 | out += sprintf(out, "green1_comp: %8d %8d %8d %8d\n", |
431 | cam->params.exposure.green1Comp, COMP_GREEN1, 255, | 431 | cam->params.exposure.green1Comp, COMP_GREEN1, 255, |
432 | COMP_GREEN1); | 432 | COMP_GREEN1); |
433 | out += sprintf(out, "green2_comp: %8d %8d %8d %8d\n", | 433 | out += sprintf(out, "green2_comp: %8d %8d %8d %8d\n", |
434 | cam->params.exposure.green2Comp, COMP_GREEN2, 255, | 434 | cam->params.exposure.green2Comp, COMP_GREEN2, 255, |
435 | COMP_GREEN2); | 435 | COMP_GREEN2); |
436 | out += sprintf(out, "blue_comp: %8d %8d %8d %8d\n", | 436 | out += sprintf(out, "blue_comp: %8d %8d %8d %8d\n", |
437 | cam->params.exposure.blueComp, COMP_BLUE, 255, COMP_BLUE); | 437 | cam->params.exposure.blueComp, COMP_BLUE, 255, COMP_BLUE); |
438 | 438 | ||
439 | out += sprintf(out, "apcor_gain1: %#8x %#8x %#8x %#8x\n", | 439 | out += sprintf(out, "apcor_gain1: %#8x %#8x %#8x %#8x\n", |
440 | cam->params.apcor.gain1, 0, 0xff, 0x1c); | 440 | cam->params.apcor.gain1, 0, 0xff, 0x1c); |
441 | out += sprintf(out, "apcor_gain2: %#8x %#8x %#8x %#8x\n", | 441 | out += sprintf(out, "apcor_gain2: %#8x %#8x %#8x %#8x\n", |
442 | cam->params.apcor.gain2, 0, 0xff, 0x1a); | 442 | cam->params.apcor.gain2, 0, 0xff, 0x1a); |
443 | out += sprintf(out, "apcor_gain4: %#8x %#8x %#8x %#8x\n", | 443 | out += sprintf(out, "apcor_gain4: %#8x %#8x %#8x %#8x\n", |
444 | cam->params.apcor.gain4, 0, 0xff, 0x2d); | 444 | cam->params.apcor.gain4, 0, 0xff, 0x2d); |
445 | out += sprintf(out, "apcor_gain8: %#8x %#8x %#8x %#8x\n", | 445 | out += sprintf(out, "apcor_gain8: %#8x %#8x %#8x %#8x\n", |
446 | cam->params.apcor.gain8, 0, 0xff, 0x2a); | 446 | cam->params.apcor.gain8, 0, 0xff, 0x2a); |
447 | out += sprintf(out, "vl_offset_gain1: %8d %8d %8d %8d\n", | 447 | out += sprintf(out, "vl_offset_gain1: %8d %8d %8d %8d\n", |
448 | cam->params.vlOffset.gain1, 0, 255, 24); | 448 | cam->params.vlOffset.gain1, 0, 255, 24); |
449 | out += sprintf(out, "vl_offset_gain2: %8d %8d %8d %8d\n", | 449 | out += sprintf(out, "vl_offset_gain2: %8d %8d %8d %8d\n", |
450 | cam->params.vlOffset.gain2, 0, 255, 28); | 450 | cam->params.vlOffset.gain2, 0, 255, 28); |
451 | out += sprintf(out, "vl_offset_gain4: %8d %8d %8d %8d\n", | 451 | out += sprintf(out, "vl_offset_gain4: %8d %8d %8d %8d\n", |
452 | cam->params.vlOffset.gain4, 0, 255, 30); | 452 | cam->params.vlOffset.gain4, 0, 255, 30); |
453 | out += sprintf(out, "vl_offset_gain8: %8d %8d %8d %8d\n", | 453 | out += sprintf(out, "vl_offset_gain8: %8d %8d %8d %8d\n", |
454 | cam->params.vlOffset.gain8, 0, 255, 30); | 454 | cam->params.vlOffset.gain8, 0, 255, 30); |
455 | out += sprintf(out, "flicker_control: %8s %8s %8s %8s\n", | 455 | out += sprintf(out, "flicker_control: %8s %8s %8s %8s\n", |
456 | cam->params.flickerControl.flickerMode ? "on" : "off", | 456 | cam->params.flickerControl.flickerMode ? "on" : "off", |
457 | "off", "on", "off"); | 457 | "off", "on", "off"); |
458 | out += sprintf(out, "mains_frequency: %8d %8d %8d %8d" | 458 | out += sprintf(out, "mains_frequency: %8d %8d %8d %8d" |
459 | " only 50/60\n", | 459 | " only 50/60\n", |
460 | cam->mainsFreq ? 60 : 50, 50, 60, 50); | 460 | cam->mainsFreq ? 60 : 50, 50, 60, 50); |
461 | if(cam->params.flickerControl.allowableOverExposure < 0) | 461 | if(cam->params.flickerControl.allowableOverExposure < 0) |
462 | out += sprintf(out, "allowable_overexposure: %4dauto auto %8d auto\n", | 462 | out += sprintf(out, "allowable_overexposure: %4dauto auto %8d auto\n", |
463 | -cam->params.flickerControl.allowableOverExposure, | 463 | -cam->params.flickerControl.allowableOverExposure, |
464 | 255); | 464 | 255); |
465 | else | 465 | else |
466 | out += sprintf(out, "allowable_overexposure: %8d auto %8d auto\n", | 466 | out += sprintf(out, "allowable_overexposure: %8d auto %8d auto\n", |
467 | cam->params.flickerControl.allowableOverExposure, | 467 | cam->params.flickerControl.allowableOverExposure, |
468 | 255); | 468 | 255); |
469 | out += sprintf(out, "compression_mode: "); | 469 | out += sprintf(out, "compression_mode: "); |
470 | switch(cam->params.compression.mode) { | 470 | switch(cam->params.compression.mode) { |
471 | case CPIA_COMPRESSION_NONE: | 471 | case CPIA_COMPRESSION_NONE: |
@@ -483,52 +483,52 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
483 | } | 483 | } |
484 | out += sprintf(out, " none,auto,manual auto\n"); | 484 | out += sprintf(out, " none,auto,manual auto\n"); |
485 | out += sprintf(out, "decimation_enable: %8s %8s %8s %8s\n", | 485 | out += sprintf(out, "decimation_enable: %8s %8s %8s %8s\n", |
486 | cam->params.compression.decimation == | 486 | cam->params.compression.decimation == |
487 | DECIMATION_ENAB ? "on":"off", "off", "on", | 487 | DECIMATION_ENAB ? "on":"off", "off", "on", |
488 | "off"); | 488 | "off"); |
489 | out += sprintf(out, "compression_target: %9s %9s %9s %9s\n", | 489 | out += sprintf(out, "compression_target: %9s %9s %9s %9s\n", |
490 | cam->params.compressionTarget.frTargeting == | 490 | cam->params.compressionTarget.frTargeting == |
491 | CPIA_COMPRESSION_TARGET_FRAMERATE ? | 491 | CPIA_COMPRESSION_TARGET_FRAMERATE ? |
492 | "framerate":"quality", | 492 | "framerate":"quality", |
493 | "framerate", "quality", "quality"); | 493 | "framerate", "quality", "quality"); |
494 | out += sprintf(out, "target_framerate: %8d %8d %8d %8d\n", | 494 | out += sprintf(out, "target_framerate: %8d %8d %8d %8d\n", |
495 | cam->params.compressionTarget.targetFR, 1, 30, 15); | 495 | cam->params.compressionTarget.targetFR, 1, 30, 15); |
496 | out += sprintf(out, "target_quality: %8d %8d %8d %8d\n", | 496 | out += sprintf(out, "target_quality: %8d %8d %8d %8d\n", |
497 | cam->params.compressionTarget.targetQ, 1, 64, 5); | 497 | cam->params.compressionTarget.targetQ, 1, 64, 5); |
498 | out += sprintf(out, "y_threshold: %8d %8d %8d %8d\n", | 498 | out += sprintf(out, "y_threshold: %8d %8d %8d %8d\n", |
499 | cam->params.yuvThreshold.yThreshold, 0, 31, 6); | 499 | cam->params.yuvThreshold.yThreshold, 0, 31, 6); |
500 | out += sprintf(out, "uv_threshold: %8d %8d %8d %8d\n", | 500 | out += sprintf(out, "uv_threshold: %8d %8d %8d %8d\n", |
501 | cam->params.yuvThreshold.uvThreshold, 0, 31, 6); | 501 | cam->params.yuvThreshold.uvThreshold, 0, 31, 6); |
502 | out += sprintf(out, "hysteresis: %8d %8d %8d %8d\n", | 502 | out += sprintf(out, "hysteresis: %8d %8d %8d %8d\n", |
503 | cam->params.compressionParams.hysteresis, 0, 255, 3); | 503 | cam->params.compressionParams.hysteresis, 0, 255, 3); |
504 | out += sprintf(out, "threshold_max: %8d %8d %8d %8d\n", | 504 | out += sprintf(out, "threshold_max: %8d %8d %8d %8d\n", |
505 | cam->params.compressionParams.threshMax, 0, 255, 11); | 505 | cam->params.compressionParams.threshMax, 0, 255, 11); |
506 | out += sprintf(out, "small_step: %8d %8d %8d %8d\n", | 506 | out += sprintf(out, "small_step: %8d %8d %8d %8d\n", |
507 | cam->params.compressionParams.smallStep, 0, 255, 1); | 507 | cam->params.compressionParams.smallStep, 0, 255, 1); |
508 | out += sprintf(out, "large_step: %8d %8d %8d %8d\n", | 508 | out += sprintf(out, "large_step: %8d %8d %8d %8d\n", |
509 | cam->params.compressionParams.largeStep, 0, 255, 3); | 509 | cam->params.compressionParams.largeStep, 0, 255, 3); |
510 | out += sprintf(out, "decimation_hysteresis: %8d %8d %8d %8d\n", | 510 | out += sprintf(out, "decimation_hysteresis: %8d %8d %8d %8d\n", |
511 | cam->params.compressionParams.decimationHysteresis, | 511 | cam->params.compressionParams.decimationHysteresis, |
512 | 0, 255, 2); | 512 | 0, 255, 2); |
513 | out += sprintf(out, "fr_diff_step_thresh: %8d %8d %8d %8d\n", | 513 | out += sprintf(out, "fr_diff_step_thresh: %8d %8d %8d %8d\n", |
514 | cam->params.compressionParams.frDiffStepThresh, | 514 | cam->params.compressionParams.frDiffStepThresh, |
515 | 0, 255, 5); | 515 | 0, 255, 5); |
516 | out += sprintf(out, "q_diff_step_thresh: %8d %8d %8d %8d\n", | 516 | out += sprintf(out, "q_diff_step_thresh: %8d %8d %8d %8d\n", |
517 | cam->params.compressionParams.qDiffStepThresh, | 517 | cam->params.compressionParams.qDiffStepThresh, |
518 | 0, 255, 3); | 518 | 0, 255, 3); |
519 | out += sprintf(out, "decimation_thresh_mod: %8d %8d %8d %8d\n", | 519 | out += sprintf(out, "decimation_thresh_mod: %8d %8d %8d %8d\n", |
520 | cam->params.compressionParams.decimationThreshMod, | 520 | cam->params.compressionParams.decimationThreshMod, |
521 | 0, 255, 2); | 521 | 0, 255, 2); |
522 | /* QX3 specific entries */ | 522 | /* QX3 specific entries */ |
523 | if (cam->params.qx3.qx3_detected) { | 523 | if (cam->params.qx3.qx3_detected) { |
524 | out += sprintf(out, "toplight: %8s %8s %8s %8s\n", | 524 | out += sprintf(out, "toplight: %8s %8s %8s %8s\n", |
525 | cam->params.qx3.toplight ? "on" : "off", | 525 | cam->params.qx3.toplight ? "on" : "off", |
526 | "off", "on", "off"); | 526 | "off", "on", "off"); |
527 | out += sprintf(out, "bottomlight: %8s %8s %8s %8s\n", | 527 | out += sprintf(out, "bottomlight: %8s %8s %8s %8s\n", |
528 | cam->params.qx3.bottomlight ? "on" : "off", | 528 | cam->params.qx3.bottomlight ? "on" : "off", |
529 | "off", "on", "off"); | 529 | "off", "on", "off"); |
530 | } | 530 | } |
531 | 531 | ||
532 | len = out - page; | 532 | len = out - page; |
533 | len -= off; | 533 | len -= off; |
534 | if (len < count) { | 534 | if (len < count) { |
@@ -543,7 +543,7 @@ static int cpia_read_proc(char *page, char **start, off_t off, | |||
543 | 543 | ||
544 | 544 | ||
545 | static int match(char *checkstr, char **buffer, unsigned long *count, | 545 | static int match(char *checkstr, char **buffer, unsigned long *count, |
546 | int *find_colon, int *err) | 546 | int *find_colon, int *err) |
547 | { | 547 | { |
548 | int ret, colon_found = 1; | 548 | int ret, colon_found = 1; |
549 | int len = strlen(checkstr); | 549 | int len = strlen(checkstr); |
@@ -583,7 +583,7 @@ static unsigned long int value(char **buffer, unsigned long *count, int *err) | |||
583 | } | 583 | } |
584 | 584 | ||
585 | static int cpia_write_proc(struct file *file, const char __user *buf, | 585 | static int cpia_write_proc(struct file *file, const char __user *buf, |
586 | unsigned long count, void *data) | 586 | unsigned long count, void *data) |
587 | { | 587 | { |
588 | struct cam_data *cam = data; | 588 | struct cam_data *cam = data; |
589 | struct cam_params new_params; | 589 | struct cam_params new_params; |
@@ -619,12 +619,12 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
619 | retval = -EINVAL; | 619 | retval = -EINVAL; |
620 | goto out; | 620 | goto out; |
621 | } | 621 | } |
622 | 622 | ||
623 | buffer = page; | 623 | buffer = page; |
624 | 624 | ||
625 | if (mutex_lock_interruptible(&cam->param_lock)) | 625 | if (mutex_lock_interruptible(&cam->param_lock)) |
626 | return -ERESTARTSYS; | 626 | return -ERESTARTSYS; |
627 | 627 | ||
628 | /* | 628 | /* |
629 | * Skip over leading whitespace | 629 | * Skip over leading whitespace |
630 | */ | 630 | */ |
@@ -632,15 +632,15 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
632 | --count; | 632 | --count; |
633 | ++buffer; | 633 | ++buffer; |
634 | } | 634 | } |
635 | 635 | ||
636 | memcpy(&new_params, &cam->params, sizeof(struct cam_params)); | 636 | memcpy(&new_params, &cam->params, sizeof(struct cam_params)); |
637 | new_mains = cam->mainsFreq; | 637 | new_mains = cam->mainsFreq; |
638 | 638 | ||
639 | #define MATCH(x) (match(x, &buffer, &count, &find_colon, &retval)) | 639 | #define MATCH(x) (match(x, &buffer, &count, &find_colon, &retval)) |
640 | #define VALUE (value(&buffer,&count, &retval)) | 640 | #define VALUE (value(&buffer,&count, &retval)) |
641 | #define FIRMWARE_VERSION(x,y) (new_params.version.firmwareVersion == (x) && \ | 641 | #define FIRMWARE_VERSION(x,y) (new_params.version.firmwareVersion == (x) && \ |
642 | new_params.version.firmwareRevision == (y)) | 642 | new_params.version.firmwareRevision == (y)) |
643 | 643 | ||
644 | retval = 0; | 644 | retval = 0; |
645 | while (count && !retval) { | 645 | while (count && !retval) { |
646 | find_colon = 1; | 646 | find_colon = 1; |
@@ -656,7 +656,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
656 | } | 656 | } |
657 | command_flags |= COMMAND_SETCOLOURPARAMS; | 657 | command_flags |= COMMAND_SETCOLOURPARAMS; |
658 | if(new_params.flickerControl.allowableOverExposure < 0) | 658 | if(new_params.flickerControl.allowableOverExposure < 0) |
659 | new_params.flickerControl.allowableOverExposure = | 659 | new_params.flickerControl.allowableOverExposure = |
660 | -find_over_exposure(new_params.colourParams.brightness); | 660 | -find_over_exposure(new_params.colourParams.brightness); |
661 | if(new_params.flickerControl.flickerMode != 0) | 661 | if(new_params.flickerControl.flickerMode != 0) |
662 | command_flags |= COMMAND_SETFLICKERCTRL; | 662 | command_flags |= COMMAND_SETFLICKERCTRL; |
@@ -721,7 +721,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
721 | /* Either base rate would work here */ | 721 | /* Either base rate would work here */ |
722 | new_params.sensorFps.baserate = 1; | 722 | new_params.sensorFps.baserate = 1; |
723 | } | 723 | } |
724 | new_params.flickerControl.coarseJump = | 724 | new_params.flickerControl.coarseJump = |
725 | flicker_jumps[new_mains] | 725 | flicker_jumps[new_mains] |
726 | [new_params.sensorFps.baserate] | 726 | [new_params.sensorFps.baserate] |
727 | [new_params.sensorFps.divisor]; | 727 | [new_params.sensorFps.divisor]; |
@@ -1085,7 +1085,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1085 | } else if (MATCH("mains_frequency")) { | 1085 | } else if (MATCH("mains_frequency")) { |
1086 | if (!retval && MATCH("50")) { | 1086 | if (!retval && MATCH("50")) { |
1087 | new_mains = 0; | 1087 | new_mains = 0; |
1088 | new_params.flickerControl.coarseJump = | 1088 | new_params.flickerControl.coarseJump = |
1089 | flicker_jumps[new_mains] | 1089 | flicker_jumps[new_mains] |
1090 | [new_params.sensorFps.baserate] | 1090 | [new_params.sensorFps.baserate] |
1091 | [new_params.sensorFps.divisor]; | 1091 | [new_params.sensorFps.divisor]; |
@@ -1093,7 +1093,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1093 | command_flags |= COMMAND_SETFLICKERCTRL; | 1093 | command_flags |= COMMAND_SETFLICKERCTRL; |
1094 | } else if (!retval && MATCH("60")) { | 1094 | } else if (!retval && MATCH("60")) { |
1095 | new_mains = 1; | 1095 | new_mains = 1; |
1096 | new_params.flickerControl.coarseJump = | 1096 | new_params.flickerControl.coarseJump = |
1097 | flicker_jumps[new_mains] | 1097 | flicker_jumps[new_mains] |
1098 | [new_params.sensorFps.baserate] | 1098 | [new_params.sensorFps.baserate] |
1099 | [new_params.sensorFps.divisor]; | 1099 | [new_params.sensorFps.divisor]; |
@@ -1103,7 +1103,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1103 | retval = -EINVAL; | 1103 | retval = -EINVAL; |
1104 | } else if (MATCH("allowable_overexposure")) { | 1104 | } else if (MATCH("allowable_overexposure")) { |
1105 | if (!retval && MATCH("auto")) { | 1105 | if (!retval && MATCH("auto")) { |
1106 | new_params.flickerControl.allowableOverExposure = | 1106 | new_params.flickerControl.allowableOverExposure = |
1107 | -find_over_exposure(new_params.colourParams.brightness); | 1107 | -find_over_exposure(new_params.colourParams.brightness); |
1108 | if(new_params.flickerControl.flickerMode != 0) | 1108 | if(new_params.flickerControl.flickerMode != 0) |
1109 | command_flags |= COMMAND_SETFLICKERCTRL; | 1109 | command_flags |= COMMAND_SETFLICKERCTRL; |
@@ -1146,10 +1146,10 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1146 | command_flags |= COMMAND_SETCOMPRESSION; | 1146 | command_flags |= COMMAND_SETCOMPRESSION; |
1147 | } else if (MATCH("compression_target")) { | 1147 | } else if (MATCH("compression_target")) { |
1148 | if (!retval && MATCH("quality")) | 1148 | if (!retval && MATCH("quality")) |
1149 | new_params.compressionTarget.frTargeting = | 1149 | new_params.compressionTarget.frTargeting = |
1150 | CPIA_COMPRESSION_TARGET_QUALITY; | 1150 | CPIA_COMPRESSION_TARGET_QUALITY; |
1151 | else if (!retval && MATCH("framerate")) | 1151 | else if (!retval && MATCH("framerate")) |
1152 | new_params.compressionTarget.frTargeting = | 1152 | new_params.compressionTarget.frTargeting = |
1153 | CPIA_COMPRESSION_TARGET_FRAMERATE; | 1153 | CPIA_COMPRESSION_TARGET_FRAMERATE; |
1154 | else | 1154 | else |
1155 | retval = -EINVAL; | 1155 | retval = -EINVAL; |
@@ -1173,7 +1173,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1173 | if (!retval) { | 1173 | if (!retval) { |
1174 | if(val > 0 && val <= 64) | 1174 | if(val > 0 && val <= 64) |
1175 | new_params.compressionTarget.targetQ = val; | 1175 | new_params.compressionTarget.targetQ = val; |
1176 | else | 1176 | else |
1177 | retval = -EINVAL; | 1177 | retval = -EINVAL; |
1178 | } | 1178 | } |
1179 | command_flags |= COMMAND_SETCOMPRESSIONTARGET; | 1179 | command_flags |= COMMAND_SETCOMPRESSIONTARGET; |
@@ -1288,19 +1288,19 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1288 | } | 1288 | } |
1289 | command_flags |= COMMAND_SETCOMPRESSIONPARAMS; | 1289 | command_flags |= COMMAND_SETCOMPRESSIONPARAMS; |
1290 | } else if (MATCH("toplight")) { | 1290 | } else if (MATCH("toplight")) { |
1291 | if (!retval && MATCH("on")) | 1291 | if (!retval && MATCH("on")) |
1292 | new_params.qx3.toplight = 1; | 1292 | new_params.qx3.toplight = 1; |
1293 | else if (!retval && MATCH("off")) | 1293 | else if (!retval && MATCH("off")) |
1294 | new_params.qx3.toplight = 0; | 1294 | new_params.qx3.toplight = 0; |
1295 | else | 1295 | else |
1296 | retval = -EINVAL; | 1296 | retval = -EINVAL; |
1297 | command_flags |= COMMAND_SETLIGHTS; | 1297 | command_flags |= COMMAND_SETLIGHTS; |
1298 | } else if (MATCH("bottomlight")) { | 1298 | } else if (MATCH("bottomlight")) { |
1299 | if (!retval && MATCH("on")) | 1299 | if (!retval && MATCH("on")) |
1300 | new_params.qx3.bottomlight = 1; | 1300 | new_params.qx3.bottomlight = 1; |
1301 | else if (!retval && MATCH("off")) | 1301 | else if (!retval && MATCH("off")) |
1302 | new_params.qx3.bottomlight = 0; | 1302 | new_params.qx3.bottomlight = 0; |
1303 | else | 1303 | else |
1304 | retval = -EINVAL; | 1304 | retval = -EINVAL; |
1305 | command_flags |= COMMAND_SETLIGHTS; | 1305 | command_flags |= COMMAND_SETLIGHTS; |
1306 | } else { | 1306 | } else { |
@@ -1326,7 +1326,7 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1326 | } | 1326 | } |
1327 | } | 1327 | } |
1328 | } | 1328 | } |
1329 | #undef MATCH | 1329 | #undef MATCH |
1330 | #undef VALUE | 1330 | #undef VALUE |
1331 | #undef FIRMWARE_VERSION | 1331 | #undef FIRMWARE_VERSION |
1332 | if (!retval) { | 1332 | if (!retval) { |
@@ -1349,24 +1349,24 @@ static int cpia_write_proc(struct file *file, const char __user *buf, | |||
1349 | retval = size; | 1349 | retval = size; |
1350 | } else | 1350 | } else |
1351 | DBG("error: %d\n", retval); | 1351 | DBG("error: %d\n", retval); |
1352 | 1352 | ||
1353 | mutex_unlock(&cam->param_lock); | 1353 | mutex_unlock(&cam->param_lock); |
1354 | 1354 | ||
1355 | out: | 1355 | out: |
1356 | free_page((unsigned long)page); | 1356 | free_page((unsigned long)page); |
1357 | return retval; | 1357 | return retval; |
1358 | } | 1358 | } |
1359 | 1359 | ||
1360 | static void create_proc_cpia_cam(struct cam_data *cam) | 1360 | static void create_proc_cpia_cam(struct cam_data *cam) |
1361 | { | 1361 | { |
1362 | char name[7]; | 1362 | char name[7]; |
1363 | struct proc_dir_entry *ent; | 1363 | struct proc_dir_entry *ent; |
1364 | 1364 | ||
1365 | if (!cpia_proc_root || !cam) | 1365 | if (!cpia_proc_root || !cam) |
1366 | return; | 1366 | return; |
1367 | 1367 | ||
1368 | sprintf(name, "video%d", cam->vdev.minor); | 1368 | sprintf(name, "video%d", cam->vdev.minor); |
1369 | 1369 | ||
1370 | ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root); | 1370 | ent = create_proc_entry(name, S_IFREG|S_IRUGO|S_IWUSR, cpia_proc_root); |
1371 | if (!ent) | 1371 | if (!ent) |
1372 | return; | 1372 | return; |
@@ -1374,9 +1374,9 @@ static void create_proc_cpia_cam(struct cam_data *cam) | |||
1374 | ent->data = cam; | 1374 | ent->data = cam; |
1375 | ent->read_proc = cpia_read_proc; | 1375 | ent->read_proc = cpia_read_proc; |
1376 | ent->write_proc = cpia_write_proc; | 1376 | ent->write_proc = cpia_write_proc; |
1377 | /* | 1377 | /* |
1378 | size of the proc entry is 3736 bytes for the standard webcam; | 1378 | size of the proc entry is 3736 bytes for the standard webcam; |
1379 | the extra features of the QX3 microscope add 189 bytes. | 1379 | the extra features of the QX3 microscope add 189 bytes. |
1380 | (we have not yet probed the camera to see which type it is). | 1380 | (we have not yet probed the camera to see which type it is). |
1381 | */ | 1381 | */ |
1382 | ent->size = 3736 + 189; | 1382 | ent->size = 3736 + 189; |
@@ -1386,10 +1386,10 @@ static void create_proc_cpia_cam(struct cam_data *cam) | |||
1386 | static void destroy_proc_cpia_cam(struct cam_data *cam) | 1386 | static void destroy_proc_cpia_cam(struct cam_data *cam) |
1387 | { | 1387 | { |
1388 | char name[7]; | 1388 | char name[7]; |
1389 | 1389 | ||
1390 | if (!cam || !cam->proc_entry) | 1390 | if (!cam || !cam->proc_entry) |
1391 | return; | 1391 | return; |
1392 | 1392 | ||
1393 | sprintf(name, "video%d", cam->vdev.minor); | 1393 | sprintf(name, "video%d", cam->vdev.minor); |
1394 | remove_proc_entry(name, cpia_proc_root); | 1394 | remove_proc_entry(name, cpia_proc_root); |
1395 | cam->proc_entry = NULL; | 1395 | cam->proc_entry = NULL; |
@@ -1596,13 +1596,13 @@ static void set_vw_size(struct cam_data *cam) | |||
1596 | cam->vc.width = cam->vw.width; | 1596 | cam->vc.width = cam->vw.width; |
1597 | if(cam->vc.height == 0) | 1597 | if(cam->vc.height == 0) |
1598 | cam->vc.height = cam->vw.height; | 1598 | cam->vc.height = cam->vw.height; |
1599 | 1599 | ||
1600 | cam->params.roi.colStart += cam->vc.x >> 3; | 1600 | cam->params.roi.colStart += cam->vc.x >> 3; |
1601 | cam->params.roi.colEnd = cam->params.roi.colStart + | 1601 | cam->params.roi.colEnd = cam->params.roi.colStart + |
1602 | (cam->vc.width >> 3); | 1602 | (cam->vc.width >> 3); |
1603 | cam->params.roi.rowStart += cam->vc.y >> 2; | 1603 | cam->params.roi.rowStart += cam->vc.y >> 2; |
1604 | cam->params.roi.rowEnd = cam->params.roi.rowStart + | 1604 | cam->params.roi.rowEnd = cam->params.roi.rowStart + |
1605 | (cam->vc.height >> 2); | 1605 | (cam->vc.height >> 2); |
1606 | 1606 | ||
1607 | return; | 1607 | return; |
1608 | } | 1608 | } |
@@ -1624,7 +1624,7 @@ static int allocate_frame_buf(struct cam_data *cam) | |||
1624 | static int free_frame_buf(struct cam_data *cam) | 1624 | static int free_frame_buf(struct cam_data *cam) |
1625 | { | 1625 | { |
1626 | int i; | 1626 | int i; |
1627 | 1627 | ||
1628 | rvfree(cam->frame_buf, FRAME_NUM*CPIA_MAX_FRAME_SIZE); | 1628 | rvfree(cam->frame_buf, FRAME_NUM*CPIA_MAX_FRAME_SIZE); |
1629 | cam->frame_buf = NULL; | 1629 | cam->frame_buf = NULL; |
1630 | for (i=0; i < FRAME_NUM; i++) | 1630 | for (i=0; i < FRAME_NUM; i++) |
@@ -1667,7 +1667,7 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d) | |||
1667 | mutex_lock(&cam->param_lock); | 1667 | mutex_lock(&cam->param_lock); |
1668 | datasize=8; | 1668 | datasize=8; |
1669 | break; | 1669 | break; |
1670 | case CPIA_COMMAND_ReadMCPorts: | 1670 | case CPIA_COMMAND_ReadMCPorts: |
1671 | case CPIA_COMMAND_ReadVCRegs: | 1671 | case CPIA_COMMAND_ReadVCRegs: |
1672 | datasize = 4; | 1672 | datasize = 4; |
1673 | break; | 1673 | break; |
@@ -1746,10 +1746,10 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d) | |||
1746 | mutex_unlock(&cam->param_lock); | 1746 | mutex_unlock(&cam->param_lock); |
1747 | break; | 1747 | break; |
1748 | 1748 | ||
1749 | case CPIA_COMMAND_ReadMCPorts: | 1749 | case CPIA_COMMAND_ReadMCPorts: |
1750 | if (!cam->params.qx3.qx3_detected) | 1750 | if (!cam->params.qx3.qx3_detected) |
1751 | break; | 1751 | break; |
1752 | /* test button press */ | 1752 | /* test button press */ |
1753 | cam->params.qx3.button = ((data[1] & 0x02) == 0); | 1753 | cam->params.qx3.button = ((data[1] & 0x02) == 0); |
1754 | if (cam->params.qx3.button) { | 1754 | if (cam->params.qx3.button) { |
1755 | /* button pressed - unlock the latch */ | 1755 | /* button pressed - unlock the latch */ |
@@ -1770,9 +1770,9 @@ static int do_command(struct cam_data *cam, u16 command, u8 a, u8 b, u8 c, u8 d) | |||
1770 | 1770 | ||
1771 | /* send a command to the camera with an additional data transaction */ | 1771 | /* send a command to the camera with an additional data transaction */ |
1772 | static int do_command_extended(struct cam_data *cam, u16 command, | 1772 | static int do_command_extended(struct cam_data *cam, u16 command, |
1773 | u8 a, u8 b, u8 c, u8 d, | 1773 | u8 a, u8 b, u8 c, u8 d, |
1774 | u8 e, u8 f, u8 g, u8 h, | 1774 | u8 e, u8 f, u8 g, u8 h, |
1775 | u8 i, u8 j, u8 k, u8 l) | 1775 | u8 i, u8 j, u8 k, u8 l) |
1776 | { | 1776 | { |
1777 | int retval; | 1777 | int retval; |
1778 | u8 cmd[8], data[8]; | 1778 | u8 cmd[8], data[8]; |
@@ -1809,10 +1809,10 @@ static int do_command_extended(struct cam_data *cam, u16 command, | |||
1809 | #define LIMIT(x) ((((x)>0xffffff)?0xff0000:(((x)<=0xffff)?0:(x)&0xff0000))>>16) | 1809 | #define LIMIT(x) ((((x)>0xffffff)?0xff0000:(((x)<=0xffff)?0:(x)&0xff0000))>>16) |
1810 | 1810 | ||
1811 | static int convert420(unsigned char *yuv, unsigned char *rgb, int out_fmt, | 1811 | static int convert420(unsigned char *yuv, unsigned char *rgb, int out_fmt, |
1812 | int linesize, int mmap_kludge) | 1812 | int linesize, int mmap_kludge) |
1813 | { | 1813 | { |
1814 | int y, u, v, r, g, b, y1; | 1814 | int y, u, v, r, g, b, y1; |
1815 | 1815 | ||
1816 | /* Odd lines use the same u and v as the previous line. | 1816 | /* Odd lines use the same u and v as the previous line. |
1817 | * Because of compression, it is necessary to get this | 1817 | * Because of compression, it is necessary to get this |
1818 | * information from the decoded image. */ | 1818 | * information from the decoded image. */ |
@@ -1925,7 +1925,7 @@ static int convert420(unsigned char *yuv, unsigned char *rgb, int out_fmt, | |||
1925 | 1925 | ||
1926 | 1926 | ||
1927 | static int yuvconvert(unsigned char *yuv, unsigned char *rgb, int out_fmt, | 1927 | static int yuvconvert(unsigned char *yuv, unsigned char *rgb, int out_fmt, |
1928 | int in_uyvy, int mmap_kludge) | 1928 | int in_uyvy, int mmap_kludge) |
1929 | { | 1929 | { |
1930 | int y, u, v, r, g, b, y1; | 1930 | int y, u, v, r, g, b, y1; |
1931 | 1931 | ||
@@ -2078,21 +2078,21 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2078 | mutex_unlock(&cam->param_lock); | 2078 | mutex_unlock(&cam->param_lock); |
2079 | return -1; | 2079 | return -1; |
2080 | } | 2080 | } |
2081 | 2081 | ||
2082 | if (ibuf[17] != SUBSAMPLE_420 && ibuf[17] != SUBSAMPLE_422) { | 2082 | if (ibuf[17] != SUBSAMPLE_420 && ibuf[17] != SUBSAMPLE_422) { |
2083 | LOG("illegal subtype %d\n",ibuf[17]); | 2083 | LOG("illegal subtype %d\n",ibuf[17]); |
2084 | mutex_unlock(&cam->param_lock); | 2084 | mutex_unlock(&cam->param_lock); |
2085 | return -1; | 2085 | return -1; |
2086 | } | 2086 | } |
2087 | subsample_422 = ibuf[17] == SUBSAMPLE_422; | 2087 | subsample_422 = ibuf[17] == SUBSAMPLE_422; |
2088 | 2088 | ||
2089 | if (ibuf[18] != YUVORDER_YUYV && ibuf[18] != YUVORDER_UYVY) { | 2089 | if (ibuf[18] != YUVORDER_YUYV && ibuf[18] != YUVORDER_UYVY) { |
2090 | LOG("illegal yuvorder %d\n",ibuf[18]); | 2090 | LOG("illegal yuvorder %d\n",ibuf[18]); |
2091 | mutex_unlock(&cam->param_lock); | 2091 | mutex_unlock(&cam->param_lock); |
2092 | return -1; | 2092 | return -1; |
2093 | } | 2093 | } |
2094 | in_uyvy = ibuf[18] == YUVORDER_UYVY; | 2094 | in_uyvy = ibuf[18] == YUVORDER_UYVY; |
2095 | 2095 | ||
2096 | if ((ibuf[24] != cam->params.roi.colStart) || | 2096 | if ((ibuf[24] != cam->params.roi.colStart) || |
2097 | (ibuf[25] != cam->params.roi.colEnd) || | 2097 | (ibuf[25] != cam->params.roi.colEnd) || |
2098 | (ibuf[26] != cam->params.roi.rowStart) || | 2098 | (ibuf[26] != cam->params.roi.rowStart) || |
@@ -2104,20 +2104,20 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2104 | cols = 8*(ibuf[25] - ibuf[24]); | 2104 | cols = 8*(ibuf[25] - ibuf[24]); |
2105 | rows = 4*(ibuf[27] - ibuf[26]); | 2105 | rows = 4*(ibuf[27] - ibuf[26]); |
2106 | 2106 | ||
2107 | 2107 | ||
2108 | if ((ibuf[28] != NOT_COMPRESSED) && (ibuf[28] != COMPRESSED)) { | 2108 | if ((ibuf[28] != NOT_COMPRESSED) && (ibuf[28] != COMPRESSED)) { |
2109 | LOG("illegal compression %d\n",ibuf[28]); | 2109 | LOG("illegal compression %d\n",ibuf[28]); |
2110 | mutex_unlock(&cam->param_lock); | 2110 | mutex_unlock(&cam->param_lock); |
2111 | return -1; | 2111 | return -1; |
2112 | } | 2112 | } |
2113 | compressed = (ibuf[28] == COMPRESSED); | 2113 | compressed = (ibuf[28] == COMPRESSED); |
2114 | 2114 | ||
2115 | if (ibuf[29] != NO_DECIMATION && ibuf[29] != DECIMATION_ENAB) { | 2115 | if (ibuf[29] != NO_DECIMATION && ibuf[29] != DECIMATION_ENAB) { |
2116 | LOG("illegal decimation %d\n",ibuf[29]); | 2116 | LOG("illegal decimation %d\n",ibuf[29]); |
2117 | mutex_unlock(&cam->param_lock); | 2117 | mutex_unlock(&cam->param_lock); |
2118 | return -1; | 2118 | return -1; |
2119 | } | 2119 | } |
2120 | decimation = (ibuf[29] == DECIMATION_ENAB); | 2120 | decimation = (ibuf[29] == DECIMATION_ENAB); |
2121 | 2121 | ||
2122 | cam->params.yuvThreshold.yThreshold = ibuf[30]; | 2122 | cam->params.yuvThreshold.yThreshold = ibuf[30]; |
2123 | cam->params.yuvThreshold.uvThreshold = ibuf[31]; | 2123 | cam->params.yuvThreshold.uvThreshold = ibuf[31]; |
@@ -2131,7 +2131,7 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2131 | cam->params.status.errorCode = ibuf[39]; | 2131 | cam->params.status.errorCode = ibuf[39]; |
2132 | cam->fps = ibuf[41]; | 2132 | cam->fps = ibuf[41]; |
2133 | mutex_unlock(&cam->param_lock); | 2133 | mutex_unlock(&cam->param_lock); |
2134 | 2134 | ||
2135 | linesize = skipcount(cols, out_fmt); | 2135 | linesize = skipcount(cols, out_fmt); |
2136 | ibuf += FRAME_HEADER_SIZE; | 2136 | ibuf += FRAME_HEADER_SIZE; |
2137 | size -= FRAME_HEADER_SIZE; | 2137 | size -= FRAME_HEADER_SIZE; |
@@ -2150,14 +2150,14 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2150 | if (!compressed || (compressed && !(*ibuf & 1))) { | 2150 | if (!compressed || (compressed && !(*ibuf & 1))) { |
2151 | if(subsample_422 || even_line) { | 2151 | if(subsample_422 || even_line) { |
2152 | obuf += yuvconvert(ibuf, obuf, out_fmt, | 2152 | obuf += yuvconvert(ibuf, obuf, out_fmt, |
2153 | in_uyvy, cam->mmap_kludge); | 2153 | in_uyvy, cam->mmap_kludge); |
2154 | ibuf += 4; | 2154 | ibuf += 4; |
2155 | ll -= 4; | 2155 | ll -= 4; |
2156 | } else { | 2156 | } else { |
2157 | /* SUBSAMPLE_420 on an odd line */ | 2157 | /* SUBSAMPLE_420 on an odd line */ |
2158 | obuf += convert420(ibuf, obuf, | 2158 | obuf += convert420(ibuf, obuf, |
2159 | out_fmt, linesize, | 2159 | out_fmt, linesize, |
2160 | cam->mmap_kludge); | 2160 | cam->mmap_kludge); |
2161 | ibuf += 2; | 2161 | ibuf += 2; |
2162 | ll -= 2; | 2162 | ll -= 2; |
2163 | } | 2163 | } |
@@ -2183,7 +2183,7 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2183 | 2183 | ||
2184 | if ((size > 3) && (ibuf[0] == EOI) && (ibuf[1] == EOI) && | 2184 | if ((size > 3) && (ibuf[0] == EOI) && (ibuf[1] == EOI) && |
2185 | (ibuf[2] == EOI) && (ibuf[3] == EOI)) { | 2185 | (ibuf[2] == EOI) && (ibuf[3] == EOI)) { |
2186 | size -= 4; | 2186 | size -= 4; |
2187 | break; | 2187 | break; |
2188 | } | 2188 | } |
2189 | 2189 | ||
@@ -2204,7 +2204,7 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2204 | return -1; | 2204 | return -1; |
2205 | } | 2205 | } |
2206 | } | 2206 | } |
2207 | 2207 | ||
2208 | if(decimation) { | 2208 | if(decimation) { |
2209 | /* interpolate odd rows */ | 2209 | /* interpolate odd rows */ |
2210 | int i, j; | 2210 | int i, j; |
@@ -2233,7 +2233,7 @@ static int parse_picture(struct cam_data *cam, int size) | |||
2233 | static inline int init_stream_cap(struct cam_data *cam) | 2233 | static inline int init_stream_cap(struct cam_data *cam) |
2234 | { | 2234 | { |
2235 | return do_command(cam, CPIA_COMMAND_InitStreamCap, | 2235 | return do_command(cam, CPIA_COMMAND_InitStreamCap, |
2236 | 0, cam->params.streamStartLine, 0, 0); | 2236 | 0, cam->params.streamStartLine, 0, 0); |
2237 | } | 2237 | } |
2238 | 2238 | ||
2239 | 2239 | ||
@@ -2254,7 +2254,7 @@ static int find_over_exposure(int brightness) | |||
2254 | int MaxAllowableOverExposure, OverExposure; | 2254 | int MaxAllowableOverExposure, OverExposure; |
2255 | 2255 | ||
2256 | MaxAllowableOverExposure = FLICKER_MAX_EXPOSURE - brightness - | 2256 | MaxAllowableOverExposure = FLICKER_MAX_EXPOSURE - brightness - |
2257 | FLICKER_BRIGHTNESS_CONSTANT; | 2257 | FLICKER_BRIGHTNESS_CONSTANT; |
2258 | 2258 | ||
2259 | if (MaxAllowableOverExposure < FLICKER_ALLOWABLE_OVER_EXPOSURE) { | 2259 | if (MaxAllowableOverExposure < FLICKER_ALLOWABLE_OVER_EXPOSURE) { |
2260 | OverExposure = MaxAllowableOverExposure; | 2260 | OverExposure = MaxAllowableOverExposure; |
@@ -2280,62 +2280,62 @@ static void dispatch_commands(struct cam_data *cam) | |||
2280 | DEB_BYTE(cam->cmd_queue>>8); | 2280 | DEB_BYTE(cam->cmd_queue>>8); |
2281 | if (cam->cmd_queue & COMMAND_SETFORMAT) { | 2281 | if (cam->cmd_queue & COMMAND_SETFORMAT) { |
2282 | do_command(cam, CPIA_COMMAND_SetFormat, | 2282 | do_command(cam, CPIA_COMMAND_SetFormat, |
2283 | cam->params.format.videoSize, | 2283 | cam->params.format.videoSize, |
2284 | cam->params.format.subSample, | 2284 | cam->params.format.subSample, |
2285 | cam->params.format.yuvOrder, 0); | 2285 | cam->params.format.yuvOrder, 0); |
2286 | do_command(cam, CPIA_COMMAND_SetROI, | 2286 | do_command(cam, CPIA_COMMAND_SetROI, |
2287 | cam->params.roi.colStart, cam->params.roi.colEnd, | 2287 | cam->params.roi.colStart, cam->params.roi.colEnd, |
2288 | cam->params.roi.rowStart, cam->params.roi.rowEnd); | 2288 | cam->params.roi.rowStart, cam->params.roi.rowEnd); |
2289 | cam->first_frame = 1; | 2289 | cam->first_frame = 1; |
2290 | } | 2290 | } |
2291 | 2291 | ||
2292 | if (cam->cmd_queue & COMMAND_SETCOLOURPARAMS) | 2292 | if (cam->cmd_queue & COMMAND_SETCOLOURPARAMS) |
2293 | do_command(cam, CPIA_COMMAND_SetColourParams, | 2293 | do_command(cam, CPIA_COMMAND_SetColourParams, |
2294 | cam->params.colourParams.brightness, | 2294 | cam->params.colourParams.brightness, |
2295 | cam->params.colourParams.contrast, | 2295 | cam->params.colourParams.contrast, |
2296 | cam->params.colourParams.saturation, 0); | 2296 | cam->params.colourParams.saturation, 0); |
2297 | 2297 | ||
2298 | if (cam->cmd_queue & COMMAND_SETAPCOR) | 2298 | if (cam->cmd_queue & COMMAND_SETAPCOR) |
2299 | do_command(cam, CPIA_COMMAND_SetApcor, | 2299 | do_command(cam, CPIA_COMMAND_SetApcor, |
2300 | cam->params.apcor.gain1, | 2300 | cam->params.apcor.gain1, |
2301 | cam->params.apcor.gain2, | 2301 | cam->params.apcor.gain2, |
2302 | cam->params.apcor.gain4, | 2302 | cam->params.apcor.gain4, |
2303 | cam->params.apcor.gain8); | 2303 | cam->params.apcor.gain8); |
2304 | 2304 | ||
2305 | if (cam->cmd_queue & COMMAND_SETVLOFFSET) | 2305 | if (cam->cmd_queue & COMMAND_SETVLOFFSET) |
2306 | do_command(cam, CPIA_COMMAND_SetVLOffset, | 2306 | do_command(cam, CPIA_COMMAND_SetVLOffset, |
2307 | cam->params.vlOffset.gain1, | 2307 | cam->params.vlOffset.gain1, |
2308 | cam->params.vlOffset.gain2, | 2308 | cam->params.vlOffset.gain2, |
2309 | cam->params.vlOffset.gain4, | 2309 | cam->params.vlOffset.gain4, |
2310 | cam->params.vlOffset.gain8); | 2310 | cam->params.vlOffset.gain8); |
2311 | 2311 | ||
2312 | if (cam->cmd_queue & COMMAND_SETEXPOSURE) { | 2312 | if (cam->cmd_queue & COMMAND_SETEXPOSURE) { |
2313 | do_command_extended(cam, CPIA_COMMAND_SetExposure, | 2313 | do_command_extended(cam, CPIA_COMMAND_SetExposure, |
2314 | cam->params.exposure.gainMode, | 2314 | cam->params.exposure.gainMode, |
2315 | 1, | 2315 | 1, |
2316 | cam->params.exposure.compMode, | 2316 | cam->params.exposure.compMode, |
2317 | cam->params.exposure.centreWeight, | 2317 | cam->params.exposure.centreWeight, |
2318 | cam->params.exposure.gain, | 2318 | cam->params.exposure.gain, |
2319 | cam->params.exposure.fineExp, | 2319 | cam->params.exposure.fineExp, |
2320 | cam->params.exposure.coarseExpLo, | 2320 | cam->params.exposure.coarseExpLo, |
2321 | cam->params.exposure.coarseExpHi, | 2321 | cam->params.exposure.coarseExpHi, |
2322 | cam->params.exposure.redComp, | 2322 | cam->params.exposure.redComp, |
2323 | cam->params.exposure.green1Comp, | 2323 | cam->params.exposure.green1Comp, |
2324 | cam->params.exposure.green2Comp, | 2324 | cam->params.exposure.green2Comp, |
2325 | cam->params.exposure.blueComp); | 2325 | cam->params.exposure.blueComp); |
2326 | if(cam->params.exposure.expMode != 1) { | 2326 | if(cam->params.exposure.expMode != 1) { |
2327 | do_command_extended(cam, CPIA_COMMAND_SetExposure, | 2327 | do_command_extended(cam, CPIA_COMMAND_SetExposure, |
2328 | 0, | 2328 | 0, |
2329 | cam->params.exposure.expMode, | 2329 | cam->params.exposure.expMode, |
2330 | 0, 0, | 2330 | 0, 0, |
2331 | cam->params.exposure.gain, | 2331 | cam->params.exposure.gain, |
2332 | cam->params.exposure.fineExp, | 2332 | cam->params.exposure.fineExp, |
2333 | cam->params.exposure.coarseExpLo, | 2333 | cam->params.exposure.coarseExpLo, |
2334 | cam->params.exposure.coarseExpHi, | 2334 | cam->params.exposure.coarseExpHi, |
2335 | 0, 0, 0, 0); | 2335 | 0, 0, 0, 0); |
2336 | } | 2336 | } |
2337 | } | 2337 | } |
2338 | 2338 | ||
2339 | if (cam->cmd_queue & COMMAND_SETCOLOURBALANCE) { | 2339 | if (cam->cmd_queue & COMMAND_SETCOLOURBALANCE) { |
2340 | if (cam->params.colourBalance.balanceMode == 1) { | 2340 | if (cam->params.colourBalance.balanceMode == 1) { |
2341 | do_command(cam, CPIA_COMMAND_SetColourBalance, | 2341 | do_command(cam, CPIA_COMMAND_SetColourBalance, |
@@ -2358,47 +2358,47 @@ static void dispatch_commands(struct cam_data *cam) | |||
2358 | 2358 | ||
2359 | if (cam->cmd_queue & COMMAND_SETCOMPRESSIONTARGET) | 2359 | if (cam->cmd_queue & COMMAND_SETCOMPRESSIONTARGET) |
2360 | do_command(cam, CPIA_COMMAND_SetCompressionTarget, | 2360 | do_command(cam, CPIA_COMMAND_SetCompressionTarget, |
2361 | cam->params.compressionTarget.frTargeting, | 2361 | cam->params.compressionTarget.frTargeting, |
2362 | cam->params.compressionTarget.targetFR, | 2362 | cam->params.compressionTarget.targetFR, |
2363 | cam->params.compressionTarget.targetQ, 0); | 2363 | cam->params.compressionTarget.targetQ, 0); |
2364 | 2364 | ||
2365 | if (cam->cmd_queue & COMMAND_SETYUVTHRESH) | 2365 | if (cam->cmd_queue & COMMAND_SETYUVTHRESH) |
2366 | do_command(cam, CPIA_COMMAND_SetYUVThresh, | 2366 | do_command(cam, CPIA_COMMAND_SetYUVThresh, |
2367 | cam->params.yuvThreshold.yThreshold, | 2367 | cam->params.yuvThreshold.yThreshold, |
2368 | cam->params.yuvThreshold.uvThreshold, 0, 0); | 2368 | cam->params.yuvThreshold.uvThreshold, 0, 0); |
2369 | 2369 | ||
2370 | if (cam->cmd_queue & COMMAND_SETCOMPRESSIONPARAMS) | 2370 | if (cam->cmd_queue & COMMAND_SETCOMPRESSIONPARAMS) |
2371 | do_command_extended(cam, CPIA_COMMAND_SetCompressionParams, | 2371 | do_command_extended(cam, CPIA_COMMAND_SetCompressionParams, |
2372 | 0, 0, 0, 0, | 2372 | 0, 0, 0, 0, |
2373 | cam->params.compressionParams.hysteresis, | 2373 | cam->params.compressionParams.hysteresis, |
2374 | cam->params.compressionParams.threshMax, | 2374 | cam->params.compressionParams.threshMax, |
2375 | cam->params.compressionParams.smallStep, | 2375 | cam->params.compressionParams.smallStep, |
2376 | cam->params.compressionParams.largeStep, | 2376 | cam->params.compressionParams.largeStep, |
2377 | cam->params.compressionParams.decimationHysteresis, | 2377 | cam->params.compressionParams.decimationHysteresis, |
2378 | cam->params.compressionParams.frDiffStepThresh, | 2378 | cam->params.compressionParams.frDiffStepThresh, |
2379 | cam->params.compressionParams.qDiffStepThresh, | 2379 | cam->params.compressionParams.qDiffStepThresh, |
2380 | cam->params.compressionParams.decimationThreshMod); | 2380 | cam->params.compressionParams.decimationThreshMod); |
2381 | 2381 | ||
2382 | if (cam->cmd_queue & COMMAND_SETCOMPRESSION) | 2382 | if (cam->cmd_queue & COMMAND_SETCOMPRESSION) |
2383 | do_command(cam, CPIA_COMMAND_SetCompression, | 2383 | do_command(cam, CPIA_COMMAND_SetCompression, |
2384 | cam->params.compression.mode, | 2384 | cam->params.compression.mode, |
2385 | cam->params.compression.decimation, 0, 0); | 2385 | cam->params.compression.decimation, 0, 0); |
2386 | 2386 | ||
2387 | if (cam->cmd_queue & COMMAND_SETSENSORFPS) | 2387 | if (cam->cmd_queue & COMMAND_SETSENSORFPS) |
2388 | do_command(cam, CPIA_COMMAND_SetSensorFPS, | 2388 | do_command(cam, CPIA_COMMAND_SetSensorFPS, |
2389 | cam->params.sensorFps.divisor, | 2389 | cam->params.sensorFps.divisor, |
2390 | cam->params.sensorFps.baserate, 0, 0); | 2390 | cam->params.sensorFps.baserate, 0, 0); |
2391 | 2391 | ||
2392 | if (cam->cmd_queue & COMMAND_SETFLICKERCTRL) | 2392 | if (cam->cmd_queue & COMMAND_SETFLICKERCTRL) |
2393 | do_command(cam, CPIA_COMMAND_SetFlickerCtrl, | 2393 | do_command(cam, CPIA_COMMAND_SetFlickerCtrl, |
2394 | cam->params.flickerControl.flickerMode, | 2394 | cam->params.flickerControl.flickerMode, |
2395 | cam->params.flickerControl.coarseJump, | 2395 | cam->params.flickerControl.coarseJump, |
2396 | abs(cam->params.flickerControl.allowableOverExposure), | 2396 | abs(cam->params.flickerControl.allowableOverExposure), |
2397 | 0); | 2397 | 0); |
2398 | 2398 | ||
2399 | if (cam->cmd_queue & COMMAND_SETECPTIMING) | 2399 | if (cam->cmd_queue & COMMAND_SETECPTIMING) |
2400 | do_command(cam, CPIA_COMMAND_SetECPTiming, | 2400 | do_command(cam, CPIA_COMMAND_SetECPTiming, |
2401 | cam->params.ecpTiming, 0, 0, 0); | 2401 | cam->params.ecpTiming, 0, 0, 0); |
2402 | 2402 | ||
2403 | if (cam->cmd_queue & COMMAND_PAUSE) | 2403 | if (cam->cmd_queue & COMMAND_PAUSE) |
2404 | do_command(cam, CPIA_COMMAND_EndStreamCap, 0, 0, 0, 0); | 2404 | do_command(cam, CPIA_COMMAND_EndStreamCap, 0, 0, 0, 0); |
@@ -2409,9 +2409,9 @@ static void dispatch_commands(struct cam_data *cam) | |||
2409 | if (cam->cmd_queue & COMMAND_SETLIGHTS && cam->params.qx3.qx3_detected) | 2409 | if (cam->cmd_queue & COMMAND_SETLIGHTS && cam->params.qx3.qx3_detected) |
2410 | { | 2410 | { |
2411 | int p1 = (cam->params.qx3.bottomlight == 0) << 1; | 2411 | int p1 = (cam->params.qx3.bottomlight == 0) << 1; |
2412 | int p2 = (cam->params.qx3.toplight == 0) << 3; | 2412 | int p2 = (cam->params.qx3.toplight == 0) << 3; |
2413 | do_command(cam, CPIA_COMMAND_WriteVCReg, 0x90, 0x8F, 0x50, 0); | 2413 | do_command(cam, CPIA_COMMAND_WriteVCReg, 0x90, 0x8F, 0x50, 0); |
2414 | do_command(cam, CPIA_COMMAND_WriteMCPort, 2, 0, (p1|p2|0xE0), 0); | 2414 | do_command(cam, CPIA_COMMAND_WriteMCPort, 2, 0, (p1|p2|0xE0), 0); |
2415 | } | 2415 | } |
2416 | 2416 | ||
2417 | cam->cmd_queue = COMMAND_NONE; | 2417 | cam->cmd_queue = COMMAND_NONE; |
@@ -2422,11 +2422,11 @@ static void dispatch_commands(struct cam_data *cam) | |||
2422 | 2422 | ||
2423 | 2423 | ||
2424 | static void set_flicker(struct cam_params *params, volatile u32 *command_flags, | 2424 | static void set_flicker(struct cam_params *params, volatile u32 *command_flags, |
2425 | int on) | 2425 | int on) |
2426 | { | 2426 | { |
2427 | /* Everything in here is from the Windows driver */ | 2427 | /* Everything in here is from the Windows driver */ |
2428 | #define FIRMWARE_VERSION(x,y) (params->version.firmwareVersion == (x) && \ | 2428 | #define FIRMWARE_VERSION(x,y) (params->version.firmwareVersion == (x) && \ |
2429 | params->version.firmwareRevision == (y)) | 2429 | params->version.firmwareRevision == (y)) |
2430 | /* define for compgain calculation */ | 2430 | /* define for compgain calculation */ |
2431 | #if 0 | 2431 | #if 0 |
2432 | #define COMPGAIN(base, curexp, newexp) \ | 2432 | #define COMPGAIN(base, curexp, newexp) \ |
@@ -2441,7 +2441,7 @@ static void set_flicker(struct cam_params *params, volatile u32 *command_flags, | |||
2441 | (u16)(((u32)(curexp * (u8)(curcomp + 128)) / (u8)(basecomp - 128))) | 2441 | (u16)(((u32)(curexp * (u8)(curcomp + 128)) / (u8)(basecomp - 128))) |
2442 | #endif | 2442 | #endif |
2443 | 2443 | ||
2444 | 2444 | ||
2445 | int currentexp = params->exposure.coarseExpLo + | 2445 | int currentexp = params->exposure.coarseExpLo + |
2446 | params->exposure.coarseExpHi*256; | 2446 | params->exposure.coarseExpHi*256; |
2447 | int startexp; | 2447 | int startexp; |
@@ -2482,7 +2482,7 @@ static void set_flicker(struct cam_params *params, volatile u32 *command_flags, | |||
2482 | } | 2482 | } |
2483 | if(FIRMWARE_VERSION(1,2)) | 2483 | if(FIRMWARE_VERSION(1,2)) |
2484 | params->exposure.compMode = 0; | 2484 | params->exposure.compMode = 0; |
2485 | else | 2485 | else |
2486 | params->exposure.compMode = 1; | 2486 | params->exposure.compMode = 1; |
2487 | 2487 | ||
2488 | params->apcor.gain1 = 0x18; | 2488 | params->apcor.gain1 = 0x18; |
@@ -2533,14 +2533,14 @@ static void set_flicker(struct cam_params *params, volatile u32 *command_flags, | |||
2533 | } | 2533 | } |
2534 | 2534 | ||
2535 | #define FIRMWARE_VERSION(x,y) (cam->params.version.firmwareVersion == (x) && \ | 2535 | #define FIRMWARE_VERSION(x,y) (cam->params.version.firmwareVersion == (x) && \ |
2536 | cam->params.version.firmwareRevision == (y)) | 2536 | cam->params.version.firmwareRevision == (y)) |
2537 | /* monitor the exposure and adjust the sensor frame rate if needed */ | 2537 | /* monitor the exposure and adjust the sensor frame rate if needed */ |
2538 | static void monitor_exposure(struct cam_data *cam) | 2538 | static void monitor_exposure(struct cam_data *cam) |
2539 | { | 2539 | { |
2540 | u8 exp_acc, bcomp, gain, coarseL, cmd[8], data[8]; | 2540 | u8 exp_acc, bcomp, gain, coarseL, cmd[8], data[8]; |
2541 | int retval, light_exp, dark_exp, very_dark_exp; | 2541 | int retval, light_exp, dark_exp, very_dark_exp; |
2542 | int old_exposure, new_exposure, framerate; | 2542 | int old_exposure, new_exposure, framerate; |
2543 | 2543 | ||
2544 | /* get necessary stats and register settings from camera */ | 2544 | /* get necessary stats and register settings from camera */ |
2545 | /* do_command can't handle this, so do it ourselves */ | 2545 | /* do_command can't handle this, so do it ourselves */ |
2546 | cmd[0] = CPIA_COMMAND_ReadVPRegs>>8; | 2546 | cmd[0] = CPIA_COMMAND_ReadVPRegs>>8; |
@@ -2564,17 +2564,17 @@ static void monitor_exposure(struct cam_data *cam) | |||
2564 | 2564 | ||
2565 | mutex_lock(&cam->param_lock); | 2565 | mutex_lock(&cam->param_lock); |
2566 | light_exp = cam->params.colourParams.brightness + | 2566 | light_exp = cam->params.colourParams.brightness + |
2567 | TC - 50 + EXP_ACC_LIGHT; | 2567 | TC - 50 + EXP_ACC_LIGHT; |
2568 | if(light_exp > 255) | 2568 | if(light_exp > 255) |
2569 | light_exp = 255; | 2569 | light_exp = 255; |
2570 | dark_exp = cam->params.colourParams.brightness + | 2570 | dark_exp = cam->params.colourParams.brightness + |
2571 | TC - 50 - EXP_ACC_DARK; | 2571 | TC - 50 - EXP_ACC_DARK; |
2572 | if(dark_exp < 0) | 2572 | if(dark_exp < 0) |
2573 | dark_exp = 0; | 2573 | dark_exp = 0; |
2574 | very_dark_exp = dark_exp/2; | 2574 | very_dark_exp = dark_exp/2; |
2575 | 2575 | ||
2576 | old_exposure = cam->params.exposure.coarseExpHi * 256 + | 2576 | old_exposure = cam->params.exposure.coarseExpHi * 256 + |
2577 | cam->params.exposure.coarseExpLo; | 2577 | cam->params.exposure.coarseExpLo; |
2578 | 2578 | ||
2579 | if(!cam->params.flickerControl.disabled) { | 2579 | if(!cam->params.flickerControl.disabled) { |
2580 | /* Flicker control on */ | 2580 | /* Flicker control on */ |
@@ -2667,11 +2667,11 @@ static void monitor_exposure(struct cam_data *cam) | |||
2667 | cam->exposure_status = EXPOSURE_NORMAL; | 2667 | cam->exposure_status = EXPOSURE_NORMAL; |
2668 | } | 2668 | } |
2669 | } | 2669 | } |
2670 | 2670 | ||
2671 | framerate = cam->fps; | 2671 | framerate = cam->fps; |
2672 | if(framerate > 30 || framerate < 1) | 2672 | if(framerate > 30 || framerate < 1) |
2673 | framerate = 1; | 2673 | framerate = 1; |
2674 | 2674 | ||
2675 | if(!cam->params.flickerControl.disabled) { | 2675 | if(!cam->params.flickerControl.disabled) { |
2676 | /* Flicker control on */ | 2676 | /* Flicker control on */ |
2677 | if((cam->exposure_status == EXPOSURE_VERY_DARK || | 2677 | if((cam->exposure_status == EXPOSURE_VERY_DARK || |
@@ -2683,10 +2683,10 @@ static void monitor_exposure(struct cam_data *cam) | |||
2683 | ++cam->params.sensorFps.divisor; | 2683 | ++cam->params.sensorFps.divisor; |
2684 | cam->cmd_queue |= COMMAND_SETSENSORFPS; | 2684 | cam->cmd_queue |= COMMAND_SETSENSORFPS; |
2685 | 2685 | ||
2686 | cam->params.flickerControl.coarseJump = | 2686 | cam->params.flickerControl.coarseJump = |
2687 | flicker_jumps[cam->mainsFreq] | 2687 | flicker_jumps[cam->mainsFreq] |
2688 | [cam->params.sensorFps.baserate] | 2688 | [cam->params.sensorFps.baserate] |
2689 | [cam->params.sensorFps.divisor]; | 2689 | [cam->params.sensorFps.divisor]; |
2690 | cam->cmd_queue |= COMMAND_SETFLICKERCTRL; | 2690 | cam->cmd_queue |= COMMAND_SETFLICKERCTRL; |
2691 | 2691 | ||
2692 | new_exposure = cam->params.flickerControl.coarseJump-1; | 2692 | new_exposure = cam->params.flickerControl.coarseJump-1; |
@@ -2704,15 +2704,15 @@ static void monitor_exposure(struct cam_data *cam) | |||
2704 | cam->params.sensorFps.divisor > 0) { | 2704 | cam->params.sensorFps.divisor > 0) { |
2705 | 2705 | ||
2706 | /* light for too long */ | 2706 | /* light for too long */ |
2707 | int max_exp = FIRMWARE_VERSION(1,2) ? MAX_EXP_102 : MAX_EXP ; | 2707 | int max_exp = FIRMWARE_VERSION(1,2) ? MAX_EXP_102 : MAX_EXP ; |
2708 | 2708 | ||
2709 | --cam->params.sensorFps.divisor; | 2709 | --cam->params.sensorFps.divisor; |
2710 | cam->cmd_queue |= COMMAND_SETSENSORFPS; | 2710 | cam->cmd_queue |= COMMAND_SETSENSORFPS; |
2711 | 2711 | ||
2712 | cam->params.flickerControl.coarseJump = | 2712 | cam->params.flickerControl.coarseJump = |
2713 | flicker_jumps[cam->mainsFreq] | 2713 | flicker_jumps[cam->mainsFreq] |
2714 | [cam->params.sensorFps.baserate] | 2714 | [cam->params.sensorFps.baserate] |
2715 | [cam->params.sensorFps.divisor]; | 2715 | [cam->params.sensorFps.divisor]; |
2716 | cam->cmd_queue |= COMMAND_SETFLICKERCTRL; | 2716 | cam->cmd_queue |= COMMAND_SETFLICKERCTRL; |
2717 | 2717 | ||
2718 | new_exposure = cam->params.flickerControl.coarseJump-1; | 2718 | new_exposure = cam->params.flickerControl.coarseJump-1; |
@@ -2772,7 +2772,7 @@ static void monitor_exposure(struct cam_data *cam) | |||
2772 | 2772 | ||
2773 | It also adjust the colour balance when an exposure step is detected - as | 2773 | It also adjust the colour balance when an exposure step is detected - as |
2774 | long as flicker is running | 2774 | long as flicker is running |
2775 | */ | 2775 | */ |
2776 | static void restart_flicker(struct cam_data *cam) | 2776 | static void restart_flicker(struct cam_data *cam) |
2777 | { | 2777 | { |
2778 | int cam_exposure, old_exp; | 2778 | int cam_exposure, old_exp; |
@@ -2786,22 +2786,22 @@ static void restart_flicker(struct cam_data *cam) | |||
2786 | } | 2786 | } |
2787 | cam_exposure = cam->raw_image[39]*2; | 2787 | cam_exposure = cam->raw_image[39]*2; |
2788 | old_exp = cam->params.exposure.coarseExpLo + | 2788 | old_exp = cam->params.exposure.coarseExpLo + |
2789 | cam->params.exposure.coarseExpHi*256; | 2789 | cam->params.exposure.coarseExpHi*256; |
2790 | /* | 2790 | /* |
2791 | see how far away camera exposure is from a valid | 2791 | see how far away camera exposure is from a valid |
2792 | flicker exposure value | 2792 | flicker exposure value |
2793 | */ | 2793 | */ |
2794 | cam_exposure %= cam->params.flickerControl.coarseJump; | 2794 | cam_exposure %= cam->params.flickerControl.coarseJump; |
2795 | if(!cam->params.flickerControl.disabled && | 2795 | if(!cam->params.flickerControl.disabled && |
2796 | cam_exposure <= cam->params.flickerControl.coarseJump - 3) { | 2796 | cam_exposure <= cam->params.flickerControl.coarseJump - 3) { |
2797 | /* Flicker control auto-disabled */ | 2797 | /* Flicker control auto-disabled */ |
2798 | cam->params.flickerControl.disabled = 1; | 2798 | cam->params.flickerControl.disabled = 1; |
2799 | } | 2799 | } |
2800 | 2800 | ||
2801 | if(cam->params.flickerControl.disabled && | 2801 | if(cam->params.flickerControl.disabled && |
2802 | cam->params.flickerControl.flickerMode && | 2802 | cam->params.flickerControl.flickerMode && |
2803 | old_exp > cam->params.flickerControl.coarseJump + | 2803 | old_exp > cam->params.flickerControl.coarseJump + |
2804 | ROUND_UP_EXP_FOR_FLICKER) { | 2804 | ROUND_UP_EXP_FOR_FLICKER) { |
2805 | /* exposure is now high enough to switch | 2805 | /* exposure is now high enough to switch |
2806 | flicker control back on */ | 2806 | flicker control back on */ |
2807 | set_flicker(&cam->params, &cam->cmd_queue, 1); | 2807 | set_flicker(&cam->params, &cam->cmd_queue, 1); |
@@ -2818,7 +2818,7 @@ static int clear_stall(struct cam_data *cam) | |||
2818 | { | 2818 | { |
2819 | /* FIXME: Does this actually work? */ | 2819 | /* FIXME: Does this actually work? */ |
2820 | LOG("Clearing stall\n"); | 2820 | LOG("Clearing stall\n"); |
2821 | 2821 | ||
2822 | cam->ops->streamRead(cam->lowlevel_data, cam->raw_image, 0); | 2822 | cam->ops->streamRead(cam->lowlevel_data, cam->raw_image, 0); |
2823 | do_command(cam, CPIA_COMMAND_GetCameraStatus,0,0,0,0); | 2823 | do_command(cam, CPIA_COMMAND_GetCameraStatus,0,0,0,0); |
2824 | return cam->params.status.streamState != STREAM_PAUSED; | 2824 | return cam->params.status.streamState != STREAM_PAUSED; |
@@ -2878,7 +2878,7 @@ static int fetch_frame(void *data) | |||
2878 | return -EINTR; | 2878 | return -EINTR; |
2879 | 2879 | ||
2880 | do_command(cam, CPIA_COMMAND_GetCameraStatus, | 2880 | do_command(cam, CPIA_COMMAND_GetCameraStatus, |
2881 | 0, 0, 0, 0); | 2881 | 0, 0, 0, 0); |
2882 | } | 2882 | } |
2883 | if(cam->params.status.streamState != STREAM_READY) { | 2883 | if(cam->params.status.streamState != STREAM_READY) { |
2884 | continue; | 2884 | continue; |
@@ -2903,18 +2903,18 @@ static int fetch_frame(void *data) | |||
2903 | 2903 | ||
2904 | /* Switch flicker control back on if it got turned off */ | 2904 | /* Switch flicker control back on if it got turned off */ |
2905 | restart_flicker(cam); | 2905 | restart_flicker(cam); |
2906 | 2906 | ||
2907 | /* If AEC is enabled, monitor the exposure and | 2907 | /* If AEC is enabled, monitor the exposure and |
2908 | adjust the sensor frame rate if needed */ | 2908 | adjust the sensor frame rate if needed */ |
2909 | if(cam->params.exposure.expMode == 2) | 2909 | if(cam->params.exposure.expMode == 2) |
2910 | monitor_exposure(cam); | 2910 | monitor_exposure(cam); |
2911 | 2911 | ||
2912 | /* camera idle now so dispatch queued commands */ | 2912 | /* camera idle now so dispatch queued commands */ |
2913 | dispatch_commands(cam); | 2913 | dispatch_commands(cam); |
2914 | 2914 | ||
2915 | /* Update our knowledge of the camera state */ | 2915 | /* Update our knowledge of the camera state */ |
2916 | do_command(cam, CPIA_COMMAND_GetColourBalance, 0, 0, 0, 0); | 2916 | do_command(cam, CPIA_COMMAND_GetColourBalance, 0, 0, 0, 0); |
2917 | do_command(cam, CPIA_COMMAND_GetExposure, 0, 0, 0, 0); | 2917 | do_command(cam, CPIA_COMMAND_GetExposure, 0, 0, 0, 0); |
2918 | do_command(cam, CPIA_COMMAND_ReadMCPorts, 0, 0, 0, 0); | 2918 | do_command(cam, CPIA_COMMAND_ReadMCPorts, 0, 0, 0, 0); |
2919 | 2919 | ||
2920 | /* decompress and convert image to by copying it from | 2920 | /* decompress and convert image to by copying it from |
@@ -2933,7 +2933,7 @@ static int fetch_frame(void *data) | |||
2933 | uncompressed. */ | 2933 | uncompressed. */ |
2934 | cam->first_frame = 1; | 2934 | cam->first_frame = 1; |
2935 | do_command(cam, CPIA_COMMAND_SetGrabMode, | 2935 | do_command(cam, CPIA_COMMAND_SetGrabMode, |
2936 | CPIA_GRAB_SINGLE, 0, 0, 0); | 2936 | CPIA_GRAB_SINGLE, 0, 0, 0); |
2937 | /* FIXME: Trial & error - need up to 70ms for | 2937 | /* FIXME: Trial & error - need up to 70ms for |
2938 | the grab mode change to complete ? */ | 2938 | the grab mode change to complete ? */ |
2939 | msleep_interruptible(70); | 2939 | msleep_interruptible(70); |
@@ -2957,12 +2957,12 @@ static int fetch_frame(void *data) | |||
2957 | if (cam->first_frame) { | 2957 | if (cam->first_frame) { |
2958 | cam->first_frame = 0; | 2958 | cam->first_frame = 0; |
2959 | do_command(cam, CPIA_COMMAND_SetCompression, | 2959 | do_command(cam, CPIA_COMMAND_SetCompression, |
2960 | cam->params.compression.mode, | 2960 | cam->params.compression.mode, |
2961 | cam->params.compression.decimation, 0, 0); | 2961 | cam->params.compression.decimation, 0, 0); |
2962 | 2962 | ||
2963 | /* Switch from single-grab to continuous grab */ | 2963 | /* Switch from single-grab to continuous grab */ |
2964 | do_command(cam, CPIA_COMMAND_SetGrabMode, | 2964 | do_command(cam, CPIA_COMMAND_SetGrabMode, |
2965 | CPIA_GRAB_CONTINUOUS, 0, 0, 0); | 2965 | CPIA_GRAB_CONTINUOUS, 0, 0, 0); |
2966 | } | 2966 | } |
2967 | return 0; | 2967 | return 0; |
2968 | } | 2968 | } |
@@ -2977,12 +2977,12 @@ static int capture_frame(struct cam_data *cam, struct video_mmap *vm) | |||
2977 | if ((err = allocate_frame_buf(cam))) | 2977 | if ((err = allocate_frame_buf(cam))) |
2978 | return err; | 2978 | return err; |
2979 | } | 2979 | } |
2980 | 2980 | ||
2981 | cam->curframe = vm->frame; | 2981 | cam->curframe = vm->frame; |
2982 | cam->frame[cam->curframe].state = FRAME_READY; | 2982 | cam->frame[cam->curframe].state = FRAME_READY; |
2983 | return fetch_frame(cam); | 2983 | return fetch_frame(cam); |
2984 | } | 2984 | } |
2985 | 2985 | ||
2986 | static int goto_high_power(struct cam_data *cam) | 2986 | static int goto_high_power(struct cam_data *cam) |
2987 | { | 2987 | { |
2988 | if (do_command(cam, CPIA_COMMAND_GotoHiPower, 0, 0, 0, 0)) | 2988 | if (do_command(cam, CPIA_COMMAND_GotoHiPower, 0, 0, 0, 0)) |
@@ -3039,22 +3039,22 @@ static void save_camera_state(struct cam_data *cam) | |||
3039 | static int set_camera_state(struct cam_data *cam) | 3039 | static int set_camera_state(struct cam_data *cam) |
3040 | { | 3040 | { |
3041 | cam->cmd_queue = COMMAND_SETCOMPRESSION | | 3041 | cam->cmd_queue = COMMAND_SETCOMPRESSION | |
3042 | COMMAND_SETCOMPRESSIONTARGET | | 3042 | COMMAND_SETCOMPRESSIONTARGET | |
3043 | COMMAND_SETCOLOURPARAMS | | 3043 | COMMAND_SETCOLOURPARAMS | |
3044 | COMMAND_SETFORMAT | | 3044 | COMMAND_SETFORMAT | |
3045 | COMMAND_SETYUVTHRESH | | 3045 | COMMAND_SETYUVTHRESH | |
3046 | COMMAND_SETECPTIMING | | 3046 | COMMAND_SETECPTIMING | |
3047 | COMMAND_SETCOMPRESSIONPARAMS | | 3047 | COMMAND_SETCOMPRESSIONPARAMS | |
3048 | COMMAND_SETEXPOSURE | | 3048 | COMMAND_SETEXPOSURE | |
3049 | COMMAND_SETCOLOURBALANCE | | 3049 | COMMAND_SETCOLOURBALANCE | |
3050 | COMMAND_SETSENSORFPS | | 3050 | COMMAND_SETSENSORFPS | |
3051 | COMMAND_SETAPCOR | | 3051 | COMMAND_SETAPCOR | |
3052 | COMMAND_SETFLICKERCTRL | | 3052 | COMMAND_SETFLICKERCTRL | |
3053 | COMMAND_SETVLOFFSET; | 3053 | COMMAND_SETVLOFFSET; |
3054 | 3054 | ||
3055 | do_command(cam, CPIA_COMMAND_SetGrabMode, CPIA_GRAB_SINGLE,0,0,0); | 3055 | do_command(cam, CPIA_COMMAND_SetGrabMode, CPIA_GRAB_SINGLE,0,0,0); |
3056 | dispatch_commands(cam); | 3056 | dispatch_commands(cam); |
3057 | 3057 | ||
3058 | /* Wait 6 frames for the sensor to get all settings and | 3058 | /* Wait 6 frames for the sensor to get all settings and |
3059 | AEC/ACB to settle */ | 3059 | AEC/ACB to settle */ |
3060 | msleep_interruptible(6*(cam->params.sensorFps.baserate ? 33 : 40) * | 3060 | msleep_interruptible(6*(cam->params.sensorFps.baserate ? 33 : 40) * |
@@ -3062,7 +3062,7 @@ static int set_camera_state(struct cam_data *cam) | |||
3062 | 3062 | ||
3063 | if(signal_pending(current)) | 3063 | if(signal_pending(current)) |
3064 | return -EINTR; | 3064 | return -EINTR; |
3065 | 3065 | ||
3066 | save_camera_state(cam); | 3066 | save_camera_state(cam); |
3067 | 3067 | ||
3068 | return 0; | 3068 | return 0; |
@@ -3094,9 +3094,9 @@ static int reset_camera(struct cam_data *cam) | |||
3094 | if (goto_low_power(cam)) | 3094 | if (goto_low_power(cam)) |
3095 | return -ENODEV; | 3095 | return -ENODEV; |
3096 | } | 3096 | } |
3097 | 3097 | ||
3098 | /* procedure described in developer's guide p3-28 */ | 3098 | /* procedure described in developer's guide p3-28 */ |
3099 | 3099 | ||
3100 | /* Check the firmware version. */ | 3100 | /* Check the firmware version. */ |
3101 | cam->params.version.firmwareVersion = 0; | 3101 | cam->params.version.firmwareVersion = 0; |
3102 | get_version_information(cam); | 3102 | get_version_information(cam); |
@@ -3113,14 +3113,14 @@ static int reset_camera(struct cam_data *cam) | |||
3113 | cam->params.qx3.qx3_detected = (cam->params.pnpID.vendor == 0x0813 && | 3113 | cam->params.qx3.qx3_detected = (cam->params.pnpID.vendor == 0x0813 && |
3114 | cam->params.pnpID.product == 0x0001); | 3114 | cam->params.pnpID.product == 0x0001); |
3115 | 3115 | ||
3116 | /* The fatal error checking should be done after | 3116 | /* The fatal error checking should be done after |
3117 | * the camera powers up (developer's guide p 3-38) */ | 3117 | * the camera powers up (developer's guide p 3-38) */ |
3118 | 3118 | ||
3119 | /* Set streamState before transition to high power to avoid bug | 3119 | /* Set streamState before transition to high power to avoid bug |
3120 | * in firmware 1-02 */ | 3120 | * in firmware 1-02 */ |
3121 | do_command(cam, CPIA_COMMAND_ModifyCameraStatus, STREAMSTATE, 0, | 3121 | do_command(cam, CPIA_COMMAND_ModifyCameraStatus, STREAMSTATE, 0, |
3122 | STREAM_NOT_READY, 0); | 3122 | STREAM_NOT_READY, 0); |
3123 | 3123 | ||
3124 | /* GotoHiPower */ | 3124 | /* GotoHiPower */ |
3125 | err = goto_high_power(cam); | 3125 | err = goto_high_power(cam); |
3126 | if (err) | 3126 | if (err) |
@@ -3142,16 +3142,16 @@ static int reset_camera(struct cam_data *cam) | |||
3142 | /* Firmware 1-02 may do this for parallel port cameras, | 3142 | /* Firmware 1-02 may do this for parallel port cameras, |
3143 | * just clear the flags (developer's guide p 3-38) */ | 3143 | * just clear the flags (developer's guide p 3-38) */ |
3144 | do_command(cam, CPIA_COMMAND_ModifyCameraStatus, | 3144 | do_command(cam, CPIA_COMMAND_ModifyCameraStatus, |
3145 | FATALERROR, ~(COM_FLAG|CPIA_FLAG), 0, 0); | 3145 | FATALERROR, ~(COM_FLAG|CPIA_FLAG), 0, 0); |
3146 | } | 3146 | } |
3147 | } | 3147 | } |
3148 | 3148 | ||
3149 | /* Check the camera status again */ | 3149 | /* Check the camera status again */ |
3150 | if (cam->params.status.fatalError) { | 3150 | if (cam->params.status.fatalError) { |
3151 | if (cam->params.status.fatalError) | 3151 | if (cam->params.status.fatalError) |
3152 | return -EIO; | 3152 | return -EIO; |
3153 | } | 3153 | } |
3154 | 3154 | ||
3155 | /* VPVersion can't be retrieved before the camera is in HiPower, | 3155 | /* VPVersion can't be retrieved before the camera is in HiPower, |
3156 | * so get it here instead of in get_version_information. */ | 3156 | * so get it here instead of in get_version_information. */ |
3157 | do_command(cam, CPIA_COMMAND_GetVPVersion, 0, 0, 0, 0); | 3157 | do_command(cam, CPIA_COMMAND_GetVPVersion, 0, 0, 0, 0); |
@@ -3193,24 +3193,24 @@ static int cpia_open(struct inode *inode, struct file *file) | |||
3193 | if (!cam->raw_image) | 3193 | if (!cam->raw_image) |
3194 | goto oops; | 3194 | goto oops; |
3195 | } | 3195 | } |
3196 | 3196 | ||
3197 | if (!cam->decompressed_frame.data) { | 3197 | if (!cam->decompressed_frame.data) { |
3198 | cam->decompressed_frame.data = rvmalloc(CPIA_MAX_FRAME_SIZE); | 3198 | cam->decompressed_frame.data = rvmalloc(CPIA_MAX_FRAME_SIZE); |
3199 | if (!cam->decompressed_frame.data) | 3199 | if (!cam->decompressed_frame.data) |
3200 | goto oops; | 3200 | goto oops; |
3201 | } | 3201 | } |
3202 | 3202 | ||
3203 | /* open cpia */ | 3203 | /* open cpia */ |
3204 | err = -ENODEV; | 3204 | err = -ENODEV; |
3205 | if (cam->ops->open(cam->lowlevel_data)) | 3205 | if (cam->ops->open(cam->lowlevel_data)) |
3206 | goto oops; | 3206 | goto oops; |
3207 | 3207 | ||
3208 | /* reset the camera */ | 3208 | /* reset the camera */ |
3209 | if ((err = reset_camera(cam)) != 0) { | 3209 | if ((err = reset_camera(cam)) != 0) { |
3210 | cam->ops->close(cam->lowlevel_data); | 3210 | cam->ops->close(cam->lowlevel_data); |
3211 | goto oops; | 3211 | goto oops; |
3212 | } | 3212 | } |
3213 | 3213 | ||
3214 | err = -EINTR; | 3214 | err = -EINTR; |
3215 | if(signal_pending(current)) | 3215 | if(signal_pending(current)) |
3216 | goto oops; | 3216 | goto oops; |
@@ -3224,7 +3224,7 @@ static int cpia_open(struct inode *inode, struct file *file) | |||
3224 | 3224 | ||
3225 | /* init it to something */ | 3225 | /* init it to something */ |
3226 | cam->mmap_kludge = 0; | 3226 | cam->mmap_kludge = 0; |
3227 | 3227 | ||
3228 | ++cam->open_count; | 3228 | ++cam->open_count; |
3229 | file->private_data = dev; | 3229 | file->private_data = dev; |
3230 | mutex_unlock(&cam->busy_lock); | 3230 | mutex_unlock(&cam->busy_lock); |
@@ -3250,10 +3250,10 @@ static int cpia_close(struct inode *inode, struct file *file) | |||
3250 | struct cam_data *cam = dev->priv; | 3250 | struct cam_data *cam = dev->priv; |
3251 | 3251 | ||
3252 | if (cam->ops) { | 3252 | if (cam->ops) { |
3253 | /* Return ownership of /proc/cpia/videoX to root */ | 3253 | /* Return ownership of /proc/cpia/videoX to root */ |
3254 | if(cam->proc_entry) | 3254 | if(cam->proc_entry) |
3255 | cam->proc_entry->uid = 0; | 3255 | cam->proc_entry->uid = 0; |
3256 | 3256 | ||
3257 | /* save camera state for later open (developers guide ch 3.5.3) */ | 3257 | /* save camera state for later open (developers guide ch 3.5.3) */ |
3258 | save_camera_state(cam); | 3258 | save_camera_state(cam); |
3259 | 3259 | ||
@@ -3342,7 +3342,7 @@ static ssize_t cpia_read(struct file *file, char __user *buf, | |||
3342 | return -EFAULT; | 3342 | return -EFAULT; |
3343 | } | 3343 | } |
3344 | if (copy_to_user(buf, cam->decompressed_frame.data, | 3344 | if (copy_to_user(buf, cam->decompressed_frame.data, |
3345 | cam->decompressed_frame.count)) { | 3345 | cam->decompressed_frame.count)) { |
3346 | DBG("copy_to_user failed\n"); | 3346 | DBG("copy_to_user failed\n"); |
3347 | mutex_unlock(&cam->busy_lock); | 3347 | mutex_unlock(&cam->busy_lock); |
3348 | return -EFAULT; | 3348 | return -EFAULT; |
@@ -3361,7 +3361,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3361 | 3361 | ||
3362 | if (!cam || !cam->ops) | 3362 | if (!cam || !cam->ops) |
3363 | return -ENODEV; | 3363 | return -ENODEV; |
3364 | 3364 | ||
3365 | /* make this _really_ smp-safe */ | 3365 | /* make this _really_ smp-safe */ |
3366 | if (mutex_lock_interruptible(&cam->busy_lock)) | 3366 | if (mutex_lock_interruptible(&cam->busy_lock)) |
3367 | return -EINTR; | 3367 | return -EINTR; |
@@ -3405,7 +3405,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3405 | v->norm = 0; | 3405 | v->norm = 0; |
3406 | break; | 3406 | break; |
3407 | } | 3407 | } |
3408 | 3408 | ||
3409 | case VIDIOCSCHAN: | 3409 | case VIDIOCSCHAN: |
3410 | { | 3410 | { |
3411 | struct video_channel *v = arg; | 3411 | struct video_channel *v = arg; |
@@ -3424,7 +3424,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3424 | *pic = cam->vp; | 3424 | *pic = cam->vp; |
3425 | break; | 3425 | break; |
3426 | } | 3426 | } |
3427 | 3427 | ||
3428 | case VIDIOCSPICT: | 3428 | case VIDIOCSPICT: |
3429 | { | 3429 | { |
3430 | struct video_picture *vp = arg; | 3430 | struct video_picture *vp = arg; |
@@ -3458,11 +3458,11 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3458 | 3458 | ||
3459 | /* Adjust flicker control if necessary */ | 3459 | /* Adjust flicker control if necessary */ |
3460 | if(cam->params.flickerControl.allowableOverExposure < 0) | 3460 | if(cam->params.flickerControl.allowableOverExposure < 0) |
3461 | cam->params.flickerControl.allowableOverExposure = | 3461 | cam->params.flickerControl.allowableOverExposure = |
3462 | -find_over_exposure(cam->params.colourParams.brightness); | 3462 | -find_over_exposure(cam->params.colourParams.brightness); |
3463 | if(cam->params.flickerControl.flickerMode != 0) | 3463 | if(cam->params.flickerControl.flickerMode != 0) |
3464 | cam->cmd_queue |= COMMAND_SETFLICKERCTRL; | 3464 | cam->cmd_queue |= COMMAND_SETFLICKERCTRL; |
3465 | 3465 | ||
3466 | 3466 | ||
3467 | /* queue command to update camera */ | 3467 | /* queue command to update camera */ |
3468 | cam->cmd_queue |= COMMAND_SETCOLOURPARAMS; | 3468 | cam->cmd_queue |= COMMAND_SETCOLOURPARAMS; |
@@ -3482,7 +3482,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3482 | *vw = cam->vw; | 3482 | *vw = cam->vw; |
3483 | break; | 3483 | break; |
3484 | } | 3484 | } |
3485 | 3485 | ||
3486 | case VIDIOCSWIN: | 3486 | case VIDIOCSWIN: |
3487 | { | 3487 | { |
3488 | /* copy_from_user, check validity, copy to internal structure */ | 3488 | /* copy_from_user, check validity, copy to internal structure */ |
@@ -3514,7 +3514,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3514 | 3514 | ||
3515 | /* video size is changing, reset the subcapture area */ | 3515 | /* video size is changing, reset the subcapture area */ |
3516 | memset(&cam->vc, 0, sizeof(cam->vc)); | 3516 | memset(&cam->vc, 0, sizeof(cam->vc)); |
3517 | 3517 | ||
3518 | set_vw_size(cam); | 3518 | set_vw_size(cam); |
3519 | DBG("%d / %d\n", cam->vw.width, cam->vw.height); | 3519 | DBG("%d / %d\n", cam->vw.width, cam->vw.height); |
3520 | cam->cmd_queue |= COMMAND_SETFORMAT; | 3520 | cam->cmd_queue |= COMMAND_SETFORMAT; |
@@ -3547,7 +3547,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3547 | vm->offsets[i] = CPIA_MAX_FRAME_SIZE * i; | 3547 | vm->offsets[i] = CPIA_MAX_FRAME_SIZE * i; |
3548 | break; | 3548 | break; |
3549 | } | 3549 | } |
3550 | 3550 | ||
3551 | case VIDIOCMCAPTURE: | 3551 | case VIDIOCMCAPTURE: |
3552 | { | 3552 | { |
3553 | struct video_mmap *vm = arg; | 3553 | struct video_mmap *vm = arg; |
@@ -3597,7 +3597,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3597 | 3597 | ||
3598 | /* video size is changing, reset the subcapture area */ | 3598 | /* video size is changing, reset the subcapture area */ |
3599 | memset(&cam->vc, 0, sizeof(cam->vc)); | 3599 | memset(&cam->vc, 0, sizeof(cam->vc)); |
3600 | 3600 | ||
3601 | set_vw_size(cam); | 3601 | set_vw_size(cam); |
3602 | cam->cmd_queue |= COMMAND_SETFORMAT; | 3602 | cam->cmd_queue |= COMMAND_SETFORMAT; |
3603 | dispatch_commands(cam); | 3603 | dispatch_commands(cam); |
@@ -3608,7 +3608,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3608 | 3608 | ||
3609 | break; | 3609 | break; |
3610 | } | 3610 | } |
3611 | 3611 | ||
3612 | case VIDIOCSYNC: | 3612 | case VIDIOCSYNC: |
3613 | { | 3613 | { |
3614 | int *frame = arg; | 3614 | int *frame = arg; |
@@ -3649,7 +3649,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3649 | *vc = cam->vc; | 3649 | *vc = cam->vc; |
3650 | 3650 | ||
3651 | break; | 3651 | break; |
3652 | } | 3652 | } |
3653 | 3653 | ||
3654 | case VIDIOCSCAPTURE: | 3654 | case VIDIOCSCAPTURE: |
3655 | { | 3655 | { |
@@ -3665,7 +3665,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3665 | retval = -EINVAL; | 3665 | retval = -EINVAL; |
3666 | break; | 3666 | break; |
3667 | } | 3667 | } |
3668 | 3668 | ||
3669 | /* Clip to the resolution we can set for the ROI | 3669 | /* Clip to the resolution we can set for the ROI |
3670 | (every 8 columns and 4 rows) */ | 3670 | (every 8 columns and 4 rows) */ |
3671 | vc->x = vc->x & ~(__u32)7; | 3671 | vc->x = vc->x & ~(__u32)7; |
@@ -3681,14 +3681,14 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3681 | } | 3681 | } |
3682 | 3682 | ||
3683 | DBG("%d,%d/%dx%d\n", vc->x,vc->y,vc->width, vc->height); | 3683 | DBG("%d,%d/%dx%d\n", vc->x,vc->y,vc->width, vc->height); |
3684 | 3684 | ||
3685 | mutex_lock(&cam->param_lock); | 3685 | mutex_lock(&cam->param_lock); |
3686 | 3686 | ||
3687 | cam->vc.x = vc->x; | 3687 | cam->vc.x = vc->x; |
3688 | cam->vc.y = vc->y; | 3688 | cam->vc.y = vc->y; |
3689 | cam->vc.width = vc->width; | 3689 | cam->vc.width = vc->width; |
3690 | cam->vc.height = vc->height; | 3690 | cam->vc.height = vc->height; |
3691 | 3691 | ||
3692 | set_vw_size(cam); | 3692 | set_vw_size(cam); |
3693 | cam->cmd_queue |= COMMAND_SETFORMAT; | 3693 | cam->cmd_queue |= COMMAND_SETFORMAT; |
3694 | 3694 | ||
@@ -3699,7 +3699,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3699 | dispatch_commands(cam); | 3699 | dispatch_commands(cam); |
3700 | break; | 3700 | break; |
3701 | } | 3701 | } |
3702 | 3702 | ||
3703 | case VIDIOCGUNIT: | 3703 | case VIDIOCGUNIT: |
3704 | { | 3704 | { |
3705 | struct video_unit *vu = arg; | 3705 | struct video_unit *vu = arg; |
@@ -3715,7 +3715,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3715 | break; | 3715 | break; |
3716 | } | 3716 | } |
3717 | 3717 | ||
3718 | 3718 | ||
3719 | /* pointless to implement overlay with this camera */ | 3719 | /* pointless to implement overlay with this camera */ |
3720 | case VIDIOCCAPTURE: | 3720 | case VIDIOCCAPTURE: |
3721 | case VIDIOCGFBUF: | 3721 | case VIDIOCGFBUF: |
@@ -3738,7 +3738,7 @@ static int cpia_do_ioctl(struct inode *inode, struct file *file, | |||
3738 | 3738 | ||
3739 | mutex_unlock(&cam->busy_lock); | 3739 | mutex_unlock(&cam->busy_lock); |
3740 | return retval; | 3740 | return retval; |
3741 | } | 3741 | } |
3742 | 3742 | ||
3743 | static int cpia_ioctl(struct inode *inode, struct file *file, | 3743 | static int cpia_ioctl(struct inode *inode, struct file *file, |
3744 | unsigned int cmd, unsigned long arg) | 3744 | unsigned int cmd, unsigned long arg) |
@@ -3759,7 +3759,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma) | |||
3759 | 3759 | ||
3760 | if (!cam || !cam->ops) | 3760 | if (!cam || !cam->ops) |
3761 | return -ENODEV; | 3761 | return -ENODEV; |
3762 | 3762 | ||
3763 | DBG("cpia_mmap: %ld\n", size); | 3763 | DBG("cpia_mmap: %ld\n", size); |
3764 | 3764 | ||
3765 | if (size > FRAME_NUM*CPIA_MAX_FRAME_SIZE) | 3765 | if (size > FRAME_NUM*CPIA_MAX_FRAME_SIZE) |
@@ -3767,7 +3767,7 @@ static int cpia_mmap(struct file *file, struct vm_area_struct *vma) | |||
3767 | 3767 | ||
3768 | if (!cam || !cam->ops) | 3768 | if (!cam || !cam->ops) |
3769 | return -ENODEV; | 3769 | return -ENODEV; |
3770 | 3770 | ||
3771 | /* make this _really_ smp-safe */ | 3771 | /* make this _really_ smp-safe */ |
3772 | if (mutex_lock_interruptible(&cam->busy_lock)) | 3772 | if (mutex_lock_interruptible(&cam->busy_lock)) |
3773 | return -EINTR; | 3773 | return -EINTR; |
@@ -3851,11 +3851,11 @@ static void reset_camera_struct(struct cam_data *cam) | |||
3851 | cam->params.flickerControl.flickerMode = 0; | 3851 | cam->params.flickerControl.flickerMode = 0; |
3852 | cam->params.flickerControl.disabled = 1; | 3852 | cam->params.flickerControl.disabled = 1; |
3853 | 3853 | ||
3854 | cam->params.flickerControl.coarseJump = | 3854 | cam->params.flickerControl.coarseJump = |
3855 | flicker_jumps[cam->mainsFreq] | 3855 | flicker_jumps[cam->mainsFreq] |
3856 | [cam->params.sensorFps.baserate] | 3856 | [cam->params.sensorFps.baserate] |
3857 | [cam->params.sensorFps.divisor]; | 3857 | [cam->params.sensorFps.divisor]; |
3858 | cam->params.flickerControl.allowableOverExposure = | 3858 | cam->params.flickerControl.allowableOverExposure = |
3859 | -find_over_exposure(cam->params.colourParams.brightness); | 3859 | -find_over_exposure(cam->params.colourParams.brightness); |
3860 | cam->params.vlOffset.gain1 = 20; | 3860 | cam->params.vlOffset.gain1 = 20; |
3861 | cam->params.vlOffset.gain2 = 24; | 3861 | cam->params.vlOffset.gain2 = 24; |
@@ -3870,21 +3870,21 @@ static void reset_camera_struct(struct cam_data *cam) | |||
3870 | cam->params.compressionParams.qDiffStepThresh = 3; | 3870 | cam->params.compressionParams.qDiffStepThresh = 3; |
3871 | cam->params.compressionParams.decimationThreshMod = 2; | 3871 | cam->params.compressionParams.decimationThreshMod = 2; |
3872 | /* End of default values from Software Developer's Guide */ | 3872 | /* End of default values from Software Developer's Guide */ |
3873 | 3873 | ||
3874 | cam->transfer_rate = 0; | 3874 | cam->transfer_rate = 0; |
3875 | cam->exposure_status = EXPOSURE_NORMAL; | 3875 | cam->exposure_status = EXPOSURE_NORMAL; |
3876 | 3876 | ||
3877 | /* Set Sensor FPS to 15fps. This seems better than 30fps | 3877 | /* Set Sensor FPS to 15fps. This seems better than 30fps |
3878 | * for indoor lighting. */ | 3878 | * for indoor lighting. */ |
3879 | cam->params.sensorFps.divisor = 1; | 3879 | cam->params.sensorFps.divisor = 1; |
3880 | cam->params.sensorFps.baserate = 1; | 3880 | cam->params.sensorFps.baserate = 1; |
3881 | 3881 | ||
3882 | cam->params.yuvThreshold.yThreshold = 6; /* From windows driver */ | 3882 | cam->params.yuvThreshold.yThreshold = 6; /* From windows driver */ |
3883 | cam->params.yuvThreshold.uvThreshold = 6; /* From windows driver */ | 3883 | cam->params.yuvThreshold.uvThreshold = 6; /* From windows driver */ |
3884 | 3884 | ||
3885 | cam->params.format.subSample = SUBSAMPLE_422; | 3885 | cam->params.format.subSample = SUBSAMPLE_422; |
3886 | cam->params.format.yuvOrder = YUVORDER_YUYV; | 3886 | cam->params.format.yuvOrder = YUVORDER_YUYV; |
3887 | 3887 | ||
3888 | cam->params.compression.mode = CPIA_COMPRESSION_AUTO; | 3888 | cam->params.compression.mode = CPIA_COMPRESSION_AUTO; |
3889 | cam->params.compressionTarget.frTargeting = | 3889 | cam->params.compressionTarget.frTargeting = |
3890 | CPIA_COMPRESSION_TARGET_QUALITY; | 3890 | CPIA_COMPRESSION_TARGET_QUALITY; |
@@ -3898,7 +3898,7 @@ static void reset_camera_struct(struct cam_data *cam) | |||
3898 | cam->params.qx3.cradled = 0; | 3898 | cam->params.qx3.cradled = 0; |
3899 | 3899 | ||
3900 | cam->video_size = VIDEOSIZE_CIF; | 3900 | cam->video_size = VIDEOSIZE_CIF; |
3901 | 3901 | ||
3902 | cam->vp.colour = 32768; /* 50% */ | 3902 | cam->vp.colour = 32768; /* 50% */ |
3903 | cam->vp.hue = 32768; /* 50% */ | 3903 | cam->vp.hue = 32768; /* 50% */ |
3904 | cam->vp.brightness = 32768; /* 50% */ | 3904 | cam->vp.brightness = 32768; /* 50% */ |
@@ -3911,7 +3911,7 @@ static void reset_camera_struct(struct cam_data *cam) | |||
3911 | cam->vc.y = 0; | 3911 | cam->vc.y = 0; |
3912 | cam->vc.width = 0; | 3912 | cam->vc.width = 0; |
3913 | cam->vc.height = 0; | 3913 | cam->vc.height = 0; |
3914 | 3914 | ||
3915 | cam->vw.x = 0; | 3915 | cam->vw.x = 0; |
3916 | cam->vw.y = 0; | 3916 | cam->vw.y = 0; |
3917 | set_vw_size(cam); | 3917 | set_vw_size(cam); |
@@ -3928,7 +3928,7 @@ static void reset_camera_struct(struct cam_data *cam) | |||
3928 | 3928 | ||
3929 | /* initialize cam_data structure */ | 3929 | /* initialize cam_data structure */ |
3930 | static void init_camera_struct(struct cam_data *cam, | 3930 | static void init_camera_struct(struct cam_data *cam, |
3931 | struct cpia_camera_ops *ops ) | 3931 | struct cpia_camera_ops *ops ) |
3932 | { | 3932 | { |
3933 | int i; | 3933 | int i; |
3934 | 3934 | ||
@@ -3945,7 +3945,7 @@ static void init_camera_struct(struct cam_data *cam, | |||
3945 | 3945 | ||
3946 | memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template)); | 3946 | memcpy(&cam->vdev, &cpia_template, sizeof(cpia_template)); |
3947 | cam->vdev.priv = cam; | 3947 | cam->vdev.priv = cam; |
3948 | 3948 | ||
3949 | cam->curframe = 0; | 3949 | cam->curframe = 0; |
3950 | for (i = 0; i < FRAME_NUM; i++) { | 3950 | for (i = 0; i < FRAME_NUM; i++) { |
3951 | cam->frame[i].width = 0; | 3951 | cam->frame[i].width = 0; |
@@ -3961,15 +3961,15 @@ static void init_camera_struct(struct cam_data *cam, | |||
3961 | 3961 | ||
3962 | struct cam_data *cpia_register_camera(struct cpia_camera_ops *ops, void *lowlevel) | 3962 | struct cam_data *cpia_register_camera(struct cpia_camera_ops *ops, void *lowlevel) |
3963 | { | 3963 | { |
3964 | struct cam_data *camera; | 3964 | struct cam_data *camera; |
3965 | 3965 | ||
3966 | if ((camera = kmalloc(sizeof(struct cam_data), GFP_KERNEL)) == NULL) | 3966 | if ((camera = kmalloc(sizeof(struct cam_data), GFP_KERNEL)) == NULL) |
3967 | return NULL; | 3967 | return NULL; |
3968 | 3968 | ||
3969 | 3969 | ||
3970 | init_camera_struct( camera, ops ); | 3970 | init_camera_struct( camera, ops ); |
3971 | camera->lowlevel_data = lowlevel; | 3971 | camera->lowlevel_data = lowlevel; |
3972 | 3972 | ||
3973 | /* register v4l device */ | 3973 | /* register v4l device */ |
3974 | if (video_register_device(&camera->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { | 3974 | if (video_register_device(&camera->vdev, VFL_TYPE_GRABBER, video_nr) == -1) { |
3975 | kfree(camera); | 3975 | kfree(camera); |
@@ -3982,7 +3982,7 @@ struct cam_data *cpia_register_camera(struct cpia_camera_ops *ops, void *lowleve | |||
3982 | /* open cpia */ | 3982 | /* open cpia */ |
3983 | if (camera->ops->open(camera->lowlevel_data)) | 3983 | if (camera->ops->open(camera->lowlevel_data)) |
3984 | return camera; | 3984 | return camera; |
3985 | 3985 | ||
3986 | /* reset the camera */ | 3986 | /* reset the camera */ |
3987 | if (reset_camera(camera) != 0) { | 3987 | if (reset_camera(camera) != 0) { |
3988 | camera->ops->close(camera->lowlevel_data); | 3988 | camera->ops->close(camera->lowlevel_data); |
@@ -4022,11 +4022,11 @@ void cpia_unregister_camera(struct cam_data *cam) | |||
4022 | DBG("camera open -- setting ops to NULL\n"); | 4022 | DBG("camera open -- setting ops to NULL\n"); |
4023 | cam->ops = NULL; | 4023 | cam->ops = NULL; |
4024 | } | 4024 | } |
4025 | 4025 | ||
4026 | #ifdef CONFIG_PROC_FS | 4026 | #ifdef CONFIG_PROC_FS |
4027 | DBG("destroying /proc/cpia/video%d\n", cam->vdev.minor); | 4027 | DBG("destroying /proc/cpia/video%d\n", cam->vdev.minor); |
4028 | destroy_proc_cpia_cam(cam); | 4028 | destroy_proc_cpia_cam(cam); |
4029 | #endif | 4029 | #endif |
4030 | if (!cam->open_count) { | 4030 | if (!cam->open_count) { |
4031 | DBG("freeing camera\n"); | 4031 | DBG("freeing camera\n"); |
4032 | kfree(cam); | 4032 | kfree(cam); |
diff --git a/drivers/media/video/cpia.h b/drivers/media/video/cpia.h index de6678200a57..dde27a6a4a09 100644 --- a/drivers/media/video/cpia.h +++ b/drivers/media/video/cpia.h | |||
@@ -52,10 +52,10 @@ | |||
52 | struct cpia_camera_ops | 52 | struct cpia_camera_ops |
53 | { | 53 | { |
54 | /* open sets privdata to point to structure for this camera. | 54 | /* open sets privdata to point to structure for this camera. |
55 | * Returns negative value on error, otherwise 0. | 55 | * Returns negative value on error, otherwise 0. |
56 | */ | 56 | */ |
57 | int (*open)(void *privdata); | 57 | int (*open)(void *privdata); |
58 | 58 | ||
59 | /* Registers callback function cb to be called with cbdata | 59 | /* Registers callback function cb to be called with cbdata |
60 | * when an image is ready. If cb is NULL, only single image grabs | 60 | * when an image is ready. If cb is NULL, only single image grabs |
61 | * should be used. cb should immediately call streamRead to read | 61 | * should be used. cb should immediately call streamRead to read |
@@ -63,8 +63,8 @@ struct cpia_camera_ops | |||
63 | * otherwise 0. | 63 | * otherwise 0. |
64 | */ | 64 | */ |
65 | int (*registerCallback)(void *privdata, void (*cb)(void *cbdata), | 65 | int (*registerCallback)(void *privdata, void (*cb)(void *cbdata), |
66 | void *cbdata); | 66 | void *cbdata); |
67 | 67 | ||
68 | /* transferCmd sends commands to the camera. command MUST point to | 68 | /* transferCmd sends commands to the camera. command MUST point to |
69 | * an 8 byte buffer in kernel space. data can be NULL if no extra | 69 | * an 8 byte buffer in kernel space. data can be NULL if no extra |
70 | * data is needed. The size of the data is given by the last 2 | 70 | * data is needed. The size of the data is given by the last 2 |
@@ -77,30 +77,30 @@ struct cpia_camera_ops | |||
77 | * Returns negative value on error, otherwise 0. | 77 | * Returns negative value on error, otherwise 0. |
78 | */ | 78 | */ |
79 | int (*streamStart)(void *privdata); | 79 | int (*streamStart)(void *privdata); |
80 | 80 | ||
81 | /* streamStop terminates stream capture mode. | 81 | /* streamStop terminates stream capture mode. |
82 | * Returns negative value on error, otherwise 0. | 82 | * Returns negative value on error, otherwise 0. |
83 | */ | 83 | */ |
84 | int (*streamStop)(void *privdata); | 84 | int (*streamStop)(void *privdata); |
85 | 85 | ||
86 | /* streamRead reads a frame from the camera. buffer points to a | 86 | /* streamRead reads a frame from the camera. buffer points to a |
87 | * buffer large enough to hold a complete frame in kernel space. | 87 | * buffer large enough to hold a complete frame in kernel space. |
88 | * noblock indicates if this should be a non blocking read. | 88 | * noblock indicates if this should be a non blocking read. |
89 | * Returns the number of bytes read, or negative value on error. | 89 | * Returns the number of bytes read, or negative value on error. |
90 | */ | 90 | */ |
91 | int (*streamRead)(void *privdata, u8 *buffer, int noblock); | 91 | int (*streamRead)(void *privdata, u8 *buffer, int noblock); |
92 | 92 | ||
93 | /* close disables the device until open() is called again. | 93 | /* close disables the device until open() is called again. |
94 | * Returns negative value on error, otherwise 0. | 94 | * Returns negative value on error, otherwise 0. |
95 | */ | 95 | */ |
96 | int (*close)(void *privdata); | 96 | int (*close)(void *privdata); |
97 | 97 | ||
98 | /* If wait_for_stream_ready is non-zero, wait until the streamState | 98 | /* If wait_for_stream_ready is non-zero, wait until the streamState |
99 | * is STREAM_READY before calling streamRead. | 99 | * is STREAM_READY before calling streamRead. |
100 | */ | 100 | */ |
101 | int wait_for_stream_ready; | 101 | int wait_for_stream_ready; |
102 | 102 | ||
103 | /* | 103 | /* |
104 | * Used to maintain lowlevel module usage counts | 104 | * Used to maintain lowlevel module usage counts |
105 | */ | 105 | */ |
106 | struct module *owner; | 106 | struct module *owner; |
@@ -215,14 +215,14 @@ struct cam_params { | |||
215 | u8 videoSize; /* CIF/QCIF */ | 215 | u8 videoSize; /* CIF/QCIF */ |
216 | u8 subSample; | 216 | u8 subSample; |
217 | u8 yuvOrder; | 217 | u8 yuvOrder; |
218 | } format; | 218 | } format; |
219 | struct { /* Intel QX3 specific data */ | 219 | struct { /* Intel QX3 specific data */ |
220 | u8 qx3_detected; /* a QX3 is present */ | 220 | u8 qx3_detected; /* a QX3 is present */ |
221 | u8 toplight; /* top light lit , R/W */ | 221 | u8 toplight; /* top light lit , R/W */ |
222 | u8 bottomlight; /* bottom light lit, R/W */ | 222 | u8 bottomlight; /* bottom light lit, R/W */ |
223 | u8 button; /* snapshot button pressed (R/O) */ | 223 | u8 button; /* snapshot button pressed (R/O) */ |
224 | u8 cradled; /* microscope is in cradle (R/O) */ | 224 | u8 cradled; /* microscope is in cradle (R/O) */ |
225 | } qx3; | 225 | } qx3; |
226 | struct { | 226 | struct { |
227 | u8 colStart; /* skip first 8*colStart pixels */ | 227 | u8 colStart; /* skip first 8*colStart pixels */ |
228 | u8 colEnd; /* finish at 8*colEnd pixels */ | 228 | u8 colEnd; /* finish at 8*colEnd pixels */ |
@@ -247,13 +247,13 @@ enum v4l_camstates { | |||
247 | struct cam_data { | 247 | struct cam_data { |
248 | struct list_head cam_data_list; | 248 | struct list_head cam_data_list; |
249 | 249 | ||
250 | struct mutex busy_lock; /* guard against SMP multithreading */ | 250 | struct mutex busy_lock; /* guard against SMP multithreading */ |
251 | struct cpia_camera_ops *ops; /* lowlevel driver operations */ | 251 | struct cpia_camera_ops *ops; /* lowlevel driver operations */ |
252 | void *lowlevel_data; /* private data for lowlevel driver */ | 252 | void *lowlevel_data; /* private data for lowlevel driver */ |
253 | u8 *raw_image; /* buffer for raw image data */ | 253 | u8 *raw_image; /* buffer for raw image data */ |
254 | struct cpia_frame decompressed_frame; | 254 | struct cpia_frame decompressed_frame; |
255 | /* buffer to hold decompressed frame */ | 255 | /* buffer to hold decompressed frame */ |
256 | int image_size; /* sizeof last decompressed image */ | 256 | int image_size; /* sizeof last decompressed image */ |
257 | int open_count; /* # of process that have camera open */ | 257 | int open_count; /* # of process that have camera open */ |
258 | 258 | ||
259 | /* camera status */ | 259 | /* camera status */ |
@@ -265,7 +265,7 @@ struct cam_data { | |||
265 | struct mutex param_lock; /* params lock for this camera */ | 265 | struct mutex param_lock; /* params lock for this camera */ |
266 | struct cam_params params; /* camera settings */ | 266 | struct cam_params params; /* camera settings */ |
267 | struct proc_dir_entry *proc_entry; /* /proc/cpia/videoX */ | 267 | struct proc_dir_entry *proc_entry; /* /proc/cpia/videoX */ |
268 | 268 | ||
269 | /* v4l */ | 269 | /* v4l */ |
270 | int video_size; /* VIDEO_SIZE_ */ | 270 | int video_size; /* VIDEO_SIZE_ */ |
271 | volatile enum v4l_camstates camstate; /* v4l layer status */ | 271 | volatile enum v4l_camstates camstate; /* v4l layer status */ |
@@ -277,7 +277,7 @@ struct cam_data { | |||
277 | /* mmap interface */ | 277 | /* mmap interface */ |
278 | int curframe; /* the current frame to grab into */ | 278 | int curframe; /* the current frame to grab into */ |
279 | u8 *frame_buf; /* frame buffer data */ | 279 | u8 *frame_buf; /* frame buffer data */ |
280 | struct cpia_frame frame[FRAME_NUM]; | 280 | struct cpia_frame frame[FRAME_NUM]; |
281 | /* FRAME_NUM-buffering, so we need a array */ | 281 | /* FRAME_NUM-buffering, so we need a array */ |
282 | 282 | ||
283 | int first_frame; | 283 | int first_frame; |
@@ -424,7 +424,7 @@ void cpia_unregister_camera(struct cam_data *cam); | |||
424 | #define DEB_BYTE(p)\ | 424 | #define DEB_BYTE(p)\ |
425 | DBG("%1d %1d %1d %1d %1d %1d %1d %1d \n",\ | 425 | DBG("%1d %1d %1d %1d %1d %1d %1d %1d \n",\ |
426 | (p)&0x80?1:0, (p)&0x40?1:0, (p)&0x20?1:0, (p)&0x10?1:0,\ | 426 | (p)&0x80?1:0, (p)&0x40?1:0, (p)&0x20?1:0, (p)&0x10?1:0,\ |
427 | (p)&0x08?1:0, (p)&0x04?1:0, (p)&0x02?1:0, (p)&0x01?1:0); | 427 | (p)&0x08?1:0, (p)&0x04?1:0, (p)&0x02?1:0, (p)&0x01?1:0); |
428 | 428 | ||
429 | #endif /* __KERNEL__ */ | 429 | #endif /* __KERNEL__ */ |
430 | 430 | ||
diff --git a/drivers/media/video/cpia2/cpia2.h b/drivers/media/video/cpia2/cpia2.h index 95d3afa94a3d..8394283993f6 100644 --- a/drivers/media/video/cpia2/cpia2.h +++ b/drivers/media/video/cpia2/cpia2.h | |||
@@ -381,7 +381,7 @@ struct cpia2_fh { | |||
381 | 381 | ||
382 | struct camera_data { | 382 | struct camera_data { |
383 | /* locks */ | 383 | /* locks */ |
384 | struct semaphore busy_lock; /* guard against SMP multithreading */ | 384 | struct mutex busy_lock; /* guard against SMP multithreading */ |
385 | struct v4l2_prio_state prio; | 385 | struct v4l2_prio_state prio; |
386 | 386 | ||
387 | /* camera status */ | 387 | /* camera status */ |
diff --git a/drivers/media/video/cpia2/cpia2_core.c b/drivers/media/video/cpia2/cpia2_core.c index 5dfb242d5b8c..fd771c7a2fe2 100644 --- a/drivers/media/video/cpia2/cpia2_core.c +++ b/drivers/media/video/cpia2/cpia2_core.c | |||
@@ -2238,7 +2238,7 @@ struct camera_data *cpia2_init_camera_struct(void) | |||
2238 | memset(cam, 0, sizeof(struct camera_data)); | 2238 | memset(cam, 0, sizeof(struct camera_data)); |
2239 | 2239 | ||
2240 | cam->present = 1; | 2240 | cam->present = 1; |
2241 | init_MUTEX(&cam->busy_lock); | 2241 | mutex_init(&cam->busy_lock); |
2242 | init_waitqueue_head(&cam->wq_stream); | 2242 | init_waitqueue_head(&cam->wq_stream); |
2243 | 2243 | ||
2244 | return cam; | 2244 | return cam; |
@@ -2371,12 +2371,12 @@ long cpia2_read(struct camera_data *cam, | |||
2371 | } | 2371 | } |
2372 | 2372 | ||
2373 | /* make this _really_ smp and multithread-safe */ | 2373 | /* make this _really_ smp and multithread-safe */ |
2374 | if (down_interruptible(&cam->busy_lock)) | 2374 | if (mutex_lock_interruptible(&cam->busy_lock)) |
2375 | return -ERESTARTSYS; | 2375 | return -ERESTARTSYS; |
2376 | 2376 | ||
2377 | if (!cam->present) { | 2377 | if (!cam->present) { |
2378 | LOG("%s: camera removed\n",__FUNCTION__); | 2378 | LOG("%s: camera removed\n",__FUNCTION__); |
2379 | up(&cam->busy_lock); | 2379 | mutex_unlock(&cam->busy_lock); |
2380 | return 0; /* EOF */ | 2380 | return 0; /* EOF */ |
2381 | } | 2381 | } |
2382 | 2382 | ||
@@ -2389,34 +2389,34 @@ long cpia2_read(struct camera_data *cam, | |||
2389 | /* Copy cam->curbuff in case it changes while we're processing */ | 2389 | /* Copy cam->curbuff in case it changes while we're processing */ |
2390 | frame = cam->curbuff; | 2390 | frame = cam->curbuff; |
2391 | if (noblock && frame->status != FRAME_READY) { | 2391 | if (noblock && frame->status != FRAME_READY) { |
2392 | up(&cam->busy_lock); | 2392 | mutex_unlock(&cam->busy_lock); |
2393 | return -EAGAIN; | 2393 | return -EAGAIN; |
2394 | } | 2394 | } |
2395 | 2395 | ||
2396 | if(frame->status != FRAME_READY) { | 2396 | if(frame->status != FRAME_READY) { |
2397 | up(&cam->busy_lock); | 2397 | mutex_unlock(&cam->busy_lock); |
2398 | wait_event_interruptible(cam->wq_stream, | 2398 | wait_event_interruptible(cam->wq_stream, |
2399 | !cam->present || | 2399 | !cam->present || |
2400 | (frame = cam->curbuff)->status == FRAME_READY); | 2400 | (frame = cam->curbuff)->status == FRAME_READY); |
2401 | if (signal_pending(current)) | 2401 | if (signal_pending(current)) |
2402 | return -ERESTARTSYS; | 2402 | return -ERESTARTSYS; |
2403 | /* make this _really_ smp and multithread-safe */ | 2403 | /* make this _really_ smp and multithread-safe */ |
2404 | if (down_interruptible(&cam->busy_lock)) { | 2404 | if (mutex_lock_interruptible(&cam->busy_lock)) { |
2405 | return -ERESTARTSYS; | 2405 | return -ERESTARTSYS; |
2406 | } | 2406 | } |
2407 | if(!cam->present) { | 2407 | if(!cam->present) { |
2408 | up(&cam->busy_lock); | 2408 | mutex_unlock(&cam->busy_lock); |
2409 | return 0; | 2409 | return 0; |
2410 | } | 2410 | } |
2411 | } | 2411 | } |
2412 | 2412 | ||
2413 | /* copy data to user space */ | 2413 | /* copy data to user space */ |
2414 | if (frame->length > count) { | 2414 | if (frame->length > count) { |
2415 | up(&cam->busy_lock); | 2415 | mutex_unlock(&cam->busy_lock); |
2416 | return -EFAULT; | 2416 | return -EFAULT; |
2417 | } | 2417 | } |
2418 | if (copy_to_user(buf, frame->data, frame->length)) { | 2418 | if (copy_to_user(buf, frame->data, frame->length)) { |
2419 | up(&cam->busy_lock); | 2419 | mutex_unlock(&cam->busy_lock); |
2420 | return -EFAULT; | 2420 | return -EFAULT; |
2421 | } | 2421 | } |
2422 | 2422 | ||
@@ -2424,7 +2424,7 @@ long cpia2_read(struct camera_data *cam, | |||
2424 | 2424 | ||
2425 | frame->status = FRAME_EMPTY; | 2425 | frame->status = FRAME_EMPTY; |
2426 | 2426 | ||
2427 | up(&cam->busy_lock); | 2427 | mutex_unlock(&cam->busy_lock); |
2428 | return count; | 2428 | return count; |
2429 | } | 2429 | } |
2430 | 2430 | ||
@@ -2443,10 +2443,10 @@ unsigned int cpia2_poll(struct camera_data *cam, struct file *filp, | |||
2443 | return POLLERR; | 2443 | return POLLERR; |
2444 | } | 2444 | } |
2445 | 2445 | ||
2446 | down(&cam->busy_lock); | 2446 | mutex_lock(&cam->busy_lock); |
2447 | 2447 | ||
2448 | if(!cam->present) { | 2448 | if(!cam->present) { |
2449 | up(&cam->busy_lock); | 2449 | mutex_unlock(&cam->busy_lock); |
2450 | return POLLHUP; | 2450 | return POLLHUP; |
2451 | } | 2451 | } |
2452 | 2452 | ||
@@ -2456,16 +2456,16 @@ unsigned int cpia2_poll(struct camera_data *cam, struct file *filp, | |||
2456 | cam->params.camera_state.stream_mode); | 2456 | cam->params.camera_state.stream_mode); |
2457 | } | 2457 | } |
2458 | 2458 | ||
2459 | up(&cam->busy_lock); | 2459 | mutex_unlock(&cam->busy_lock); |
2460 | poll_wait(filp, &cam->wq_stream, wait); | 2460 | poll_wait(filp, &cam->wq_stream, wait); |
2461 | down(&cam->busy_lock); | 2461 | mutex_lock(&cam->busy_lock); |
2462 | 2462 | ||
2463 | if(!cam->present) | 2463 | if(!cam->present) |
2464 | status = POLLHUP; | 2464 | status = POLLHUP; |
2465 | else if(cam->curbuff->status == FRAME_READY) | 2465 | else if(cam->curbuff->status == FRAME_READY) |
2466 | status = POLLIN | POLLRDNORM; | 2466 | status = POLLIN | POLLRDNORM; |
2467 | 2467 | ||
2468 | up(&cam->busy_lock); | 2468 | mutex_unlock(&cam->busy_lock); |
2469 | return status; | 2469 | return status; |
2470 | } | 2470 | } |
2471 | 2471 | ||
@@ -2488,18 +2488,18 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma) | |||
2488 | DBG("mmap offset:%ld size:%ld\n", start_offset, size); | 2488 | DBG("mmap offset:%ld size:%ld\n", start_offset, size); |
2489 | 2489 | ||
2490 | /* make this _really_ smp-safe */ | 2490 | /* make this _really_ smp-safe */ |
2491 | if (down_interruptible(&cam->busy_lock)) | 2491 | if (mutex_lock_interruptible(&cam->busy_lock)) |
2492 | return -ERESTARTSYS; | 2492 | return -ERESTARTSYS; |
2493 | 2493 | ||
2494 | if (!cam->present) { | 2494 | if (!cam->present) { |
2495 | up(&cam->busy_lock); | 2495 | mutex_unlock(&cam->busy_lock); |
2496 | return -ENODEV; | 2496 | return -ENODEV; |
2497 | } | 2497 | } |
2498 | 2498 | ||
2499 | if (size > cam->frame_size*cam->num_frames || | 2499 | if (size > cam->frame_size*cam->num_frames || |
2500 | (start_offset % cam->frame_size) != 0 || | 2500 | (start_offset % cam->frame_size) != 0 || |
2501 | (start_offset+size > cam->frame_size*cam->num_frames)) { | 2501 | (start_offset+size > cam->frame_size*cam->num_frames)) { |
2502 | up(&cam->busy_lock); | 2502 | mutex_unlock(&cam->busy_lock); |
2503 | return -EINVAL; | 2503 | return -EINVAL; |
2504 | } | 2504 | } |
2505 | 2505 | ||
@@ -2507,7 +2507,7 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma) | |||
2507 | while (size > 0) { | 2507 | while (size > 0) { |
2508 | page = kvirt_to_pa(pos); | 2508 | page = kvirt_to_pa(pos); |
2509 | if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, PAGE_SIZE, PAGE_SHARED)) { | 2509 | if (remap_pfn_range(vma, start, page >> PAGE_SHIFT, PAGE_SIZE, PAGE_SHARED)) { |
2510 | up(&cam->busy_lock); | 2510 | mutex_unlock(&cam->busy_lock); |
2511 | return -EAGAIN; | 2511 | return -EAGAIN; |
2512 | } | 2512 | } |
2513 | start += PAGE_SIZE; | 2513 | start += PAGE_SIZE; |
@@ -2519,7 +2519,7 @@ int cpia2_remap_buffer(struct camera_data *cam, struct vm_area_struct *vma) | |||
2519 | } | 2519 | } |
2520 | 2520 | ||
2521 | cam->mmapped = true; | 2521 | cam->mmapped = true; |
2522 | up(&cam->busy_lock); | 2522 | mutex_unlock(&cam->busy_lock); |
2523 | return 0; | 2523 | return 0; |
2524 | } | 2524 | } |
2525 | 2525 | ||
diff --git a/drivers/media/video/cpia2/cpia2_v4l.c b/drivers/media/video/cpia2/cpia2_v4l.c index 08f8be345fa8..481e178ef56d 100644 --- a/drivers/media/video/cpia2/cpia2_v4l.c +++ b/drivers/media/video/cpia2/cpia2_v4l.c | |||
@@ -255,7 +255,7 @@ static int cpia2_open(struct inode *inode, struct file *file) | |||
255 | return -ENODEV; | 255 | return -ENODEV; |
256 | } | 256 | } |
257 | 257 | ||
258 | if(down_interruptible(&cam->busy_lock)) | 258 | if(mutex_lock_interruptible(&cam->busy_lock)) |
259 | return -ERESTARTSYS; | 259 | return -ERESTARTSYS; |
260 | 260 | ||
261 | if(!cam->present) { | 261 | if(!cam->present) { |
@@ -299,7 +299,7 @@ skip_init: | |||
299 | cpia2_dbg_dump_registers(cam); | 299 | cpia2_dbg_dump_registers(cam); |
300 | 300 | ||
301 | err_return: | 301 | err_return: |
302 | up(&cam->busy_lock); | 302 | mutex_unlock(&cam->busy_lock); |
303 | return retval; | 303 | return retval; |
304 | } | 304 | } |
305 | 305 | ||
@@ -314,7 +314,7 @@ static int cpia2_close(struct inode *inode, struct file *file) | |||
314 | struct camera_data *cam = video_get_drvdata(dev); | 314 | struct camera_data *cam = video_get_drvdata(dev); |
315 | struct cpia2_fh *fh = file->private_data; | 315 | struct cpia2_fh *fh = file->private_data; |
316 | 316 | ||
317 | down(&cam->busy_lock); | 317 | mutex_lock(&cam->busy_lock); |
318 | 318 | ||
319 | if (cam->present && | 319 | if (cam->present && |
320 | (cam->open_count == 1 | 320 | (cam->open_count == 1 |
@@ -347,7 +347,7 @@ static int cpia2_close(struct inode *inode, struct file *file) | |||
347 | } | 347 | } |
348 | } | 348 | } |
349 | 349 | ||
350 | up(&cam->busy_lock); | 350 | mutex_unlock(&cam->busy_lock); |
351 | 351 | ||
352 | return 0; | 352 | return 0; |
353 | } | 353 | } |
@@ -523,11 +523,11 @@ static int sync(struct camera_data *cam, int frame_nr) | |||
523 | return 0; | 523 | return 0; |
524 | } | 524 | } |
525 | 525 | ||
526 | up(&cam->busy_lock); | 526 | mutex_unlock(&cam->busy_lock); |
527 | wait_event_interruptible(cam->wq_stream, | 527 | wait_event_interruptible(cam->wq_stream, |
528 | !cam->streaming || | 528 | !cam->streaming || |
529 | frame->status == FRAME_READY); | 529 | frame->status == FRAME_READY); |
530 | down(&cam->busy_lock); | 530 | mutex_lock(&cam->busy_lock); |
531 | if (signal_pending(current)) | 531 | if (signal_pending(current)) |
532 | return -ERESTARTSYS; | 532 | return -ERESTARTSYS; |
533 | if(!cam->present) | 533 | if(!cam->present) |
@@ -1544,11 +1544,11 @@ static int ioctl_dqbuf(void *arg,struct camera_data *cam, struct file *file) | |||
1544 | if(frame < 0) { | 1544 | if(frame < 0) { |
1545 | /* Wait for a frame to become available */ | 1545 | /* Wait for a frame to become available */ |
1546 | struct framebuf *cb=cam->curbuff; | 1546 | struct framebuf *cb=cam->curbuff; |
1547 | up(&cam->busy_lock); | 1547 | mutex_unlock(&cam->busy_lock); |
1548 | wait_event_interruptible(cam->wq_stream, | 1548 | wait_event_interruptible(cam->wq_stream, |
1549 | !cam->present || | 1549 | !cam->present || |
1550 | (cb=cam->curbuff)->status == FRAME_READY); | 1550 | (cb=cam->curbuff)->status == FRAME_READY); |
1551 | down(&cam->busy_lock); | 1551 | mutex_lock(&cam->busy_lock); |
1552 | if (signal_pending(current)) | 1552 | if (signal_pending(current)) |
1553 | return -ERESTARTSYS; | 1553 | return -ERESTARTSYS; |
1554 | if(!cam->present) | 1554 | if(!cam->present) |
@@ -1591,11 +1591,11 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, | |||
1591 | return -ENOTTY; | 1591 | return -ENOTTY; |
1592 | 1592 | ||
1593 | /* make this _really_ smp-safe */ | 1593 | /* make this _really_ smp-safe */ |
1594 | if (down_interruptible(&cam->busy_lock)) | 1594 | if (mutex_lock_interruptible(&cam->busy_lock)) |
1595 | return -ERESTARTSYS; | 1595 | return -ERESTARTSYS; |
1596 | 1596 | ||
1597 | if (!cam->present) { | 1597 | if (!cam->present) { |
1598 | up(&cam->busy_lock); | 1598 | mutex_unlock(&cam->busy_lock); |
1599 | return -ENODEV; | 1599 | return -ENODEV; |
1600 | } | 1600 | } |
1601 | 1601 | ||
@@ -1608,7 +1608,7 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, | |||
1608 | struct cpia2_fh *fh = file->private_data; | 1608 | struct cpia2_fh *fh = file->private_data; |
1609 | retval = v4l2_prio_check(&cam->prio, &fh->prio); | 1609 | retval = v4l2_prio_check(&cam->prio, &fh->prio); |
1610 | if(retval) { | 1610 | if(retval) { |
1611 | up(&cam->busy_lock); | 1611 | mutex_unlock(&cam->busy_lock); |
1612 | return retval; | 1612 | return retval; |
1613 | } | 1613 | } |
1614 | break; | 1614 | break; |
@@ -1618,7 +1618,7 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, | |||
1618 | { | 1618 | { |
1619 | struct cpia2_fh *fh = file->private_data; | 1619 | struct cpia2_fh *fh = file->private_data; |
1620 | if(fh->prio != V4L2_PRIORITY_RECORD) { | 1620 | if(fh->prio != V4L2_PRIORITY_RECORD) { |
1621 | up(&cam->busy_lock); | 1621 | mutex_unlock(&cam->busy_lock); |
1622 | return -EBUSY; | 1622 | return -EBUSY; |
1623 | } | 1623 | } |
1624 | break; | 1624 | break; |
@@ -1847,7 +1847,7 @@ static int cpia2_do_ioctl(struct inode *inode, struct file *file, | |||
1847 | break; | 1847 | break; |
1848 | } | 1848 | } |
1849 | 1849 | ||
1850 | up(&cam->busy_lock); | 1850 | mutex_unlock(&cam->busy_lock); |
1851 | return retval; | 1851 | return retval; |
1852 | } | 1852 | } |
1853 | 1853 | ||
@@ -1924,14 +1924,15 @@ static void reset_camera_struct_v4l(struct camera_data *cam) | |||
1924 | * The v4l video device structure initialized for this device | 1924 | * The v4l video device structure initialized for this device |
1925 | ***/ | 1925 | ***/ |
1926 | static struct file_operations fops_template = { | 1926 | static struct file_operations fops_template = { |
1927 | .owner= THIS_MODULE, | 1927 | .owner = THIS_MODULE, |
1928 | .open= cpia2_open, | 1928 | .open = cpia2_open, |
1929 | .release= cpia2_close, | 1929 | .release = cpia2_close, |
1930 | .read= cpia2_v4l_read, | 1930 | .read = cpia2_v4l_read, |
1931 | .poll= cpia2_v4l_poll, | 1931 | .poll = cpia2_v4l_poll, |
1932 | .ioctl= cpia2_ioctl, | 1932 | .ioctl = cpia2_ioctl, |
1933 | .llseek= no_llseek, | 1933 | .llseek = no_llseek, |
1934 | .mmap= cpia2_mmap, | 1934 | .compat_ioctl = v4l_compat_ioctl32, |
1935 | .mmap = cpia2_mmap, | ||
1935 | }; | 1936 | }; |
1936 | 1937 | ||
1937 | static struct video_device cpia2_template = { | 1938 | static struct video_device cpia2_template = { |
diff --git a/drivers/media/video/cpia_pp.c b/drivers/media/video/cpia_pp.c index 74cff626e044..3021f21aae36 100644 --- a/drivers/media/video/cpia_pp.c +++ b/drivers/media/video/cpia_pp.c | |||
@@ -23,7 +23,7 @@ | |||
23 | */ | 23 | */ |
24 | 24 | ||
25 | /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ | 25 | /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ |
26 | /* #define _CPIA_DEBUG_ 1 */ | 26 | /* #define _CPIA_DEBUG_ 1 */ |
27 | 27 | ||
28 | #include <linux/config.h> | 28 | #include <linux/config.h> |
29 | 29 | ||
@@ -45,7 +45,7 @@ | |||
45 | 45 | ||
46 | static int cpia_pp_open(void *privdata); | 46 | static int cpia_pp_open(void *privdata); |
47 | static int cpia_pp_registerCallback(void *privdata, void (*cb) (void *cbdata), | 47 | static int cpia_pp_registerCallback(void *privdata, void (*cb) (void *cbdata), |
48 | void *cbdata); | 48 | void *cbdata); |
49 | static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data); | 49 | static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data); |
50 | static int cpia_pp_streamStart(void *privdata); | 50 | static int cpia_pp_streamStart(void *privdata); |
51 | static int cpia_pp_streamStop(void *privdata); | 51 | static int cpia_pp_streamStop(void *privdata); |
@@ -93,7 +93,7 @@ struct pp_cam_entry { | |||
93 | int stream_irq; | 93 | int stream_irq; |
94 | }; | 94 | }; |
95 | 95 | ||
96 | static struct cpia_camera_ops cpia_pp_ops = | 96 | static struct cpia_camera_ops cpia_pp_ops = |
97 | { | 97 | { |
98 | cpia_pp_open, | 98 | cpia_pp_open, |
99 | cpia_pp_registerCallback, | 99 | cpia_pp_registerCallback, |
@@ -123,7 +123,7 @@ static void cpia_parport_disable_irq( struct parport *port ) { | |||
123 | } | 123 | } |
124 | 124 | ||
125 | /* Special CPiA PPC modes: These are invoked by using the 1284 Extensibility | 125 | /* Special CPiA PPC modes: These are invoked by using the 1284 Extensibility |
126 | * Link Flag during negotiation */ | 126 | * Link Flag during negotiation */ |
127 | #define UPLOAD_FLAG 0x08 | 127 | #define UPLOAD_FLAG 0x08 |
128 | #define NIBBLE_TRANSFER 0x01 | 128 | #define NIBBLE_TRANSFER 0x01 |
129 | #define ECP_TRANSFER 0x03 | 129 | #define ECP_TRANSFER 0x03 |
@@ -139,17 +139,17 @@ static void cpia_parport_disable_irq( struct parport *port ) { | |||
139 | /* CPiA nonstandard "Nibble" mode (no nDataAvail signal after each byte). */ | 139 | /* CPiA nonstandard "Nibble" mode (no nDataAvail signal after each byte). */ |
140 | /* The standard kernel parport_ieee1284_read_nibble() fails with the CPiA... */ | 140 | /* The standard kernel parport_ieee1284_read_nibble() fails with the CPiA... */ |
141 | 141 | ||
142 | static size_t cpia_read_nibble (struct parport *port, | 142 | static size_t cpia_read_nibble (struct parport *port, |
143 | void *buffer, size_t len, | 143 | void *buffer, size_t len, |
144 | int flags) | 144 | int flags) |
145 | { | 145 | { |
146 | /* adapted verbatim, with one change, from | 146 | /* adapted verbatim, with one change, from |
147 | parport_ieee1284_read_nibble() in drivers/parport/ieee1284-ops.c */ | 147 | parport_ieee1284_read_nibble() in drivers/parport/ieee1284-ops.c */ |
148 | 148 | ||
149 | unsigned char *buf = buffer; | 149 | unsigned char *buf = buffer; |
150 | int i; | 150 | int i; |
151 | unsigned char byte = 0; | 151 | unsigned char byte = 0; |
152 | 152 | ||
153 | len *= 2; /* in nibbles */ | 153 | len *= 2; /* in nibbles */ |
154 | for (i=0; i < len; i++) { | 154 | for (i=0; i < len; i++) { |
155 | unsigned char nibble; | 155 | unsigned char nibble; |
@@ -158,12 +158,12 @@ static size_t cpia_read_nibble (struct parport *port, | |||
158 | * after every second nibble to signal that more | 158 | * after every second nibble to signal that more |
159 | * data is available. (the total number of Bytes that | 159 | * data is available. (the total number of Bytes that |
160 | * should be sent is known; if too few are received, an error | 160 | * should be sent is known; if too few are received, an error |
161 | * will be recorded after a timeout). | 161 | * will be recorded after a timeout). |
162 | * This is incompatible with parport_ieee1284_read_nibble(), | 162 | * This is incompatible with parport_ieee1284_read_nibble(), |
163 | * which expects to find nFault LO after every second nibble. | 163 | * which expects to find nFault LO after every second nibble. |
164 | */ | 164 | */ |
165 | 165 | ||
166 | /* Solution: modify cpia_read_nibble to only check for | 166 | /* Solution: modify cpia_read_nibble to only check for |
167 | * nDataAvail before the first nibble is sent. | 167 | * nDataAvail before the first nibble is sent. |
168 | */ | 168 | */ |
169 | 169 | ||
@@ -216,7 +216,7 @@ static size_t cpia_read_nibble (struct parport *port, | |||
216 | /* Second nibble */ | 216 | /* Second nibble */ |
217 | byte |= nibble << 4; | 217 | byte |= nibble << 4; |
218 | *buf++ = byte; | 218 | *buf++ = byte; |
219 | } else | 219 | } else |
220 | byte = nibble; | 220 | byte = nibble; |
221 | } | 221 | } |
222 | 222 | ||
@@ -238,18 +238,18 @@ static size_t cpia_read_nibble (struct parport *port, | |||
238 | } | 238 | } |
239 | 239 | ||
240 | /* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1) | 240 | /* CPiA nonstandard "Nibble Stream" mode (2 nibbles per cycle, instead of 1) |
241 | * (See CPiA Data sheet p. 31) | 241 | * (See CPiA Data sheet p. 31) |
242 | * | 242 | * |
243 | * "Nibble Stream" mode used by CPiA for uploads to non-ECP ports is a | 243 | * "Nibble Stream" mode used by CPiA for uploads to non-ECP ports is a |
244 | * nonstandard variant of nibble mode which allows the same (mediocre) | 244 | * nonstandard variant of nibble mode which allows the same (mediocre) |
245 | * data flow of 8 bits per cycle as software-enabled ECP by TRISTATE-capable | 245 | * data flow of 8 bits per cycle as software-enabled ECP by TRISTATE-capable |
246 | * parallel ports, but works also for non-TRISTATE-capable ports. | 246 | * parallel ports, but works also for non-TRISTATE-capable ports. |
247 | * (Standard nibble mode only send 4 bits per cycle) | 247 | * (Standard nibble mode only send 4 bits per cycle) |
248 | * | 248 | * |
249 | */ | 249 | */ |
250 | 250 | ||
251 | static size_t cpia_read_nibble_stream(struct parport *port, | 251 | static size_t cpia_read_nibble_stream(struct parport *port, |
252 | void *buffer, size_t len, | 252 | void *buffer, size_t len, |
253 | int flags) | 253 | int flags) |
254 | { | 254 | { |
255 | int i; | 255 | int i; |
@@ -260,7 +260,7 @@ static size_t cpia_read_nibble_stream(struct parport *port, | |||
260 | unsigned char nibble[2], byte = 0; | 260 | unsigned char nibble[2], byte = 0; |
261 | int j; | 261 | int j; |
262 | 262 | ||
263 | /* Image Data is complete when 4 consecutive EOI bytes (0xff) are seen */ | 263 | /* Image Data is complete when 4 consecutive EOI bytes (0xff) are seen */ |
264 | if (endseen > 3 ) | 264 | if (endseen > 3 ) |
265 | break; | 265 | break; |
266 | 266 | ||
@@ -268,7 +268,7 @@ static size_t cpia_read_nibble_stream(struct parport *port, | |||
268 | parport_frob_control (port, | 268 | parport_frob_control (port, |
269 | PARPORT_CONTROL_AUTOFD, | 269 | PARPORT_CONTROL_AUTOFD, |
270 | PARPORT_CONTROL_AUTOFD); | 270 | PARPORT_CONTROL_AUTOFD); |
271 | 271 | ||
272 | /* Event 9: nAck goes low. */ | 272 | /* Event 9: nAck goes low. */ |
273 | port->ieee1284.phase = IEEE1284_PH_REV_DATA; | 273 | port->ieee1284.phase = IEEE1284_PH_REV_DATA; |
274 | if (parport_wait_peripheral (port, | 274 | if (parport_wait_peripheral (port, |
@@ -282,7 +282,7 @@ static size_t cpia_read_nibble_stream(struct parport *port, | |||
282 | 282 | ||
283 | /* Read lower nibble */ | 283 | /* Read lower nibble */ |
284 | nibble[0] = parport_read_status (port) >>3; | 284 | nibble[0] = parport_read_status (port) >>3; |
285 | 285 | ||
286 | /* Event 10: Set nAutoFd high. */ | 286 | /* Event 10: Set nAutoFd high. */ |
287 | parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); | 287 | parport_frob_control (port, PARPORT_CONTROL_AUTOFD, 0); |
288 | 288 | ||
@@ -295,10 +295,10 @@ static size_t cpia_read_nibble_stream(struct parport *port, | |||
295 | port->name); | 295 | port->name); |
296 | break; | 296 | break; |
297 | } | 297 | } |
298 | 298 | ||
299 | /* Read upper nibble */ | 299 | /* Read upper nibble */ |
300 | nibble[1] = parport_read_status (port) >>3; | 300 | nibble[1] = parport_read_status (port) >>3; |
301 | 301 | ||
302 | /* reassemble the byte */ | 302 | /* reassemble the byte */ |
303 | for (j = 0; j < 2 ; j++ ) { | 303 | for (j = 0; j < 2 ; j++ ) { |
304 | nibble[j] &= ~8; | 304 | nibble[j] &= ~8; |
@@ -335,8 +335,8 @@ static void EndTransferMode(struct pp_cam_entry *cam) | |||
335 | static int ForwardSetup(struct pp_cam_entry *cam) | 335 | static int ForwardSetup(struct pp_cam_entry *cam) |
336 | { | 336 | { |
337 | int retry; | 337 | int retry; |
338 | 338 | ||
339 | /* The CPiA uses ECP protocol for Downloads from the Host to the camera. | 339 | /* The CPiA uses ECP protocol for Downloads from the Host to the camera. |
340 | * This will be software-emulated if ECP hardware is not present | 340 | * This will be software-emulated if ECP hardware is not present |
341 | */ | 341 | */ |
342 | 342 | ||
@@ -375,9 +375,9 @@ static int ReverseSetup(struct pp_cam_entry *cam, int extensibility) | |||
375 | upload_mode = mode; | 375 | upload_mode = mode; |
376 | if(extensibility) mode = UPLOAD_FLAG|transfer_mode|IEEE1284_EXT_LINK; | 376 | if(extensibility) mode = UPLOAD_FLAG|transfer_mode|IEEE1284_EXT_LINK; |
377 | 377 | ||
378 | /* the usual camera maximum response time is 10ms, but after | 378 | /* the usual camera maximum response time is 10ms, but after |
379 | * receiving some commands, it needs up to 40ms. */ | 379 | * receiving some commands, it needs up to 40ms. */ |
380 | 380 | ||
381 | for(retry = 0; retry < 4; ++retry) { | 381 | for(retry = 0; retry < 4; ++retry) { |
382 | if(!parport_negotiate(cam->port, mode)) { | 382 | if(!parport_negotiate(cam->port, mode)) { |
383 | break; | 383 | break; |
@@ -439,10 +439,10 @@ static int ReadPacket(struct pp_cam_entry *cam, u8 *packet, size_t size) | |||
439 | 439 | ||
440 | /* support for CPiA variant nibble reads */ | 440 | /* support for CPiA variant nibble reads */ |
441 | if(cam->port->ieee1284.mode == IEEE1284_MODE_NIBBLE) { | 441 | if(cam->port->ieee1284.mode == IEEE1284_MODE_NIBBLE) { |
442 | if(cpia_read_nibble(cam->port, packet, size, 0) != size) | 442 | if(cpia_read_nibble(cam->port, packet, size, 0) != size) |
443 | retval = -EIO; | 443 | retval = -EIO; |
444 | } else { | 444 | } else { |
445 | if(parport_read(cam->port, packet, size) != size) | 445 | if(parport_read(cam->port, packet, size) != size) |
446 | retval = -EIO; | 446 | retval = -EIO; |
447 | } | 447 | } |
448 | EndTransferMode(cam); | 448 | EndTransferMode(cam); |
@@ -542,18 +542,18 @@ static int cpia_pp_streamRead(void *privdata, u8 *buffer, int noblock) | |||
542 | block_size = PARPORT_CHUNK_SIZE; | 542 | block_size = PARPORT_CHUNK_SIZE; |
543 | while( !cam->image_complete ) { | 543 | while( !cam->image_complete ) { |
544 | cond_resched(); | 544 | cond_resched(); |
545 | 545 | ||
546 | new_bytes = cpia_pp_read(cam->port, buffer, block_size ); | 546 | new_bytes = cpia_pp_read(cam->port, buffer, block_size ); |
547 | if( new_bytes <= 0 ) { | 547 | if( new_bytes <= 0 ) { |
548 | break; | 548 | break; |
549 | } | 549 | } |
550 | i=-1; | 550 | i=-1; |
551 | while(++i<new_bytes && endseen<4) { | 551 | while(++i<new_bytes && endseen<4) { |
552 | if(*buffer==EOI) { | 552 | if(*buffer==EOI) { |
553 | endseen++; | 553 | endseen++; |
554 | } else { | 554 | } else { |
555 | endseen=0; | 555 | endseen=0; |
556 | } | 556 | } |
557 | buffer++; | 557 | buffer++; |
558 | } | 558 | } |
559 | read_bytes += i; | 559 | read_bytes += i; |
@@ -601,7 +601,7 @@ static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data) | |||
601 | } | 601 | } |
602 | if((err = ReadPacket(cam, buffer, 8)) < 0) { | 602 | if((err = ReadPacket(cam, buffer, 8)) < 0) { |
603 | DBG("Error reading command result\n"); | 603 | DBG("Error reading command result\n"); |
604 | return err; | 604 | return err; |
605 | } | 605 | } |
606 | memcpy(data, buffer, databytes); | 606 | memcpy(data, buffer, databytes); |
607 | } else if(command[0] == DATA_OUT) { | 607 | } else if(command[0] == DATA_OUT) { |
@@ -631,10 +631,10 @@ static int cpia_pp_transferCmd(void *privdata, u8 *command, u8 *data) | |||
631 | static int cpia_pp_open(void *privdata) | 631 | static int cpia_pp_open(void *privdata) |
632 | { | 632 | { |
633 | struct pp_cam_entry *cam = (struct pp_cam_entry *)privdata; | 633 | struct pp_cam_entry *cam = (struct pp_cam_entry *)privdata; |
634 | 634 | ||
635 | if (cam == NULL) | 635 | if (cam == NULL) |
636 | return -EINVAL; | 636 | return -EINVAL; |
637 | 637 | ||
638 | if(cam->open_count == 0) { | 638 | if(cam->open_count == 0) { |
639 | if (parport_claim(cam->pdev)) { | 639 | if (parport_claim(cam->pdev)) { |
640 | DBG("failed to claim the port\n"); | 640 | DBG("failed to claim the port\n"); |
@@ -645,12 +645,12 @@ static int cpia_pp_open(void *privdata) | |||
645 | parport_write_control(cam->port, PARPORT_CONTROL_SELECT); | 645 | parport_write_control(cam->port, PARPORT_CONTROL_SELECT); |
646 | udelay(50); | 646 | udelay(50); |
647 | parport_write_control(cam->port, | 647 | parport_write_control(cam->port, |
648 | PARPORT_CONTROL_SELECT | 648 | PARPORT_CONTROL_SELECT |
649 | | PARPORT_CONTROL_INIT); | 649 | | PARPORT_CONTROL_INIT); |
650 | } | 650 | } |
651 | 651 | ||
652 | ++cam->open_count; | 652 | ++cam->open_count; |
653 | 653 | ||
654 | return 0; | 654 | return 0; |
655 | } | 655 | } |
656 | 656 | ||
@@ -663,7 +663,7 @@ static int cpia_pp_registerCallback(void *privdata, void (*cb)(void *cbdata), vo | |||
663 | { | 663 | { |
664 | struct pp_cam_entry *cam = privdata; | 664 | struct pp_cam_entry *cam = privdata; |
665 | int retval = 0; | 665 | int retval = 0; |
666 | 666 | ||
667 | if(cam->port->irq != PARPORT_IRQ_NONE) { | 667 | if(cam->port->irq != PARPORT_IRQ_NONE) { |
668 | INIT_WORK(&cam->cb_task, cb, cbdata); | 668 | INIT_WORK(&cam->cb_task, cb, cbdata); |
669 | } else { | 669 | } else { |
@@ -707,9 +707,9 @@ static int cpia_pp_register(struct parport *port) | |||
707 | LOG("failed to allocate camera structure\n"); | 707 | LOG("failed to allocate camera structure\n"); |
708 | return -ENOMEM; | 708 | return -ENOMEM; |
709 | } | 709 | } |
710 | 710 | ||
711 | pdev = parport_register_device(port, "cpia_pp", NULL, NULL, | 711 | pdev = parport_register_device(port, "cpia_pp", NULL, NULL, |
712 | NULL, 0, cam); | 712 | NULL, 0, cam); |
713 | 713 | ||
714 | if (!pdev) { | 714 | if (!pdev) { |
715 | LOG("failed to parport_register_device\n"); | 715 | LOG("failed to parport_register_device\n"); |
@@ -753,19 +753,19 @@ static void cpia_pp_detach (struct parport *port) | |||
753 | } | 753 | } |
754 | cpia = NULL; | 754 | cpia = NULL; |
755 | } | 755 | } |
756 | spin_unlock( &cam_list_lock_pp ); | 756 | spin_unlock( &cam_list_lock_pp ); |
757 | 757 | ||
758 | if (!cpia) { | 758 | if (!cpia) { |
759 | DBG("cpia_pp_detach failed to find cam_data in cam_list\n"); | 759 | DBG("cpia_pp_detach failed to find cam_data in cam_list\n"); |
760 | return; | 760 | return; |
761 | } | 761 | } |
762 | 762 | ||
763 | cam = (struct pp_cam_entry *) cpia->lowlevel_data; | 763 | cam = (struct pp_cam_entry *) cpia->lowlevel_data; |
764 | cpia_unregister_camera(cpia); | 764 | cpia_unregister_camera(cpia); |
765 | if(cam->open_count > 0) | 765 | if(cam->open_count > 0) |
766 | cpia_pp_close(cam); | 766 | cpia_pp_close(cam); |
767 | parport_unregister_device(cam->pdev); | 767 | parport_unregister_device(cam->pdev); |
768 | cpia->lowlevel_data = NULL; | 768 | cpia->lowlevel_data = NULL; |
769 | kfree(cam); | 769 | kfree(cam); |
770 | } | 770 | } |
771 | 771 | ||
@@ -805,14 +805,14 @@ static struct parport_driver cpia_pp_driver = { | |||
805 | 805 | ||
806 | int cpia_pp_init(void) | 806 | int cpia_pp_init(void) |
807 | { | 807 | { |
808 | printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, | 808 | printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, |
809 | CPIA_PP_MAJ_VER,CPIA_PP_MIN_VER,CPIA_PP_PATCH_VER); | 809 | CPIA_PP_MAJ_VER,CPIA_PP_MIN_VER,CPIA_PP_PATCH_VER); |
810 | 810 | ||
811 | if(parport_nr[0] == PPCPIA_PARPORT_OFF) { | 811 | if(parport_nr[0] == PPCPIA_PARPORT_OFF) { |
812 | printk(" disabled\n"); | 812 | printk(" disabled\n"); |
813 | return 0; | 813 | return 0; |
814 | } | 814 | } |
815 | 815 | ||
816 | spin_lock_init( &cam_list_lock_pp ); | 816 | spin_lock_init( &cam_list_lock_pp ); |
817 | 817 | ||
818 | if (parport_register_driver (&cpia_pp_driver)) { | 818 | if (parport_register_driver (&cpia_pp_driver)) { |
diff --git a/drivers/media/video/cpia_usb.c b/drivers/media/video/cpia_usb.c index 03275c37c5d3..9c49a4b00116 100644 --- a/drivers/media/video/cpia_usb.c +++ b/drivers/media/video/cpia_usb.c | |||
@@ -22,7 +22,7 @@ | |||
22 | */ | 22 | */ |
23 | 23 | ||
24 | /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ | 24 | /* define _CPIA_DEBUG_ for verbose debug output (see cpia.h) */ |
25 | /* #define _CPIA_DEBUG_ 1 */ | 25 | /* #define _CPIA_DEBUG_ 1 */ |
26 | 26 | ||
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/kernel.h> | 28 | #include <linux/kernel.h> |
@@ -85,7 +85,7 @@ struct usb_cpia { | |||
85 | 85 | ||
86 | static int cpia_usb_open(void *privdata); | 86 | static int cpia_usb_open(void *privdata); |
87 | static int cpia_usb_registerCallback(void *privdata, void (*cb) (void *cbdata), | 87 | static int cpia_usb_registerCallback(void *privdata, void (*cb) (void *cbdata), |
88 | void *cbdata); | 88 | void *cbdata); |
89 | static int cpia_usb_transferCmd(void *privdata, u8 *command, u8 *data); | 89 | static int cpia_usb_transferCmd(void *privdata, u8 *command, u8 *data); |
90 | static int cpia_usb_streamStart(void *privdata); | 90 | static int cpia_usb_streamStart(void *privdata); |
91 | static int cpia_usb_streamStop(void *privdata); | 91 | static int cpia_usb_streamStop(void *privdata); |
@@ -127,7 +127,7 @@ static void cpia_usb_complete(struct urb *urb, struct pt_regs *regs) | |||
127 | ucpia->workbuff->status = FRAME_READING; | 127 | ucpia->workbuff->status = FRAME_READING; |
128 | ucpia->workbuff->length = 0; | 128 | ucpia->workbuff->length = 0; |
129 | } | 129 | } |
130 | 130 | ||
131 | for (i = 0; i < urb->number_of_packets; i++) { | 131 | for (i = 0; i < urb->number_of_packets; i++) { |
132 | int n = urb->iso_frame_desc[i].actual_length; | 132 | int n = urb->iso_frame_desc[i].actual_length; |
133 | int st = urb->iso_frame_desc[i].status; | 133 | int st = urb->iso_frame_desc[i].status; |
@@ -141,9 +141,9 @@ static void cpia_usb_complete(struct urb *urb, struct pt_regs *regs) | |||
141 | printk(KERN_DEBUG "cpia: scratch buf overflow!scr_len: %d, n: %d\n", ucpia->workbuff->length, n); | 141 | printk(KERN_DEBUG "cpia: scratch buf overflow!scr_len: %d, n: %d\n", ucpia->workbuff->length, n); |
142 | return; | 142 | return; |
143 | } | 143 | } |
144 | 144 | ||
145 | if (n) { | 145 | if (n) { |
146 | if ((ucpia->workbuff->length > 0) || | 146 | if ((ucpia->workbuff->length > 0) || |
147 | (0x19 == cdata[0] && 0x68 == cdata[1])) { | 147 | (0x19 == cdata[0] && 0x68 == cdata[1])) { |
148 | memcpy(ucpia->workbuff->data + ucpia->workbuff->length, cdata, n); | 148 | memcpy(ucpia->workbuff->data + ucpia->workbuff->length, cdata, n); |
149 | ucpia->workbuff->length += n; | 149 | ucpia->workbuff->length += n; |
@@ -160,7 +160,7 @@ static void cpia_usb_complete(struct urb *urb, struct pt_regs *regs) | |||
160 | ucpia->workbuff = ucpia->workbuff->next; | 160 | ucpia->workbuff = ucpia->workbuff->next; |
161 | ucpia->workbuff->status = FRAME_EMPTY; | 161 | ucpia->workbuff->status = FRAME_EMPTY; |
162 | ucpia->workbuff->length = 0; | 162 | ucpia->workbuff->length = 0; |
163 | 163 | ||
164 | if (waitqueue_active(&ucpia->wq_stream)) | 164 | if (waitqueue_active(&ucpia->wq_stream)) |
165 | wake_up_interruptible(&ucpia->wq_stream); | 165 | wake_up_interruptible(&ucpia->wq_stream); |
166 | } | 166 | } |
@@ -178,7 +178,7 @@ static int cpia_usb_open(void *privdata) | |||
178 | struct usb_cpia *ucpia = (struct usb_cpia *) privdata; | 178 | struct usb_cpia *ucpia = (struct usb_cpia *) privdata; |
179 | struct urb *urb; | 179 | struct urb *urb; |
180 | int ret, retval = 0, fx, err; | 180 | int ret, retval = 0, fx, err; |
181 | 181 | ||
182 | if (!ucpia) | 182 | if (!ucpia) |
183 | return -EINVAL; | 183 | return -EINVAL; |
184 | 184 | ||
@@ -191,7 +191,7 @@ static int cpia_usb_open(void *privdata) | |||
191 | retval = -EINVAL; | 191 | retval = -EINVAL; |
192 | goto error_0; | 192 | goto error_0; |
193 | } | 193 | } |
194 | 194 | ||
195 | ret = usb_set_interface(ucpia->dev, ucpia->iface, 3); | 195 | ret = usb_set_interface(ucpia->dev, ucpia->iface, 3); |
196 | if (ret < 0) { | 196 | if (ret < 0) { |
197 | printk(KERN_ERR "cpia_usb_open: usb_set_interface error (ret = %d)\n", ret); | 197 | printk(KERN_ERR "cpia_usb_open: usb_set_interface error (ret = %d)\n", ret); |
@@ -286,7 +286,7 @@ error_1: | |||
286 | error_0: | 286 | error_0: |
287 | kfree (ucpia->sbuf[0].data); | 287 | kfree (ucpia->sbuf[0].data); |
288 | ucpia->sbuf[0].data = NULL; | 288 | ucpia->sbuf[0].data = NULL; |
289 | 289 | ||
290 | return retval; | 290 | return retval; |
291 | } | 291 | } |
292 | 292 | ||
@@ -307,7 +307,7 @@ static int WritePacket(struct usb_device *udev, const u8 *packet, u8 *buf, size_ | |||
307 | return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), | 307 | return usb_control_msg(udev, usb_sndctrlpipe(udev, 0), |
308 | packet[1] + (packet[0] << 8), | 308 | packet[1] + (packet[0] << 8), |
309 | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 309 | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
310 | packet[2] + (packet[3] << 8), | 310 | packet[2] + (packet[3] << 8), |
311 | packet[4] + (packet[5] << 8), buf, size, 1000); | 311 | packet[4] + (packet[5] << 8), buf, size, 1000); |
312 | } | 312 | } |
313 | 313 | ||
@@ -324,7 +324,7 @@ static int ReadPacket(struct usb_device *udev, u8 *packet, u8 *buf, size_t size) | |||
324 | return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), | 324 | return usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), |
325 | packet[1] + (packet[0] << 8), | 325 | packet[1] + (packet[0] << 8), |
326 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 326 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
327 | packet[2] + (packet[3] << 8), | 327 | packet[2] + (packet[3] << 8), |
328 | packet[4] + (packet[5] << 8), buf, size, 1000); | 328 | packet[4] + (packet[5] << 8), buf, size, 1000); |
329 | } | 329 | } |
330 | 330 | ||
@@ -393,7 +393,7 @@ static int cpia_usb_streamRead(void *privdata, u8 *frame, int noblock) | |||
393 | 393 | ||
394 | if (!ucpia || !ucpia->present) | 394 | if (!ucpia || !ucpia->present) |
395 | return -1; | 395 | return -1; |
396 | 396 | ||
397 | if (ucpia->curbuff->status != FRAME_READY) | 397 | if (ucpia->curbuff->status != FRAME_READY) |
398 | interruptible_sleep_on(&ucpia->wq_stream); | 398 | interruptible_sleep_on(&ucpia->wq_stream); |
399 | else | 399 | else |
@@ -403,7 +403,7 @@ static int cpia_usb_streamRead(void *privdata, u8 *frame, int noblock) | |||
403 | 403 | ||
404 | if (!mybuff) | 404 | if (!mybuff) |
405 | return -1; | 405 | return -1; |
406 | 406 | ||
407 | if (mybuff->status != FRAME_READY || mybuff->length < 4) { | 407 | if (mybuff->status != FRAME_READY || mybuff->length < 4) { |
408 | DBG("Something went wrong!\n"); | 408 | DBG("Something went wrong!\n"); |
409 | return -1; | 409 | return -1; |
@@ -411,7 +411,7 @@ static int cpia_usb_streamRead(void *privdata, u8 *frame, int noblock) | |||
411 | 411 | ||
412 | memcpy(frame, mybuff->data, mybuff->length); | 412 | memcpy(frame, mybuff->data, mybuff->length); |
413 | mybuff->status = FRAME_EMPTY; | 413 | mybuff->status = FRAME_EMPTY; |
414 | 414 | ||
415 | /* DBG("read done, %d bytes, Header: %x/%x, Footer: %x%x%x%x\n", */ | 415 | /* DBG("read done, %d bytes, Header: %x/%x, Footer: %x%x%x%x\n", */ |
416 | /* mybuff->length, frame[0], frame[1], */ | 416 | /* mybuff->length, frame[0], frame[1], */ |
417 | /* frame[mybuff->length-4], frame[mybuff->length-3], */ | 417 | /* frame[mybuff->length-4], frame[mybuff->length-3], */ |
@@ -447,7 +447,7 @@ static void cpia_usb_free_resources(struct usb_cpia *ucpia, int try) | |||
447 | 447 | ||
448 | kfree(ucpia->sbuf[1].data); | 448 | kfree(ucpia->sbuf[1].data); |
449 | ucpia->sbuf[1].data = NULL; | 449 | ucpia->sbuf[1].data = NULL; |
450 | 450 | ||
451 | if (ucpia->sbuf[0].urb) { | 451 | if (ucpia->sbuf[0].urb) { |
452 | usb_kill_urb(ucpia->sbuf[0].urb); | 452 | usb_kill_urb(ucpia->sbuf[0].urb); |
453 | usb_free_urb(ucpia->sbuf[0].urb); | 453 | usb_free_urb(ucpia->sbuf[0].urb); |
@@ -490,7 +490,7 @@ static int cpia_probe(struct usb_interface *intf, | |||
490 | struct usb_cpia *ucpia; | 490 | struct usb_cpia *ucpia; |
491 | struct cam_data *cam; | 491 | struct cam_data *cam; |
492 | int ret; | 492 | int ret; |
493 | 493 | ||
494 | /* A multi-config CPiA camera? */ | 494 | /* A multi-config CPiA camera? */ |
495 | if (udev->descriptor.bNumConfigurations != 1) | 495 | if (udev->descriptor.bNumConfigurations != 1) |
496 | return -ENODEV; | 496 | return -ENODEV; |
@@ -539,7 +539,7 @@ static int cpia_probe(struct usb_interface *intf, | |||
539 | 539 | ||
540 | /* Before register_camera, important */ | 540 | /* Before register_camera, important */ |
541 | ucpia->present = 1; | 541 | ucpia->present = 1; |
542 | 542 | ||
543 | cam = cpia_register_camera(&cpia_usb_ops, ucpia); | 543 | cam = cpia_register_camera(&cpia_usb_ops, ucpia); |
544 | if (!cam) { | 544 | if (!cam) { |
545 | LOG("failed to cpia_register_camera\n"); | 545 | LOG("failed to cpia_register_camera\n"); |
@@ -591,7 +591,7 @@ static void cpia_disconnect(struct usb_interface *intf) | |||
591 | struct cam_data *cam = usb_get_intfdata(intf); | 591 | struct cam_data *cam = usb_get_intfdata(intf); |
592 | struct usb_cpia *ucpia; | 592 | struct usb_cpia *ucpia; |
593 | struct usb_device *udev; | 593 | struct usb_device *udev; |
594 | 594 | ||
595 | usb_set_intfdata(intf, NULL); | 595 | usb_set_intfdata(intf, NULL); |
596 | if (!cam) | 596 | if (!cam) |
597 | return; | 597 | return; |
@@ -600,7 +600,7 @@ static void cpia_disconnect(struct usb_interface *intf) | |||
600 | spin_lock( &cam_list_lock_usb ); | 600 | spin_lock( &cam_list_lock_usb ); |
601 | list_del(&cam->cam_data_list); | 601 | list_del(&cam->cam_data_list); |
602 | spin_unlock( &cam_list_lock_usb ); | 602 | spin_unlock( &cam_list_lock_usb ); |
603 | 603 | ||
604 | ucpia->present = 0; | 604 | ucpia->present = 0; |
605 | 605 | ||
606 | cpia_unregister_camera(cam); | 606 | cpia_unregister_camera(cam); |
@@ -631,7 +631,7 @@ static void cpia_disconnect(struct usb_interface *intf) | |||
631 | 631 | ||
632 | static int __init usb_cpia_init(void) | 632 | static int __init usb_cpia_init(void) |
633 | { | 633 | { |
634 | printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, | 634 | printk(KERN_INFO "%s v%d.%d.%d\n",ABOUT, |
635 | CPIA_USB_MAJ_VER,CPIA_USB_MIN_VER,CPIA_USB_PATCH_VER); | 635 | CPIA_USB_MAJ_VER,CPIA_USB_MIN_VER,CPIA_USB_PATCH_VER); |
636 | 636 | ||
637 | spin_lock_init(&cam_list_lock_usb); | 637 | spin_lock_init(&cam_list_lock_usb); |
diff --git a/drivers/media/video/cs53l32a.c b/drivers/media/video/cs53l32a.c index 8739c64785ef..de87247c74ee 100644 --- a/drivers/media/video/cs53l32a.c +++ b/drivers/media/video/cs53l32a.c | |||
@@ -59,25 +59,25 @@ static int cs53l32a_read(struct i2c_client *client, u8 reg) | |||
59 | static int cs53l32a_command(struct i2c_client *client, unsigned int cmd, | 59 | static int cs53l32a_command(struct i2c_client *client, unsigned int cmd, |
60 | void *arg) | 60 | void *arg) |
61 | { | 61 | { |
62 | struct v4l2_audio *input = arg; | 62 | struct v4l2_routing *route = arg; |
63 | struct v4l2_control *ctrl = arg; | 63 | struct v4l2_control *ctrl = arg; |
64 | 64 | ||
65 | switch (cmd) { | 65 | switch (cmd) { |
66 | case VIDIOC_S_AUDIO: | 66 | case VIDIOC_INT_G_AUDIO_ROUTING: |
67 | route->input = (cs53l32a_read(client, 0x01) >> 4) & 3; | ||
68 | route->output = 0; | ||
69 | break; | ||
70 | |||
71 | case VIDIOC_INT_S_AUDIO_ROUTING: | ||
67 | /* There are 2 physical inputs, but the second input can be | 72 | /* There are 2 physical inputs, but the second input can be |
68 | placed in two modes, the first mode bypasses the PGA (gain), | 73 | placed in two modes, the first mode bypasses the PGA (gain), |
69 | the second goes through the PGA. Hence there are three | 74 | the second goes through the PGA. Hence there are three |
70 | possible inputs to choose from. */ | 75 | possible inputs to choose from. */ |
71 | if (input->index > 2) { | 76 | if (route->input > 2) { |
72 | v4l_err(client, "Invalid input %d.\n", input->index); | 77 | v4l_err(client, "Invalid input %d.\n", route->input); |
73 | return -EINVAL; | 78 | return -EINVAL; |
74 | } | 79 | } |
75 | cs53l32a_write(client, 0x01, 0x01 + (input->index << 4)); | 80 | cs53l32a_write(client, 0x01, 0x01 + (route->input << 4)); |
76 | break; | ||
77 | |||
78 | case VIDIOC_G_AUDIO: | ||
79 | memset(input, 0, sizeof(*input)); | ||
80 | input->index = (cs53l32a_read(client, 0x01) >> 4) & 3; | ||
81 | break; | 81 | break; |
82 | 82 | ||
83 | case VIDIOC_G_CTRL: | 83 | case VIDIOC_G_CTRL: |
diff --git a/drivers/media/video/cs8420.h b/drivers/media/video/cs8420.h index 2b22f3a38de5..621c0c6678ea 100644 --- a/drivers/media/video/cs8420.h +++ b/drivers/media/video/cs8420.h | |||
@@ -20,7 +20,7 @@ | |||
20 | #define __CS8420_H__ | 20 | #define __CS8420_H__ |
21 | 21 | ||
22 | /* Initialization Sequence */ | 22 | /* Initialization Sequence */ |
23 | 23 | ||
24 | static __u8 init8420[] = { | 24 | static __u8 init8420[] = { |
25 | 1, 0x01, 2, 0x02, 3, 0x00, 4, 0x46, | 25 | 1, 0x01, 2, 0x02, 3, 0x00, 4, 0x46, |
26 | 5, 0x24, 6, 0x84, 18, 0x18, 19, 0x13, | 26 | 5, 0x24, 6, 0x84, 18, 0x18, 19, 0x13, |
diff --git a/drivers/media/video/cx25840/cx25840-audio.c b/drivers/media/video/cx25840/cx25840-audio.c index cb9a7981e408..a4540e858f21 100644 --- a/drivers/media/video/cx25840/cx25840-audio.c +++ b/drivers/media/video/cx25840/cx25840-audio.c | |||
@@ -18,7 +18,6 @@ | |||
18 | 18 | ||
19 | #include <linux/videodev2.h> | 19 | #include <linux/videodev2.h> |
20 | #include <linux/i2c.h> | 20 | #include <linux/i2c.h> |
21 | #include <media/audiochip.h> | ||
22 | #include <media/v4l2-common.h> | 21 | #include <media/v4l2-common.h> |
23 | 22 | ||
24 | #include "cx25840.h" | 23 | #include "cx25840.h" |
diff --git a/drivers/media/video/cx25840/cx25840-core.c b/drivers/media/video/cx25840/cx25840-core.c index 8a257978056f..a65b3cc4bf03 100644 --- a/drivers/media/video/cx25840/cx25840-core.c +++ b/drivers/media/video/cx25840/cx25840-core.c | |||
@@ -31,7 +31,6 @@ | |||
31 | #include <linux/slab.h> | 31 | #include <linux/slab.h> |
32 | #include <linux/videodev2.h> | 32 | #include <linux/videodev2.h> |
33 | #include <linux/i2c.h> | 33 | #include <linux/i2c.h> |
34 | #include <media/audiochip.h> | ||
35 | #include <media/v4l2-common.h> | 34 | #include <media/v4l2-common.h> |
36 | 35 | ||
37 | #include "cx25840.h" | 36 | #include "cx25840.h" |
@@ -176,9 +175,9 @@ static void cx25840_initialize(struct i2c_client *client, int loadfw) | |||
176 | cx25840_write(client, 0x4a5, 0x00); | 175 | cx25840_write(client, 0x4a5, 0x00); |
177 | cx25840_write(client, 0x402, 0x00); | 176 | cx25840_write(client, 0x402, 0x00); |
178 | /* 8. */ | 177 | /* 8. */ |
179 | cx25840_write(client, 0x401, 0x18); | 178 | cx25840_and_or(client, 0x401, ~0x18, 0); |
180 | cx25840_write(client, 0x4a2, 0x10); | 179 | cx25840_and_or(client, 0x4a2, ~0x10, 0x10); |
181 | cx25840_write(client, 0x402, 0x04); | 180 | /* steps 8c and 8d are done in change_input() */ |
182 | /* 10. */ | 181 | /* 10. */ |
183 | cx25840_write(client, 0x8d3, 0x1f); | 182 | cx25840_write(client, 0x8d3, 0x1f); |
184 | cx25840_write(client, 0x8e3, 0x03); | 183 | cx25840_write(client, 0x8e3, 0x03); |
@@ -209,6 +208,17 @@ static void input_change(struct i2c_client *client) | |||
209 | struct cx25840_state *state = i2c_get_clientdata(client); | 208 | struct cx25840_state *state = i2c_get_clientdata(client); |
210 | v4l2_std_id std = cx25840_get_v4lstd(client); | 209 | v4l2_std_id std = cx25840_get_v4lstd(client); |
211 | 210 | ||
211 | /* Follow step 8c and 8d of section 3.16 in the cx25840 datasheet */ | ||
212 | if (std & V4L2_STD_SECAM) { | ||
213 | cx25840_write(client, 0x402, 0); | ||
214 | } | ||
215 | else { | ||
216 | cx25840_write(client, 0x402, 0x04); | ||
217 | cx25840_write(client, 0x49f, (std & V4L2_STD_NTSC) ? 0x14 : 0x11); | ||
218 | } | ||
219 | cx25840_and_or(client, 0x401, ~0x60, 0); | ||
220 | cx25840_and_or(client, 0x401, ~0x60, 0x60); | ||
221 | |||
212 | /* Note: perhaps V4L2_STD_PAL_M should be handled as V4L2_STD_NTSC | 222 | /* Note: perhaps V4L2_STD_PAL_M should be handled as V4L2_STD_NTSC |
213 | instead of V4L2_STD_PAL. Someone needs to test this. */ | 223 | instead of V4L2_STD_PAL. Someone needs to test this. */ |
214 | if (std & V4L2_STD_PAL) { | 224 | if (std & V4L2_STD_PAL) { |
@@ -343,6 +353,15 @@ static int set_v4lstd(struct i2c_client *client, v4l2_std_id std) | |||
343 | } | 353 | } |
344 | } | 354 | } |
345 | 355 | ||
356 | /* Follow step 9 of section 3.16 in the cx25840 datasheet. | ||
357 | Without this PAL may display a vertical ghosting effect. | ||
358 | This happens for example with the Yuan MPC622. */ | ||
359 | if (fmt >= 4 && fmt < 8) { | ||
360 | /* Set format to NTSC-M */ | ||
361 | cx25840_and_or(client, 0x400, ~0xf, 1); | ||
362 | /* Turn off LCOMB */ | ||
363 | cx25840_and_or(client, 0x47b, ~6, 0); | ||
364 | } | ||
346 | cx25840_and_or(client, 0x400, ~0xf, fmt); | 365 | cx25840_and_or(client, 0x400, ~0xf, fmt); |
347 | cx25840_vbi_setup(client); | 366 | cx25840_vbi_setup(client); |
348 | return 0; | 367 | return 0; |
@@ -359,7 +378,14 @@ v4l2_std_id cx25840_get_v4lstd(struct i2c_client * client) | |||
359 | } | 378 | } |
360 | 379 | ||
361 | switch (fmt) { | 380 | switch (fmt) { |
362 | case 0x1: return V4L2_STD_NTSC_M | V4L2_STD_NTSC_M_KR; | 381 | case 0x1: |
382 | { | ||
383 | /* if the audio std is A2-M, then this is the South Korean | ||
384 | NTSC standard */ | ||
385 | if (cx25840_read(client, 0x805) == 2) | ||
386 | return V4L2_STD_NTSC_M_KR; | ||
387 | return V4L2_STD_NTSC_M; | ||
388 | } | ||
363 | case 0x2: return V4L2_STD_NTSC_M_JP; | 389 | case 0x2: return V4L2_STD_NTSC_M_JP; |
364 | case 0x3: return V4L2_STD_NTSC_443; | 390 | case 0x3: return V4L2_STD_NTSC_443; |
365 | case 0x4: return V4L2_STD_PAL; | 391 | case 0x4: return V4L2_STD_PAL; |
@@ -737,16 +763,6 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
737 | return set_input(client, state->vid_input, input->index); | 763 | return set_input(client, state->vid_input, input->index); |
738 | } | 764 | } |
739 | 765 | ||
740 | case VIDIOC_G_AUDIO: | ||
741 | { | ||
742 | struct v4l2_audio *input = arg; | ||
743 | |||
744 | memset(input, 0, sizeof(*input)); | ||
745 | input->index = state->aud_input; | ||
746 | input->capability = V4L2_AUDCAP_STEREO; | ||
747 | break; | ||
748 | } | ||
749 | |||
750 | case VIDIOC_S_FREQUENCY: | 766 | case VIDIOC_S_FREQUENCY: |
751 | input_change(client); | 767 | input_change(client); |
752 | break; | 768 | break; |
@@ -794,13 +810,14 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
794 | bilingual -> lang1 */ | 810 | bilingual -> lang1 */ |
795 | cx25840_and_or(client, 0x809, ~0xf, 0x00); | 811 | cx25840_and_or(client, 0x809, ~0xf, 0x00); |
796 | break; | 812 | break; |
813 | case V4L2_TUNER_MODE_STEREO: | ||
797 | case V4L2_TUNER_MODE_LANG1: | 814 | case V4L2_TUNER_MODE_LANG1: |
798 | /* mono -> mono | 815 | /* mono -> mono |
799 | stereo -> stereo | 816 | stereo -> stereo |
800 | bilingual -> lang1 */ | 817 | bilingual -> lang1 */ |
801 | cx25840_and_or(client, 0x809, ~0xf, 0x04); | 818 | cx25840_and_or(client, 0x809, ~0xf, 0x04); |
802 | break; | 819 | break; |
803 | case V4L2_TUNER_MODE_STEREO: | 820 | case V4L2_TUNER_MODE_LANG1_LANG2: |
804 | /* mono -> mono | 821 | /* mono -> mono |
805 | stereo -> stereo | 822 | stereo -> stereo |
806 | bilingual -> lang1/lang2 */ | 823 | bilingual -> lang1/lang2 */ |
@@ -808,7 +825,7 @@ static int cx25840_command(struct i2c_client *client, unsigned int cmd, | |||
808 | break; | 825 | break; |
809 | case V4L2_TUNER_MODE_LANG2: | 826 | case V4L2_TUNER_MODE_LANG2: |
810 | /* mono -> mono | 827 | /* mono -> mono |
811 | stereo ->stereo | 828 | stereo -> stereo |
812 | bilingual -> lang2 */ | 829 | bilingual -> lang2 */ |
813 | cx25840_and_or(client, 0x809, ~0xf, 0x01); | 830 | cx25840_and_or(client, 0x809, ~0xf, 0x01); |
814 | break; | 831 | break; |
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index e140996e6ee4..ff0f72340d69 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig | |||
@@ -16,12 +16,13 @@ config VIDEO_CX88 | |||
16 | module will be called cx8800 | 16 | module will be called cx8800 |
17 | 17 | ||
18 | config VIDEO_CX88_ALSA | 18 | config VIDEO_CX88_ALSA |
19 | tristate "ALSA DMA audio support" | 19 | tristate "Conexant 2388x DMA audio support" |
20 | depends on VIDEO_CX88 && SND && EXPERIMENTAL | 20 | depends on VIDEO_CX88 && SND && EXPERIMENTAL |
21 | select SND_PCM | 21 | select SND_PCM |
22 | ---help--- | 22 | ---help--- |
23 | This is a video4linux driver for direct (DMA) audio on | 23 | This is a video4linux driver for direct (DMA) audio on |
24 | Conexant 2388x based TV cards. | 24 | Conexant 2388x based TV cards using ALSA. |
25 | |||
25 | It only works with boards with function 01 enabled. | 26 | It only works with boards with function 01 enabled. |
26 | To check if your board supports, use lspci -n. | 27 | To check if your board supports, use lspci -n. |
27 | If supported, you should see 1471:8801 or 1471:8811 | 28 | If supported, you should see 1471:8801 or 1471:8811 |
diff --git a/drivers/media/video/cx88/cx88-alsa.c b/drivers/media/video/cx88/cx88-alsa.c index 3170b8f72c68..f9d87b86492c 100644 --- a/drivers/media/video/cx88/cx88-alsa.c +++ b/drivers/media/video/cx88/cx88-alsa.c | |||
@@ -303,7 +303,7 @@ static int dsp_buffer_free(snd_cx88_card_t *chip) | |||
303 | BUG_ON(!chip->dma_size); | 303 | BUG_ON(!chip->dma_size); |
304 | 304 | ||
305 | dprintk(2,"Freeing buffer\n"); | 305 | dprintk(2,"Freeing buffer\n"); |
306 | videobuf_dma_pci_unmap(chip->pci, &chip->dma_risc); | 306 | videobuf_pci_dma_unmap(chip->pci, &chip->dma_risc); |
307 | videobuf_dma_free(&chip->dma_risc); | 307 | videobuf_dma_free(&chip->dma_risc); |
308 | btcx_riscmem_free(chip->pci,&chip->buf->risc); | 308 | btcx_riscmem_free(chip->pci,&chip->buf->risc); |
309 | kfree(chip->buf); | 309 | kfree(chip->buf); |
@@ -429,7 +429,7 @@ static int snd_cx88_hw_params(struct snd_pcm_substream * substream, | |||
429 | videobuf_dma_init_kernel(&buf->vb.dma,PCI_DMA_FROMDEVICE, | 429 | videobuf_dma_init_kernel(&buf->vb.dma,PCI_DMA_FROMDEVICE, |
430 | (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); | 430 | (PAGE_ALIGN(buf->vb.size) >> PAGE_SHIFT)); |
431 | 431 | ||
432 | videobuf_dma_pci_map(chip->pci,&buf->vb.dma); | 432 | videobuf_pci_dma_map(chip->pci,&buf->vb.dma); |
433 | 433 | ||
434 | 434 | ||
435 | cx88_risc_databuffer(chip->pci, &buf->risc, | 435 | cx88_risc_databuffer(chip->pci, &buf->risc, |
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index a502a4d6e4ae..e100d8ef369a 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c | |||
@@ -1341,7 +1341,7 @@ bb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
1341 | enum v4l2_field field) | 1341 | enum v4l2_field field) |
1342 | { | 1342 | { |
1343 | struct cx8802_fh *fh = q->priv_data; | 1343 | struct cx8802_fh *fh = q->priv_data; |
1344 | return cx8802_buf_prepare(fh->dev, (struct cx88_buffer*)vb, field); | 1344 | return cx8802_buf_prepare(q, fh->dev, (struct cx88_buffer*)vb, field); |
1345 | } | 1345 | } |
1346 | 1346 | ||
1347 | static void | 1347 | static void |
@@ -1354,8 +1354,7 @@ bb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
1354 | static void | 1354 | static void |
1355 | bb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 1355 | bb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
1356 | { | 1356 | { |
1357 | struct cx8802_fh *fh = q->priv_data; | 1357 | cx88_free_buffer(q, (struct cx88_buffer*)vb); |
1358 | cx88_free_buffer(fh->dev->pci, (struct cx88_buffer*)vb); | ||
1359 | } | 1358 | } |
1360 | 1359 | ||
1361 | static struct videobuf_queue_ops blackbird_qops = { | 1360 | static struct videobuf_queue_ops blackbird_qops = { |
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index c2cdbafdb77b..2c3d9f1999be 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c | |||
@@ -213,13 +213,13 @@ int cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, | |||
213 | } | 213 | } |
214 | 214 | ||
215 | void | 215 | void |
216 | cx88_free_buffer(struct pci_dev *pci, struct cx88_buffer *buf) | 216 | cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf) |
217 | { | 217 | { |
218 | BUG_ON(in_interrupt()); | 218 | BUG_ON(in_interrupt()); |
219 | videobuf_waiton(&buf->vb,0,0); | 219 | videobuf_waiton(&buf->vb,0,0); |
220 | videobuf_dma_pci_unmap(pci, &buf->vb.dma); | 220 | videobuf_dma_unmap(q, &buf->vb.dma); |
221 | videobuf_dma_free(&buf->vb.dma); | 221 | videobuf_dma_free(&buf->vb.dma); |
222 | btcx_riscmem_free(pci, &buf->risc); | 222 | btcx_riscmem_free((struct pci_dev *)q->dev, &buf->risc); |
223 | buf->vb.state = STATE_NEEDS_INIT; | 223 | buf->vb.state = STATE_NEEDS_INIT; |
224 | } | 224 | } |
225 | 225 | ||
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index a9fc2695b157..f0ea9b5cdbc2 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c | |||
@@ -90,7 +90,7 @@ static int dvb_buf_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
90 | enum v4l2_field field) | 90 | enum v4l2_field field) |
91 | { | 91 | { |
92 | struct cx8802_dev *dev = q->priv_data; | 92 | struct cx8802_dev *dev = q->priv_data; |
93 | return cx8802_buf_prepare(dev, (struct cx88_buffer*)vb,field); | 93 | return cx8802_buf_prepare(q, dev, (struct cx88_buffer*)vb,field); |
94 | } | 94 | } |
95 | 95 | ||
96 | static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | 96 | static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) |
@@ -101,8 +101,7 @@ static void dvb_buf_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
101 | 101 | ||
102 | static void dvb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 102 | static void dvb_buf_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
103 | { | 103 | { |
104 | struct cx8802_dev *dev = q->priv_data; | 104 | cx88_free_buffer(q, (struct cx88_buffer*)vb); |
105 | cx88_free_buffer(dev->pci, (struct cx88_buffer*)vb); | ||
106 | } | 105 | } |
107 | 106 | ||
108 | static struct videobuf_queue_ops dvb_qops = { | 107 | static struct videobuf_queue_ops dvb_qops = { |
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index c79cc1d2bf8b..7d16888b4a86 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c | |||
@@ -163,8 +163,8 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, | |||
163 | 163 | ||
164 | /* ------------------------------------------------------------------ */ | 164 | /* ------------------------------------------------------------------ */ |
165 | 165 | ||
166 | int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, | 166 | int cx8802_buf_prepare(struct videobuf_queue *q, struct cx8802_dev *dev, |
167 | enum v4l2_field field) | 167 | struct cx88_buffer *buf, enum v4l2_field field) |
168 | { | 168 | { |
169 | int size = dev->ts_packet_size * dev->ts_packet_count; | 169 | int size = dev->ts_packet_size * dev->ts_packet_count; |
170 | int rc; | 170 | int rc; |
@@ -179,7 +179,7 @@ int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, | |||
179 | buf->vb.size = size; | 179 | buf->vb.size = size; |
180 | buf->vb.field = field /*V4L2_FIELD_TOP*/; | 180 | buf->vb.field = field /*V4L2_FIELD_TOP*/; |
181 | 181 | ||
182 | if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) | 182 | if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) |
183 | goto fail; | 183 | goto fail; |
184 | cx88_risc_databuffer(dev->pci, &buf->risc, | 184 | cx88_risc_databuffer(dev->pci, &buf->risc, |
185 | buf->vb.dma.sglist, | 185 | buf->vb.dma.sglist, |
@@ -189,36 +189,36 @@ int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, | |||
189 | return 0; | 189 | return 0; |
190 | 190 | ||
191 | fail: | 191 | fail: |
192 | cx88_free_buffer(dev->pci,buf); | 192 | cx88_free_buffer(q,buf); |
193 | return rc; | 193 | return rc; |
194 | } | 194 | } |
195 | 195 | ||
196 | void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) | 196 | void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) |
197 | { | 197 | { |
198 | struct cx88_buffer *prev; | 198 | struct cx88_buffer *prev; |
199 | struct cx88_dmaqueue *q = &dev->mpegq; | 199 | struct cx88_dmaqueue *cx88q = &dev->mpegq; |
200 | 200 | ||
201 | dprintk( 1, "cx8802_buf_queue\n" ); | 201 | dprintk( 1, "cx8802_buf_queue\n" ); |
202 | /* add jump to stopper */ | 202 | /* add jump to stopper */ |
203 | buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); | 203 | buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); |
204 | buf->risc.jmp[1] = cpu_to_le32(q->stopper.dma); | 204 | buf->risc.jmp[1] = cpu_to_le32(cx88q->stopper.dma); |
205 | 205 | ||
206 | if (list_empty(&q->active)) { | 206 | if (list_empty(&cx88q->active)) { |
207 | dprintk( 0, "queue is empty - first active\n" ); | 207 | dprintk( 0, "queue is empty - first active\n" ); |
208 | list_add_tail(&buf->vb.queue,&q->active); | 208 | list_add_tail(&buf->vb.queue,&cx88q->active); |
209 | cx8802_start_dma(dev, q, buf); | 209 | cx8802_start_dma(dev, cx88q, buf); |
210 | buf->vb.state = STATE_ACTIVE; | 210 | buf->vb.state = STATE_ACTIVE; |
211 | buf->count = q->count++; | 211 | buf->count = cx88q->count++; |
212 | mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); | 212 | mod_timer(&cx88q->timeout, jiffies+BUFFER_TIMEOUT); |
213 | dprintk(0,"[%p/%d] %s - first active\n", | 213 | dprintk(0,"[%p/%d] %s - first active\n", |
214 | buf, buf->vb.i, __FUNCTION__); | 214 | buf, buf->vb.i, __FUNCTION__); |
215 | 215 | ||
216 | } else { | 216 | } else { |
217 | dprintk( 1, "queue is not empty - append to active\n" ); | 217 | dprintk( 1, "queue is not empty - append to active\n" ); |
218 | prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue); | 218 | prev = list_entry(cx88q->active.prev, struct cx88_buffer, vb.queue); |
219 | list_add_tail(&buf->vb.queue,&q->active); | 219 | list_add_tail(&buf->vb.queue,&cx88q->active); |
220 | buf->vb.state = STATE_ACTIVE; | 220 | buf->vb.state = STATE_ACTIVE; |
221 | buf->count = q->count++; | 221 | buf->count = cx88q->count++; |
222 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); | 222 | prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); |
223 | dprintk( 1, "[%p/%d] %s - append to active\n", | 223 | dprintk( 1, "[%p/%d] %s - append to active\n", |
224 | buf, buf->vb.i, __FUNCTION__); | 224 | buf, buf->vb.i, __FUNCTION__); |
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index da8d97ce0c4b..641a0c5a6490 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c | |||
@@ -885,6 +885,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) | |||
885 | set_audio_standard_BTSC(core, 1, EN_BTSC_FORCE_SAP); | 885 | set_audio_standard_BTSC(core, 1, EN_BTSC_FORCE_SAP); |
886 | break; | 886 | break; |
887 | case V4L2_TUNER_MODE_STEREO: | 887 | case V4L2_TUNER_MODE_STEREO: |
888 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
888 | set_audio_standard_BTSC(core, 0, EN_BTSC_FORCE_STEREO); | 889 | set_audio_standard_BTSC(core, 0, EN_BTSC_FORCE_STEREO); |
889 | break; | 890 | break; |
890 | } | 891 | } |
@@ -905,6 +906,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) | |||
905 | EN_NICAM_FORCE_MONO2); | 906 | EN_NICAM_FORCE_MONO2); |
906 | break; | 907 | break; |
907 | case V4L2_TUNER_MODE_STEREO: | 908 | case V4L2_TUNER_MODE_STEREO: |
909 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
908 | set_audio_standard_NICAM(core, | 910 | set_audio_standard_NICAM(core, |
909 | EN_NICAM_FORCE_STEREO); | 911 | EN_NICAM_FORCE_STEREO); |
910 | break; | 912 | break; |
@@ -926,6 +928,7 @@ void cx88_set_stereo(struct cx88_core *core, u32 mode, int manual) | |||
926 | EN_A2_FORCE_MONO2); | 928 | EN_A2_FORCE_MONO2); |
927 | break; | 929 | break; |
928 | case V4L2_TUNER_MODE_STEREO: | 930 | case V4L2_TUNER_MODE_STEREO: |
931 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
929 | set_audio_standard_A2(core, | 932 | set_audio_standard_A2(core, |
930 | EN_A2_FORCE_STEREO); | 933 | EN_A2_FORCE_STEREO); |
931 | break; | 934 | break; |
diff --git a/drivers/media/video/cx88/cx88-vbi.c b/drivers/media/video/cx88/cx88-vbi.c index 9bc6c8995581..846faadc9f1c 100644 --- a/drivers/media/video/cx88/cx88-vbi.c +++ b/drivers/media/video/cx88/cx88-vbi.c | |||
@@ -175,7 +175,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
175 | buf->vb.size = size; | 175 | buf->vb.size = size; |
176 | buf->vb.field = V4L2_FIELD_SEQ_TB; | 176 | buf->vb.field = V4L2_FIELD_SEQ_TB; |
177 | 177 | ||
178 | if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) | 178 | if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) |
179 | goto fail; | 179 | goto fail; |
180 | cx88_risc_buffer(dev->pci, &buf->risc, | 180 | cx88_risc_buffer(dev->pci, &buf->risc, |
181 | buf->vb.dma.sglist, | 181 | buf->vb.dma.sglist, |
@@ -187,7 +187,7 @@ vbi_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
187 | return 0; | 187 | return 0; |
188 | 188 | ||
189 | fail: | 189 | fail: |
190 | cx88_free_buffer(dev->pci,buf); | 190 | cx88_free_buffer(q,buf); |
191 | return rc; | 191 | return rc; |
192 | } | 192 | } |
193 | 193 | ||
@@ -227,9 +227,8 @@ vbi_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) | |||
227 | static void vbi_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 227 | static void vbi_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
228 | { | 228 | { |
229 | struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); | 229 | struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); |
230 | struct cx8800_fh *fh = q->priv_data; | ||
231 | 230 | ||
232 | cx88_free_buffer(fh->dev->pci,buf); | 231 | cx88_free_buffer(q,buf); |
233 | } | 232 | } |
234 | 233 | ||
235 | struct videobuf_queue_ops cx8800_vbi_qops = { | 234 | struct videobuf_queue_ops cx8800_vbi_qops = { |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 6c97aa740d27..72a417b31745 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -564,7 +564,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
564 | 564 | ||
565 | if (STATE_NEEDS_INIT == buf->vb.state) { | 565 | if (STATE_NEEDS_INIT == buf->vb.state) { |
566 | init_buffer = 1; | 566 | init_buffer = 1; |
567 | if (0 != (rc = videobuf_iolock(dev->pci,&buf->vb,NULL))) | 567 | if (0 != (rc = videobuf_iolock(q,&buf->vb,NULL))) |
568 | goto fail; | 568 | goto fail; |
569 | } | 569 | } |
570 | 570 | ||
@@ -614,7 +614,7 @@ buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
614 | return 0; | 614 | return 0; |
615 | 615 | ||
616 | fail: | 616 | fail: |
617 | cx88_free_buffer(dev->pci,buf); | 617 | cx88_free_buffer(q,buf); |
618 | return rc; | 618 | return rc; |
619 | } | 619 | } |
620 | 620 | ||
@@ -671,9 +671,8 @@ buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) | |||
671 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 671 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
672 | { | 672 | { |
673 | struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); | 673 | struct cx88_buffer *buf = container_of(vb,struct cx88_buffer,vb); |
674 | struct cx8800_fh *fh = q->priv_data; | ||
675 | 674 | ||
676 | cx88_free_buffer(fh->dev->pci,buf); | 675 | cx88_free_buffer(q,buf); |
677 | } | 676 | } |
678 | 677 | ||
679 | static struct videobuf_queue_ops cx8800_video_qops = { | 678 | static struct videobuf_queue_ops cx8800_video_qops = { |
@@ -1251,9 +1250,17 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | |||
1251 | { | 1250 | { |
1252 | int err; | 1251 | int err; |
1253 | 1252 | ||
1254 | dprintk(2, "CORE IOCTL: 0x%x\n", cmd ); | 1253 | if (video_debug) { |
1255 | if (video_debug > 1) | 1254 | if (video_debug > 1) { |
1256 | v4l_print_ioctl(core->name,cmd); | 1255 | if (_IOC_DIR(cmd) & _IOC_WRITE) |
1256 | v4l_printk_ioctl_arg("cx88(w)",cmd, arg); | ||
1257 | else if (!_IOC_DIR(cmd) & _IOC_READ) { | ||
1258 | v4l_print_ioctl("cx88", cmd); | ||
1259 | } | ||
1260 | } else | ||
1261 | v4l_print_ioctl(core->name,cmd); | ||
1262 | |||
1263 | } | ||
1257 | 1264 | ||
1258 | switch (cmd) { | 1265 | switch (cmd) { |
1259 | /* ---------- tv norms ---------- */ | 1266 | /* ---------- tv norms ---------- */ |
@@ -1460,7 +1467,19 @@ int cx88_do_ioctl(struct inode *inode, struct file *file, int radio, | |||
1460 | static int video_ioctl(struct inode *inode, struct file *file, | 1467 | static int video_ioctl(struct inode *inode, struct file *file, |
1461 | unsigned int cmd, unsigned long arg) | 1468 | unsigned int cmd, unsigned long arg) |
1462 | { | 1469 | { |
1463 | return video_usercopy(inode, file, cmd, arg, video_do_ioctl); | 1470 | int retval; |
1471 | |||
1472 | retval=video_usercopy(inode, file, cmd, arg, video_do_ioctl); | ||
1473 | |||
1474 | if (video_debug > 1) { | ||
1475 | if (retval < 0) { | ||
1476 | v4l_print_ioctl("cx88(err)", cmd); | ||
1477 | printk(KERN_DEBUG "cx88(err): errcode=%d\n",retval); | ||
1478 | } else if (_IOC_DIR(cmd) & _IOC_READ) | ||
1479 | v4l_printk_ioctl_arg("cx88(r)",cmd, (void *)arg); | ||
1480 | } | ||
1481 | |||
1482 | return retval; | ||
1464 | } | 1483 | } |
1465 | 1484 | ||
1466 | /* ----------------------------------------------------------- */ | 1485 | /* ----------------------------------------------------------- */ |
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index cfa8668784b4..326a25f147f6 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -27,7 +27,6 @@ | |||
27 | 27 | ||
28 | #include <media/tuner.h> | 28 | #include <media/tuner.h> |
29 | #include <media/tveeprom.h> | 29 | #include <media/tveeprom.h> |
30 | #include <media/audiochip.h> | ||
31 | #include <media/video-buf.h> | 30 | #include <media/video-buf.h> |
32 | #include <media/video-buf-dvb.h> | 31 | #include <media/video-buf-dvb.h> |
33 | 32 | ||
@@ -485,7 +484,7 @@ extern int | |||
485 | cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, | 484 | cx88_risc_stopper(struct pci_dev *pci, struct btcx_riscmem *risc, |
486 | u32 reg, u32 mask, u32 value); | 485 | u32 reg, u32 mask, u32 value); |
487 | extern void | 486 | extern void |
488 | cx88_free_buffer(struct pci_dev *pci, struct cx88_buffer *buf); | 487 | cx88_free_buffer(struct videobuf_queue *q, struct cx88_buffer *buf); |
489 | 488 | ||
490 | extern void cx88_risc_disasm(struct cx88_core *core, | 489 | extern void cx88_risc_disasm(struct cx88_core *core, |
491 | struct btcx_riscmem *risc); | 490 | struct btcx_riscmem *risc); |
@@ -577,8 +576,8 @@ void cx88_ir_irq(struct cx88_core *core); | |||
577 | /* ----------------------------------------------------------- */ | 576 | /* ----------------------------------------------------------- */ |
578 | /* cx88-mpeg.c */ | 577 | /* cx88-mpeg.c */ |
579 | 578 | ||
580 | int cx8802_buf_prepare(struct cx8802_dev *dev, struct cx88_buffer *buf, | 579 | int cx8802_buf_prepare(struct videobuf_queue *q,struct cx8802_dev *dev, |
581 | enum v4l2_field field); | 580 | struct cx88_buffer *buf, enum v4l2_field field); |
582 | void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf); | 581 | void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf); |
583 | void cx8802_cancel_buffers(struct cx8802_dev *dev); | 582 | void cx8802_cancel_buffers(struct cx8802_dev *dev); |
584 | 583 | ||
diff --git a/drivers/usb/media/dabfirmware.h b/drivers/media/video/dabfirmware.h index d14d803566a3..d14d803566a3 100644 --- a/drivers/usb/media/dabfirmware.h +++ b/drivers/media/video/dabfirmware.h | |||
diff --git a/drivers/usb/media/dabusb.c b/drivers/media/video/dabusb.c index 1774ab7a40d2..b9ba95f5e026 100644 --- a/drivers/usb/media/dabusb.c +++ b/drivers/media/video/dabusb.c | |||
@@ -86,7 +86,7 @@ static int dabusb_add_buf_tail (pdabusb_t s, struct list_head *dst, struct list_ | |||
86 | return ret; | 86 | return ret; |
87 | } | 87 | } |
88 | /*-------------------------------------------------------------------*/ | 88 | /*-------------------------------------------------------------------*/ |
89 | #ifdef DEBUG | 89 | #ifdef DEBUG |
90 | static void dump_urb (struct urb *urb) | 90 | static void dump_urb (struct urb *urb) |
91 | { | 91 | { |
92 | dbg("urb :%p", urb); | 92 | dbg("urb :%p", urb); |
@@ -136,7 +136,7 @@ static int dabusb_free_queue (struct list_head *q) | |||
136 | for (p = q->next; p != q;) { | 136 | for (p = q->next; p != q;) { |
137 | b = list_entry (p, buff_t, buff_list); | 137 | b = list_entry (p, buff_t, buff_list); |
138 | 138 | ||
139 | #ifdef DEBUG | 139 | #ifdef DEBUG |
140 | dump_urb(b->purb); | 140 | dump_urb(b->purb); |
141 | #endif | 141 | #endif |
142 | kfree(b->purb->transfer_buffer); | 142 | kfree(b->purb->transfer_buffer); |
@@ -287,7 +287,7 @@ static int dabusb_bulk (pdabusb_t s, pbulk_transfer_t pb) | |||
287 | } | 287 | } |
288 | 288 | ||
289 | } | 289 | } |
290 | 290 | ||
291 | if( ret == -EPIPE ) { | 291 | if( ret == -EPIPE ) { |
292 | warn("CLEAR_FEATURE request to remove STALL condition."); | 292 | warn("CLEAR_FEATURE request to remove STALL condition."); |
293 | if(usb_clear_halt(s->usbdev, usb_pipeendpoint(pipe))) | 293 | if(usb_clear_halt(s->usbdev, usb_pipeendpoint(pipe))) |
@@ -328,7 +328,7 @@ static int dabusb_loadmem (pdabusb_t s, const char *fname) | |||
328 | PINTEL_HEX_RECORD ptr = firmware; | 328 | PINTEL_HEX_RECORD ptr = firmware; |
329 | 329 | ||
330 | dbg("Enter dabusb_loadmem (internal)"); | 330 | dbg("Enter dabusb_loadmem (internal)"); |
331 | 331 | ||
332 | ret = dabusb_8051_reset (s, 1); | 332 | ret = dabusb_8051_reset (s, 1); |
333 | while (ptr->Type == 0) { | 333 | while (ptr->Type == 0) { |
334 | 334 | ||
@@ -449,7 +449,7 @@ static int dabusb_startrek (pdabusb_t s) | |||
449 | if (!list_empty (&s->free_buff_list)) { | 449 | if (!list_empty (&s->free_buff_list)) { |
450 | pbuff_t end; | 450 | pbuff_t end; |
451 | int ret; | 451 | int ret; |
452 | 452 | ||
453 | while (!dabusb_add_buf_tail (s, &s->rec_buff_list, &s->free_buff_list)) { | 453 | while (!dabusb_add_buf_tail (s, &s->rec_buff_list, &s->free_buff_list)) { |
454 | 454 | ||
455 | dbg("submitting: end:%p s->rec_buff_list:%p", s->rec_buff_list.prev, &s->rec_buff_list); | 455 | dbg("submitting: end:%p s->rec_buff_list:%p", s->rec_buff_list.prev, &s->rec_buff_list); |
@@ -506,7 +506,7 @@ static ssize_t dabusb_read (struct file *file, char __user *buf, size_t count, l | |||
506 | err("error: rec_buf_list is empty"); | 506 | err("error: rec_buf_list is empty"); |
507 | goto err; | 507 | goto err; |
508 | } | 508 | } |
509 | 509 | ||
510 | b = list_entry (s->rec_buff_list.next, buff_t, buff_list); | 510 | b = list_entry (s->rec_buff_list.next, buff_t, buff_list); |
511 | purb = b->purb; | 511 | purb = b->purb; |
512 | 512 | ||
@@ -783,9 +783,9 @@ static void dabusb_disconnect (struct usb_interface *intf) | |||
783 | pdabusb_t s = usb_get_intfdata (intf); | 783 | pdabusb_t s = usb_get_intfdata (intf); |
784 | 784 | ||
785 | dbg("dabusb_disconnect"); | 785 | dbg("dabusb_disconnect"); |
786 | 786 | ||
787 | init_waitqueue_entry(&__wait, current); | 787 | init_waitqueue_entry(&__wait, current); |
788 | 788 | ||
789 | usb_set_intfdata (intf, NULL); | 789 | usb_set_intfdata (intf, NULL); |
790 | if (s) { | 790 | if (s) { |
791 | usb_deregister_dev (intf, &dabusb_class); | 791 | usb_deregister_dev (intf, &dabusb_class); |
@@ -797,7 +797,7 @@ static void dabusb_disconnect (struct usb_interface *intf) | |||
797 | schedule(); | 797 | schedule(); |
798 | current->state = TASK_RUNNING; | 798 | current->state = TASK_RUNNING; |
799 | remove_wait_queue(&s->remove_ok, &__wait); | 799 | remove_wait_queue(&s->remove_ok, &__wait); |
800 | 800 | ||
801 | s->usbdev = NULL; | 801 | s->usbdev = NULL; |
802 | s->overruns = 0; | 802 | s->overruns = 0; |
803 | } | 803 | } |
diff --git a/drivers/usb/media/dabusb.h b/drivers/media/video/dabusb.h index 96b03e4af8b9..00eb34c863eb 100644 --- a/drivers/usb/media/dabusb.h +++ b/drivers/media/video/dabusb.h | |||
@@ -10,7 +10,7 @@ typedef struct | |||
10 | #define DABUSB_VERSION 0x1000 | 10 | #define DABUSB_VERSION 0x1000 |
11 | #define IOCTL_DAB_BULK _IOWR('d', 0x30, bulk_transfer_t) | 11 | #define IOCTL_DAB_BULK _IOWR('d', 0x30, bulk_transfer_t) |
12 | #define IOCTL_DAB_OVERRUNS _IOR('d', 0x15, int) | 12 | #define IOCTL_DAB_OVERRUNS _IOR('d', 0x15, int) |
13 | #define IOCTL_DAB_VERSION _IOR('d', 0x3f, int) | 13 | #define IOCTL_DAB_VERSION _IOR('d', 0x3f, int) |
14 | 14 | ||
15 | #ifdef __KERNEL__ | 15 | #ifdef __KERNEL__ |
16 | 16 | ||
@@ -36,7 +36,7 @@ typedef struct | |||
36 | struct list_head rec_buff_list; | 36 | struct list_head rec_buff_list; |
37 | } dabusb_t,*pdabusb_t; | 37 | } dabusb_t,*pdabusb_t; |
38 | 38 | ||
39 | typedef struct | 39 | typedef struct |
40 | { | 40 | { |
41 | pdabusb_t s; | 41 | pdabusb_t s; |
42 | struct urb *purb; | 42 | struct urb *purb; |
diff --git a/drivers/usb/media/dsbr100.c b/drivers/media/video/dsbr100.c index 25646804d5be..3b4e9985c3d7 100644 --- a/drivers/usb/media/dsbr100.c +++ b/drivers/media/video/dsbr100.c | |||
@@ -37,28 +37,28 @@ | |||
37 | Markus: Updates for 2.6.x kernels, code layout changes, name sanitizing | 37 | Markus: Updates for 2.6.x kernels, code layout changes, name sanitizing |
38 | 38 | ||
39 | Version 0.30: | 39 | Version 0.30: |
40 | Markus: Updates for 2.5.x kernel and more ISO compliant source | 40 | Markus: Updates for 2.5.x kernel and more ISO compliant source |
41 | 41 | ||
42 | Version 0.25: | 42 | Version 0.25: |
43 | PSL and Markus: Cleanup, radio now doesn't stop on device close | 43 | PSL and Markus: Cleanup, radio now doesn't stop on device close |
44 | 44 | ||
45 | Version 0.24: | 45 | Version 0.24: |
46 | Markus: Hope I got these silly VIDEO_TUNER_LOW issues finally | 46 | Markus: Hope I got these silly VIDEO_TUNER_LOW issues finally |
47 | right. Some minor cleanup, improved standalone compilation | 47 | right. Some minor cleanup, improved standalone compilation |
48 | 48 | ||
49 | Version 0.23: | 49 | Version 0.23: |
50 | Markus: Sign extension bug fixed by declaring transfer_buffer unsigned | 50 | Markus: Sign extension bug fixed by declaring transfer_buffer unsigned |
51 | 51 | ||
52 | Version 0.22: | 52 | Version 0.22: |
53 | Markus: Some (brown bag) cleanup in what VIDIOCSTUNER returns, | 53 | Markus: Some (brown bag) cleanup in what VIDIOCSTUNER returns, |
54 | thanks to Mike Cox for pointing the problem out. | 54 | thanks to Mike Cox for pointing the problem out. |
55 | 55 | ||
56 | Version 0.21: | 56 | Version 0.21: |
57 | Markus: Minor cleanup, warnings if something goes wrong, lame attempt | 57 | Markus: Minor cleanup, warnings if something goes wrong, lame attempt |
58 | to adhere to Documentation/CodingStyle | 58 | to adhere to Documentation/CodingStyle |
59 | 59 | ||
60 | Version 0.2: | 60 | Version 0.2: |
61 | Brad Hards <bradh@dynamite.com.au>: Fixes to make it work as non-module | 61 | Brad Hards <bradh@dynamite.com.au>: Fixes to make it work as non-module |
62 | Markus: Copyright clarification | 62 | Markus: Copyright clarification |
63 | 63 | ||
64 | Version 0.01: Markus: initial release | 64 | Version 0.01: Markus: initial release |
@@ -163,11 +163,11 @@ static struct usb_driver usb_dsbr100_driver = { | |||
163 | static int dsbr100_start(dsbr100_device *radio) | 163 | static int dsbr100_start(dsbr100_device *radio) |
164 | { | 164 | { |
165 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 165 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
166 | USB_REQ_GET_STATUS, | 166 | USB_REQ_GET_STATUS, |
167 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 167 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
168 | 0x00, 0xC7, radio->transfer_buffer, 8, 300)<0 || | 168 | 0x00, 0xC7, radio->transfer_buffer, 8, 300)<0 || |
169 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 169 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
170 | DSB100_ONOFF, | 170 | DSB100_ONOFF, |
171 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 171 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
172 | 0x01, 0x00, radio->transfer_buffer, 8, 300)<0) | 172 | 0x01, 0x00, radio->transfer_buffer, 8, 300)<0) |
173 | return -1; | 173 | return -1; |
@@ -179,11 +179,11 @@ static int dsbr100_start(dsbr100_device *radio) | |||
179 | static int dsbr100_stop(dsbr100_device *radio) | 179 | static int dsbr100_stop(dsbr100_device *radio) |
180 | { | 180 | { |
181 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 181 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
182 | USB_REQ_GET_STATUS, | 182 | USB_REQ_GET_STATUS, |
183 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 183 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
184 | 0x16, 0x1C, radio->transfer_buffer, 8, 300)<0 || | 184 | 0x16, 0x1C, radio->transfer_buffer, 8, 300)<0 || |
185 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 185 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
186 | DSB100_ONOFF, | 186 | DSB100_ONOFF, |
187 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 187 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
188 | 0x00, 0x00, radio->transfer_buffer, 8, 300)<0) | 188 | 0x00, 0x00, radio->transfer_buffer, 8, 300)<0) |
189 | return -1; | 189 | return -1; |
@@ -195,16 +195,16 @@ static int dsbr100_setfreq(dsbr100_device *radio, int freq) | |||
195 | { | 195 | { |
196 | freq = (freq/16*80)/1000+856; | 196 | freq = (freq/16*80)/1000+856; |
197 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 197 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
198 | DSB100_TUNE, | 198 | DSB100_TUNE, |
199 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 199 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
200 | (freq>>8)&0x00ff, freq&0xff, | 200 | (freq>>8)&0x00ff, freq&0xff, |
201 | radio->transfer_buffer, 8, 300)<0 || | 201 | radio->transfer_buffer, 8, 300)<0 || |
202 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 202 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
203 | USB_REQ_GET_STATUS, | 203 | USB_REQ_GET_STATUS, |
204 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 204 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
205 | 0x96, 0xB7, radio->transfer_buffer, 8, 300)<0 || | 205 | 0x96, 0xB7, radio->transfer_buffer, 8, 300)<0 || |
206 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 206 | usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
207 | USB_REQ_GET_STATUS, | 207 | USB_REQ_GET_STATUS, |
208 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 208 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
209 | 0x00, 0x24, radio->transfer_buffer, 8, 300)<0) { | 209 | 0x00, 0x24, radio->transfer_buffer, 8, 300)<0) { |
210 | radio->stereo = -1; | 210 | radio->stereo = -1; |
@@ -219,7 +219,7 @@ sees a stereo signal or not. Pity. */ | |||
219 | static void dsbr100_getstat(dsbr100_device *radio) | 219 | static void dsbr100_getstat(dsbr100_device *radio) |
220 | { | 220 | { |
221 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), | 221 | if (usb_control_msg(radio->usbdev, usb_rcvctrlpipe(radio->usbdev, 0), |
222 | USB_REQ_GET_STATUS, | 222 | USB_REQ_GET_STATUS, |
223 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, | 223 | USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_DIR_IN, |
224 | 0x00 , 0x24, radio->transfer_buffer, 8, 300)<0) | 224 | 0x00 , 0x24, radio->transfer_buffer, 8, 300)<0) |
225 | radio->stereo = -1; | 225 | radio->stereo = -1; |
@@ -232,7 +232,7 @@ static void dsbr100_getstat(dsbr100_device *radio) | |||
232 | 232 | ||
233 | /* check if the device is present and register with v4l and | 233 | /* check if the device is present and register with v4l and |
234 | usb if it is */ | 234 | usb if it is */ |
235 | static int usb_dsbr100_probe(struct usb_interface *intf, | 235 | static int usb_dsbr100_probe(struct usb_interface *intf, |
236 | const struct usb_device_id *id) | 236 | const struct usb_device_id *id) |
237 | { | 237 | { |
238 | dsbr100_device *radio; | 238 | dsbr100_device *radio; |
@@ -243,7 +243,7 @@ static int usb_dsbr100_probe(struct usb_interface *intf, | |||
243 | kfree(radio); | 243 | kfree(radio); |
244 | return -ENOMEM; | 244 | return -ENOMEM; |
245 | } | 245 | } |
246 | memcpy(radio->videodev, &dsbr100_videodev_template, | 246 | memcpy(radio->videodev, &dsbr100_videodev_template, |
247 | sizeof(dsbr100_videodev_template)); | 247 | sizeof(dsbr100_videodev_template)); |
248 | radio->removed = 0; | 248 | radio->removed = 0; |
249 | radio->users = 0; | 249 | radio->users = 0; |
@@ -310,7 +310,7 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, | |||
310 | struct video_tuner *v = arg; | 310 | struct video_tuner *v = arg; |
311 | 311 | ||
312 | dsbr100_getstat(radio); | 312 | dsbr100_getstat(radio); |
313 | if(v->tuner) /* Only 1 tuner */ | 313 | if(v->tuner) /* Only 1 tuner */ |
314 | return -EINVAL; | 314 | return -EINVAL; |
315 | v->rangelow = FREQ_MIN*FREQ_MUL; | 315 | v->rangelow = FREQ_MIN*FREQ_MUL; |
316 | v->rangehigh = FREQ_MAX*FREQ_MUL; | 316 | v->rangehigh = FREQ_MAX*FREQ_MUL; |
@@ -355,12 +355,12 @@ static int usb_dsbr100_do_ioctl(struct inode *inode, struct file *file, | |||
355 | v->volume = 1; | 355 | v->volume = 1; |
356 | v->step = 1; | 356 | v->step = 1; |
357 | strcpy(v->name, "Radio"); | 357 | strcpy(v->name, "Radio"); |
358 | return 0; | 358 | return 0; |
359 | } | 359 | } |
360 | case VIDIOCSAUDIO: { | 360 | case VIDIOCSAUDIO: { |
361 | struct video_audio *v = arg; | 361 | struct video_audio *v = arg; |
362 | 362 | ||
363 | if (v->audio) | 363 | if (v->audio) |
364 | return -EINVAL; | 364 | return -EINVAL; |
365 | if (v->flags&VIDEO_AUDIO_MUTE) { | 365 | if (v->flags&VIDEO_AUDIO_MUTE) { |
366 | if (dsbr100_stop(radio)==-1) | 366 | if (dsbr100_stop(radio)==-1) |
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 4e22fc4889e1..f62fd706b45a 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -28,10 +28,10 @@ | |||
28 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
29 | #include <linux/usb.h> | 29 | #include <linux/usb.h> |
30 | #include <media/tuner.h> | 30 | #include <media/tuner.h> |
31 | #include <media/audiochip.h> | 31 | #include <media/msp3400.h> |
32 | #include <media/tveeprom.h> | 32 | #include <media/tveeprom.h> |
33 | #include <media/audiochip.h> | ||
33 | #include <media/v4l2-common.h> | 34 | #include <media/v4l2-common.h> |
34 | #include "msp3400.h" | ||
35 | 35 | ||
36 | #include "em28xx.h" | 36 | #include "em28xx.h" |
37 | 37 | ||
@@ -147,11 +147,12 @@ struct em28xx_board em28xx_boards[] = { | |||
147 | .input = {{ | 147 | .input = {{ |
148 | .type = EM28XX_VMUX_TELEVISION, | 148 | .type = EM28XX_VMUX_TELEVISION, |
149 | .vmux = 0, | 149 | .vmux = 0, |
150 | .amux = 6, | 150 | .amux = MSP_INPUT_DEFAULT, |
151 | },{ | 151 | },{ |
152 | .type = EM28XX_VMUX_SVIDEO, | 152 | .type = EM28XX_VMUX_SVIDEO, |
153 | .vmux = 2, | 153 | .vmux = 2, |
154 | .amux = 1, | 154 | .amux = MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, |
155 | MSP_DSP_OUT_SCART, MSP_DSP_OUT_SCART), | ||
155 | }}, | 156 | }}, |
156 | }, | 157 | }, |
157 | [EM2820_BOARD_MSI_VOX_USB_2] = { | 158 | [EM2820_BOARD_MSI_VOX_USB_2] = { |
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 780342f7b239..dfba33d0fa61 100644 --- a/drivers/media/video/em28xx/em28xx-video.c +++ b/drivers/media/video/em28xx/em28xx-video.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include "em28xx.h" | 38 | #include "em28xx.h" |
39 | #include <media/tuner.h> | 39 | #include <media/tuner.h> |
40 | #include <media/v4l2-common.h> | 40 | #include <media/v4l2-common.h> |
41 | #include <media/msp3400.h> | ||
41 | 42 | ||
42 | #define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \ | 43 | #define DRIVER_AUTHOR "Ludovico Cavedon <cavedon@sssup.it>, " \ |
43 | "Markus Rechberger <mrechberger@gmail.com>, " \ | 44 | "Markus Rechberger <mrechberger@gmail.com>, " \ |
@@ -216,9 +217,14 @@ static void video_mux(struct em28xx *dev, int index) | |||
216 | em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput); | 217 | em28xx_videodbg("Setting input index=%d, vmux=%d, amux=%d\n",index,input,dev->ctl_ainput); |
217 | 218 | ||
218 | if (dev->has_msp34xx) { | 219 | if (dev->has_msp34xx) { |
220 | struct v4l2_routing route; | ||
221 | |||
219 | if (dev->i2s_speed) | 222 | if (dev->i2s_speed) |
220 | em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed); | 223 | em28xx_i2c_call_clients(dev, VIDIOC_INT_I2S_CLOCK_FREQ, &dev->i2s_speed); |
221 | em28xx_i2c_call_clients(dev, VIDIOC_S_AUDIO, &dev->ctl_ainput); | 224 | route.input = dev->ctl_ainput; |
225 | route.output = MSP_OUTPUT(MSP_OUT_SCART1_DA); | ||
226 | /* Note: this is msp3400 specific */ | ||
227 | em28xx_i2c_call_clients(dev, VIDIOC_INT_S_AUDIO_ROUTING, &route); | ||
222 | ainput = EM28XX_AUDIO_SRC_TUNER; | 228 | ainput = EM28XX_AUDIO_SRC_TUNER; |
223 | em28xx_audio_source(dev, ainput); | 229 | em28xx_audio_source(dev, ainput); |
224 | } else { | 230 | } else { |
diff --git a/drivers/media/video/et61x251/Makefile b/drivers/media/video/et61x251/Makefile new file mode 100644 index 000000000000..2ff4db9ec882 --- /dev/null +++ b/drivers/media/video/et61x251/Makefile | |||
@@ -0,0 +1,4 @@ | |||
1 | et61x251-objs := et61x251_core.o et61x251_tas5130d1b.o | ||
2 | |||
3 | obj-$(CONFIG_USB_ET61X251) += et61x251.o | ||
4 | |||
diff --git a/drivers/usb/media/et61x251.h b/drivers/media/video/et61x251/et61x251.h index eee8afc9be72..2e5ca4032489 100644 --- a/drivers/usb/media/et61x251.h +++ b/drivers/media/video/et61x251/et61x251.h | |||
@@ -180,7 +180,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id) | |||
180 | 180 | ||
181 | void | 181 | void |
182 | et61x251_attach_sensor(struct et61x251_device* cam, | 182 | et61x251_attach_sensor(struct et61x251_device* cam, |
183 | struct et61x251_sensor* sensor) | 183 | struct et61x251_sensor* sensor) |
184 | { | 184 | { |
185 | memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor)); | 185 | memcpy(&cam->sensor, sensor, sizeof(struct et61x251_sensor)); |
186 | } | 186 | } |
@@ -199,7 +199,7 @@ do { \ | |||
199 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ | 199 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ |
200 | else if ((level) >= 3) \ | 200 | else if ((level) >= 3) \ |
201 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 201 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
202 | __FUNCTION__, __LINE__ , ## args); \ | 202 | __FUNCTION__, __LINE__ , ## args); \ |
203 | } \ | 203 | } \ |
204 | } while (0) | 204 | } while (0) |
205 | # define KDBG(level, fmt, args...) \ | 205 | # define KDBG(level, fmt, args...) \ |
@@ -209,7 +209,7 @@ do { \ | |||
209 | pr_info("et61x251: " fmt "\n", ## args); \ | 209 | pr_info("et61x251: " fmt "\n", ## args); \ |
210 | else if ((level) == 3) \ | 210 | else if ((level) == 3) \ |
211 | pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \ | 211 | pr_debug("et61x251: [%s:%d] " fmt "\n", __FUNCTION__, \ |
212 | __LINE__ , ## args); \ | 212 | __LINE__ , ## args); \ |
213 | } \ | 213 | } \ |
214 | } while (0) | 214 | } while (0) |
215 | # define V4LDBG(level, name, cmd) \ | 215 | # define V4LDBG(level, name, cmd) \ |
@@ -226,7 +226,7 @@ do { \ | |||
226 | #undef PDBG | 226 | #undef PDBG |
227 | #define PDBG(fmt, args...) \ | 227 | #define PDBG(fmt, args...) \ |
228 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 228 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
229 | __FUNCTION__, __LINE__ , ## args) | 229 | __FUNCTION__, __LINE__ , ## args) |
230 | 230 | ||
231 | #undef PDBGG | 231 | #undef PDBGG |
232 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ | 232 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |
diff --git a/drivers/usb/media/et61x251_core.c b/drivers/media/video/et61x251/et61x251_core.c index 7cc01b828b3d..dfc9dd732c9d 100644 --- a/drivers/usb/media/et61x251_core.c +++ b/drivers/media/video/et61x251/et61x251_core.c | |||
@@ -44,7 +44,7 @@ | |||
44 | /*****************************************************************************/ | 44 | /*****************************************************************************/ |
45 | 45 | ||
46 | #define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \ | 46 | #define ET61X251_MODULE_NAME "V4L2 driver for ET61X[12]51 " \ |
47 | "PC Camera Controllers" | 47 | "PC Camera Controllers" |
48 | #define ET61X251_MODULE_AUTHOR "(C) 2006 Luca Risolia" | 48 | #define ET61X251_MODULE_AUTHOR "(C) 2006 Luca Risolia" |
49 | #define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | 49 | #define ET61X251_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" |
50 | #define ET61X251_MODULE_LICENSE "GPL" | 50 | #define ET61X251_MODULE_LICENSE "GPL" |
@@ -63,68 +63,68 @@ MODULE_LICENSE(ET61X251_MODULE_LICENSE); | |||
63 | static short video_nr[] = {[0 ... ET61X251_MAX_DEVICES-1] = -1}; | 63 | static short video_nr[] = {[0 ... ET61X251_MAX_DEVICES-1] = -1}; |
64 | module_param_array(video_nr, short, NULL, 0444); | 64 | module_param_array(video_nr, short, NULL, 0444); |
65 | MODULE_PARM_DESC(video_nr, | 65 | MODULE_PARM_DESC(video_nr, |
66 | "\n<-1|n[,...]> Specify V4L2 minor mode number." | 66 | "\n<-1|n[,...]> Specify V4L2 minor mode number." |
67 | "\n -1 = use next available (default)" | 67 | "\n -1 = use next available (default)" |
68 | "\n n = use minor number n (integer >= 0)" | 68 | "\n n = use minor number n (integer >= 0)" |
69 | "\nYou can specify up to " | 69 | "\nYou can specify up to " |
70 | __MODULE_STRING(ET61X251_MAX_DEVICES) " cameras this way." | 70 | __MODULE_STRING(ET61X251_MAX_DEVICES) " cameras this way." |
71 | "\nFor example:" | 71 | "\nFor example:" |
72 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" | 72 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" |
73 | "\nthe second registered camera and use auto for the first" | 73 | "\nthe second registered camera and use auto for the first" |
74 | "\none and for every other camera." | 74 | "\none and for every other camera." |
75 | "\n"); | 75 | "\n"); |
76 | 76 | ||
77 | static short force_munmap[] = {[0 ... ET61X251_MAX_DEVICES-1] = | 77 | static short force_munmap[] = {[0 ... ET61X251_MAX_DEVICES-1] = |
78 | ET61X251_FORCE_MUNMAP}; | 78 | ET61X251_FORCE_MUNMAP}; |
79 | module_param_array(force_munmap, bool, NULL, 0444); | 79 | module_param_array(force_munmap, bool, NULL, 0444); |
80 | MODULE_PARM_DESC(force_munmap, | 80 | MODULE_PARM_DESC(force_munmap, |
81 | "\n<0|1[,...]> Force the application to unmap previously" | 81 | "\n<0|1[,...]> Force the application to unmap previously" |
82 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" | 82 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" |
83 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" | 83 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" |
84 | "\nthis feature. This parameter is specific for each" | 84 | "\nthis feature. This parameter is specific for each" |
85 | "\ndetected camera." | 85 | "\ndetected camera." |
86 | "\n 0 = do not force memory unmapping" | 86 | "\n 0 = do not force memory unmapping" |
87 | "\n 1 = force memory unmapping (save memory)" | 87 | "\n 1 = force memory unmapping (save memory)" |
88 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." | 88 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." |
89 | "\n"); | 89 | "\n"); |
90 | 90 | ||
91 | static unsigned int frame_timeout[] = {[0 ... ET61X251_MAX_DEVICES-1] = | 91 | static unsigned int frame_timeout[] = {[0 ... ET61X251_MAX_DEVICES-1] = |
92 | ET61X251_FRAME_TIMEOUT}; | 92 | ET61X251_FRAME_TIMEOUT}; |
93 | module_param_array(frame_timeout, uint, NULL, 0644); | 93 | module_param_array(frame_timeout, uint, NULL, 0644); |
94 | MODULE_PARM_DESC(frame_timeout, | 94 | MODULE_PARM_DESC(frame_timeout, |
95 | "\n<n[,...]> Timeout for a video frame in seconds." | 95 | "\n<n[,...]> Timeout for a video frame in seconds." |
96 | "\nThis parameter is specific for each detected camera." | 96 | "\nThis parameter is specific for each detected camera." |
97 | "\nDefault value is " | 97 | "\nDefault value is " |
98 | __MODULE_STRING(ET61X251_FRAME_TIMEOUT)"." | 98 | __MODULE_STRING(ET61X251_FRAME_TIMEOUT)"." |
99 | "\n"); | 99 | "\n"); |
100 | 100 | ||
101 | #ifdef ET61X251_DEBUG | 101 | #ifdef ET61X251_DEBUG |
102 | static unsigned short debug = ET61X251_DEBUG_LEVEL; | 102 | static unsigned short debug = ET61X251_DEBUG_LEVEL; |
103 | module_param(debug, ushort, 0644); | 103 | module_param(debug, ushort, 0644); |
104 | MODULE_PARM_DESC(debug, | 104 | MODULE_PARM_DESC(debug, |
105 | "\n<n> Debugging information level, from 0 to 3:" | 105 | "\n<n> Debugging information level, from 0 to 3:" |
106 | "\n0 = none (use carefully)" | 106 | "\n0 = none (use carefully)" |
107 | "\n1 = critical errors" | 107 | "\n1 = critical errors" |
108 | "\n2 = significant informations" | 108 | "\n2 = significant informations" |
109 | "\n3 = more verbose messages" | 109 | "\n3 = more verbose messages" |
110 | "\nLevel 3 is useful for testing only, when only " | 110 | "\nLevel 3 is useful for testing only, when only " |
111 | "one device is used." | 111 | "one device is used." |
112 | "\nDefault value is "__MODULE_STRING(ET61X251_DEBUG_LEVEL)"." | 112 | "\nDefault value is "__MODULE_STRING(ET61X251_DEBUG_LEVEL)"." |
113 | "\n"); | 113 | "\n"); |
114 | #endif | 114 | #endif |
115 | 115 | ||
116 | /*****************************************************************************/ | 116 | /*****************************************************************************/ |
117 | 117 | ||
118 | static u32 | 118 | static u32 |
119 | et61x251_request_buffers(struct et61x251_device* cam, u32 count, | 119 | et61x251_request_buffers(struct et61x251_device* cam, u32 count, |
120 | enum et61x251_io_method io) | 120 | enum et61x251_io_method io) |
121 | { | 121 | { |
122 | struct v4l2_pix_format* p = &(cam->sensor.pix_format); | 122 | struct v4l2_pix_format* p = &(cam->sensor.pix_format); |
123 | struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); | 123 | struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); |
124 | const size_t imagesize = cam->module_param.force_munmap || | 124 | const size_t imagesize = cam->module_param.force_munmap || |
125 | io == IO_READ ? | 125 | io == IO_READ ? |
126 | (p->width * p->height * p->priv) / 8 : | 126 | (p->width * p->height * p->priv) / 8 : |
127 | (r->width * r->height * p->priv) / 8; | 127 | (r->width * r->height * p->priv) / 8; |
128 | void* buff = NULL; | 128 | void* buff = NULL; |
129 | u32 i; | 129 | u32 i; |
130 | 130 | ||
@@ -216,7 +216,7 @@ int et61x251_write_reg(struct et61x251_device* cam, u8 value, u16 index) | |||
216 | *buff = value; | 216 | *buff = value; |
217 | 217 | ||
218 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 218 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
219 | 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); | 219 | 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); |
220 | if (res < 0) { | 220 | if (res < 0) { |
221 | DBG(3, "Failed to write a register (value 0x%02X, index " | 221 | DBG(3, "Failed to write a register (value 0x%02X, index " |
222 | "0x%02X, error %d)", value, index, res); | 222 | "0x%02X, error %d)", value, index, res); |
@@ -234,7 +234,7 @@ int et61x251_read_reg(struct et61x251_device* cam, u16 index) | |||
234 | int res; | 234 | int res; |
235 | 235 | ||
236 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, | 236 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, |
237 | 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); | 237 | 0, index, buff, 1, ET61X251_CTRL_TIMEOUT); |
238 | if (res < 0) | 238 | if (res < 0) |
239 | DBG(3, "Failed to read a register (index 0x%02X, error %d)", | 239 | DBG(3, "Failed to read a register (index 0x%02X, error %d)", |
240 | index, res); | 240 | index, res); |
@@ -269,7 +269,7 @@ et61x251_i2c_wait(struct et61x251_device* cam, struct et61x251_sensor* sensor) | |||
269 | 269 | ||
270 | int | 270 | int |
271 | et61x251_i2c_try_read(struct et61x251_device* cam, | 271 | et61x251_i2c_try_read(struct et61x251_device* cam, |
272 | struct et61x251_sensor* sensor, u8 address) | 272 | struct et61x251_sensor* sensor, u8 address) |
273 | { | 273 | { |
274 | struct usb_device* udev = cam->usbdev; | 274 | struct usb_device* udev = cam->usbdev; |
275 | u8* data = cam->control_buffer; | 275 | u8* data = cam->control_buffer; |
@@ -280,14 +280,14 @@ et61x251_i2c_try_read(struct et61x251_device* cam, | |||
280 | data[2] = cam->sensor.rsta | 0x10; | 280 | data[2] = cam->sensor.rsta | 0x10; |
281 | data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02); | 281 | data[3] = !(et61x251_read_reg(cam, 0x8b) & 0x02); |
282 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 282 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
283 | 0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT); | 283 | 0, 0x88, data, 4, ET61X251_CTRL_TIMEOUT); |
284 | if (res < 0) | 284 | if (res < 0) |
285 | err += res; | 285 | err += res; |
286 | 286 | ||
287 | err += et61x251_i2c_wait(cam, sensor); | 287 | err += et61x251_i2c_wait(cam, sensor); |
288 | 288 | ||
289 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, | 289 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, |
290 | 0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT); | 290 | 0, 0x80, data, 8, ET61X251_CTRL_TIMEOUT); |
291 | if (res < 0) | 291 | if (res < 0) |
292 | err += res; | 292 | err += res; |
293 | 293 | ||
@@ -302,7 +302,7 @@ et61x251_i2c_try_read(struct et61x251_device* cam, | |||
302 | 302 | ||
303 | int | 303 | int |
304 | et61x251_i2c_try_write(struct et61x251_device* cam, | 304 | et61x251_i2c_try_write(struct et61x251_device* cam, |
305 | struct et61x251_sensor* sensor, u8 address, u8 value) | 305 | struct et61x251_sensor* sensor, u8 address, u8 value) |
306 | { | 306 | { |
307 | struct usb_device* udev = cam->usbdev; | 307 | struct usb_device* udev = cam->usbdev; |
308 | u8* data = cam->control_buffer; | 308 | u8* data = cam->control_buffer; |
@@ -312,13 +312,13 @@ et61x251_i2c_try_write(struct et61x251_device* cam, | |||
312 | data[1] = cam->sensor.i2c_slave_id; | 312 | data[1] = cam->sensor.i2c_slave_id; |
313 | data[2] = cam->sensor.rsta | 0x12; | 313 | data[2] = cam->sensor.rsta | 0x12; |
314 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 314 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
315 | 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); | 315 | 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); |
316 | if (res < 0) | 316 | if (res < 0) |
317 | err += res; | 317 | err += res; |
318 | 318 | ||
319 | data[0] = value; | 319 | data[0] = value; |
320 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 320 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
321 | 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); | 321 | 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); |
322 | if (res < 0) | 322 | if (res < 0) |
323 | err += res; | 323 | err += res; |
324 | 324 | ||
@@ -335,8 +335,8 @@ et61x251_i2c_try_write(struct et61x251_device* cam, | |||
335 | 335 | ||
336 | int | 336 | int |
337 | et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, | 337 | et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, |
338 | u8 data3, u8 data4, u8 data5, u8 data6, u8 data7, | 338 | u8 data3, u8 data4, u8 data5, u8 data6, u8 data7, |
339 | u8 data8, u8 address) | 339 | u8 data8, u8 address) |
340 | { | 340 | { |
341 | struct usb_device* udev = cam->usbdev; | 341 | struct usb_device* udev = cam->usbdev; |
342 | u8* data = cam->control_buffer; | 342 | u8* data = cam->control_buffer; |
@@ -350,7 +350,7 @@ et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, | |||
350 | data[5] = data7; | 350 | data[5] = data7; |
351 | data[6] = data8; | 351 | data[6] = data8; |
352 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 352 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
353 | 0, 0x81, data, n-1, ET61X251_CTRL_TIMEOUT); | 353 | 0, 0x81, data, n-1, ET61X251_CTRL_TIMEOUT); |
354 | if (res < 0) | 354 | if (res < 0) |
355 | err += res; | 355 | err += res; |
356 | 356 | ||
@@ -358,14 +358,14 @@ et61x251_i2c_raw_write(struct et61x251_device* cam, u8 n, u8 data1, u8 data2, | |||
358 | data[1] = cam->sensor.i2c_slave_id; | 358 | data[1] = cam->sensor.i2c_slave_id; |
359 | data[2] = cam->sensor.rsta | 0x02 | (n << 4); | 359 | data[2] = cam->sensor.rsta | 0x02 | (n << 4); |
360 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 360 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
361 | 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); | 361 | 0, 0x88, data, 3, ET61X251_CTRL_TIMEOUT); |
362 | if (res < 0) | 362 | if (res < 0) |
363 | err += res; | 363 | err += res; |
364 | 364 | ||
365 | /* Start writing through the serial interface */ | 365 | /* Start writing through the serial interface */ |
366 | data[0] = data1; | 366 | data[0] = data1; |
367 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, | 367 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x00, 0x41, |
368 | 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); | 368 | 0, 0x80, data, 1, ET61X251_CTRL_TIMEOUT); |
369 | if (res < 0) | 369 | if (res < 0) |
370 | err += res; | 370 | err += res; |
371 | 371 | ||
@@ -432,11 +432,11 @@ static void et61x251_urb_complete(struct urb *urb, struct pt_regs* regs) | |||
432 | 432 | ||
433 | if (!(*f)) | 433 | if (!(*f)) |
434 | (*f) = list_entry(cam->inqueue.next, struct et61x251_frame_t, | 434 | (*f) = list_entry(cam->inqueue.next, struct et61x251_frame_t, |
435 | frame); | 435 | frame); |
436 | 436 | ||
437 | imagesize = (cam->sensor.pix_format.width * | 437 | imagesize = (cam->sensor.pix_format.width * |
438 | cam->sensor.pix_format.height * | 438 | cam->sensor.pix_format.height * |
439 | cam->sensor.pix_format.priv) / 8; | 439 | cam->sensor.pix_format.priv) / 8; |
440 | 440 | ||
441 | for (i = 0; i < urb->number_of_packets; i++) { | 441 | for (i = 0; i < urb->number_of_packets; i++) { |
442 | unsigned int len, status; | 442 | unsigned int len, status; |
@@ -476,7 +476,7 @@ start_of_frame: | |||
476 | if ((*f)->state == F_GRABBING) { | 476 | if ((*f)->state == F_GRABBING) { |
477 | if (sof && (*f)->buf.bytesused) { | 477 | if (sof && (*f)->buf.bytesused) { |
478 | if (cam->sensor.pix_format.pixelformat == | 478 | if (cam->sensor.pix_format.pixelformat == |
479 | V4L2_PIX_FMT_ET61X251) | 479 | V4L2_PIX_FMT_ET61X251) |
480 | goto end_of_frame; | 480 | goto end_of_frame; |
481 | else { | 481 | else { |
482 | DBG(3, "Not expected SOF detected " | 482 | DBG(3, "Not expected SOF detected " |
@@ -508,8 +508,8 @@ end_of_frame: | |||
508 | list_move_tail(&(*f)->frame, &cam->outqueue); | 508 | list_move_tail(&(*f)->frame, &cam->outqueue); |
509 | if (!list_empty(&cam->inqueue)) | 509 | if (!list_empty(&cam->inqueue)) |
510 | (*f) = list_entry(cam->inqueue.next, | 510 | (*f) = list_entry(cam->inqueue.next, |
511 | struct et61x251_frame_t, | 511 | struct et61x251_frame_t, |
512 | frame); | 512 | frame); |
513 | else | 513 | else |
514 | (*f) = NULL; | 514 | (*f) = NULL; |
515 | spin_unlock(&cam->queue_lock); | 515 | spin_unlock(&cam->queue_lock); |
@@ -521,7 +521,7 @@ end_of_frame: | |||
521 | 521 | ||
522 | if (sof && | 522 | if (sof && |
523 | cam->sensor.pix_format.pixelformat == | 523 | cam->sensor.pix_format.pixelformat == |
524 | V4L2_PIX_FMT_ET61X251) | 524 | V4L2_PIX_FMT_ET61X251) |
525 | goto start_of_frame; | 525 | goto start_of_frame; |
526 | } | 526 | } |
527 | } | 527 | } |
@@ -544,15 +544,15 @@ static int et61x251_start_transfer(struct et61x251_device* cam) | |||
544 | struct usb_device *udev = cam->usbdev; | 544 | struct usb_device *udev = cam->usbdev; |
545 | struct urb* urb; | 545 | struct urb* urb; |
546 | const unsigned int wMaxPacketSize[] = {0, 256, 384, 512, 640, 768, 832, | 546 | const unsigned int wMaxPacketSize[] = {0, 256, 384, 512, 640, 768, 832, |
547 | 864, 896, 920, 956, 980, 1000, | 547 | 864, 896, 920, 956, 980, 1000, |
548 | 1022}; | 548 | 1022}; |
549 | const unsigned int psz = wMaxPacketSize[ET61X251_ALTERNATE_SETTING]; | 549 | const unsigned int psz = wMaxPacketSize[ET61X251_ALTERNATE_SETTING]; |
550 | s8 i, j; | 550 | s8 i, j; |
551 | int err = 0; | 551 | int err = 0; |
552 | 552 | ||
553 | for (i = 0; i < ET61X251_URBS; i++) { | 553 | for (i = 0; i < ET61X251_URBS; i++) { |
554 | cam->transfer_buffer[i] = kzalloc(ET61X251_ISO_PACKETS * psz, | 554 | cam->transfer_buffer[i] = kzalloc(ET61X251_ISO_PACKETS * psz, |
555 | GFP_KERNEL); | 555 | GFP_KERNEL); |
556 | if (!cam->transfer_buffer[i]) { | 556 | if (!cam->transfer_buffer[i]) { |
557 | err = -ENOMEM; | 557 | err = -ENOMEM; |
558 | DBG(1, "Not enough memory"); | 558 | DBG(1, "Not enough memory"); |
@@ -653,9 +653,9 @@ static int et61x251_stream_interrupt(struct et61x251_device* cam) | |||
653 | 653 | ||
654 | cam->stream = STREAM_INTERRUPT; | 654 | cam->stream = STREAM_INTERRUPT; |
655 | timeout = wait_event_timeout(cam->wait_stream, | 655 | timeout = wait_event_timeout(cam->wait_stream, |
656 | (cam->stream == STREAM_OFF) || | 656 | (cam->stream == STREAM_OFF) || |
657 | (cam->state & DEV_DISCONNECTED), | 657 | (cam->state & DEV_DISCONNECTED), |
658 | ET61X251_URB_TIMEOUT); | 658 | ET61X251_URB_TIMEOUT); |
659 | if (cam->state & DEV_DISCONNECTED) | 659 | if (cam->state & DEV_DISCONNECTED) |
660 | return -ENODEV; | 660 | return -ENODEV; |
661 | else if (cam->stream != STREAM_OFF) { | 661 | else if (cam->stream != STREAM_OFF) { |
@@ -699,7 +699,7 @@ static u8 et61x251_strtou8(const char* buff, size_t len, ssize_t* count) | |||
699 | 699 | ||
700 | /* | 700 | /* |
701 | NOTE 1: being inside one of the following methods implies that the v4l | 701 | NOTE 1: being inside one of the following methods implies that the v4l |
702 | device exists for sure (see kobjects and reference counters) | 702 | device exists for sure (see kobjects and reference counters) |
703 | NOTE 2: buffers are PAGE_SIZE long | 703 | NOTE 2: buffers are PAGE_SIZE long |
704 | */ | 704 | */ |
705 | 705 | ||
@@ -964,13 +964,13 @@ et61x251_store_i2c_val(struct class_device* cd, const char* buf, size_t len) | |||
964 | 964 | ||
965 | 965 | ||
966 | static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, | 966 | static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, |
967 | et61x251_show_reg, et61x251_store_reg); | 967 | et61x251_show_reg, et61x251_store_reg); |
968 | static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, | 968 | static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, |
969 | et61x251_show_val, et61x251_store_val); | 969 | et61x251_show_val, et61x251_store_val); |
970 | static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, | 970 | static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, |
971 | et61x251_show_i2c_reg, et61x251_store_i2c_reg); | 971 | et61x251_show_i2c_reg, et61x251_store_i2c_reg); |
972 | static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, | 972 | static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, |
973 | et61x251_show_i2c_val, et61x251_store_i2c_val); | 973 | et61x251_show_i2c_val, et61x251_store_i2c_val); |
974 | 974 | ||
975 | 975 | ||
976 | static void et61x251_create_sysfs(struct et61x251_device* cam) | 976 | static void et61x251_create_sysfs(struct et61x251_device* cam) |
@@ -990,7 +990,7 @@ static void et61x251_create_sysfs(struct et61x251_device* cam) | |||
990 | 990 | ||
991 | static int | 991 | static int |
992 | et61x251_set_pix_format(struct et61x251_device* cam, | 992 | et61x251_set_pix_format(struct et61x251_device* cam, |
993 | struct v4l2_pix_format* pix) | 993 | struct v4l2_pix_format* pix) |
994 | { | 994 | { |
995 | int r, err = 0; | 995 | int r, err = 0; |
996 | 996 | ||
@@ -1007,7 +1007,7 @@ et61x251_set_pix_format(struct et61x251_device* cam, | |||
1007 | 1007 | ||
1008 | static int | 1008 | static int |
1009 | et61x251_set_compression(struct et61x251_device* cam, | 1009 | et61x251_set_compression(struct et61x251_device* cam, |
1010 | struct v4l2_jpegcompression* compression) | 1010 | struct v4l2_jpegcompression* compression) |
1011 | { | 1011 | { |
1012 | int r, err = 0; | 1012 | int r, err = 0; |
1013 | 1013 | ||
@@ -1049,9 +1049,9 @@ et61x251_set_crop(struct et61x251_device* cam, struct v4l2_rect* rect) | |||
1049 | { | 1049 | { |
1050 | struct et61x251_sensor* s = &cam->sensor; | 1050 | struct et61x251_sensor* s = &cam->sensor; |
1051 | u16 fmw_sx = (u16)(rect->left - s->cropcap.bounds.left + | 1051 | u16 fmw_sx = (u16)(rect->left - s->cropcap.bounds.left + |
1052 | s->active_pixel.left), | 1052 | s->active_pixel.left), |
1053 | fmw_sy = (u16)(rect->top - s->cropcap.bounds.top + | 1053 | fmw_sy = (u16)(rect->top - s->cropcap.bounds.top + |
1054 | s->active_pixel.top), | 1054 | s->active_pixel.top), |
1055 | fmw_length = (u16)(rect->width), | 1055 | fmw_length = (u16)(rect->width), |
1056 | fmw_height = (u16)(rect->height); | 1056 | fmw_height = (u16)(rect->height); |
1057 | int err = 0; | 1057 | int err = 0; |
@@ -1061,8 +1061,8 @@ et61x251_set_crop(struct et61x251_device* cam, struct v4l2_rect* rect) | |||
1061 | err += et61x251_write_reg(cam, fmw_length & 0xff, 0x6b); | 1061 | err += et61x251_write_reg(cam, fmw_length & 0xff, 0x6b); |
1062 | err += et61x251_write_reg(cam, fmw_height & 0xff, 0x6c); | 1062 | err += et61x251_write_reg(cam, fmw_height & 0xff, 0x6c); |
1063 | err += et61x251_write_reg(cam, (fmw_sx >> 8) | ((fmw_sy & 0x300) >> 6) | 1063 | err += et61x251_write_reg(cam, (fmw_sx >> 8) | ((fmw_sy & 0x300) >> 6) |
1064 | | ((fmw_length & 0x300) >> 4) | 1064 | | ((fmw_length & 0x300) >> 4) |
1065 | | ((fmw_height & 0x300) >> 2), 0x6d); | 1065 | | ((fmw_height & 0x300) >> 2), 0x6d); |
1066 | if (err) | 1066 | if (err) |
1067 | return -EIO; | 1067 | return -EIO; |
1068 | 1068 | ||
@@ -1203,8 +1203,8 @@ static int et61x251_open(struct inode* inode, struct file* filp) | |||
1203 | } | 1203 | } |
1204 | mutex_unlock(&cam->dev_mutex); | 1204 | mutex_unlock(&cam->dev_mutex); |
1205 | err = wait_event_interruptible_exclusive(cam->open, | 1205 | err = wait_event_interruptible_exclusive(cam->open, |
1206 | cam->state & DEV_DISCONNECTED | 1206 | cam->state & DEV_DISCONNECTED |
1207 | || !cam->users); | 1207 | || !cam->users); |
1208 | if (err) { | 1208 | if (err) { |
1209 | up_read(&et61x251_disconnect); | 1209 | up_read(&et61x251_disconnect); |
1210 | return err; | 1210 | return err; |
@@ -1277,7 +1277,7 @@ static int et61x251_release(struct inode* inode, struct file* filp) | |||
1277 | 1277 | ||
1278 | static ssize_t | 1278 | static ssize_t |
1279 | et61x251_read(struct file* filp, char __user * buf, | 1279 | et61x251_read(struct file* filp, char __user * buf, |
1280 | size_t count, loff_t* f_pos) | 1280 | size_t count, loff_t* f_pos) |
1281 | { | 1281 | { |
1282 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | 1282 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); |
1283 | struct et61x251_frame_t* f, * i; | 1283 | struct et61x251_frame_t* f, * i; |
@@ -1310,7 +1310,7 @@ et61x251_read(struct file* filp, char __user * buf, | |||
1310 | 1310 | ||
1311 | if (cam->io == IO_NONE) { | 1311 | if (cam->io == IO_NONE) { |
1312 | if (!et61x251_request_buffers(cam, cam->nreadbuffers, | 1312 | if (!et61x251_request_buffers(cam, cam->nreadbuffers, |
1313 | IO_READ)) { | 1313 | IO_READ)) { |
1314 | DBG(1, "read() failed, not enough memory"); | 1314 | DBG(1, "read() failed, not enough memory"); |
1315 | mutex_unlock(&cam->fileop_mutex); | 1315 | mutex_unlock(&cam->fileop_mutex); |
1316 | return -ENOMEM; | 1316 | return -ENOMEM; |
@@ -1336,12 +1336,12 @@ et61x251_read(struct file* filp, char __user * buf, | |||
1336 | return -EAGAIN; | 1336 | return -EAGAIN; |
1337 | } | 1337 | } |
1338 | timeout = wait_event_interruptible_timeout | 1338 | timeout = wait_event_interruptible_timeout |
1339 | ( cam->wait_frame, | 1339 | ( cam->wait_frame, |
1340 | (!list_empty(&cam->outqueue)) || | 1340 | (!list_empty(&cam->outqueue)) || |
1341 | (cam->state & DEV_DISCONNECTED) || | 1341 | (cam->state & DEV_DISCONNECTED) || |
1342 | (cam->state & DEV_MISCONFIGURED), | 1342 | (cam->state & DEV_MISCONFIGURED), |
1343 | cam->module_param.frame_timeout * | 1343 | cam->module_param.frame_timeout * |
1344 | 1000 * msecs_to_jiffies(1) ); | 1344 | 1000 * msecs_to_jiffies(1) ); |
1345 | if (timeout < 0) { | 1345 | if (timeout < 0) { |
1346 | mutex_unlock(&cam->fileop_mutex); | 1346 | mutex_unlock(&cam->fileop_mutex); |
1347 | return timeout; | 1347 | return timeout; |
@@ -1408,7 +1408,7 @@ static unsigned int et61x251_poll(struct file *filp, poll_table *wait) | |||
1408 | 1408 | ||
1409 | if (cam->io == IO_NONE) { | 1409 | if (cam->io == IO_NONE) { |
1410 | if (!et61x251_request_buffers(cam, cam->nreadbuffers, | 1410 | if (!et61x251_request_buffers(cam, cam->nreadbuffers, |
1411 | IO_READ)) { | 1411 | IO_READ)) { |
1412 | DBG(1, "poll() failed, not enough memory"); | 1412 | DBG(1, "poll() failed, not enough memory"); |
1413 | goto error; | 1413 | goto error; |
1414 | } | 1414 | } |
@@ -1465,7 +1465,7 @@ static int et61x251_mmap(struct file* filp, struct vm_area_struct *vma) | |||
1465 | { | 1465 | { |
1466 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | 1466 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); |
1467 | unsigned long size = vma->vm_end - vma->vm_start, | 1467 | unsigned long size = vma->vm_end - vma->vm_start, |
1468 | start = vma->vm_start; | 1468 | start = vma->vm_start; |
1469 | void *pos; | 1469 | void *pos; |
1470 | u32 i; | 1470 | u32 i; |
1471 | 1471 | ||
@@ -1533,13 +1533,13 @@ et61x251_vidioc_querycap(struct et61x251_device* cam, void __user * arg) | |||
1533 | .driver = "et61x251", | 1533 | .driver = "et61x251", |
1534 | .version = ET61X251_MODULE_VERSION_CODE, | 1534 | .version = ET61X251_MODULE_VERSION_CODE, |
1535 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | | 1535 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
1536 | V4L2_CAP_STREAMING, | 1536 | V4L2_CAP_STREAMING, |
1537 | }; | 1537 | }; |
1538 | 1538 | ||
1539 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); | 1539 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); |
1540 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) | 1540 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) |
1541 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, | 1541 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, |
1542 | sizeof(cap.bus_info)); | 1542 | sizeof(cap.bus_info)); |
1543 | 1543 | ||
1544 | if (copy_to_user(arg, &cap, sizeof(cap))) | 1544 | if (copy_to_user(arg, &cap, sizeof(cap))) |
1545 | return -EFAULT; | 1545 | return -EFAULT; |
@@ -1871,7 +1871,7 @@ et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg) | |||
1871 | return -EINVAL; | 1871 | return -EINVAL; |
1872 | 1872 | ||
1873 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251) | 1873 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_ET61X251) |
1874 | ? 0 : (pfmt->width * pfmt->priv) / 8; | 1874 | ? 0 : (pfmt->width * pfmt->priv) / 8; |
1875 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); | 1875 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); |
1876 | pfmt->field = V4L2_FIELD_NONE; | 1876 | pfmt->field = V4L2_FIELD_NONE; |
1877 | memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); | 1877 | memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); |
@@ -1885,7 +1885,7 @@ et61x251_vidioc_g_fmt(struct et61x251_device* cam, void __user * arg) | |||
1885 | 1885 | ||
1886 | static int | 1886 | static int |
1887 | et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, | 1887 | et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, |
1888 | void __user * arg) | 1888 | void __user * arg) |
1889 | { | 1889 | { |
1890 | struct et61x251_sensor* s = &cam->sensor; | 1890 | struct et61x251_sensor* s = &cam->sensor; |
1891 | struct v4l2_format format; | 1891 | struct v4l2_format format; |
@@ -1947,7 +1947,7 @@ et61x251_vidioc_try_s_fmt(struct et61x251_device* cam, unsigned int cmd, | |||
1947 | pix->priv = pfmt->priv; /* bpp */ | 1947 | pix->priv = pfmt->priv; /* bpp */ |
1948 | pix->colorspace = pfmt->colorspace; | 1948 | pix->colorspace = pfmt->colorspace; |
1949 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251) | 1949 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_ET61X251) |
1950 | ? 0 : (pix->width * pix->priv) / 8; | 1950 | ? 0 : (pix->width * pix->priv) / 8; |
1951 | pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); | 1951 | pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); |
1952 | pix->field = V4L2_FIELD_NONE; | 1952 | pix->field = V4L2_FIELD_NONE; |
1953 | 1953 | ||
@@ -2020,7 +2020,7 @@ static int | |||
2020 | et61x251_vidioc_g_jpegcomp(struct et61x251_device* cam, void __user * arg) | 2020 | et61x251_vidioc_g_jpegcomp(struct et61x251_device* cam, void __user * arg) |
2021 | { | 2021 | { |
2022 | if (copy_to_user(arg, &cam->compression, | 2022 | if (copy_to_user(arg, &cam->compression, |
2023 | sizeof(cam->compression))) | 2023 | sizeof(cam->compression))) |
2024 | return -EFAULT; | 2024 | return -EFAULT; |
2025 | 2025 | ||
2026 | return 0; | 2026 | return 0; |
@@ -2169,7 +2169,7 @@ et61x251_vidioc_qbuf(struct et61x251_device* cam, void __user * arg) | |||
2169 | 2169 | ||
2170 | static int | 2170 | static int |
2171 | et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp, | 2171 | et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp, |
2172 | void __user * arg) | 2172 | void __user * arg) |
2173 | { | 2173 | { |
2174 | struct v4l2_buffer b; | 2174 | struct v4l2_buffer b; |
2175 | struct et61x251_frame_t *f; | 2175 | struct et61x251_frame_t *f; |
@@ -2188,12 +2188,12 @@ et61x251_vidioc_dqbuf(struct et61x251_device* cam, struct file* filp, | |||
2188 | if (filp->f_flags & O_NONBLOCK) | 2188 | if (filp->f_flags & O_NONBLOCK) |
2189 | return -EAGAIN; | 2189 | return -EAGAIN; |
2190 | timeout = wait_event_interruptible_timeout | 2190 | timeout = wait_event_interruptible_timeout |
2191 | ( cam->wait_frame, | 2191 | ( cam->wait_frame, |
2192 | (!list_empty(&cam->outqueue)) || | 2192 | (!list_empty(&cam->outqueue)) || |
2193 | (cam->state & DEV_DISCONNECTED) || | 2193 | (cam->state & DEV_DISCONNECTED) || |
2194 | (cam->state & DEV_MISCONFIGURED), | 2194 | (cam->state & DEV_MISCONFIGURED), |
2195 | cam->module_param.frame_timeout * | 2195 | cam->module_param.frame_timeout * |
2196 | 1000 * msecs_to_jiffies(1) ); | 2196 | 1000 * msecs_to_jiffies(1) ); |
2197 | if (timeout < 0) | 2197 | if (timeout < 0) |
2198 | return timeout; | 2198 | return timeout; |
2199 | if (cam->state & DEV_DISCONNECTED) | 2199 | if (cam->state & DEV_DISCONNECTED) |
@@ -2317,7 +2317,7 @@ et61x251_vidioc_s_parm(struct et61x251_device* cam, void __user * arg) | |||
2317 | 2317 | ||
2318 | 2318 | ||
2319 | static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, | 2319 | static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, |
2320 | unsigned int cmd, void __user * arg) | 2320 | unsigned int cmd, void __user * arg) |
2321 | { | 2321 | { |
2322 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | 2322 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); |
2323 | 2323 | ||
@@ -2411,7 +2411,7 @@ static int et61x251_ioctl_v4l2(struct inode* inode, struct file* filp, | |||
2411 | 2411 | ||
2412 | 2412 | ||
2413 | static int et61x251_ioctl(struct inode* inode, struct file* filp, | 2413 | static int et61x251_ioctl(struct inode* inode, struct file* filp, |
2414 | unsigned int cmd, unsigned long arg) | 2414 | unsigned int cmd, unsigned long arg) |
2415 | { | 2415 | { |
2416 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); | 2416 | struct et61x251_device* cam = video_get_drvdata(video_devdata(filp)); |
2417 | int err = 0; | 2417 | int err = 0; |
@@ -2518,7 +2518,7 @@ et61x251_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2518 | mutex_lock(&cam->dev_mutex); | 2518 | mutex_lock(&cam->dev_mutex); |
2519 | 2519 | ||
2520 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | 2520 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, |
2521 | video_nr[dev_nr]); | 2521 | video_nr[dev_nr]); |
2522 | if (err) { | 2522 | if (err) { |
2523 | DBG(1, "V4L2 device registration failed"); | 2523 | DBG(1, "V4L2 device registration failed"); |
2524 | if (err == -ENFILE && video_nr[dev_nr] == -1) | 2524 | if (err == -ENFILE && video_nr[dev_nr] == -1) |
diff --git a/drivers/usb/media/et61x251_sensor.h b/drivers/media/video/et61x251/et61x251_sensor.h index 56841ae8a207..65edd08dc386 100644 --- a/drivers/usb/media/et61x251_sensor.h +++ b/drivers/media/video/et61x251/et61x251_sensor.h | |||
@@ -47,7 +47,7 @@ et61x251_match_id(struct et61x251_device* cam, const struct usb_device_id *id); | |||
47 | 47 | ||
48 | extern void | 48 | extern void |
49 | et61x251_attach_sensor(struct et61x251_device* cam, | 49 | et61x251_attach_sensor(struct et61x251_device* cam, |
50 | struct et61x251_sensor* sensor); | 50 | struct et61x251_sensor* sensor); |
51 | 51 | ||
52 | /*****************************************************************************/ | 52 | /*****************************************************************************/ |
53 | 53 | ||
@@ -56,13 +56,13 @@ extern int et61x251_read_reg(struct et61x251_device*, u16 index); | |||
56 | extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value); | 56 | extern int et61x251_i2c_write(struct et61x251_device*, u8 address, u8 value); |
57 | extern int et61x251_i2c_read(struct et61x251_device*, u8 address); | 57 | extern int et61x251_i2c_read(struct et61x251_device*, u8 address); |
58 | extern int et61x251_i2c_try_write(struct et61x251_device*, | 58 | extern int et61x251_i2c_try_write(struct et61x251_device*, |
59 | struct et61x251_sensor*, u8 address, | 59 | struct et61x251_sensor*, u8 address, |
60 | u8 value); | 60 | u8 value); |
61 | extern int et61x251_i2c_try_read(struct et61x251_device*, | 61 | extern int et61x251_i2c_try_read(struct et61x251_device*, |
62 | struct et61x251_sensor*, u8 address); | 62 | struct et61x251_sensor*, u8 address); |
63 | extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1, | 63 | extern int et61x251_i2c_raw_write(struct et61x251_device*, u8 n, u8 data1, |
64 | u8 data2, u8 data3, u8 data4, u8 data5, | 64 | u8 data2, u8 data3, u8 data4, u8 data5, |
65 | u8 data6, u8 data7, u8 data8, u8 address); | 65 | u8 data6, u8 data7, u8 data8, u8 address); |
66 | 66 | ||
67 | /*****************************************************************************/ | 67 | /*****************************************************************************/ |
68 | 68 | ||
@@ -100,13 +100,13 @@ struct et61x251_sensor { | |||
100 | 100 | ||
101 | int (*init)(struct et61x251_device* cam); | 101 | int (*init)(struct et61x251_device* cam); |
102 | int (*get_ctrl)(struct et61x251_device* cam, | 102 | int (*get_ctrl)(struct et61x251_device* cam, |
103 | struct v4l2_control* ctrl); | 103 | struct v4l2_control* ctrl); |
104 | int (*set_ctrl)(struct et61x251_device* cam, | 104 | int (*set_ctrl)(struct et61x251_device* cam, |
105 | const struct v4l2_control* ctrl); | 105 | const struct v4l2_control* ctrl); |
106 | int (*set_crop)(struct et61x251_device* cam, | 106 | int (*set_crop)(struct et61x251_device* cam, |
107 | const struct v4l2_rect* rect); | 107 | const struct v4l2_rect* rect); |
108 | int (*set_pix_format)(struct et61x251_device* cam, | 108 | int (*set_pix_format)(struct et61x251_device* cam, |
109 | const struct v4l2_pix_format* pix); | 109 | const struct v4l2_pix_format* pix); |
110 | 110 | ||
111 | /* Private */ | 111 | /* Private */ |
112 | struct v4l2_queryctrl _qctrl[ET61X251_MAX_CTRLS]; | 112 | struct v4l2_queryctrl _qctrl[ET61X251_MAX_CTRLS]; |
diff --git a/drivers/usb/media/et61x251_tas5130d1b.c b/drivers/media/video/et61x251/et61x251_tas5130d1b.c index 3998d76a307a..a7d65b82b2fb 100644 --- a/drivers/usb/media/et61x251_tas5130d1b.c +++ b/drivers/media/video/et61x251/et61x251_tas5130d1b.c | |||
@@ -46,20 +46,20 @@ static int tas5130d1b_init(struct et61x251_device* cam) | |||
46 | 46 | ||
47 | 47 | ||
48 | static int tas5130d1b_set_ctrl(struct et61x251_device* cam, | 48 | static int tas5130d1b_set_ctrl(struct et61x251_device* cam, |
49 | const struct v4l2_control* ctrl) | 49 | const struct v4l2_control* ctrl) |
50 | { | 50 | { |
51 | int err = 0; | 51 | int err = 0; |
52 | 52 | ||
53 | switch (ctrl->id) { | 53 | switch (ctrl->id) { |
54 | case V4L2_CID_GAIN: | 54 | case V4L2_CID_GAIN: |
55 | err += et61x251_i2c_raw_write(cam, 2, 0x20, | 55 | err += et61x251_i2c_raw_write(cam, 2, 0x20, |
56 | 0xf6-ctrl->value, 0, 0, 0, | 56 | 0xf6-ctrl->value, 0, 0, 0, |
57 | 0, 0, 0, 0); | 57 | 0, 0, 0, 0); |
58 | break; | 58 | break; |
59 | case V4L2_CID_EXPOSURE: | 59 | case V4L2_CID_EXPOSURE: |
60 | err += et61x251_i2c_raw_write(cam, 2, 0x40, | 60 | err += et61x251_i2c_raw_write(cam, 2, 0x40, |
61 | 0x47-ctrl->value, 0, 0, 0, | 61 | 0x47-ctrl->value, 0, 0, 0, |
62 | 0, 0, 0, 0); | 62 | 0, 0, 0, 0); |
63 | break; | 63 | break; |
64 | default: | 64 | default: |
65 | return -EINVAL; | 65 | return -EINVAL; |
diff --git a/drivers/media/video/font.h b/drivers/media/video/font.h new file mode 100644 index 000000000000..8b1fecc37599 --- /dev/null +++ b/drivers/media/video/font.h | |||
@@ -0,0 +1,407 @@ | |||
1 | static unsigned char rom8x16_bits[] = { | ||
2 | /* Character 0 (0x30): | ||
3 | ht=16, width=8 | ||
4 | +--------+ | ||
5 | | | | ||
6 | | | | ||
7 | | ***** | | ||
8 | |** ** | | ||
9 | |** ** | | ||
10 | |** *** | | ||
11 | |** **** | | ||
12 | |**** ** | | ||
13 | |*** ** | | ||
14 | |** ** | | ||
15 | |** ** | | ||
16 | | ***** | | ||
17 | | | | ||
18 | | | | ||
19 | | | | ||
20 | | | | ||
21 | +--------+ */ | ||
22 | 0x00, | ||
23 | 0x00, | ||
24 | 0x7c, | ||
25 | 0xc6, | ||
26 | 0xc6, | ||
27 | 0xce, | ||
28 | 0xde, | ||
29 | 0xf6, | ||
30 | 0xe6, | ||
31 | 0xc6, | ||
32 | 0xc6, | ||
33 | 0x7c, | ||
34 | 0x00, | ||
35 | 0x00, | ||
36 | 0x00, | ||
37 | 0x00, | ||
38 | |||
39 | /* Character 1 (0x31): | ||
40 | ht=16, width=8 | ||
41 | +--------+ | ||
42 | | | | ||
43 | | | | ||
44 | | ** | | ||
45 | | **** | | ||
46 | | ** | | ||
47 | | ** | | ||
48 | | ** | | ||
49 | | ** | | ||
50 | | ** | | ||
51 | | ** | | ||
52 | | ** | | ||
53 | | ****** | | ||
54 | | | | ||
55 | | | | ||
56 | | | | ||
57 | | | | ||
58 | +--------+ */ | ||
59 | 0x00, | ||
60 | 0x00, | ||
61 | 0x18, | ||
62 | 0x78, | ||
63 | 0x18, | ||
64 | 0x18, | ||
65 | 0x18, | ||
66 | 0x18, | ||
67 | 0x18, | ||
68 | 0x18, | ||
69 | 0x18, | ||
70 | 0x7e, | ||
71 | 0x00, | ||
72 | 0x00, | ||
73 | 0x00, | ||
74 | 0x00, | ||
75 | |||
76 | /* Character 2 (0x32): | ||
77 | ht=16, width=8 | ||
78 | +--------+ | ||
79 | | | | ||
80 | | | | ||
81 | | ***** | | ||
82 | |** ** | | ||
83 | |** ** | | ||
84 | | ** | | ||
85 | | ** | | ||
86 | | ** | | ||
87 | | ** | | ||
88 | | ** | | ||
89 | |** ** | | ||
90 | |******* | | ||
91 | | | | ||
92 | | | | ||
93 | | | | ||
94 | | | | ||
95 | +--------+ */ | ||
96 | 0x00, | ||
97 | 0x00, | ||
98 | 0x7c, | ||
99 | 0xc6, | ||
100 | 0xc6, | ||
101 | 0x06, | ||
102 | 0x0c, | ||
103 | 0x18, | ||
104 | 0x30, | ||
105 | 0x60, | ||
106 | 0xc6, | ||
107 | 0xfe, | ||
108 | 0x00, | ||
109 | 0x00, | ||
110 | 0x00, | ||
111 | 0x00, | ||
112 | |||
113 | /* Character 3 (0x33): | ||
114 | ht=16, width=8 | ||
115 | +--------+ | ||
116 | | | | ||
117 | | | | ||
118 | | ***** | | ||
119 | |** ** | | ||
120 | | ** | | ||
121 | | ** | | ||
122 | | **** | | ||
123 | | ** | | ||
124 | | ** | | ||
125 | | ** | | ||
126 | |** ** | | ||
127 | | ***** | | ||
128 | | | | ||
129 | | | | ||
130 | | | | ||
131 | | | | ||
132 | +--------+ */ | ||
133 | 0x00, | ||
134 | 0x00, | ||
135 | 0x7c, | ||
136 | 0xc6, | ||
137 | 0x06, | ||
138 | 0x06, | ||
139 | 0x3c, | ||
140 | 0x06, | ||
141 | 0x06, | ||
142 | 0x06, | ||
143 | 0xc6, | ||
144 | 0x7c, | ||
145 | 0x00, | ||
146 | 0x00, | ||
147 | 0x00, | ||
148 | 0x00, | ||
149 | |||
150 | /* Character 4 (0x34): | ||
151 | ht=16, width=8 | ||
152 | +--------+ | ||
153 | | | | ||
154 | | | | ||
155 | | ** | | ||
156 | | *** | | ||
157 | | **** | | ||
158 | | ** ** | | ||
159 | |** ** | | ||
160 | |** ** | | ||
161 | |******* | | ||
162 | | ** | | ||
163 | | ** | | ||
164 | | **** | | ||
165 | | | | ||
166 | | | | ||
167 | | | | ||
168 | | | | ||
169 | +--------+ */ | ||
170 | 0x00, | ||
171 | 0x00, | ||
172 | 0x0c, | ||
173 | 0x1c, | ||
174 | 0x3c, | ||
175 | 0x6c, | ||
176 | 0xcc, | ||
177 | 0xcc, | ||
178 | 0xfe, | ||
179 | 0x0c, | ||
180 | 0x0c, | ||
181 | 0x1e, | ||
182 | 0x00, | ||
183 | 0x00, | ||
184 | 0x00, | ||
185 | 0x00, | ||
186 | |||
187 | /* Character 5 (0x35): | ||
188 | ht=16, width=8 | ||
189 | +--------+ | ||
190 | | | | ||
191 | | | | ||
192 | |******* | | ||
193 | |** | | ||
194 | |** | | ||
195 | |** | | ||
196 | |****** | | ||
197 | | ** | | ||
198 | | ** | | ||
199 | | ** | | ||
200 | |** ** | | ||
201 | | ***** | | ||
202 | | | | ||
203 | | | | ||
204 | | | | ||
205 | | | | ||
206 | +--------+ */ | ||
207 | 0x00, | ||
208 | 0x00, | ||
209 | 0xfe, | ||
210 | 0xc0, | ||
211 | 0xc0, | ||
212 | 0xc0, | ||
213 | 0xfc, | ||
214 | 0x06, | ||
215 | 0x06, | ||
216 | 0x06, | ||
217 | 0xc6, | ||
218 | 0x7c, | ||
219 | 0x00, | ||
220 | 0x00, | ||
221 | 0x00, | ||
222 | 0x00, | ||
223 | |||
224 | /* Character 6 (0x36): | ||
225 | ht=16, width=8 | ||
226 | +--------+ | ||
227 | | | | ||
228 | | | | ||
229 | | ***** | | ||
230 | |** ** | | ||
231 | |** | | ||
232 | |** | | ||
233 | |****** | | ||
234 | |** ** | | ||
235 | |** ** | | ||
236 | |** ** | | ||
237 | |** ** | | ||
238 | | ***** | | ||
239 | | | | ||
240 | | | | ||
241 | | | | ||
242 | | | | ||
243 | +--------+ */ | ||
244 | 0x00, | ||
245 | 0x00, | ||
246 | 0x7c, | ||
247 | 0xc6, | ||
248 | 0xc0, | ||
249 | 0xc0, | ||
250 | 0xfc, | ||
251 | 0xc6, | ||
252 | 0xc6, | ||
253 | 0xc6, | ||
254 | 0xc6, | ||
255 | 0x7c, | ||
256 | 0x00, | ||
257 | 0x00, | ||
258 | 0x00, | ||
259 | 0x00, | ||
260 | |||
261 | /* Character 7 (0x37): | ||
262 | ht=16, width=8 | ||
263 | +--------+ | ||
264 | | | | ||
265 | | | | ||
266 | |******* | | ||
267 | |** ** | | ||
268 | | ** | | ||
269 | | ** | | ||
270 | | ** | | ||
271 | | ** | | ||
272 | | ** | | ||
273 | | ** | | ||
274 | | ** | | ||
275 | | ** | | ||
276 | | | | ||
277 | | | | ||
278 | | | | ||
279 | | | | ||
280 | +--------+ */ | ||
281 | 0x00, | ||
282 | 0x00, | ||
283 | 0xfe, | ||
284 | 0xc6, | ||
285 | 0x06, | ||
286 | 0x0c, | ||
287 | 0x18, | ||
288 | 0x30, | ||
289 | 0x30, | ||
290 | 0x30, | ||
291 | 0x30, | ||
292 | 0x30, | ||
293 | 0x00, | ||
294 | 0x00, | ||
295 | 0x00, | ||
296 | 0x00, | ||
297 | |||
298 | /* Character 8 (0x38): | ||
299 | ht=16, width=8 | ||
300 | +--------+ | ||
301 | | | | ||
302 | | | | ||
303 | | ***** | | ||
304 | |** ** | | ||
305 | |** ** | | ||
306 | |** ** | | ||
307 | | ***** | | ||
308 | |** ** | | ||
309 | |** ** | | ||
310 | |** ** | | ||
311 | |** ** | | ||
312 | | ***** | | ||
313 | | | | ||
314 | | | | ||
315 | | | | ||
316 | | | | ||
317 | +--------+ */ | ||
318 | 0x00, | ||
319 | 0x00, | ||
320 | 0x7c, | ||
321 | 0xc6, | ||
322 | 0xc6, | ||
323 | 0xc6, | ||
324 | 0x7c, | ||
325 | 0xc6, | ||
326 | 0xc6, | ||
327 | 0xc6, | ||
328 | 0xc6, | ||
329 | 0x7c, | ||
330 | 0x00, | ||
331 | 0x00, | ||
332 | 0x00, | ||
333 | 0x00, | ||
334 | |||
335 | /* Character 9 (0x39): | ||
336 | ht=16, width=8 | ||
337 | +--------+ | ||
338 | | | | ||
339 | | | | ||
340 | | ***** | | ||
341 | |** ** | | ||
342 | |** ** | | ||
343 | |** ** | | ||
344 | |** ** | | ||
345 | | ****** | | ||
346 | | ** | | ||
347 | | ** | | ||
348 | |** ** | | ||
349 | | ***** | | ||
350 | | | | ||
351 | | | | ||
352 | | | | ||
353 | | | | ||
354 | +--------+ */ | ||
355 | 0x00, | ||
356 | 0x00, | ||
357 | 0x7c, | ||
358 | 0xc6, | ||
359 | 0xc6, | ||
360 | 0xc6, | ||
361 | 0xc6, | ||
362 | 0x7e, | ||
363 | 0x06, | ||
364 | 0x06, | ||
365 | 0xc6, | ||
366 | 0x7c, | ||
367 | 0x00, | ||
368 | 0x00, | ||
369 | 0x00, | ||
370 | 0x00, | ||
371 | /* Character : (0x3a): | ||
372 | ht=16, width=8 | ||
373 | +--------+ | ||
374 | | | | ||
375 | | | | ||
376 | | | | ||
377 | | | | ||
378 | | | | ||
379 | | ** | | ||
380 | | ** | | ||
381 | | | | ||
382 | | | | ||
383 | | ** | | ||
384 | | ** | | ||
385 | | | | ||
386 | | | | ||
387 | | | | ||
388 | | | | ||
389 | | | | ||
390 | +--------+ */ | ||
391 | 0x00, | ||
392 | 0x00, | ||
393 | 0x00, | ||
394 | 0x00, | ||
395 | 0x00, | ||
396 | 0x0c, | ||
397 | 0x0c, | ||
398 | 0x00, | ||
399 | 0x00, | ||
400 | 0x0c, | ||
401 | 0x0c, | ||
402 | 0x00, | ||
403 | 0x00, | ||
404 | 0x00, | ||
405 | 0x00, | ||
406 | 0x00, | ||
407 | }; | ||
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c index 11ea9765769c..c40e8ba9a2ea 100644 --- a/drivers/media/video/msp3400-driver.c +++ b/drivers/media/video/msp3400-driver.c | |||
@@ -53,10 +53,11 @@ | |||
53 | #include <linux/videodev.h> | 53 | #include <linux/videodev.h> |
54 | #include <linux/videodev2.h> | 54 | #include <linux/videodev2.h> |
55 | #include <media/v4l2-common.h> | 55 | #include <media/v4l2-common.h> |
56 | #include <media/audiochip.h> | 56 | #include <media/tvaudio.h> |
57 | #include <media/msp3400.h> | ||
57 | #include <linux/kthread.h> | 58 | #include <linux/kthread.h> |
58 | #include <linux/suspend.h> | 59 | #include <linux/suspend.h> |
59 | #include "msp3400.h" | 60 | #include "msp3400-driver.h" |
60 | 61 | ||
61 | /* ---------------------------------------------------------------------- */ | 62 | /* ---------------------------------------------------------------------- */ |
62 | 63 | ||
@@ -245,31 +246,31 @@ int msp_write_dsp(struct i2c_client *client, int addr, int val) | |||
245 | * ----------------------------------------------------------------------- */ | 246 | * ----------------------------------------------------------------------- */ |
246 | 247 | ||
247 | static int scarts[3][9] = { | 248 | static int scarts[3][9] = { |
248 | /* MASK IN1 IN2 IN1_DA IN2_DA IN3 IN4 MONO MUTE */ | 249 | /* MASK IN1 IN2 IN3 IN4 IN1_DA IN2_DA MONO MUTE */ |
249 | /* SCART DSP Input select */ | 250 | /* SCART DSP Input select */ |
250 | { 0x0320, 0x0000, 0x0200, -1, -1, 0x0300, 0x0020, 0x0100, 0x0320 }, | 251 | { 0x0320, 0x0000, 0x0200, 0x0300, 0x0020, -1, -1, 0x0100, 0x0320 }, |
251 | /* SCART1 Output select */ | 252 | /* SCART1 Output select */ |
252 | { 0x0c40, 0x0440, 0x0400, 0x0c00, 0x0040, 0x0000, 0x0840, 0x0800, 0x0c40 }, | 253 | { 0x0c40, 0x0440, 0x0400, 0x0000, 0x0840, 0x0c00, 0x0040, 0x0800, 0x0c40 }, |
253 | /* SCART2 Output select */ | 254 | /* SCART2 Output select */ |
254 | { 0x3080, 0x1000, 0x1080, 0x0000, 0x0080, 0x2080, 0x3080, 0x2000, 0x3000 }, | 255 | { 0x3080, 0x1000, 0x1080, 0x2080, 0x3080, 0x0000, 0x0080, 0x2000, 0x3000 }, |
255 | }; | 256 | }; |
256 | 257 | ||
257 | static char *scart_names[] = { | 258 | static char *scart_names[] = { |
258 | "mask", "in1", "in2", "in1 da", "in2 da", "in3", "in4", "mono", "mute" | 259 | "in1", "in2", "in3", "in4", "in1 da", "in2 da", "mono", "mute" |
259 | }; | 260 | }; |
260 | 261 | ||
261 | void msp_set_scart(struct i2c_client *client, int in, int out) | 262 | void msp_set_scart(struct i2c_client *client, int in, int out) |
262 | { | 263 | { |
263 | struct msp_state *state = i2c_get_clientdata(client); | 264 | struct msp_state *state = i2c_get_clientdata(client); |
264 | 265 | ||
265 | state->in_scart=in; | 266 | state->in_scart = in; |
266 | 267 | ||
267 | if (in >= 1 && in <= 8 && out >= 0 && out <= 2) { | 268 | if (in >= 0 && in <= 7 && out >= 0 && out <= 2) { |
268 | if (-1 == scarts[out][in]) | 269 | if (-1 == scarts[out][in + 1]) |
269 | return; | 270 | return; |
270 | 271 | ||
271 | state->acb &= ~scarts[out][SCART_MASK]; | 272 | state->acb &= ~scarts[out][0]; |
272 | state->acb |= scarts[out][in]; | 273 | state->acb |= scarts[out][in + 1]; |
273 | } else | 274 | } else |
274 | state->acb = 0xf60; /* Mute Input and SCART 1 Output */ | 275 | state->acb = 0xf60; /* Mute Input and SCART 1 Output */ |
275 | 276 | ||
@@ -336,37 +337,6 @@ void msp_set_audio(struct i2c_client *client) | |||
336 | msp_write_dsp(client, 0x0033, loudness); | 337 | msp_write_dsp(client, 0x0033, loudness); |
337 | } | 338 | } |
338 | 339 | ||
339 | int msp_modus(struct i2c_client *client) | ||
340 | { | ||
341 | struct msp_state *state = i2c_get_clientdata(client); | ||
342 | |||
343 | if (state->radio) { | ||
344 | v4l_dbg(1, msp_debug, client, "video mode selected to Radio\n"); | ||
345 | return 0x0003; | ||
346 | } | ||
347 | |||
348 | if (state->v4l2_std & V4L2_STD_PAL) { | ||
349 | v4l_dbg(1, msp_debug, client, "video mode selected to PAL\n"); | ||
350 | |||
351 | #if 1 | ||
352 | /* experimental: not sure this works with all chip versions */ | ||
353 | return 0x7003; | ||
354 | #else | ||
355 | /* previous value, try this if it breaks ... */ | ||
356 | return 0x1003; | ||
357 | #endif | ||
358 | } | ||
359 | if (state->v4l2_std & V4L2_STD_NTSC) { | ||
360 | v4l_dbg(1, msp_debug, client, "video mode selected to NTSC\n"); | ||
361 | return 0x2003; | ||
362 | } | ||
363 | if (state->v4l2_std & V4L2_STD_SECAM) { | ||
364 | v4l_dbg(1, msp_debug, client, "video mode selected to SECAM\n"); | ||
365 | return 0x0003; | ||
366 | } | ||
367 | return 0x0003; | ||
368 | } | ||
369 | |||
370 | /* ------------------------------------------------------------------------ */ | 340 | /* ------------------------------------------------------------------------ */ |
371 | 341 | ||
372 | 342 | ||
@@ -585,51 +555,11 @@ static int msp_set_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) | |||
585 | static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | 555 | static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) |
586 | { | 556 | { |
587 | struct msp_state *state = i2c_get_clientdata(client); | 557 | struct msp_state *state = i2c_get_clientdata(client); |
588 | u16 *sarg = arg; | ||
589 | int scart = 0; | ||
590 | 558 | ||
591 | if (msp_debug >= 2) | 559 | if (msp_debug >= 2) |
592 | v4l_i2c_print_ioctl(client, cmd); | 560 | v4l_i2c_print_ioctl(client, cmd); |
593 | 561 | ||
594 | switch (cmd) { | 562 | switch (cmd) { |
595 | case AUDC_SET_INPUT: | ||
596 | if (*sarg == state->input) | ||
597 | break; | ||
598 | state->input = *sarg; | ||
599 | switch (*sarg) { | ||
600 | case AUDIO_RADIO: | ||
601 | /* Hauppauge uses IN2 for the radio */ | ||
602 | state->mode = MSP_MODE_FM_RADIO; | ||
603 | scart = SCART_IN2; | ||
604 | break; | ||
605 | case AUDIO_EXTERN_1: | ||
606 | /* IN1 is often used for external input ... */ | ||
607 | state->mode = MSP_MODE_EXTERN; | ||
608 | scart = SCART_IN1; | ||
609 | break; | ||
610 | case AUDIO_EXTERN_2: | ||
611 | /* ... sometimes it is IN2 through ;) */ | ||
612 | state->mode = MSP_MODE_EXTERN; | ||
613 | scart = SCART_IN2; | ||
614 | break; | ||
615 | case AUDIO_TUNER: | ||
616 | state->mode = -1; | ||
617 | break; | ||
618 | default: | ||
619 | if (*sarg & AUDIO_MUTE) | ||
620 | msp_set_scart(client, SCART_MUTE, 0); | ||
621 | break; | ||
622 | } | ||
623 | if (scart) { | ||
624 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; | ||
625 | msp_set_scart(client, scart, 0); | ||
626 | msp_write_dsp(client, 0x000d, 0x1900); | ||
627 | if (state->opmode != OPMODE_AUTOSELECT) | ||
628 | msp_set_audmode(client); | ||
629 | } | ||
630 | msp_wake_thread(client); | ||
631 | break; | ||
632 | |||
633 | case AUDC_SET_RADIO: | 563 | case AUDC_SET_RADIO: |
634 | if (state->radio) | 564 | if (state->radio) |
635 | return 0; | 565 | return 0; |
@@ -692,6 +622,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
692 | 622 | ||
693 | if (va->mode != 0 && state->radio == 0) { | 623 | if (va->mode != 0 && state->radio == 0) { |
694 | state->audmode = msp_mode_v4l1_to_v4l2(va->mode); | 624 | state->audmode = msp_mode_v4l1_to_v4l2(va->mode); |
625 | msp_set_audmode(client); | ||
695 | } | 626 | } |
696 | break; | 627 | break; |
697 | } | 628 | } |
@@ -728,15 +659,6 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
728 | break; | 659 | break; |
729 | } | 660 | } |
730 | 661 | ||
731 | /* msp34xx specific */ | ||
732 | case MSP_SET_MATRIX: | ||
733 | { | ||
734 | struct msp_matrix *mspm = arg; | ||
735 | |||
736 | msp_set_scart(client, mspm->input, mspm->output); | ||
737 | break; | ||
738 | } | ||
739 | |||
740 | /* --- v4l2 ioctls --- */ | 662 | /* --- v4l2 ioctls --- */ |
741 | case VIDIOC_S_STD: | 663 | case VIDIOC_S_STD: |
742 | { | 664 | { |
@@ -750,90 +672,34 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
750 | return 0; | 672 | return 0; |
751 | } | 673 | } |
752 | 674 | ||
753 | case VIDIOC_ENUMINPUT: | 675 | case VIDIOC_INT_G_AUDIO_ROUTING: |
754 | { | ||
755 | struct v4l2_input *i = arg; | ||
756 | |||
757 | if (i->index != 0) | ||
758 | return -EINVAL; | ||
759 | |||
760 | i->type = V4L2_INPUT_TYPE_TUNER; | ||
761 | switch (i->index) { | ||
762 | case AUDIO_RADIO: | ||
763 | strcpy(i->name, "Radio"); | ||
764 | break; | ||
765 | case AUDIO_EXTERN_1: | ||
766 | strcpy(i->name, "Extern 1"); | ||
767 | break; | ||
768 | case AUDIO_EXTERN_2: | ||
769 | strcpy(i->name, "Extern 2"); | ||
770 | break; | ||
771 | case AUDIO_TUNER: | ||
772 | strcpy(i->name, "Television"); | ||
773 | break; | ||
774 | default: | ||
775 | return -EINVAL; | ||
776 | } | ||
777 | return 0; | ||
778 | } | ||
779 | |||
780 | case VIDIOC_G_AUDIO: | ||
781 | { | 676 | { |
782 | struct v4l2_audio *a = arg; | 677 | struct v4l2_routing *rt = arg; |
783 | 678 | ||
784 | memset(a, 0, sizeof(*a)); | 679 | *rt = state->routing; |
785 | |||
786 | switch (a->index) { | ||
787 | case AUDIO_RADIO: | ||
788 | strcpy(a->name, "Radio"); | ||
789 | break; | ||
790 | case AUDIO_EXTERN_1: | ||
791 | strcpy(a->name, "Extern 1"); | ||
792 | break; | ||
793 | case AUDIO_EXTERN_2: | ||
794 | strcpy(a->name, "Extern 2"); | ||
795 | break; | ||
796 | case AUDIO_TUNER: | ||
797 | strcpy(a->name, "Television"); | ||
798 | break; | ||
799 | default: | ||
800 | return -EINVAL; | ||
801 | } | ||
802 | |||
803 | a->capability = V4L2_AUDCAP_STEREO; | ||
804 | a->mode = 0; /* TODO: add support for AVL */ | ||
805 | break; | 680 | break; |
806 | } | 681 | } |
807 | 682 | ||
808 | case VIDIOC_S_AUDIO: | 683 | case VIDIOC_INT_S_AUDIO_ROUTING: |
809 | { | 684 | { |
810 | struct v4l2_audio *sarg = arg; | 685 | struct v4l2_routing *rt = arg; |
811 | 686 | int tuner = (rt->input >> 3) & 1; | |
812 | switch (sarg->index) { | 687 | int sc_in = rt->input & 0x7; |
813 | case AUDIO_RADIO: | 688 | int sc1_out = rt->output & 0xf; |
814 | /* Hauppauge uses IN2 for the radio */ | 689 | int sc2_out = (rt->output >> 4) & 0xf; |
815 | state->mode = MSP_MODE_FM_RADIO; | 690 | u16 val; |
816 | scart = SCART_IN2; | 691 | |
817 | break; | 692 | state->routing = *rt; |
818 | case AUDIO_EXTERN_1: | 693 | if (state->opmode == OPMODE_AUTOSELECT) { |
819 | /* IN1 is often used for external input ... */ | 694 | val = msp_read_dem(client, 0x30) & ~0x100; |
820 | state->mode = MSP_MODE_EXTERN; | 695 | msp_write_dem(client, 0x30, val | (tuner ? 0x100 : 0)); |
821 | scart = SCART_IN1; | 696 | } else { |
822 | break; | 697 | val = msp_read_dem(client, 0xbb) & ~0x100; |
823 | case AUDIO_EXTERN_2: | 698 | msp_write_dem(client, 0xbb, val | (tuner ? 0x100 : 0)); |
824 | /* ... sometimes it is IN2 through ;) */ | ||
825 | state->mode = MSP_MODE_EXTERN; | ||
826 | scart = SCART_IN2; | ||
827 | break; | ||
828 | case AUDIO_TUNER: | ||
829 | state->mode = -1; | ||
830 | break; | ||
831 | } | ||
832 | if (scart) { | ||
833 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; | ||
834 | msp_set_scart(client, scart, 0); | ||
835 | msp_write_dsp(client, 0x000d, 0x1900); | ||
836 | } | 699 | } |
700 | msp_set_scart(client, sc_in, 0); | ||
701 | msp_set_scart(client, sc1_out, 1); | ||
702 | msp_set_scart(client, sc2_out, 2); | ||
837 | msp_set_audmode(client); | 703 | msp_set_audmode(client); |
838 | msp_wake_thread(client); | 704 | msp_wake_thread(client); |
839 | break; | 705 | break; |
@@ -866,42 +732,6 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
866 | break; | 732 | break; |
867 | } | 733 | } |
868 | 734 | ||
869 | case VIDIOC_G_AUDOUT: | ||
870 | { | ||
871 | struct v4l2_audioout *a = (struct v4l2_audioout *)arg; | ||
872 | int idx = a->index; | ||
873 | |||
874 | memset(a, 0, sizeof(*a)); | ||
875 | |||
876 | switch (idx) { | ||
877 | case 0: | ||
878 | strcpy(a->name, "Scart1 Out"); | ||
879 | break; | ||
880 | case 1: | ||
881 | strcpy(a->name, "Scart2 Out"); | ||
882 | break; | ||
883 | case 2: | ||
884 | strcpy(a->name, "I2S Out"); | ||
885 | break; | ||
886 | default: | ||
887 | return -EINVAL; | ||
888 | } | ||
889 | break; | ||
890 | } | ||
891 | |||
892 | case VIDIOC_S_AUDOUT: | ||
893 | { | ||
894 | struct v4l2_audioout *a = (struct v4l2_audioout *)arg; | ||
895 | |||
896 | if (a->index < 0 || a->index > 2) | ||
897 | return -EINVAL; | ||
898 | |||
899 | v4l_dbg(1, msp_debug, client, "Setting audio out on msp34xx to input %i\n", a->index); | ||
900 | msp_set_scart(client, state->in_scart, a->index + 1); | ||
901 | |||
902 | break; | ||
903 | } | ||
904 | |||
905 | case VIDIOC_INT_I2S_CLOCK_FREQ: | 735 | case VIDIOC_INT_I2S_CLOCK_FREQ: |
906 | { | 736 | { |
907 | u32 *a = (u32 *)arg; | 737 | u32 *a = (u32 *)arg; |
@@ -979,12 +809,16 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
979 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", | 809 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", |
980 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); | 810 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); |
981 | } else { | 811 | } else { |
982 | v4l_info(client, "Mode: %s\n", p); | 812 | if (state->opmode == OPMODE_AUTODETECT) |
813 | v4l_info(client, "Mode: %s\n", p); | ||
983 | v4l_info(client, "Standard: %s (%s%s)\n", | 814 | v4l_info(client, "Standard: %s (%s%s)\n", |
984 | msp_standard_std_name(state->std), | 815 | msp_standard_std_name(state->std), |
985 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", | 816 | (state->rxsubchans & V4L2_TUNER_SUB_STEREO) ? "stereo" : "mono", |
986 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); | 817 | (state->rxsubchans & V4L2_TUNER_SUB_LANG2) ? ", dual" : ""); |
987 | } | 818 | } |
819 | v4l_info(client, "Audmode: 0x%04x\n", state->audmode); | ||
820 | v4l_info(client, "Routing: 0x%08x (input) 0x%08x (output)\n", | ||
821 | state->routing.input, state->routing.output); | ||
988 | v4l_info(client, "ACB: 0x%04x\n", state->acb); | 822 | v4l_info(client, "ACB: 0x%04x\n", state->acb); |
989 | break; | 823 | break; |
990 | } | 824 | } |
@@ -1063,6 +897,9 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind) | |||
1063 | state->muted = 0; | 897 | state->muted = 0; |
1064 | state->i2s_mode = 0; | 898 | state->i2s_mode = 0; |
1065 | init_waitqueue_head(&state->wq); | 899 | init_waitqueue_head(&state->wq); |
900 | /* These are the reset input/output positions */ | ||
901 | state->routing.input = MSP_INPUT_DEFAULT; | ||
902 | state->routing.output = MSP_OUTPUT_DEFAULT; | ||
1066 | 903 | ||
1067 | state->rev1 = msp_read_dsp(client, 0x1e); | 904 | state->rev1 = msp_read_dsp(client, 0x1e); |
1068 | if (state->rev1 != -1) | 905 | if (state->rev1 != -1) |
diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400-driver.h index 6fb5c8c994e7..1940748bb633 100644 --- a/drivers/media/video/msp3400.h +++ b/drivers/media/video/msp3400-driver.h | |||
@@ -1,8 +1,10 @@ | |||
1 | /* | 1 | /* |
2 | */ | 2 | */ |
3 | 3 | ||
4 | #ifndef MSP3400_H | 4 | #ifndef MSP3400_DRIVER_H |
5 | #define MSP3400_H | 5 | #define MSP3400_DRIVER_H |
6 | |||
7 | #include <media/msp3400.h> | ||
6 | 8 | ||
7 | /* ---------------------------------------------------------------------- */ | 9 | /* ---------------------------------------------------------------------- */ |
8 | 10 | ||
@@ -20,15 +22,14 @@ | |||
20 | #define MSP_MODE_BTSC 8 | 22 | #define MSP_MODE_BTSC 8 |
21 | #define MSP_MODE_EXTERN 9 | 23 | #define MSP_MODE_EXTERN 9 |
22 | 24 | ||
23 | #define SCART_MASK 0 | 25 | #define SCART_IN1 0 |
24 | #define SCART_IN1 1 | 26 | #define SCART_IN2 1 |
25 | #define SCART_IN2 2 | 27 | #define SCART_IN3 2 |
26 | #define SCART_IN1_DA 3 | 28 | #define SCART_IN4 3 |
27 | #define SCART_IN2_DA 4 | 29 | #define SCART_IN1_DA 4 |
28 | #define SCART_IN3 5 | 30 | #define SCART_IN2_DA 5 |
29 | #define SCART_IN4 6 | 31 | #define SCART_MONO 6 |
30 | #define SCART_MONO 7 | 32 | #define SCART_MUTE 7 |
31 | #define SCART_MUTE 8 | ||
32 | 33 | ||
33 | #define SCART_DSP_IN 0 | 34 | #define SCART_DSP_IN 0 |
34 | #define SCART1_OUT 1 | 35 | #define SCART1_OUT 1 |
@@ -73,7 +74,7 @@ struct msp_state { | |||
73 | int i2s_mode; | 74 | int i2s_mode; |
74 | int main, second; /* sound carrier */ | 75 | int main, second; /* sound carrier */ |
75 | int input; | 76 | int input; |
76 | int source; /* see msp34xxg_set_source */ | 77 | struct v4l2_routing routing; |
77 | 78 | ||
78 | /* v4l2 */ | 79 | /* v4l2 */ |
79 | int audmode; | 80 | int audmode; |
@@ -99,17 +100,16 @@ int msp_reset(struct i2c_client *client); | |||
99 | void msp_set_scart(struct i2c_client *client, int in, int out); | 100 | void msp_set_scart(struct i2c_client *client, int in, int out); |
100 | void msp_set_mute(struct i2c_client *client); | 101 | void msp_set_mute(struct i2c_client *client); |
101 | void msp_set_audio(struct i2c_client *client); | 102 | void msp_set_audio(struct i2c_client *client); |
102 | int msp_modus(struct i2c_client *client); | ||
103 | int msp_sleep(struct msp_state *state, int timeout); | 103 | int msp_sleep(struct msp_state *state, int timeout); |
104 | 104 | ||
105 | /* msp3400-kthreads.c */ | 105 | /* msp3400-kthreads.c */ |
106 | const char *msp_standard_std_name(int std); | 106 | const char *msp_standard_std_name(int std); |
107 | void msp_set_audmode(struct i2c_client *client); | 107 | void msp_set_audmode(struct i2c_client *client); |
108 | void msp_detect_stereo(struct i2c_client *client); | 108 | int msp_detect_stereo(struct i2c_client *client); |
109 | int msp3400c_thread(void *data); | 109 | int msp3400c_thread(void *data); |
110 | int msp3410d_thread(void *data); | 110 | int msp3410d_thread(void *data); |
111 | int msp34xxg_thread(void *data); | 111 | int msp34xxg_thread(void *data); |
112 | void msp3400c_set_mode(struct i2c_client *client, int mode); | 112 | void msp3400c_set_mode(struct i2c_client *client, int mode); |
113 | void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2); | 113 | void msp3400c_set_carrier(struct i2c_client *client, int cdo1, int cdo2); |
114 | 114 | ||
115 | #endif /* MSP3400_H */ | 115 | #endif /* MSP3400_DRIVER_H */ |
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c index 852ab6a115fa..c3984ea9ca07 100644 --- a/drivers/media/video/msp3400-kthreads.c +++ b/drivers/media/video/msp3400-kthreads.c | |||
@@ -26,10 +26,10 @@ | |||
26 | #include <linux/videodev.h> | 26 | #include <linux/videodev.h> |
27 | #include <linux/videodev2.h> | 27 | #include <linux/videodev2.h> |
28 | #include <media/v4l2-common.h> | 28 | #include <media/v4l2-common.h> |
29 | #include <media/audiochip.h> | 29 | #include <media/msp3400.h> |
30 | #include <linux/kthread.h> | 30 | #include <linux/kthread.h> |
31 | #include <linux/suspend.h> | 31 | #include <linux/suspend.h> |
32 | #include "msp3400.h" | 32 | #include "msp3400-driver.h" |
33 | 33 | ||
34 | /* this one uses the automatic sound standard detection of newer msp34xx | 34 | /* this one uses the automatic sound standard detection of newer msp34xx |
35 | chip versions */ | 35 | chip versions */ |
@@ -45,11 +45,13 @@ static struct { | |||
45 | { 0x0004, MSP_CARRIER(6.5), MSP_CARRIER(6.2578125), "6.5/6.25 D/K1 Dual FM-Stereo" }, | 45 | { 0x0004, MSP_CARRIER(6.5), MSP_CARRIER(6.2578125), "6.5/6.25 D/K1 Dual FM-Stereo" }, |
46 | { 0x0005, MSP_CARRIER(6.5), MSP_CARRIER(6.7421875), "6.5/6.74 D/K2 Dual FM-Stereo" }, | 46 | { 0x0005, MSP_CARRIER(6.5), MSP_CARRIER(6.7421875), "6.5/6.74 D/K2 Dual FM-Stereo" }, |
47 | { 0x0006, MSP_CARRIER(6.5), MSP_CARRIER(6.5), "6.5 D/K FM-Mono (HDEV3)" }, | 47 | { 0x0006, MSP_CARRIER(6.5), MSP_CARRIER(6.5), "6.5 D/K FM-Mono (HDEV3)" }, |
48 | { 0x0007, MSP_CARRIER(6.5), MSP_CARRIER(5.7421875), "6.5/5.74 D/K3 Dual FM-Stereo" }, | ||
48 | { 0x0008, MSP_CARRIER(5.5), MSP_CARRIER(5.85), "5.5/5.85 B/G NICAM FM" }, | 49 | { 0x0008, MSP_CARRIER(5.5), MSP_CARRIER(5.85), "5.5/5.85 B/G NICAM FM" }, |
49 | { 0x0009, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 L NICAM AM" }, | 50 | { 0x0009, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 L NICAM AM" }, |
50 | { 0x000a, MSP_CARRIER(6.0), MSP_CARRIER(6.55), "6.0/6.55 I NICAM FM" }, | 51 | { 0x000a, MSP_CARRIER(6.0), MSP_CARRIER(6.55), "6.0/6.55 I NICAM FM" }, |
51 | { 0x000b, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM" }, | 52 | { 0x000b, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM" }, |
52 | { 0x000c, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM (HDEV2)" }, | 53 | { 0x000c, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM (HDEV2)" }, |
54 | { 0x000d, MSP_CARRIER(6.5), MSP_CARRIER(5.85), "6.5/5.85 D/K NICAM FM (HDEV3)" }, | ||
53 | { 0x0020, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M BTSC-Stereo" }, | 55 | { 0x0020, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M BTSC-Stereo" }, |
54 | { 0x0021, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M BTSC-Mono + SAP" }, | 56 | { 0x0021, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M BTSC-Mono + SAP" }, |
55 | { 0x0030, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M EIA-J Japan Stereo" }, | 57 | { 0x0030, MSP_CARRIER(4.5), MSP_CARRIER(4.5), "4.5 M EIA-J Japan Stereo" }, |
@@ -185,13 +187,14 @@ void msp3400c_set_mode(struct i2c_client *client, int mode) | |||
185 | { | 187 | { |
186 | struct msp_state *state = i2c_get_clientdata(client); | 188 | struct msp_state *state = i2c_get_clientdata(client); |
187 | struct msp3400c_init_data_dem *data = &msp3400c_init_data[mode]; | 189 | struct msp3400c_init_data_dem *data = &msp3400c_init_data[mode]; |
190 | int tuner = (state->routing.input >> 3) & 1; | ||
188 | int i; | 191 | int i; |
189 | 192 | ||
190 | v4l_dbg(1, msp_debug, client, "set_mode: %d\n", mode); | 193 | v4l_dbg(1, msp_debug, client, "set_mode: %d\n", mode); |
191 | state->mode = mode; | 194 | state->mode = mode; |
192 | state->rxsubchans = V4L2_TUNER_SUB_MONO; | 195 | state->rxsubchans = V4L2_TUNER_SUB_MONO; |
193 | 196 | ||
194 | msp_write_dem(client, 0x00bb, data->ad_cv); | 197 | msp_write_dem(client, 0x00bb, data->ad_cv | (tuner ? 0x100 : 0)); |
195 | 198 | ||
196 | for (i = 5; i >= 0; i--) /* fir 1 */ | 199 | for (i = 5; i >= 0; i--) /* fir 1 */ |
197 | msp_write_dem(client, 0x0001, data->fir1[i]); | 200 | msp_write_dem(client, 0x0001, data->fir1[i]); |
@@ -207,21 +210,22 @@ void msp3400c_set_mode(struct i2c_client *client, int mode) | |||
207 | msp3400c_set_carrier(client, data->cdo1, data->cdo2); | 210 | msp3400c_set_carrier(client, data->cdo1, data->cdo2); |
208 | 211 | ||
209 | msp_set_source(client, data->dsp_src); | 212 | msp_set_source(client, data->dsp_src); |
210 | msp_write_dsp(client, 0x000e, data->dsp_matrix); | 213 | /* set prescales */ |
211 | 214 | ||
212 | if (state->has_nicam) { | 215 | /* volume prescale for SCART (AM mono input) */ |
213 | /* nicam prescale */ | 216 | msp_write_dsp(client, 0x000d, 0x1900); |
214 | msp_write_dsp(client, 0x0010, 0x5a00); /* was: 0x3000 */ | 217 | msp_write_dsp(client, 0x000e, data->dsp_matrix); |
215 | } | 218 | if (state->has_nicam) /* nicam prescale */ |
219 | msp_write_dsp(client, 0x0010, 0x5a00); | ||
216 | } | 220 | } |
217 | 221 | ||
218 | /* Set audio mode. Note that the pre-'G' models do not support BTSC+SAP, | 222 | /* Set audio mode. Note that the pre-'G' models do not support BTSC+SAP, |
219 | nor do they support stereo BTSC. */ | 223 | nor do they support stereo BTSC. */ |
220 | static void msp3400c_set_audmode(struct i2c_client *client) | 224 | static void msp3400c_set_audmode(struct i2c_client *client) |
221 | { | 225 | { |
222 | static char *strmode[] = { "mono", "stereo", "lang2", "lang1" }; | 226 | static char *strmode[] = { "mono", "stereo", "lang2", "lang1", "lang1+lang2" }; |
223 | struct msp_state *state = i2c_get_clientdata(client); | 227 | struct msp_state *state = i2c_get_clientdata(client); |
224 | char *modestr = (state->audmode >= 0 && state->audmode < 4) ? | 228 | char *modestr = (state->audmode >= 0 && state->audmode < 5) ? |
225 | strmode[state->audmode] : "unknown"; | 229 | strmode[state->audmode] : "unknown"; |
226 | int src = 0; /* channel source: FM/AM, nicam or SCART */ | 230 | int src = 0; /* channel source: FM/AM, nicam or SCART */ |
227 | 231 | ||
@@ -246,6 +250,7 @@ static void msp3400c_set_audmode(struct i2c_client *client) | |||
246 | case V4L2_TUNER_MODE_MONO: | 250 | case V4L2_TUNER_MODE_MONO: |
247 | case V4L2_TUNER_MODE_LANG1: | 251 | case V4L2_TUNER_MODE_LANG1: |
248 | case V4L2_TUNER_MODE_LANG2: | 252 | case V4L2_TUNER_MODE_LANG2: |
253 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
249 | msp_write_dsp(client, 0x000e, 0x3000); | 254 | msp_write_dsp(client, 0x000e, 0x3000); |
250 | break; | 255 | break; |
251 | } | 256 | } |
@@ -257,6 +262,7 @@ static void msp3400c_set_audmode(struct i2c_client *client) | |||
257 | msp3400c_set_carrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); | 262 | msp3400c_set_carrier(client, MSP_CARRIER(6.5), MSP_CARRIER(6.5)); |
258 | break; | 263 | break; |
259 | case V4L2_TUNER_MODE_STEREO: | 264 | case V4L2_TUNER_MODE_STEREO: |
265 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
260 | msp3400c_set_carrier(client, MSP_CARRIER(7.2), MSP_CARRIER(7.02)); | 266 | msp3400c_set_carrier(client, MSP_CARRIER(7.2), MSP_CARRIER(7.02)); |
261 | break; | 267 | break; |
262 | case V4L2_TUNER_MODE_LANG1: | 268 | case V4L2_TUNER_MODE_LANG1: |
@@ -271,7 +277,6 @@ static void msp3400c_set_audmode(struct i2c_client *client) | |||
271 | case MSP_MODE_FM_NICAM2: | 277 | case MSP_MODE_FM_NICAM2: |
272 | case MSP_MODE_AM_NICAM: | 278 | case MSP_MODE_AM_NICAM: |
273 | v4l_dbg(1, msp_debug, client, "NICAM set_audmode: %s\n",modestr); | 279 | v4l_dbg(1, msp_debug, client, "NICAM set_audmode: %s\n",modestr); |
274 | msp3400c_set_carrier(client, state->second, state->main); | ||
275 | if (state->nicam_on) | 280 | if (state->nicam_on) |
276 | src = 0x0100; /* NICAM */ | 281 | src = 0x0100; /* NICAM */ |
277 | break; | 282 | break; |
@@ -293,6 +298,7 @@ static void msp3400c_set_audmode(struct i2c_client *client) | |||
293 | /* switch audio */ | 298 | /* switch audio */ |
294 | switch (state->audmode) { | 299 | switch (state->audmode) { |
295 | case V4L2_TUNER_MODE_STEREO: | 300 | case V4L2_TUNER_MODE_STEREO: |
301 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
296 | src |= 0x0020; | 302 | src |= 0x0020; |
297 | break; | 303 | break; |
298 | case V4L2_TUNER_MODE_MONO: | 304 | case V4L2_TUNER_MODE_MONO: |
@@ -427,8 +433,8 @@ static void watch_stereo(struct i2c_client *client) | |||
427 | { | 433 | { |
428 | struct msp_state *state = i2c_get_clientdata(client); | 434 | struct msp_state *state = i2c_get_clientdata(client); |
429 | 435 | ||
430 | if (msp3400c_detect_stereo(client)) { | 436 | if (msp_detect_stereo(client)) { |
431 | msp3400c_set_audmode(client); | 437 | msp_set_audmode(client); |
432 | } | 438 | } |
433 | 439 | ||
434 | if (msp_once) | 440 | if (msp_once) |
@@ -464,7 +470,7 @@ int msp3400c_thread(void *data) | |||
464 | 470 | ||
465 | /* mute */ | 471 | /* mute */ |
466 | msp_set_mute(client); | 472 | msp_set_mute(client); |
467 | msp3400c_set_mode(client, MSP_MODE_AM_DETECT /* +1 */ ); | 473 | msp3400c_set_mode(client, MSP_MODE_AM_DETECT); |
468 | val1 = val2 = 0; | 474 | val1 = val2 = 0; |
469 | max1 = max2 = -1; | 475 | max1 = max2 = -1; |
470 | state->watch_stereo = 0; | 476 | state->watch_stereo = 0; |
@@ -572,8 +578,6 @@ int msp3400c_thread(void *data) | |||
572 | state->second = msp3400c_carrier_detect_65[max2].cdo; | 578 | state->second = msp3400c_carrier_detect_65[max2].cdo; |
573 | msp3400c_set_mode(client, MSP_MODE_AM_NICAM); | 579 | msp3400c_set_mode(client, MSP_MODE_AM_NICAM); |
574 | msp3400c_set_carrier(client, state->second, state->main); | 580 | msp3400c_set_carrier(client, state->second, state->main); |
575 | /* volume prescale for SCART (AM mono input) */ | ||
576 | msp_write_dsp(client, 0x000d, 0x1900); | ||
577 | state->watch_stereo = 1; | 581 | state->watch_stereo = 1; |
578 | } else if (max2 == 0 && state->has_nicam) { | 582 | } else if (max2 == 0 && state->has_nicam) { |
579 | /* D/K NICAM */ | 583 | /* D/K NICAM */ |
@@ -651,7 +655,8 @@ int msp3410d_thread(void *data) | |||
651 | if (msp_sleep(state,200)) | 655 | if (msp_sleep(state,200)) |
652 | goto restart; | 656 | goto restart; |
653 | 657 | ||
654 | /* start autodetect */ | 658 | /* start autodetect. Note: autodetect is not supported for |
659 | NTSC-M and radio, hence we force the standard in those cases. */ | ||
655 | if (state->radio) | 660 | if (state->radio) |
656 | std = 0x40; | 661 | std = 0x40; |
657 | else | 662 | else |
@@ -695,23 +700,19 @@ int msp3410d_thread(void *data) | |||
695 | v4l_dbg(1, msp_debug, client, "autodetection failed," | 700 | v4l_dbg(1, msp_debug, client, "autodetection failed," |
696 | " switching to backup standard: %s (0x%04x)\n", | 701 | " switching to backup standard: %s (0x%04x)\n", |
697 | msp_stdlist[8].name ? msp_stdlist[8].name : "unknown",val); | 702 | msp_stdlist[8].name ? msp_stdlist[8].name : "unknown",val); |
698 | val = 0x0009; | 703 | state->std = val = 0x0009; |
699 | msp_write_dem(client, 0x20, val); | 704 | msp_write_dem(client, 0x20, val); |
700 | } | 705 | } |
701 | 706 | ||
702 | /* set various prescales */ | ||
703 | msp_write_dsp(client, 0x0d, 0x1900); /* scart */ | ||
704 | msp_write_dsp(client, 0x0e, 0x2403); /* FM */ | ||
705 | msp_write_dsp(client, 0x10, 0x5a00); /* nicam */ | ||
706 | |||
707 | /* set stereo */ | 707 | /* set stereo */ |
708 | switch (val) { | 708 | switch (val) { |
709 | case 0x0008: /* B/G NICAM */ | 709 | case 0x0008: /* B/G NICAM */ |
710 | case 0x000a: /* I NICAM */ | 710 | case 0x000a: /* I NICAM */ |
711 | if (val == 0x0008) | 711 | case 0x000b: /* D/K NICAM */ |
712 | state->mode = MSP_MODE_FM_NICAM1; | 712 | if (val == 0x000a) |
713 | else | ||
714 | state->mode = MSP_MODE_FM_NICAM2; | 713 | state->mode = MSP_MODE_FM_NICAM2; |
714 | else | ||
715 | state->mode = MSP_MODE_FM_NICAM1; | ||
715 | /* just turn on stereo */ | 716 | /* just turn on stereo */ |
716 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; | 717 | state->rxsubchans = V4L2_TUNER_SUB_STEREO; |
717 | state->nicam_on = 1; | 718 | state->nicam_on = 1; |
@@ -739,6 +740,7 @@ int msp3410d_thread(void *data) | |||
739 | /* scart routing (this doesn't belong here I think) */ | 740 | /* scart routing (this doesn't belong here I think) */ |
740 | msp_set_scart(client,SCART_IN2,0); | 741 | msp_set_scart(client,SCART_IN2,0); |
741 | break; | 742 | break; |
743 | case 0x0002: | ||
742 | case 0x0003: | 744 | case 0x0003: |
743 | case 0x0004: | 745 | case 0x0004: |
744 | case 0x0005: | 746 | case 0x0005: |
@@ -748,12 +750,19 @@ int msp3410d_thread(void *data) | |||
748 | break; | 750 | break; |
749 | } | 751 | } |
750 | 752 | ||
751 | /* unmute, restore misc registers */ | 753 | /* set various prescales */ |
752 | msp_set_audio(client); | 754 | msp_write_dsp(client, 0x0d, 0x1900); /* scart */ |
753 | msp_write_dsp(client, 0x13, state->acb); | 755 | msp_write_dsp(client, 0x0e, 0x3000); /* FM */ |
756 | if (state->has_nicam) | ||
757 | msp_write_dsp(client, 0x10, 0x5a00); /* nicam */ | ||
758 | |||
754 | if (state->has_i2s_conf) | 759 | if (state->has_i2s_conf) |
755 | msp_write_dem(client, 0x40, state->i2s_mode); | 760 | msp_write_dem(client, 0x40, state->i2s_mode); |
756 | 761 | ||
762 | /* unmute, restore misc registers */ | ||
763 | msp_set_audio(client); | ||
764 | |||
765 | msp_write_dsp(client, 0x13, state->acb); | ||
757 | msp3400c_set_audmode(client); | 766 | msp3400c_set_audmode(client); |
758 | 767 | ||
759 | /* monitor tv audio mode, the first time don't wait | 768 | /* monitor tv audio mode, the first time don't wait |
@@ -772,97 +781,154 @@ int msp3410d_thread(void *data) | |||
772 | 781 | ||
773 | /* ----------------------------------------------------------------------- */ | 782 | /* ----------------------------------------------------------------------- */ |
774 | 783 | ||
775 | /* msp34xxG + (autoselect no-thread) */ | 784 | /* msp34xxG + (autoselect no-thread) |
776 | /* this one uses both automatic standard detection and automatic sound */ | 785 | * this one uses both automatic standard detection and automatic sound |
777 | /* select which are available in the newer G versions */ | 786 | * select which are available in the newer G versions |
778 | /* struct msp: only norm, acb and source are really used in this mode */ | 787 | * struct msp: only norm, acb and source are really used in this mode |
779 | |||
780 | /* set the same 'source' for the loudspeaker, scart and quasi-peak detector | ||
781 | * the value for source is the same as bit 15:8 of DSP registers 0x08, | ||
782 | * 0x0a and 0x0c: 0=mono, 1=stereo or A|B, 2=SCART, 3=stereo or A, 4=stereo or B | ||
783 | * | ||
784 | * this function replaces msp3400c_set_audmode | ||
785 | */ | 788 | */ |
786 | static void msp34xxg_set_source(struct i2c_client *client, int source) | 789 | |
790 | static int msp34xxg_modus(struct i2c_client *client) | ||
787 | { | 791 | { |
788 | struct msp_state *state = i2c_get_clientdata(client); | 792 | struct msp_state *state = i2c_get_clientdata(client); |
789 | 793 | ||
790 | /* fix matrix mode to stereo and let the msp choose what | 794 | if (state->radio) { |
791 | * to output according to 'source', as recommended | 795 | v4l_dbg(1, msp_debug, client, "selected radio modus\n"); |
792 | * for MONO (source==0) downmixing set bit[7:0] to 0x30 | 796 | return 0x0001; |
793 | */ | 797 | } |
794 | int value = (source & 0x07) << 8 | (source == 0 ? 0x30 : 0x20); | ||
795 | 798 | ||
796 | v4l_dbg(1, msp_debug, client, "set source to %d (0x%x)\n", source, value); | 799 | if (state->v4l2_std & V4L2_STD_PAL) { |
797 | msp_set_source(client, value); | 800 | v4l_dbg(1, msp_debug, client, "selected PAL modus\n"); |
798 | /* | 801 | return 0x7001; |
799 | * set identification threshold. Personally, I | 802 | } |
800 | * I set it to a higher value that the default | 803 | if (state->v4l2_std == V4L2_STD_NTSC_M_JP) { |
801 | * of 0x190 to ignore noisy stereo signals. | 804 | v4l_dbg(1, msp_debug, client, "selected M (EIA-J) modus\n"); |
802 | * this needs tuning. (recommended range 0x00a0-0x03c0) | 805 | return 0x4001; |
803 | * 0x7f0 = forced mono mode | 806 | } |
804 | */ | 807 | if (state->v4l2_std == V4L2_STD_NTSC_M_KR) { |
805 | /* a2 threshold for stereo/bilingual */ | 808 | v4l_dbg(1, msp_debug, client, "selected M (A2) modus\n"); |
806 | msp_write_dem(client, 0x22, msp_stereo_thresh); | 809 | return 0x0001; |
807 | state->source = source; | 810 | } |
811 | if (state->v4l2_std & V4L2_STD_MN) { | ||
812 | v4l_dbg(1, msp_debug, client, "selected M (BTSC) modus\n"); | ||
813 | return 0x2001; | ||
814 | } | ||
815 | if (state->v4l2_std & V4L2_STD_SECAM) { | ||
816 | v4l_dbg(1, msp_debug, client, "selected SECAM modus\n"); | ||
817 | return 0x6001; | ||
818 | } | ||
819 | return 0x0001; | ||
808 | } | 820 | } |
809 | 821 | ||
810 | /* (re-)initialize the msp34xxg, according to the current norm in state->norm | 822 | static void msp34xxg_set_source(struct i2c_client *client, u16 reg, int in) |
811 | * return 0 if it worked, -1 if it failed | 823 | { |
812 | */ | 824 | struct msp_state *state = i2c_get_clientdata(client); |
813 | static int msp34xxg_reset(struct i2c_client *client) | 825 | int source, matrix; |
826 | |||
827 | switch (state->audmode) { | ||
828 | case V4L2_TUNER_MODE_MONO: | ||
829 | source = 0; /* mono only */ | ||
830 | matrix = 0x30; | ||
831 | break; | ||
832 | case V4L2_TUNER_MODE_LANG1: | ||
833 | source = 3; /* stereo or A */ | ||
834 | matrix = 0x00; | ||
835 | break; | ||
836 | case V4L2_TUNER_MODE_LANG2: | ||
837 | source = 4; /* stereo or B */ | ||
838 | matrix = 0x10; | ||
839 | break; | ||
840 | case V4L2_TUNER_MODE_STEREO: | ||
841 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
842 | default: | ||
843 | source = 1; /* stereo or A|B */ | ||
844 | matrix = 0x20; | ||
845 | break; | ||
846 | } | ||
847 | |||
848 | if (in == MSP_DSP_OUT_TUNER) | ||
849 | source = (source << 8) | 0x20; | ||
850 | /* the msp34x2g puts the MAIN_AVC, MAIN and AUX sources in 12, 13, 14 | ||
851 | instead of 11, 12, 13. So we add one for that msp version. */ | ||
852 | else if (in >= MSP_DSP_OUT_MAIN_AVC && state->has_dolby_pro_logic) | ||
853 | source = ((in + 1) << 8) | matrix; | ||
854 | else | ||
855 | source = (in << 8) | matrix; | ||
856 | |||
857 | v4l_dbg(1, msp_debug, client, "set source to %d (0x%x) for output %02x\n", | ||
858 | in, source, reg); | ||
859 | msp_write_dsp(client, reg, source); | ||
860 | } | ||
861 | |||
862 | static void msp34xxg_set_sources(struct i2c_client *client) | ||
863 | { | ||
864 | struct msp_state *state = i2c_get_clientdata(client); | ||
865 | u32 in = state->routing.input; | ||
866 | |||
867 | msp34xxg_set_source(client, 0x0008, (in >> 4) & 0xf); | ||
868 | /* quasi-peak detector is set to same input as the loudspeaker (MAIN) */ | ||
869 | msp34xxg_set_source(client, 0x000c, (in >> 4) & 0xf); | ||
870 | msp34xxg_set_source(client, 0x0009, (in >> 8) & 0xf); | ||
871 | msp34xxg_set_source(client, 0x000a, (in >> 12) & 0xf); | ||
872 | if (state->has_scart23_in_scart2_out) | ||
873 | msp34xxg_set_source(client, 0x0041, (in >> 16) & 0xf); | ||
874 | msp34xxg_set_source(client, 0x000b, (in >> 20) & 0xf); | ||
875 | } | ||
876 | |||
877 | /* (re-)initialize the msp34xxg */ | ||
878 | static void msp34xxg_reset(struct i2c_client *client) | ||
814 | { | 879 | { |
815 | struct msp_state *state = i2c_get_clientdata(client); | 880 | struct msp_state *state = i2c_get_clientdata(client); |
816 | int modus, std; | 881 | int tuner = (state->routing.input >> 3) & 1; |
882 | int modus; | ||
883 | |||
884 | /* initialize std to 1 (autodetect) to signal that no standard is | ||
885 | selected yet. */ | ||
886 | state->std = 1; | ||
817 | 887 | ||
818 | if (msp_reset(client)) | 888 | msp_reset(client); |
819 | return -1; | ||
820 | 889 | ||
821 | /* make sure that input/output is muted (paranoid mode) */ | 890 | /* make sure that input/output is muted (paranoid mode) */ |
822 | /* ACB, mute DSP input, mute SCART 1 */ | 891 | /* ACB, mute DSP input, mute SCART 1 */ |
823 | if (msp_write_dsp(client, 0x13, 0x0f20)) | 892 | msp_write_dsp(client, 0x13, 0x0f20); |
824 | return -1; | ||
825 | 893 | ||
826 | if (state->has_i2s_conf) | 894 | if (state->has_i2s_conf) |
827 | msp_write_dem(client, 0x40, state->i2s_mode); | 895 | msp_write_dem(client, 0x40, state->i2s_mode); |
828 | 896 | ||
829 | /* step-by-step initialisation, as described in the manual */ | 897 | /* step-by-step initialisation, as described in the manual */ |
830 | modus = msp_modus(client); | 898 | modus = msp34xxg_modus(client); |
831 | if (state->radio) | 899 | modus |= tuner ? 0x100 : 0; |
832 | std = 0x40; | 900 | msp_write_dem(client, 0x30, modus); |
833 | else | ||
834 | std = (state->v4l2_std & V4L2_STD_NTSC) ? 0x20 : 1; | ||
835 | modus &= ~0x03; /* STATUS_CHANGE = 0 */ | ||
836 | modus |= 0x01; /* AUTOMATIC_SOUND_DETECTION = 1 */ | ||
837 | if (msp_write_dem(client, 0x30, modus)) | ||
838 | return -1; | ||
839 | if (msp_write_dem(client, 0x20, std)) | ||
840 | return -1; | ||
841 | 901 | ||
842 | /* write the dsps that may have an influence on | 902 | /* write the dsps that may have an influence on |
843 | standard/audio autodetection right now */ | 903 | standard/audio autodetection right now */ |
844 | msp34xxg_set_source(client, state->source); | 904 | msp34xxg_set_sources(client); |
845 | |||
846 | /* AM/FM Prescale [15:8] 75khz deviation */ | ||
847 | if (msp_write_dsp(client, 0x0e, 0x3000)) | ||
848 | return -1; | ||
849 | 905 | ||
850 | /* NICAM Prescale 9db gain (as recommended) */ | 906 | msp_write_dsp(client, 0x0d, 0x1900); /* scart */ |
851 | if (msp_write_dsp(client, 0x10, 0x5a00)) | 907 | msp_write_dsp(client, 0x0e, 0x3000); /* FM */ |
852 | return -1; | 908 | if (state->has_nicam) |
909 | msp_write_dsp(client, 0x10, 0x5a00); /* nicam */ | ||
853 | 910 | ||
854 | return 0; | 911 | /* set identification threshold. Personally, I |
912 | * I set it to a higher value than the default | ||
913 | * of 0x190 to ignore noisy stereo signals. | ||
914 | * this needs tuning. (recommended range 0x00a0-0x03c0) | ||
915 | * 0x7f0 = forced mono mode | ||
916 | * | ||
917 | * a2 threshold for stereo/bilingual. | ||
918 | * Note: this register is part of the Manual/Compatibility mode. | ||
919 | * It is supported by all 'G'-family chips. | ||
920 | */ | ||
921 | msp_write_dem(client, 0x22, msp_stereo_thresh); | ||
855 | } | 922 | } |
856 | 923 | ||
857 | int msp34xxg_thread(void *data) | 924 | int msp34xxg_thread(void *data) |
858 | { | 925 | { |
859 | struct i2c_client *client = data; | 926 | struct i2c_client *client = data; |
860 | struct msp_state *state = i2c_get_clientdata(client); | 927 | struct msp_state *state = i2c_get_clientdata(client); |
861 | int val, std, i; | 928 | int val, i; |
862 | 929 | ||
863 | v4l_dbg(1, msp_debug, client, "msp34xxg daemon started\n"); | 930 | v4l_dbg(1, msp_debug, client, "msp34xxg daemon started\n"); |
864 | 931 | ||
865 | state->source = 1; /* default */ | ||
866 | for (;;) { | 932 | for (;;) { |
867 | v4l_dbg(2, msp_debug, client, "msp34xxg thread: sleep\n"); | 933 | v4l_dbg(2, msp_debug, client, "msp34xxg thread: sleep\n"); |
868 | msp_sleep(state, -1); | 934 | msp_sleep(state, -1); |
@@ -876,12 +942,14 @@ int msp34xxg_thread(void *data) | |||
876 | 942 | ||
877 | /* setup the chip*/ | 943 | /* setup the chip*/ |
878 | msp34xxg_reset(client); | 944 | msp34xxg_reset(client); |
879 | std = msp_standard; | 945 | state->std = state->radio ? 0x40 : msp_standard; |
880 | if (std != 0x01) | 946 | if (state->std != 1) |
881 | goto unmute; | 947 | goto unmute; |
948 | /* start autodetect */ | ||
949 | msp_write_dem(client, 0x20, state->std); | ||
882 | 950 | ||
883 | /* watch autodetect */ | 951 | /* watch autodetect */ |
884 | v4l_dbg(1, msp_debug, client, "triggered autodetect, waiting for result\n"); | 952 | v4l_dbg(1, msp_debug, client, "started autodetect, waiting for result\n"); |
885 | for (i = 0; i < 10; i++) { | 953 | for (i = 0; i < 10; i++) { |
886 | if (msp_sleep(state, 100)) | 954 | if (msp_sleep(state, 100)) |
887 | goto restart; | 955 | goto restart; |
@@ -889,20 +957,19 @@ int msp34xxg_thread(void *data) | |||
889 | /* check results */ | 957 | /* check results */ |
890 | val = msp_read_dem(client, 0x7e); | 958 | val = msp_read_dem(client, 0x7e); |
891 | if (val < 0x07ff) { | 959 | if (val < 0x07ff) { |
892 | std = val; | 960 | state->std = val; |
893 | break; | 961 | break; |
894 | } | 962 | } |
895 | v4l_dbg(2, msp_debug, client, "detection still in progress\n"); | 963 | v4l_dbg(2, msp_debug, client, "detection still in progress\n"); |
896 | } | 964 | } |
897 | if (std == 1) { | 965 | if (state->std == 1) { |
898 | v4l_dbg(1, msp_debug, client, "detection still in progress after 10 tries. giving up.\n"); | 966 | v4l_dbg(1, msp_debug, client, "detection still in progress after 10 tries. giving up.\n"); |
899 | continue; | 967 | continue; |
900 | } | 968 | } |
901 | 969 | ||
902 | unmute: | 970 | unmute: |
903 | state->std = std; | 971 | v4l_dbg(1, msp_debug, client, "detected standard: %s (0x%04x)\n", |
904 | v4l_dbg(1, msp_debug, client, "current standard: %s (0x%04x)\n", | 972 | msp_standard_std_name(state->std), state->std); |
905 | msp_standard_std_name(std), std); | ||
906 | 973 | ||
907 | /* unmute: dispatch sound to scart output, set scart volume */ | 974 | /* unmute: dispatch sound to scart output, set scart volume */ |
908 | msp_set_audio(client); | 975 | msp_set_audio(client); |
@@ -911,20 +978,33 @@ int msp34xxg_thread(void *data) | |||
911 | if (msp_write_dsp(client, 0x13, state->acb)) | 978 | if (msp_write_dsp(client, 0x13, state->acb)) |
912 | return -1; | 979 | return -1; |
913 | 980 | ||
914 | if (state->has_i2s_conf) | 981 | /* the periodic stereo/SAP check is only relevant for |
915 | msp_write_dem(client, 0x40, state->i2s_mode); | 982 | the 0x20 standard (BTSC) */ |
983 | if (state->std != 0x20) | ||
984 | continue; | ||
985 | |||
986 | state->watch_stereo = 1; | ||
987 | |||
988 | /* monitor tv audio mode, the first time don't wait | ||
989 | in order to get a quick stereo/SAP update */ | ||
990 | watch_stereo(client); | ||
991 | while (state->watch_stereo) { | ||
992 | watch_stereo(client); | ||
993 | if (msp_sleep(state, 5000)) | ||
994 | goto restart; | ||
995 | } | ||
916 | } | 996 | } |
917 | v4l_dbg(1, msp_debug, client, "thread: exit\n"); | 997 | v4l_dbg(1, msp_debug, client, "thread: exit\n"); |
918 | return 0; | 998 | return 0; |
919 | } | 999 | } |
920 | 1000 | ||
921 | static void msp34xxg_detect_stereo(struct i2c_client *client) | 1001 | static int msp34xxg_detect_stereo(struct i2c_client *client) |
922 | { | 1002 | { |
923 | struct msp_state *state = i2c_get_clientdata(client); | 1003 | struct msp_state *state = i2c_get_clientdata(client); |
924 | |||
925 | int status = msp_read_dem(client, 0x0200); | 1004 | int status = msp_read_dem(client, 0x0200); |
926 | int is_bilingual = status & 0x100; | 1005 | int is_bilingual = status & 0x100; |
927 | int is_stereo = status & 0x40; | 1006 | int is_stereo = status & 0x40; |
1007 | int oldrx = state->rxsubchans; | ||
928 | 1008 | ||
929 | state->rxsubchans = 0; | 1009 | state->rxsubchans = 0; |
930 | if (is_stereo) | 1010 | if (is_stereo) |
@@ -932,42 +1012,31 @@ static void msp34xxg_detect_stereo(struct i2c_client *client) | |||
932 | else | 1012 | else |
933 | state->rxsubchans = V4L2_TUNER_SUB_MONO; | 1013 | state->rxsubchans = V4L2_TUNER_SUB_MONO; |
934 | if (is_bilingual) { | 1014 | if (is_bilingual) { |
935 | state->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; | 1015 | if (state->std == 0x20) |
936 | /* I'm supposed to check whether it's SAP or not | 1016 | state->rxsubchans |= V4L2_TUNER_SUB_SAP; |
937 | * and set only LANG2/SAP in this case. Yet, the MSP | 1017 | else |
938 | * does a lot of work to hide this and handle everything | 1018 | state->rxsubchans = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; |
939 | * the same way. I don't want to work around it so unless | ||
940 | * this is a problem, I'll handle SAP just like lang1/lang2. | ||
941 | */ | ||
942 | } | 1019 | } |
943 | v4l_dbg(1, msp_debug, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", | 1020 | v4l_dbg(1, msp_debug, client, "status=0x%x, stereo=%d, bilingual=%d -> rxsubchans=%d\n", |
944 | status, is_stereo, is_bilingual, state->rxsubchans); | 1021 | status, is_stereo, is_bilingual, state->rxsubchans); |
1022 | return (oldrx != state->rxsubchans); | ||
945 | } | 1023 | } |
946 | 1024 | ||
947 | static void msp34xxg_set_audmode(struct i2c_client *client) | 1025 | static void msp34xxg_set_audmode(struct i2c_client *client) |
948 | { | 1026 | { |
949 | struct msp_state *state = i2c_get_clientdata(client); | 1027 | struct msp_state *state = i2c_get_clientdata(client); |
950 | int source; | ||
951 | 1028 | ||
952 | switch (state->audmode) { | 1029 | if (state->std == 0x20) { |
953 | case V4L2_TUNER_MODE_MONO: | 1030 | if ((state->rxsubchans & V4L2_TUNER_SUB_SAP) && |
954 | source = 0; /* mono only */ | 1031 | (state->audmode == V4L2_TUNER_MODE_STEREO || |
955 | break; | 1032 | state->audmode == V4L2_TUNER_MODE_LANG2)) { |
956 | case V4L2_TUNER_MODE_STEREO: | 1033 | msp_write_dem(client, 0x20, 0x21); |
957 | source = 1; /* stereo or A|B, see comment in msp34xxg_get_v4l2_stereo() */ | 1034 | } else { |
958 | /* problem: that could also mean 2 (scart input) */ | 1035 | msp_write_dem(client, 0x20, 0x20); |
959 | break; | 1036 | } |
960 | case V4L2_TUNER_MODE_LANG1: | ||
961 | source = 3; /* stereo or A */ | ||
962 | break; | ||
963 | case V4L2_TUNER_MODE_LANG2: | ||
964 | source = 4; /* stereo or B */ | ||
965 | break; | ||
966 | default: | ||
967 | source = 1; | ||
968 | break; | ||
969 | } | 1037 | } |
970 | msp34xxg_set_source(client, source); | 1038 | |
1039 | msp34xxg_set_sources(client); | ||
971 | } | 1040 | } |
972 | 1041 | ||
973 | void msp_set_audmode(struct i2c_client *client) | 1042 | void msp_set_audmode(struct i2c_client *client) |
@@ -977,7 +1046,6 @@ void msp_set_audmode(struct i2c_client *client) | |||
977 | switch (state->opmode) { | 1046 | switch (state->opmode) { |
978 | case OPMODE_MANUAL: | 1047 | case OPMODE_MANUAL: |
979 | case OPMODE_AUTODETECT: | 1048 | case OPMODE_AUTODETECT: |
980 | state->watch_stereo = 0; | ||
981 | msp3400c_set_audmode(client); | 1049 | msp3400c_set_audmode(client); |
982 | break; | 1050 | break; |
983 | case OPMODE_AUTOSELECT: | 1051 | case OPMODE_AUTOSELECT: |
@@ -986,18 +1054,17 @@ void msp_set_audmode(struct i2c_client *client) | |||
986 | } | 1054 | } |
987 | } | 1055 | } |
988 | 1056 | ||
989 | void msp_detect_stereo(struct i2c_client *client) | 1057 | int msp_detect_stereo(struct i2c_client *client) |
990 | { | 1058 | { |
991 | struct msp_state *state = i2c_get_clientdata(client); | 1059 | struct msp_state *state = i2c_get_clientdata(client); |
992 | 1060 | ||
993 | switch (state->opmode) { | 1061 | switch (state->opmode) { |
994 | case OPMODE_MANUAL: | 1062 | case OPMODE_MANUAL: |
995 | case OPMODE_AUTODETECT: | 1063 | case OPMODE_AUTODETECT: |
996 | msp3400c_detect_stereo(client); | 1064 | return msp3400c_detect_stereo(client); |
997 | break; | ||
998 | case OPMODE_AUTOSELECT: | 1065 | case OPMODE_AUTOSELECT: |
999 | msp34xxg_detect_stereo(client); | 1066 | return msp34xxg_detect_stereo(client); |
1000 | break; | ||
1001 | } | 1067 | } |
1068 | return 0; | ||
1002 | } | 1069 | } |
1003 | 1070 | ||
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c index eb3b31867494..b0aea4002d11 100644 --- a/drivers/media/video/mxb.c +++ b/drivers/media/video/mxb.c | |||
@@ -198,13 +198,13 @@ static int mxb_probe(struct saa7146_dev* dev) | |||
198 | /* loop through all i2c-devices on the bus and look who is there */ | 198 | /* loop through all i2c-devices on the bus and look who is there */ |
199 | list_for_each(item,&mxb->i2c_adapter.clients) { | 199 | list_for_each(item,&mxb->i2c_adapter.clients) { |
200 | client = list_entry(item, struct i2c_client, list); | 200 | client = list_entry(item, struct i2c_client, list); |
201 | if( I2C_TEA6420_1 == client->addr ) | 201 | if( I2C_ADDR_TEA6420_1 == client->addr ) |
202 | mxb->tea6420_1 = client; | 202 | mxb->tea6420_1 = client; |
203 | if( I2C_TEA6420_2 == client->addr ) | 203 | if( I2C_ADDR_TEA6420_2 == client->addr ) |
204 | mxb->tea6420_2 = client; | 204 | mxb->tea6420_2 = client; |
205 | if( I2C_TEA6415C_2 == client->addr ) | 205 | if( I2C_TEA6415C_2 == client->addr ) |
206 | mxb->tea6415c = client; | 206 | mxb->tea6415c = client; |
207 | if( I2C_TDA9840 == client->addr ) | 207 | if( I2C_ADDR_TDA9840 == client->addr ) |
208 | mxb->tda9840 = client; | 208 | mxb->tda9840 = client; |
209 | if( I2C_SAA7111 == client->addr ) | 209 | if( I2C_SAA7111 == client->addr ) |
210 | mxb->saa7111a = client; | 210 | mxb->saa7111a = client; |
@@ -790,6 +790,12 @@ static int mxb_ioctl(struct saa7146_fh *fh, unsigned int cmd, void *arg) | |||
790 | DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_STEREO\n")); | 790 | DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_STEREO\n")); |
791 | break; | 791 | break; |
792 | } | 792 | } |
793 | case V4L2_TUNER_MODE_LANG1_LANG2: { | ||
794 | mxb->cur_mode = V4L2_TUNER_MODE_LANG1_LANG2; | ||
795 | byte = TDA9840_SET_BOTH; | ||
796 | DEB_D(("VIDIOC_S_TUNER: V4L2_TUNER_MODE_LANG1_LANG2\n")); | ||
797 | break; | ||
798 | } | ||
793 | case V4L2_TUNER_MODE_LANG1: { | 799 | case V4L2_TUNER_MODE_LANG1: { |
794 | mxb->cur_mode = V4L2_TUNER_MODE_LANG1; | 800 | mxb->cur_mode = V4L2_TUNER_MODE_LANG1; |
795 | byte = TDA9840_SET_LANG1; | 801 | byte = TDA9840_SET_LANG1; |
diff --git a/drivers/usb/media/ov511.c b/drivers/media/video/ov511.c index da44579d6f29..fdc8e3f13937 100644 --- a/drivers/usb/media/ov511.c +++ b/drivers/media/video/ov511.c | |||
@@ -15,7 +15,7 @@ | |||
15 | * | 15 | * |
16 | * Based on the Linux CPiA driver written by Peter Pregler, | 16 | * Based on the Linux CPiA driver written by Peter Pregler, |
17 | * Scott J. Bertin and Johannes Erdfelt. | 17 | * Scott J. Bertin and Johannes Erdfelt. |
18 | * | 18 | * |
19 | * Please see the file: Documentation/usb/ov511.txt | 19 | * Please see the file: Documentation/usb/ov511.txt |
20 | * and the website at: http://alpha.dyndns.org/ov511 | 20 | * and the website at: http://alpha.dyndns.org/ov511 |
21 | * for more info. | 21 | * for more info. |
@@ -433,7 +433,7 @@ reg_w_mask(struct usb_ov511 *ov, | |||
433 | return (reg_w(ov, reg, newval)); | 433 | return (reg_w(ov, reg, newval)); |
434 | } | 434 | } |
435 | 435 | ||
436 | /* | 436 | /* |
437 | * Writes multiple (n) byte value to a single register. Only valid with certain | 437 | * Writes multiple (n) byte value to a single register. Only valid with certain |
438 | * registers (0x30 and 0xc4 - 0xce). | 438 | * registers (0x30 and 0xc4 - 0xce). |
439 | */ | 439 | */ |
@@ -629,7 +629,7 @@ ov511_i2c_write_internal(struct usb_ov511 *ov, | |||
629 | /* Retry until idle */ | 629 | /* Retry until idle */ |
630 | do | 630 | do |
631 | rc = reg_r(ov, R511_I2C_CTL); | 631 | rc = reg_r(ov, R511_I2C_CTL); |
632 | while (rc > 0 && ((rc&1) == 0)); | 632 | while (rc > 0 && ((rc&1) == 0)); |
633 | if (rc < 0) | 633 | if (rc < 0) |
634 | break; | 634 | break; |
635 | 635 | ||
@@ -1752,7 +1752,7 @@ sensor_set_picture(struct usb_ov511 *ov, struct video_picture *p) | |||
1752 | ov->whiteness = p->whiteness; | 1752 | ov->whiteness = p->whiteness; |
1753 | 1753 | ||
1754 | /* Don't return error if a setting is unsupported, or rest of settings | 1754 | /* Don't return error if a setting is unsupported, or rest of settings |
1755 | * will not be performed */ | 1755 | * will not be performed */ |
1756 | 1756 | ||
1757 | rc = sensor_set_contrast(ov, p->contrast); | 1757 | rc = sensor_set_contrast(ov, p->contrast); |
1758 | if (FATAL_ERROR(rc)) | 1758 | if (FATAL_ERROR(rc)) |
@@ -1781,7 +1781,7 @@ sensor_get_picture(struct usb_ov511 *ov, struct video_picture *p) | |||
1781 | PDEBUG(4, "sensor_get_picture"); | 1781 | PDEBUG(4, "sensor_get_picture"); |
1782 | 1782 | ||
1783 | /* Don't return error if a setting is unsupported, or rest of settings | 1783 | /* Don't return error if a setting is unsupported, or rest of settings |
1784 | * will not be performed */ | 1784 | * will not be performed */ |
1785 | 1785 | ||
1786 | rc = sensor_get_contrast(ov, &(p->contrast)); | 1786 | rc = sensor_get_contrast(ov, &(p->contrast)); |
1787 | if (FATAL_ERROR(rc)) | 1787 | if (FATAL_ERROR(rc)) |
@@ -2251,7 +2251,7 @@ mode_init_ov_sensor_regs(struct usb_ov511 *ov, int width, int height, | |||
2251 | 2251 | ||
2252 | /******** Clock programming ********/ | 2252 | /******** Clock programming ********/ |
2253 | 2253 | ||
2254 | /* The OV6620 needs special handling. This prevents the | 2254 | /* The OV6620 needs special handling. This prevents the |
2255 | * severe banding that normally occurs */ | 2255 | * severe banding that normally occurs */ |
2256 | if (ov->sensor == SEN_OV6620 || ov->sensor == SEN_OV6630) | 2256 | if (ov->sensor == SEN_OV6620 || ov->sensor == SEN_OV6630) |
2257 | { | 2257 | { |
@@ -2326,7 +2326,7 @@ set_ov_sensor_window(struct usb_ov511 *ov, int width, int height, int mode, | |||
2326 | int sub_flag) | 2326 | int sub_flag) |
2327 | { | 2327 | { |
2328 | int ret; | 2328 | int ret; |
2329 | int hwsbase, hwebase, vwsbase, vwebase, hwsize, vwsize; | 2329 | int hwsbase, hwebase, vwsbase, vwebase, hwsize, vwsize; |
2330 | int hoffset, voffset, hwscale = 0, vwscale = 0; | 2330 | int hoffset, voffset, hwscale = 0, vwscale = 0; |
2331 | 2331 | ||
2332 | /* The different sensor ICs handle setting up of window differently. | 2332 | /* The different sensor ICs handle setting up of window differently. |
@@ -2575,7 +2575,7 @@ ov518_mode_init_regs(struct usb_ov511 *ov, | |||
2575 | /* OV518 needs U and V swapped */ | 2575 | /* OV518 needs U and V swapped */ |
2576 | i2c_w_mask(ov, 0x15, 0x00, 0x01); | 2576 | i2c_w_mask(ov, 0x15, 0x00, 0x01); |
2577 | 2577 | ||
2578 | if (mode == VIDEO_PALETTE_GREY) { | 2578 | if (mode == VIDEO_PALETTE_GREY) { |
2579 | /* Set 16-bit input format (UV data are ignored) */ | 2579 | /* Set 16-bit input format (UV data are ignored) */ |
2580 | reg_w_mask(ov, 0x20, 0x00, 0x08); | 2580 | reg_w_mask(ov, 0x20, 0x00, 0x08); |
2581 | 2581 | ||
@@ -2894,7 +2894,7 @@ make_8x8(unsigned char *pIn, unsigned char *pOut, int w) | |||
2894 | * ... ... ... | 2894 | * ... ... ... |
2895 | * 56 57 ... 63 120 121 ... 127 248 249 ... 255 | 2895 | * 56 57 ... 63 120 121 ... 127 248 249 ... 255 |
2896 | * | 2896 | * |
2897 | */ | 2897 | */ |
2898 | static void | 2898 | static void |
2899 | yuv400raw_to_yuv400p(struct ov511_frame *frame, | 2899 | yuv400raw_to_yuv400p(struct ov511_frame *frame, |
2900 | unsigned char *pIn0, unsigned char *pOut0) | 2900 | unsigned char *pIn0, unsigned char *pOut0) |
@@ -2923,7 +2923,7 @@ yuv400raw_to_yuv400p(struct ov511_frame *frame, | |||
2923 | * | 2923 | * |
2924 | * 0 1 ... 7 | 2924 | * 0 1 ... 7 |
2925 | * 8 9 ... 15 | 2925 | * 8 9 ... 15 |
2926 | * ... | 2926 | * ... |
2927 | * 56 57 ... 63 | 2927 | * 56 57 ... 63 |
2928 | * | 2928 | * |
2929 | * U and V are shipped at half resolution (1 U,V sample -> one 2x2 block). | 2929 | * U and V are shipped at half resolution (1 U,V sample -> one 2x2 block). |
@@ -3034,7 +3034,7 @@ decompress(struct usb_ov511 *ov, struct ov511_frame *frame, | |||
3034 | */ | 3034 | */ |
3035 | static void | 3035 | static void |
3036 | deinterlace(struct ov511_frame *frame, int rawformat, | 3036 | deinterlace(struct ov511_frame *frame, int rawformat, |
3037 | unsigned char *pIn0, unsigned char *pOut0) | 3037 | unsigned char *pIn0, unsigned char *pOut0) |
3038 | { | 3038 | { |
3039 | const int fieldheight = frame->rawheight / 2; | 3039 | const int fieldheight = frame->rawheight / 2; |
3040 | const int fieldpix = fieldheight * frame->rawwidth; | 3040 | const int fieldpix = fieldheight * frame->rawwidth; |
@@ -3112,7 +3112,7 @@ ov51x_postprocess_grey(struct usb_ov511 *ov, struct ov511_frame *frame) | |||
3112 | frame->tempdata); | 3112 | frame->tempdata); |
3113 | 3113 | ||
3114 | deinterlace(frame, RAWFMT_YUV400, frame->tempdata, | 3114 | deinterlace(frame, RAWFMT_YUV400, frame->tempdata, |
3115 | frame->data); | 3115 | frame->data); |
3116 | } else { | 3116 | } else { |
3117 | if (frame->compressed) | 3117 | if (frame->compressed) |
3118 | decompress(ov, frame, frame->rawdata, | 3118 | decompress(ov, frame, frame->rawdata, |
@@ -3136,7 +3136,7 @@ ov51x_postprocess_yuv420(struct usb_ov511 *ov, struct ov511_frame *frame) | |||
3136 | frame->tempdata); | 3136 | frame->tempdata); |
3137 | 3137 | ||
3138 | deinterlace(frame, RAWFMT_YUV420, frame->tempdata, | 3138 | deinterlace(frame, RAWFMT_YUV420, frame->tempdata, |
3139 | frame->data); | 3139 | frame->data); |
3140 | } else { | 3140 | } else { |
3141 | if (frame->compressed) | 3141 | if (frame->compressed) |
3142 | decompress(ov, frame, frame->rawdata, frame->data); | 3142 | decompress(ov, frame, frame->rawdata, frame->data); |
@@ -3226,7 +3226,7 @@ ov511_move_data(struct usb_ov511 *ov, unsigned char *in, int n) | |||
3226 | frame->rawwidth = ((int)(in[9]) + 1) * 8; | 3226 | frame->rawwidth = ((int)(in[9]) + 1) * 8; |
3227 | frame->rawheight = ((int)(in[10]) + 1) * 8; | 3227 | frame->rawheight = ((int)(in[10]) + 1) * 8; |
3228 | 3228 | ||
3229 | PDEBUG(4, "Frame end, frame=%d, pnum=%d, w=%d, h=%d, recvd=%d", | 3229 | PDEBUG(4, "Frame end, frame=%d, pnum=%d, w=%d, h=%d, recvd=%d", |
3230 | ov->curframe, pnum, frame->rawwidth, frame->rawheight, | 3230 | ov->curframe, pnum, frame->rawwidth, frame->rawheight, |
3231 | frame->bytes_recvd); | 3231 | frame->bytes_recvd); |
3232 | 3232 | ||
@@ -3527,10 +3527,10 @@ ov51x_isoc_irq(struct urb *urb, struct pt_regs *regs) | |||
3527 | return; | 3527 | return; |
3528 | } | 3528 | } |
3529 | 3529 | ||
3530 | if (urb->status == -ENOENT || urb->status == -ECONNRESET) { | 3530 | if (urb->status == -ENOENT || urb->status == -ECONNRESET) { |
3531 | PDEBUG(4, "URB unlinked"); | 3531 | PDEBUG(4, "URB unlinked"); |
3532 | return; | 3532 | return; |
3533 | } | 3533 | } |
3534 | 3534 | ||
3535 | if (urb->status != -EINPROGRESS && urb->status != 0) { | 3535 | if (urb->status != -EINPROGRESS && urb->status != 0) { |
3536 | err("ERROR: urb->status=%d: %s", urb->status, | 3536 | err("ERROR: urb->status=%d: %s", urb->status, |
@@ -4627,8 +4627,8 @@ ov51x_v4l1_mmap(struct file *file, struct vm_area_struct *vma) | |||
4627 | PDEBUG(4, "mmap: %ld (%lX) bytes", size, size); | 4627 | PDEBUG(4, "mmap: %ld (%lX) bytes", size, size); |
4628 | 4628 | ||
4629 | if (size > (((OV511_NUMFRAMES | 4629 | if (size > (((OV511_NUMFRAMES |
4630 | * MAX_DATA_SIZE(ov->maxwidth, ov->maxheight) | 4630 | * MAX_DATA_SIZE(ov->maxwidth, ov->maxheight) |
4631 | + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))) | 4631 | + PAGE_SIZE - 1) & ~(PAGE_SIZE - 1)))) |
4632 | return -EINVAL; | 4632 | return -EINVAL; |
4633 | 4633 | ||
4634 | if (mutex_lock_interruptible(&ov->lock)) | 4634 | if (mutex_lock_interruptible(&ov->lock)) |
@@ -5062,7 +5062,7 @@ ov6xx0_configure(struct usb_ov511 *ov) | |||
5062 | } | 5062 | } |
5063 | 5063 | ||
5064 | /* This initializes the KS0127 and KS0127B video decoders. */ | 5064 | /* This initializes the KS0127 and KS0127B video decoders. */ |
5065 | static int | 5065 | static int |
5066 | ks0127_configure(struct usb_ov511 *ov) | 5066 | ks0127_configure(struct usb_ov511 *ov) |
5067 | { | 5067 | { |
5068 | int rc; | 5068 | int rc; |
@@ -5193,7 +5193,7 @@ saa7111a_configure(struct usb_ov511 *ov) | |||
5193 | return -1; | 5193 | return -1; |
5194 | 5194 | ||
5195 | /* Detect version of decoder. This must be done after writing the | 5195 | /* Detect version of decoder. This must be done after writing the |
5196 | * initial regs or the decoder will lock up. */ | 5196 | * initial regs or the decoder will lock up. */ |
5197 | rc = i2c_r(ov, 0x00); | 5197 | rc = i2c_r(ov, 0x00); |
5198 | 5198 | ||
5199 | if (rc < 0) { | 5199 | if (rc < 0) { |
@@ -5216,13 +5216,13 @@ saa7111a_configure(struct usb_ov511 *ov) | |||
5216 | } | 5216 | } |
5217 | 5217 | ||
5218 | /* This initializes the OV511/OV511+ and the sensor */ | 5218 | /* This initializes the OV511/OV511+ and the sensor */ |
5219 | static int | 5219 | static int |
5220 | ov511_configure(struct usb_ov511 *ov) | 5220 | ov511_configure(struct usb_ov511 *ov) |
5221 | { | 5221 | { |
5222 | static struct ov511_regvals aRegvalsInit511[] = { | 5222 | static struct ov511_regvals aRegvalsInit511[] = { |
5223 | { OV511_REG_BUS, R51x_SYS_RESET, 0x7f }, | 5223 | { OV511_REG_BUS, R51x_SYS_RESET, 0x7f }, |
5224 | { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, | 5224 | { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, |
5225 | { OV511_REG_BUS, R51x_SYS_RESET, 0x7f }, | 5225 | { OV511_REG_BUS, R51x_SYS_RESET, 0x7f }, |
5226 | { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, | 5226 | { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, |
5227 | { OV511_REG_BUS, R51x_SYS_RESET, 0x3f }, | 5227 | { OV511_REG_BUS, R51x_SYS_RESET, 0x3f }, |
5228 | { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, | 5228 | { OV511_REG_BUS, R51x_SYS_INIT, 0x01 }, |
@@ -5269,7 +5269,7 @@ ov511_configure(struct usb_ov511 *ov) | |||
5269 | err("Please notify " EMAIL " of the name,"); | 5269 | err("Please notify " EMAIL " of the name,"); |
5270 | err("manufacturer, model, and this number of your camera."); | 5270 | err("manufacturer, model, and this number of your camera."); |
5271 | err("Also include the output of the detection process."); | 5271 | err("Also include the output of the detection process."); |
5272 | } | 5272 | } |
5273 | 5273 | ||
5274 | if (ov->customid == 70) /* USB Life TV (PAL/SECAM) */ | 5274 | if (ov->customid == 70) /* USB Life TV (PAL/SECAM) */ |
5275 | ov->pal = 1; | 5275 | ov->pal = 1; |
@@ -5336,17 +5336,17 @@ ov511_configure(struct usb_ov511 *ov) | |||
5336 | 5336 | ||
5337 | if (i2c_w(ov, 0x10, 0x00) < 0) { | 5337 | if (i2c_w(ov, 0x10, 0x00) < 0) { |
5338 | err("Can't determine sensor slave IDs"); | 5338 | err("Can't determine sensor slave IDs"); |
5339 | goto error; | 5339 | goto error; |
5340 | } else { | 5340 | } else { |
5341 | if (ks0127_configure(ov) < 0) { | 5341 | if (ks0127_configure(ov) < 0) { |
5342 | err("Failed to configure KS0127"); | 5342 | err("Failed to configure KS0127"); |
5343 | goto error; | 5343 | goto error; |
5344 | } | 5344 | } |
5345 | } | 5345 | } |
5346 | } else { | 5346 | } else { |
5347 | if (saa7111a_configure(ov) < 0) { | 5347 | if (saa7111a_configure(ov) < 0) { |
5348 | err("Failed to configure SAA7111A"); | 5348 | err("Failed to configure SAA7111A"); |
5349 | goto error; | 5349 | goto error; |
5350 | } | 5350 | } |
5351 | } | 5351 | } |
5352 | } else { | 5352 | } else { |
@@ -5356,13 +5356,13 @@ ov511_configure(struct usb_ov511 *ov) | |||
5356 | } else { | 5356 | } else { |
5357 | if (ov6xx0_configure(ov) < 0) { | 5357 | if (ov6xx0_configure(ov) < 0) { |
5358 | err("Failed to configure OV6xx0"); | 5358 | err("Failed to configure OV6xx0"); |
5359 | goto error; | 5359 | goto error; |
5360 | } | 5360 | } |
5361 | } | 5361 | } |
5362 | } else { | 5362 | } else { |
5363 | if (ov7xx0_configure(ov) < 0) { | 5363 | if (ov7xx0_configure(ov) < 0) { |
5364 | err("Failed to configure OV7xx0"); | 5364 | err("Failed to configure OV7xx0"); |
5365 | goto error; | 5365 | goto error; |
5366 | } | 5366 | } |
5367 | } | 5367 | } |
5368 | 5368 | ||
@@ -5381,12 +5381,12 @@ ov518_configure(struct usb_ov511 *ov) | |||
5381 | /* For 518 and 518+ */ | 5381 | /* For 518 and 518+ */ |
5382 | static struct ov511_regvals aRegvalsInit518[] = { | 5382 | static struct ov511_regvals aRegvalsInit518[] = { |
5383 | { OV511_REG_BUS, R51x_SYS_RESET, 0x40 }, | 5383 | { OV511_REG_BUS, R51x_SYS_RESET, 0x40 }, |
5384 | { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, | 5384 | { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, |
5385 | { OV511_REG_BUS, R51x_SYS_RESET, 0x3e }, | 5385 | { OV511_REG_BUS, R51x_SYS_RESET, 0x3e }, |
5386 | { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, | 5386 | { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, |
5387 | { OV511_REG_BUS, R51x_SYS_RESET, 0x00 }, | 5387 | { OV511_REG_BUS, R51x_SYS_RESET, 0x00 }, |
5388 | { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, | 5388 | { OV511_REG_BUS, R51x_SYS_INIT, 0xe1 }, |
5389 | { OV511_REG_BUS, 0x46, 0x00 }, | 5389 | { OV511_REG_BUS, 0x46, 0x00 }, |
5390 | { OV511_REG_BUS, 0x5d, 0x03 }, | 5390 | { OV511_REG_BUS, 0x5d, 0x03 }, |
5391 | { OV511_DONE_BUS, 0x0, 0x00}, | 5391 | { OV511_DONE_BUS, 0x0, 0x00}, |
5392 | }; | 5392 | }; |
@@ -5517,7 +5517,7 @@ ov518_configure(struct usb_ov511 *ov) | |||
5517 | 5517 | ||
5518 | if (init_ov_sensor(ov) < 0) { | 5518 | if (init_ov_sensor(ov) < 0) { |
5519 | err("Can't determine sensor slave IDs"); | 5519 | err("Can't determine sensor slave IDs"); |
5520 | goto error; | 5520 | goto error; |
5521 | } else { | 5521 | } else { |
5522 | err("Detected unsupported OV8xx0 sensor"); | 5522 | err("Detected unsupported OV8xx0 sensor"); |
5523 | goto error; | 5523 | goto error; |
@@ -5525,13 +5525,13 @@ ov518_configure(struct usb_ov511 *ov) | |||
5525 | } else { | 5525 | } else { |
5526 | if (ov6xx0_configure(ov) < 0) { | 5526 | if (ov6xx0_configure(ov) < 0) { |
5527 | err("Failed to configure OV6xx0"); | 5527 | err("Failed to configure OV6xx0"); |
5528 | goto error; | 5528 | goto error; |
5529 | } | 5529 | } |
5530 | } | 5530 | } |
5531 | } else { | 5531 | } else { |
5532 | if (ov7xx0_configure(ov) < 0) { | 5532 | if (ov7xx0_configure(ov) < 0) { |
5533 | err("Failed to configure OV7xx0"); | 5533 | err("Failed to configure OV7xx0"); |
5534 | goto error; | 5534 | goto error; |
5535 | } | 5535 | } |
5536 | } | 5536 | } |
5537 | 5537 | ||
@@ -5564,28 +5564,28 @@ static ssize_t show_custom_id(struct class_device *cd, char *buf) | |||
5564 | { | 5564 | { |
5565 | struct usb_ov511 *ov = cd_to_ov(cd); | 5565 | struct usb_ov511 *ov = cd_to_ov(cd); |
5566 | return sprintf(buf, "%d\n", ov->customid); | 5566 | return sprintf(buf, "%d\n", ov->customid); |
5567 | } | 5567 | } |
5568 | static CLASS_DEVICE_ATTR(custom_id, S_IRUGO, show_custom_id, NULL); | 5568 | static CLASS_DEVICE_ATTR(custom_id, S_IRUGO, show_custom_id, NULL); |
5569 | 5569 | ||
5570 | static ssize_t show_model(struct class_device *cd, char *buf) | 5570 | static ssize_t show_model(struct class_device *cd, char *buf) |
5571 | { | 5571 | { |
5572 | struct usb_ov511 *ov = cd_to_ov(cd); | 5572 | struct usb_ov511 *ov = cd_to_ov(cd); |
5573 | return sprintf(buf, "%s\n", ov->desc); | 5573 | return sprintf(buf, "%s\n", ov->desc); |
5574 | } | 5574 | } |
5575 | static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); | 5575 | static CLASS_DEVICE_ATTR(model, S_IRUGO, show_model, NULL); |
5576 | 5576 | ||
5577 | static ssize_t show_bridge(struct class_device *cd, char *buf) | 5577 | static ssize_t show_bridge(struct class_device *cd, char *buf) |
5578 | { | 5578 | { |
5579 | struct usb_ov511 *ov = cd_to_ov(cd); | 5579 | struct usb_ov511 *ov = cd_to_ov(cd); |
5580 | return sprintf(buf, "%s\n", symbolic(brglist, ov->bridge)); | 5580 | return sprintf(buf, "%s\n", symbolic(brglist, ov->bridge)); |
5581 | } | 5581 | } |
5582 | static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_bridge, NULL); | 5582 | static CLASS_DEVICE_ATTR(bridge, S_IRUGO, show_bridge, NULL); |
5583 | 5583 | ||
5584 | static ssize_t show_sensor(struct class_device *cd, char *buf) | 5584 | static ssize_t show_sensor(struct class_device *cd, char *buf) |
5585 | { | 5585 | { |
5586 | struct usb_ov511 *ov = cd_to_ov(cd); | 5586 | struct usb_ov511 *ov = cd_to_ov(cd); |
5587 | return sprintf(buf, "%s\n", symbolic(senlist, ov->sensor)); | 5587 | return sprintf(buf, "%s\n", symbolic(senlist, ov->sensor)); |
5588 | } | 5588 | } |
5589 | static CLASS_DEVICE_ATTR(sensor, S_IRUGO, show_sensor, NULL); | 5589 | static CLASS_DEVICE_ATTR(sensor, S_IRUGO, show_sensor, NULL); |
5590 | 5590 | ||
5591 | static ssize_t show_brightness(struct class_device *cd, char *buf) | 5591 | static ssize_t show_brightness(struct class_device *cd, char *buf) |
@@ -5597,7 +5597,7 @@ static ssize_t show_brightness(struct class_device *cd, char *buf) | |||
5597 | return -ENODEV; | 5597 | return -ENODEV; |
5598 | sensor_get_brightness(ov, &x); | 5598 | sensor_get_brightness(ov, &x); |
5599 | return sprintf(buf, "%d\n", x >> 8); | 5599 | return sprintf(buf, "%d\n", x >> 8); |
5600 | } | 5600 | } |
5601 | static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); | 5601 | static CLASS_DEVICE_ATTR(brightness, S_IRUGO, show_brightness, NULL); |
5602 | 5602 | ||
5603 | static ssize_t show_saturation(struct class_device *cd, char *buf) | 5603 | static ssize_t show_saturation(struct class_device *cd, char *buf) |
@@ -5609,7 +5609,7 @@ static ssize_t show_saturation(struct class_device *cd, char *buf) | |||
5609 | return -ENODEV; | 5609 | return -ENODEV; |
5610 | sensor_get_saturation(ov, &x); | 5610 | sensor_get_saturation(ov, &x); |
5611 | return sprintf(buf, "%d\n", x >> 8); | 5611 | return sprintf(buf, "%d\n", x >> 8); |
5612 | } | 5612 | } |
5613 | static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); | 5613 | static CLASS_DEVICE_ATTR(saturation, S_IRUGO, show_saturation, NULL); |
5614 | 5614 | ||
5615 | static ssize_t show_contrast(struct class_device *cd, char *buf) | 5615 | static ssize_t show_contrast(struct class_device *cd, char *buf) |
@@ -5621,7 +5621,7 @@ static ssize_t show_contrast(struct class_device *cd, char *buf) | |||
5621 | return -ENODEV; | 5621 | return -ENODEV; |
5622 | sensor_get_contrast(ov, &x); | 5622 | sensor_get_contrast(ov, &x); |
5623 | return sprintf(buf, "%d\n", x >> 8); | 5623 | return sprintf(buf, "%d\n", x >> 8); |
5624 | } | 5624 | } |
5625 | static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); | 5625 | static CLASS_DEVICE_ATTR(contrast, S_IRUGO, show_contrast, NULL); |
5626 | 5626 | ||
5627 | static ssize_t show_hue(struct class_device *cd, char *buf) | 5627 | static ssize_t show_hue(struct class_device *cd, char *buf) |
@@ -5633,7 +5633,7 @@ static ssize_t show_hue(struct class_device *cd, char *buf) | |||
5633 | return -ENODEV; | 5633 | return -ENODEV; |
5634 | sensor_get_hue(ov, &x); | 5634 | sensor_get_hue(ov, &x); |
5635 | return sprintf(buf, "%d\n", x >> 8); | 5635 | return sprintf(buf, "%d\n", x >> 8); |
5636 | } | 5636 | } |
5637 | static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); | 5637 | static CLASS_DEVICE_ATTR(hue, S_IRUGO, show_hue, NULL); |
5638 | 5638 | ||
5639 | static ssize_t show_exposure(struct class_device *cd, char *buf) | 5639 | static ssize_t show_exposure(struct class_device *cd, char *buf) |
@@ -5645,7 +5645,7 @@ static ssize_t show_exposure(struct class_device *cd, char *buf) | |||
5645 | return -ENODEV; | 5645 | return -ENODEV; |
5646 | sensor_get_exposure(ov, &exp); | 5646 | sensor_get_exposure(ov, &exp); |
5647 | return sprintf(buf, "%d\n", exp >> 8); | 5647 | return sprintf(buf, "%d\n", exp >> 8); |
5648 | } | 5648 | } |
5649 | static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); | 5649 | static CLASS_DEVICE_ATTR(exposure, S_IRUGO, show_exposure, NULL); |
5650 | 5650 | ||
5651 | static void ov_create_sysfs(struct video_device *vdev) | 5651 | static void ov_create_sysfs(struct video_device *vdev) |
diff --git a/drivers/usb/media/ov511.h b/drivers/media/video/ov511.h index bce9b3633889..12b3d51e1c34 100644 --- a/drivers/usb/media/ov511.h +++ b/drivers/media/video/ov511.h | |||
@@ -130,7 +130,7 @@ | |||
130 | #define R511_COMP_QVY 0x76 | 130 | #define R511_COMP_QVY 0x76 |
131 | #define R511_COMP_QVUV 0x77 | 131 | #define R511_COMP_QVUV 0x77 |
132 | #define R511_COMP_EN 0x78 | 132 | #define R511_COMP_EN 0x78 |
133 | #define R511_COMP_LUT_EN 0x79 | 133 | #define R511_COMP_LUT_EN 0x79 |
134 | #define R511_COMP_LUT_BEGIN 0x80 | 134 | #define R511_COMP_LUT_BEGIN 0x80 |
135 | 135 | ||
136 | /* --------------------------------- */ | 136 | /* --------------------------------- */ |
@@ -459,14 +459,14 @@ struct usb_ov511 { | |||
459 | int subh; /* Pix Array subcapture height */ | 459 | int subh; /* Pix Array subcapture height */ |
460 | 460 | ||
461 | int curframe; /* Current receiving sbuf */ | 461 | int curframe; /* Current receiving sbuf */ |
462 | struct ov511_frame frame[OV511_NUMFRAMES]; | 462 | struct ov511_frame frame[OV511_NUMFRAMES]; |
463 | 463 | ||
464 | struct ov511_sbuf sbuf[OV511_NUMSBUF]; | 464 | struct ov511_sbuf sbuf[OV511_NUMSBUF]; |
465 | 465 | ||
466 | wait_queue_head_t wq; /* Processes waiting */ | 466 | wait_queue_head_t wq; /* Processes waiting */ |
467 | 467 | ||
468 | int snap_enabled; /* Snapshot mode enabled */ | 468 | int snap_enabled; /* Snapshot mode enabled */ |
469 | 469 | ||
470 | int bridge; /* Type of bridge (BRG_*) */ | 470 | int bridge; /* Type of bridge (BRG_*) */ |
471 | int bclass; /* Class of bridge (BCL_*) */ | 471 | int bclass; /* Class of bridge (BCL_*) */ |
472 | int sensor; /* Type of image sensor chip (SEN_*) */ | 472 | int sensor; /* Type of image sensor chip (SEN_*) */ |
@@ -512,7 +512,7 @@ struct symbolic_list { | |||
512 | /* Returns the name of the matching element in the symbolic_list array. The | 512 | /* Returns the name of the matching element in the symbolic_list array. The |
513 | * end of the list must be marked with an element that has a NULL name. | 513 | * end of the list must be marked with an element that has a NULL name. |
514 | */ | 514 | */ |
515 | static inline char * | 515 | static inline char * |
516 | symbolic(struct symbolic_list list[], int num) | 516 | symbolic(struct symbolic_list list[], int num) |
517 | { | 517 | { |
518 | int i; | 518 | int i; |
diff --git a/drivers/media/video/ovcamchip/Makefile b/drivers/media/video/ovcamchip/Makefile index bca41ad93de8..cba4cdf20f49 100644 --- a/drivers/media/video/ovcamchip/Makefile +++ b/drivers/media/video/ovcamchip/Makefile | |||
@@ -1,4 +1,4 @@ | |||
1 | ovcamchip-objs := ovcamchip_core.o ov6x20.o ov6x30.o ov7x10.o ov7x20.o \ | 1 | ovcamchip-objs := ovcamchip_core.o ov6x20.o ov6x30.o ov7x10.o ov7x20.o \ |
2 | ov76be.o | 2 | ov76be.o |
3 | 3 | ||
4 | obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip.o | 4 | obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip.o |
diff --git a/drivers/media/video/ovcamchip/ovcamchip_core.c b/drivers/media/video/ovcamchip/ovcamchip_core.c index e76b53d5909c..3fe9fa04cd84 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_core.c +++ b/drivers/media/video/ovcamchip/ovcamchip_core.c | |||
@@ -266,17 +266,17 @@ static int ovcamchip_detect(struct i2c_client *c) | |||
266 | PDEBUG(3, "Testing for 0V6xx0"); | 266 | PDEBUG(3, "Testing for 0V6xx0"); |
267 | c->addr = OV6xx0_SID; | 267 | c->addr = OV6xx0_SID; |
268 | if (init_camchip(c) < 0) { | 268 | if (init_camchip(c) < 0) { |
269 | return -ENODEV; | 269 | return -ENODEV; |
270 | } else { | 270 | } else { |
271 | if (ov6xx0_detect(c) < 0) { | 271 | if (ov6xx0_detect(c) < 0) { |
272 | PERROR("Failed to init OV6xx0"); | 272 | PERROR("Failed to init OV6xx0"); |
273 | return -EIO; | 273 | return -EIO; |
274 | } | 274 | } |
275 | } | 275 | } |
276 | } else { | 276 | } else { |
277 | if (ov7xx0_detect(c) < 0) { | 277 | if (ov7xx0_detect(c) < 0) { |
278 | PERROR("Failed to init OV7xx0"); | 278 | PERROR("Failed to init OV7xx0"); |
279 | return -EIO; | 279 | return -EIO; |
280 | } | 280 | } |
281 | } | 281 | } |
282 | 282 | ||
diff --git a/drivers/media/video/ovcamchip/ovcamchip_priv.h b/drivers/media/video/ovcamchip/ovcamchip_priv.h index 575e612a5546..1231335a9f4a 100644 --- a/drivers/media/video/ovcamchip/ovcamchip_priv.h +++ b/drivers/media/video/ovcamchip/ovcamchip_priv.h | |||
@@ -82,6 +82,6 @@ extern int ov_write_regvals(struct i2c_client *c, | |||
82 | struct ovcamchip_regvals *rvals); | 82 | struct ovcamchip_regvals *rvals); |
83 | 83 | ||
84 | extern int ov_write_mask(struct i2c_client *c, unsigned char reg, | 84 | extern int ov_write_mask(struct i2c_client *c, unsigned char reg, |
85 | unsigned char value, unsigned char mask); | 85 | unsigned char value, unsigned char mask); |
86 | 86 | ||
87 | #endif | 87 | #endif |
diff --git a/drivers/media/video/planb.c b/drivers/media/video/planb.c index 15fd85acabda..522e9ddeb089 100644 --- a/drivers/media/video/planb.c +++ b/drivers/media/video/planb.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | planb - PlanB frame grabber driver | 2 | planb - PlanB frame grabber driver |
3 | 3 | ||
4 | PlanB is used in the 7x00/8x00 series of PowerMacintosh | 4 | PlanB is used in the 7x00/8x00 series of PowerMacintosh |
@@ -584,7 +584,7 @@ finish: | |||
584 | wake_up_interruptible(&pb->suspendq); | 584 | wake_up_interruptible(&pb->suspendq); |
585 | } | 585 | } |
586 | 586 | ||
587 | static void add_clip(struct planb *pb, struct video_clip *clip) | 587 | static void add_clip(struct planb *pb, struct video_clip *clip) |
588 | { | 588 | { |
589 | volatile unsigned char *base; | 589 | volatile unsigned char *base; |
590 | int xc = clip->x, yc = clip->y; | 590 | int xc = clip->x, yc = clip->y; |
@@ -758,7 +758,7 @@ static void cmd_buff(struct planb *pb) | |||
758 | PLANB_SET(CH_SYNC)); | 758 | PLANB_SET(CH_SYNC)); |
759 | tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel), | 759 | tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel), |
760 | PLANB_SET(DMA_ABORT)); | 760 | PLANB_SET(DMA_ABORT)); |
761 | 761 | ||
762 | /* odd field data: */ | 762 | /* odd field data: */ |
763 | jump = virt_to_bus(c1 + nlines / 2); | 763 | jump = virt_to_bus(c1 + nlines / 2); |
764 | for (i=1; i < nlines; i += stepsize, c1++) | 764 | for (i=1; i < nlines; i += stepsize, c1++) |
@@ -1247,7 +1247,7 @@ static volatile struct dbdma_cmd *setup_grab_cmd(int fr, struct planb *pb) | |||
1247 | tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++; | 1247 | tab_cmd_dbdma(c1, DBDMA_NOP | BR_IFCLR, virt_to_bus(c1-3)); c1++; |
1248 | tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel), | 1248 | tab_cmd_store(c1++, (unsigned)(&pb->planb_base_phys->ch1.br_sel), |
1249 | PLANB_SET(DMA_ABORT)); | 1249 | PLANB_SET(DMA_ABORT)); |
1250 | 1250 | ||
1251 | /* odd field data: */ | 1251 | /* odd field data: */ |
1252 | jump_addr = c1 + TAB_FACTOR * nlines / 2; | 1252 | jump_addr = c1 + TAB_FACTOR * nlines / 2; |
1253 | jump = virt_to_bus(jump_addr); | 1253 | jump = virt_to_bus(jump_addr); |
@@ -1383,7 +1383,7 @@ static int planb_open(struct video_device *dev, int mode) | |||
1383 | pb->user++; | 1383 | pb->user++; |
1384 | 1384 | ||
1385 | DEBUG("PlanB: device opened\n"); | 1385 | DEBUG("PlanB: device opened\n"); |
1386 | return 0; | 1386 | return 0; |
1387 | } | 1387 | } |
1388 | 1388 | ||
1389 | static void planb_close(struct video_device *dev) | 1389 | static void planb_close(struct video_device *dev) |
@@ -1424,9 +1424,9 @@ static long planb_write(struct video_device *v, const char *buf, | |||
1424 | static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | 1424 | static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) |
1425 | { | 1425 | { |
1426 | struct planb *pb=(struct planb *)dev; | 1426 | struct planb *pb=(struct planb *)dev; |
1427 | 1427 | ||
1428 | switch (cmd) | 1428 | switch (cmd) |
1429 | { | 1429 | { |
1430 | case VIDIOCGCAP: | 1430 | case VIDIOCGCAP: |
1431 | { | 1431 | { |
1432 | struct video_capability b; | 1432 | struct video_capability b; |
@@ -1440,26 +1440,26 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1440 | b.channels = 2; /* composite & svhs */ | 1440 | b.channels = 2; /* composite & svhs */ |
1441 | b.audios = 0; | 1441 | b.audios = 0; |
1442 | b.maxwidth = PLANB_MAXPIXELS; | 1442 | b.maxwidth = PLANB_MAXPIXELS; |
1443 | b.maxheight = PLANB_MAXLINES; | 1443 | b.maxheight = PLANB_MAXLINES; |
1444 | b.minwidth = 32; /* wild guess */ | 1444 | b.minwidth = 32; /* wild guess */ |
1445 | b.minheight = 32; | 1445 | b.minheight = 32; |
1446 | if (copy_to_user(arg,&b,sizeof(b))) | 1446 | if (copy_to_user(arg,&b,sizeof(b))) |
1447 | return -EFAULT; | 1447 | return -EFAULT; |
1448 | return 0; | 1448 | return 0; |
1449 | } | 1449 | } |
1450 | case VIDIOCSFBUF: | 1450 | case VIDIOCSFBUF: |
1451 | { | 1451 | { |
1452 | struct video_buffer v; | 1452 | struct video_buffer v; |
1453 | unsigned short bpp; | 1453 | unsigned short bpp; |
1454 | unsigned int fmt; | 1454 | unsigned int fmt; |
1455 | 1455 | ||
1456 | DEBUG("PlanB: IOCTL VIDIOCSFBUF\n"); | 1456 | DEBUG("PlanB: IOCTL VIDIOCSFBUF\n"); |
1457 | 1457 | ||
1458 | if (!capable(CAP_SYS_ADMIN) | 1458 | if (!capable(CAP_SYS_ADMIN) |
1459 | || !capable(CAP_SYS_RAWIO)) | 1459 | || !capable(CAP_SYS_RAWIO)) |
1460 | return -EPERM; | 1460 | return -EPERM; |
1461 | if (copy_from_user(&v, arg,sizeof(v))) | 1461 | if (copy_from_user(&v, arg,sizeof(v))) |
1462 | return -EFAULT; | 1462 | return -EFAULT; |
1463 | planb_lock(pb); | 1463 | planb_lock(pb); |
1464 | switch(v.depth) { | 1464 | switch(v.depth) { |
1465 | case 8: | 1465 | case 8: |
@@ -1478,7 +1478,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1478 | break; | 1478 | break; |
1479 | default: | 1479 | default: |
1480 | planb_unlock(pb); | 1480 | planb_unlock(pb); |
1481 | return -EINVAL; | 1481 | return -EINVAL; |
1482 | } | 1482 | } |
1483 | if (bpp * v.width > v.bytesperline) { | 1483 | if (bpp * v.width > v.bytesperline) { |
1484 | planb_unlock(pb); | 1484 | planb_unlock(pb); |
@@ -1493,7 +1493,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1493 | pb->win.bpl = pb->win.bpp * pb->win.swidth; | 1493 | pb->win.bpl = pb->win.bpp * pb->win.swidth; |
1494 | pb->win.pad = v.bytesperline - pb->win.bpl; | 1494 | pb->win.pad = v.bytesperline - pb->win.bpl; |
1495 | 1495 | ||
1496 | DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d," | 1496 | DEBUG("PlanB: Display at %p is %d by %d, bytedepth %d," |
1497 | " bpl %d (+ %d)\n", v.base, v.width,v.height, | 1497 | " bpl %d (+ %d)\n", v.base, v.width,v.height, |
1498 | pb->win.bpp, pb->win.bpl, pb->win.pad); | 1498 | pb->win.bpp, pb->win.bpl, pb->win.pad); |
1499 | 1499 | ||
@@ -1504,11 +1504,11 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1504 | resume_overlay(pb); | 1504 | resume_overlay(pb); |
1505 | } | 1505 | } |
1506 | planb_unlock(pb); | 1506 | planb_unlock(pb); |
1507 | return 0; | 1507 | return 0; |
1508 | } | 1508 | } |
1509 | case VIDIOCGFBUF: | 1509 | case VIDIOCGFBUF: |
1510 | { | 1510 | { |
1511 | struct video_buffer v; | 1511 | struct video_buffer v; |
1512 | 1512 | ||
1513 | DEBUG("PlanB: IOCTL VIDIOCGFBUF\n"); | 1513 | DEBUG("PlanB: IOCTL VIDIOCGFBUF\n"); |
1514 | 1514 | ||
@@ -1518,15 +1518,15 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1518 | v.depth = pb->win.depth; | 1518 | v.depth = pb->win.depth; |
1519 | v.bytesperline = pb->win.bpl + pb->win.pad; | 1519 | v.bytesperline = pb->win.bpl + pb->win.pad; |
1520 | if (copy_to_user(arg, &v, sizeof(v))) | 1520 | if (copy_to_user(arg, &v, sizeof(v))) |
1521 | return -EFAULT; | 1521 | return -EFAULT; |
1522 | return 0; | 1522 | return 0; |
1523 | } | 1523 | } |
1524 | case VIDIOCCAPTURE: | 1524 | case VIDIOCCAPTURE: |
1525 | { | 1525 | { |
1526 | int i; | 1526 | int i; |
1527 | 1527 | ||
1528 | if(copy_from_user(&i, arg, sizeof(i))) | 1528 | if(copy_from_user(&i, arg, sizeof(i))) |
1529 | return -EFAULT; | 1529 | return -EFAULT; |
1530 | if(i==0) { | 1530 | if(i==0) { |
1531 | DEBUG("PlanB: IOCTL VIDIOCCAPTURE Stop\n"); | 1531 | DEBUG("PlanB: IOCTL VIDIOCCAPTURE Stop\n"); |
1532 | 1532 | ||
@@ -1695,7 +1695,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1695 | struct video_window vw; | 1695 | struct video_window vw; |
1696 | struct video_clip clip; | 1696 | struct video_clip clip; |
1697 | int i; | 1697 | int i; |
1698 | 1698 | ||
1699 | DEBUG("PlanB: IOCTL VIDIOCSWIN\n"); | 1699 | DEBUG("PlanB: IOCTL VIDIOCSWIN\n"); |
1700 | 1700 | ||
1701 | if(copy_from_user(&vw,arg,sizeof(vw))) | 1701 | if(copy_from_user(&vw,arg,sizeof(vw))) |
@@ -1749,7 +1749,7 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1749 | return -EFAULT; | 1749 | return -EFAULT; |
1750 | return 0; | 1750 | return 0; |
1751 | } | 1751 | } |
1752 | case VIDIOCSYNC: { | 1752 | case VIDIOCSYNC: { |
1753 | int i; | 1753 | int i; |
1754 | 1754 | ||
1755 | IDEBUG("PlanB: IOCTL VIDIOCSYNC\n"); | 1755 | IDEBUG("PlanB: IOCTL VIDIOCSYNC\n"); |
@@ -1759,42 +1759,42 @@ static int planb_ioctl(struct video_device *dev, unsigned int cmd, void *arg) | |||
1759 | 1759 | ||
1760 | IDEBUG("PlanB: sync to frame %d\n", i); | 1760 | IDEBUG("PlanB: sync to frame %d\n", i); |
1761 | 1761 | ||
1762 | if(i > (MAX_GBUFFERS - 1) || i < 0) | 1762 | if(i > (MAX_GBUFFERS - 1) || i < 0) |
1763 | return -EINVAL; | 1763 | return -EINVAL; |
1764 | chk_grab: | 1764 | chk_grab: |
1765 | switch (pb->frame_stat[i]) { | 1765 | switch (pb->frame_stat[i]) { |
1766 | case GBUFFER_UNUSED: | 1766 | case GBUFFER_UNUSED: |
1767 | return -EINVAL; | 1767 | return -EINVAL; |
1768 | case GBUFFER_GRABBING: | 1768 | case GBUFFER_GRABBING: |
1769 | IDEBUG("PlanB: waiting for grab" | 1769 | IDEBUG("PlanB: waiting for grab" |
1770 | " done (%d)\n", i); | 1770 | " done (%d)\n", i); |
1771 | interruptible_sleep_on(&pb->capq); | 1771 | interruptible_sleep_on(&pb->capq); |
1772 | if(signal_pending(current)) | 1772 | if(signal_pending(current)) |
1773 | return -EINTR; | 1773 | return -EINTR; |
1774 | goto chk_grab; | 1774 | goto chk_grab; |
1775 | case GBUFFER_DONE: | 1775 | case GBUFFER_DONE: |
1776 | pb->frame_stat[i] = GBUFFER_UNUSED; | 1776 | pb->frame_stat[i] = GBUFFER_UNUSED; |
1777 | break; | 1777 | break; |
1778 | } | 1778 | } |
1779 | return 0; | 1779 | return 0; |
1780 | } | 1780 | } |
1781 | 1781 | ||
1782 | case VIDIOCMCAPTURE: | 1782 | case VIDIOCMCAPTURE: |
1783 | { | 1783 | { |
1784 | struct video_mmap vm; | 1784 | struct video_mmap vm; |
1785 | volatile unsigned int status; | 1785 | volatile unsigned int status; |
1786 | 1786 | ||
1787 | IDEBUG("PlanB: IOCTL VIDIOCMCAPTURE\n"); | 1787 | IDEBUG("PlanB: IOCTL VIDIOCMCAPTURE\n"); |
1788 | 1788 | ||
1789 | if(copy_from_user((void *) &vm,(void *)arg,sizeof(vm))) | 1789 | if(copy_from_user((void *) &vm,(void *)arg,sizeof(vm))) |
1790 | return -EFAULT; | 1790 | return -EFAULT; |
1791 | status = pb->frame_stat[vm.frame]; | 1791 | status = pb->frame_stat[vm.frame]; |
1792 | if (status != GBUFFER_UNUSED) | 1792 | if (status != GBUFFER_UNUSED) |
1793 | return -EBUSY; | 1793 | return -EBUSY; |
1794 | 1794 | ||
1795 | return vgrab(pb, &vm); | 1795 | return vgrab(pb, &vm); |
1796 | } | 1796 | } |
1797 | 1797 | ||
1798 | case VIDIOCGMBUF: | 1798 | case VIDIOCGMBUF: |
1799 | { | 1799 | { |
1800 | int i; | 1800 | int i; |
@@ -1811,7 +1811,7 @@ chk_grab: | |||
1811 | return -EFAULT; | 1811 | return -EFAULT; |
1812 | return 0; | 1812 | return 0; |
1813 | } | 1813 | } |
1814 | 1814 | ||
1815 | case PLANBIOCGSAAREGS: | 1815 | case PLANBIOCGSAAREGS: |
1816 | { | 1816 | { |
1817 | struct planb_saa_regs preg; | 1817 | struct planb_saa_regs preg; |
@@ -1828,7 +1828,7 @@ chk_grab: | |||
1828 | return -EFAULT; | 1828 | return -EFAULT; |
1829 | return 0; | 1829 | return 0; |
1830 | } | 1830 | } |
1831 | 1831 | ||
1832 | case PLANBIOCSSAAREGS: | 1832 | case PLANBIOCSSAAREGS: |
1833 | { | 1833 | { |
1834 | struct planb_saa_regs preg; | 1834 | struct planb_saa_regs preg; |
@@ -1842,7 +1842,7 @@ chk_grab: | |||
1842 | saa_set (preg.addr, preg.val, pb); | 1842 | saa_set (preg.addr, preg.val, pb); |
1843 | return 0; | 1843 | return 0; |
1844 | } | 1844 | } |
1845 | 1845 | ||
1846 | case PLANBIOCGSTAT: | 1846 | case PLANBIOCGSTAT: |
1847 | { | 1847 | { |
1848 | struct planb_stat_regs pstat; | 1848 | struct planb_stat_regs pstat; |
@@ -1859,7 +1859,7 @@ chk_grab: | |||
1859 | return -EFAULT; | 1859 | return -EFAULT; |
1860 | return 0; | 1860 | return 0; |
1861 | } | 1861 | } |
1862 | 1862 | ||
1863 | case PLANBIOCSMODE: { | 1863 | case PLANBIOCSMODE: { |
1864 | int v; | 1864 | int v; |
1865 | 1865 | ||
@@ -1985,10 +1985,10 @@ static int planb_mmap(struct vm_area_struct *vma, struct video_device *dev, cons | |||
1985 | { | 1985 | { |
1986 | int i; | 1986 | int i; |
1987 | struct planb *pb = (struct planb *)dev; | 1987 | struct planb *pb = (struct planb *)dev; |
1988 | unsigned long start = (unsigned long)adr; | 1988 | unsigned long start = (unsigned long)adr; |
1989 | 1989 | ||
1990 | if (size > MAX_GBUFFERS * PLANB_MAX_FBUF) | 1990 | if (size > MAX_GBUFFERS * PLANB_MAX_FBUF) |
1991 | return -EINVAL; | 1991 | return -EINVAL; |
1992 | if (!pb->rawbuf) { | 1992 | if (!pb->rawbuf) { |
1993 | int err; | 1993 | int err; |
1994 | if((err=grabbuf_alloc(pb))) | 1994 | if((err=grabbuf_alloc(pb))) |
@@ -2091,10 +2091,10 @@ static int init_planb(struct planb *pb) | |||
2091 | /* clear interrupt mask */ | 2091 | /* clear interrupt mask */ |
2092 | pb->intr_mask = PLANB_CLR_IRQ; | 2092 | pb->intr_mask = PLANB_CLR_IRQ; |
2093 | 2093 | ||
2094 | result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb); | 2094 | result = request_irq(pb->irq, planb_irq, 0, "PlanB", (void *)pb); |
2095 | if (result < 0) { | 2095 | if (result < 0) { |
2096 | if (result==-EINVAL) | 2096 | if (result==-EINVAL) |
2097 | printk(KERN_ERR "PlanB: Bad irq number (%d) " | 2097 | printk(KERN_ERR "PlanB: Bad irq number (%d) " |
2098 | "or handler\n", (int)pb->irq); | 2098 | "or handler\n", (int)pb->irq); |
2099 | else if (result==-EBUSY) | 2099 | else if (result==-EBUSY) |
2100 | printk(KERN_ERR "PlanB: I don't know why, " | 2100 | printk(KERN_ERR "PlanB: I don't know why, " |
@@ -2102,7 +2102,7 @@ static int init_planb(struct planb *pb) | |||
2102 | return result; | 2102 | return result; |
2103 | } | 2103 | } |
2104 | disable_irq(pb->irq); | 2104 | disable_irq(pb->irq); |
2105 | 2105 | ||
2106 | /* Now add the template and register the device unit. */ | 2106 | /* Now add the template and register the device unit. */ |
2107 | memcpy(&pb->video_dev,&planb_template,sizeof(planb_template)); | 2107 | memcpy(&pb->video_dev,&planb_template,sizeof(planb_template)); |
2108 | 2108 | ||
@@ -2143,7 +2143,7 @@ static int init_planb(struct planb *pb) | |||
2143 | } | 2143 | } |
2144 | 2144 | ||
2145 | /* | 2145 | /* |
2146 | * Scan for a PlanB controller, request the irq and map the io memory | 2146 | * Scan for a PlanB controller, request the irq and map the io memory |
2147 | */ | 2147 | */ |
2148 | 2148 | ||
2149 | static int find_planb(void) | 2149 | static int find_planb(void) |
@@ -2171,9 +2171,9 @@ static int find_planb(void) | |||
2171 | pb = &planbs[0]; | 2171 | pb = &planbs[0]; |
2172 | planb_num = 1; | 2172 | planb_num = 1; |
2173 | 2173 | ||
2174 | if (planb_devices->n_addrs != 1) { | 2174 | if (planb_devices->n_addrs != 1) { |
2175 | printk (KERN_WARNING "PlanB: expecting 1 address for planb " | 2175 | printk (KERN_WARNING "PlanB: expecting 1 address for planb " |
2176 | "(got %d)", planb_devices->n_addrs); | 2176 | "(got %d)", planb_devices->n_addrs); |
2177 | return 0; | 2177 | return 0; |
2178 | } | 2178 | } |
2179 | 2179 | ||
@@ -2236,7 +2236,7 @@ static int find_planb(void) | |||
2236 | pb->planb_base = planb_regs; | 2236 | pb->planb_base = planb_regs; |
2237 | pb->planb_base_phys = (struct planb_registers *)new_base; | 2237 | pb->planb_base_phys = (struct planb_registers *)new_base; |
2238 | pb->irq = irq; | 2238 | pb->irq = irq; |
2239 | 2239 | ||
2240 | return planb_num; | 2240 | return planb_num; |
2241 | 2241 | ||
2242 | err_out_disable: | 2242 | err_out_disable: |
@@ -2251,7 +2251,7 @@ static void release_planb(void) | |||
2251 | int i; | 2251 | int i; |
2252 | struct planb *pb; | 2252 | struct planb *pb; |
2253 | 2253 | ||
2254 | for (i=0;i<planb_num; i++) | 2254 | for (i=0;i<planb_num; i++) |
2255 | { | 2255 | { |
2256 | pb=&planbs[i]; | 2256 | pb=&planbs[i]; |
2257 | 2257 | ||
@@ -2278,7 +2278,7 @@ static void release_planb(void) | |||
2278 | static int __init init_planbs(void) | 2278 | static int __init init_planbs(void) |
2279 | { | 2279 | { |
2280 | int i; | 2280 | int i; |
2281 | 2281 | ||
2282 | if (find_planb()<=0) | 2282 | if (find_planb()<=0) |
2283 | return -EIO; | 2283 | return -EIO; |
2284 | 2284 | ||
@@ -2288,9 +2288,9 @@ static int __init init_planbs(void) | |||
2288 | " with v4l\n", i); | 2288 | " with v4l\n", i); |
2289 | release_planb(); | 2289 | release_planb(); |
2290 | return -EIO; | 2290 | return -EIO; |
2291 | } | 2291 | } |
2292 | printk(KERN_INFO "PlanB: registered device %d with v4l\n", i); | 2292 | printk(KERN_INFO "PlanB: registered device %d with v4l\n", i); |
2293 | } | 2293 | } |
2294 | return 0; | 2294 | return 0; |
2295 | } | 2295 | } |
2296 | 2296 | ||
diff --git a/drivers/media/video/planb.h b/drivers/media/video/planb.h index 79b6b561426e..92823211d0c5 100644 --- a/drivers/media/video/planb.h +++ b/drivers/media/video/planb.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | planb - PlanB frame grabber driver | 2 | planb - PlanB frame grabber driver |
3 | 3 | ||
4 | PlanB is used in the 7x00/8x00 series of PowerMacintosh | 4 | PlanB is used in the 7x00/8x00 series of PowerMacintosh |
@@ -167,7 +167,7 @@ struct planb { | |||
167 | struct video_device video_dev; | 167 | struct video_device video_dev; |
168 | struct video_picture picture; /* Current picture params */ | 168 | struct video_picture picture; /* Current picture params */ |
169 | struct video_audio audio_dev; /* Current audio params */ | 169 | struct video_audio audio_dev; /* Current audio params */ |
170 | 170 | ||
171 | volatile struct planb_registers *planb_base; /* virt base of planb */ | 171 | volatile struct planb_registers *planb_base; /* virt base of planb */ |
172 | struct planb_registers *planb_base_phys; /* phys base of planb */ | 172 | struct planb_registers *planb_base_phys; /* phys base of planb */ |
173 | void *priv_space; /* Org. alloc. mem for kfree */ | 173 | void *priv_space; /* Org. alloc. mem for kfree */ |
@@ -209,7 +209,7 @@ struct planb { | |||
209 | int gwidth[MAX_GBUFFERS], gheight[MAX_GBUFFERS]; | 209 | int gwidth[MAX_GBUFFERS], gheight[MAX_GBUFFERS]; |
210 | unsigned int gfmt[MAX_GBUFFERS]; | 210 | unsigned int gfmt[MAX_GBUFFERS]; |
211 | int gnorm_switch[MAX_GBUFFERS]; | 211 | int gnorm_switch[MAX_GBUFFERS]; |
212 | volatile unsigned int *frame_stat; | 212 | volatile unsigned int *frame_stat; |
213 | #define GBUFFER_UNUSED 0x00U | 213 | #define GBUFFER_UNUSED 0x00U |
214 | #define GBUFFER_GRABBING 0x01U | 214 | #define GBUFFER_GRABBING 0x01U |
215 | #define GBUFFER_DONE 0x02U | 215 | #define GBUFFER_DONE 0x02U |
diff --git a/drivers/media/video/pms.c b/drivers/media/video/pms.c index 05ca55939e77..09835ca098b1 100644 --- a/drivers/media/video/pms.c +++ b/drivers/media/video/pms.c | |||
@@ -12,10 +12,10 @@ | |||
12 | * Most of this code is directly derived from his userspace driver. | 12 | * Most of this code is directly derived from his userspace driver. |
13 | * His driver works so send any reports to alan@redhat.com unless the | 13 | * His driver works so send any reports to alan@redhat.com unless the |
14 | * userspace driver also doesn't work for you... | 14 | * userspace driver also doesn't work for you... |
15 | * | 15 | * |
16 | * Changes: | 16 | * Changes: |
17 | * 08/07/2003 Daniele Bellucci <bellucda@tiscali.it> | 17 | * 08/07/2003 Daniele Bellucci <bellucda@tiscali.it> |
18 | * - pms_capture: report back -EFAULT | 18 | * - pms_capture: report back -EFAULT |
19 | */ | 19 | */ |
20 | 20 | ||
21 | #include <linux/module.h> | 21 | #include <linux/module.h> |
@@ -66,14 +66,14 @@ static int standard = 0; /* 0 - auto 1 - ntsc 2 - pal 3 - secam */ | |||
66 | /* | 66 | /* |
67 | * I/O ports and Shared Memory | 67 | * I/O ports and Shared Memory |
68 | */ | 68 | */ |
69 | 69 | ||
70 | static int io_port = 0x250; | 70 | static int io_port = 0x250; |
71 | static int data_port = 0x251; | 71 | static int data_port = 0x251; |
72 | static int mem_base = 0xC8000; | 72 | static int mem_base = 0xC8000; |
73 | static void __iomem *mem; | 73 | static void __iomem *mem; |
74 | static int video_nr = -1; | 74 | static int video_nr = -1; |
75 | 75 | ||
76 | 76 | ||
77 | 77 | ||
78 | static inline void mvv_write(u8 index, u8 value) | 78 | static inline void mvv_write(u8 index, u8 value) |
79 | { | 79 | { |
@@ -90,9 +90,9 @@ static int pms_i2c_stat(u8 slave) | |||
90 | { | 90 | { |
91 | int counter; | 91 | int counter; |
92 | int i; | 92 | int i; |
93 | 93 | ||
94 | outb(0x28, io_port); | 94 | outb(0x28, io_port); |
95 | 95 | ||
96 | counter=0; | 96 | counter=0; |
97 | while((inb(data_port)&0x01)==0) | 97 | while((inb(data_port)&0x01)==0) |
98 | if(counter++==256) | 98 | if(counter++==256) |
@@ -101,9 +101,9 @@ static int pms_i2c_stat(u8 slave) | |||
101 | while((inb(data_port)&0x01)!=0) | 101 | while((inb(data_port)&0x01)!=0) |
102 | if(counter++==256) | 102 | if(counter++==256) |
103 | break; | 103 | break; |
104 | 104 | ||
105 | outb(slave, io_port); | 105 | outb(slave, io_port); |
106 | 106 | ||
107 | counter=0; | 107 | counter=0; |
108 | while((inb(data_port)&0x01)==0) | 108 | while((inb(data_port)&0x01)==0) |
109 | if(counter++==256) | 109 | if(counter++==256) |
@@ -112,7 +112,7 @@ static int pms_i2c_stat(u8 slave) | |||
112 | while((inb(data_port)&0x01)!=0) | 112 | while((inb(data_port)&0x01)!=0) |
113 | if(counter++==256) | 113 | if(counter++==256) |
114 | break; | 114 | break; |
115 | 115 | ||
116 | for(i=0;i<12;i++) | 116 | for(i=0;i<12;i++) |
117 | { | 117 | { |
118 | char st=inb(data_port); | 118 | char st=inb(data_port); |
@@ -122,7 +122,7 @@ static int pms_i2c_stat(u8 slave) | |||
122 | break; | 122 | break; |
123 | } | 123 | } |
124 | outb(0x29, io_port); | 124 | outb(0x29, io_port); |
125 | return inb(data_port); | 125 | return inb(data_port); |
126 | } | 126 | } |
127 | 127 | ||
128 | static int pms_i2c_write(u16 slave, u16 sub, u16 data) | 128 | static int pms_i2c_write(u16 slave, u16 sub, u16 data) |
@@ -130,19 +130,19 @@ static int pms_i2c_write(u16 slave, u16 sub, u16 data) | |||
130 | int skip=0; | 130 | int skip=0; |
131 | int count; | 131 | int count; |
132 | int i; | 132 | int i; |
133 | 133 | ||
134 | for(i=0;i<i2c_count;i++) | 134 | for(i=0;i<i2c_count;i++) |
135 | { | 135 | { |
136 | if((i2cinfo[i].slave==slave) && | 136 | if((i2cinfo[i].slave==slave) && |
137 | (i2cinfo[i].sub == sub)) | 137 | (i2cinfo[i].sub == sub)) |
138 | { | 138 | { |
139 | if(i2cinfo[i].data==data) | 139 | if(i2cinfo[i].data==data) |
140 | skip=1; | 140 | skip=1; |
141 | i2cinfo[i].data=data; | 141 | i2cinfo[i].data=data; |
142 | i=i2c_count+1; | 142 | i=i2c_count+1; |
143 | } | 143 | } |
144 | } | 144 | } |
145 | 145 | ||
146 | if(i==i2c_count && i2c_count<64) | 146 | if(i==i2c_count && i2c_count<64) |
147 | { | 147 | { |
148 | i2cinfo[i2c_count].slave=slave; | 148 | i2cinfo[i2c_count].slave=slave; |
@@ -150,16 +150,16 @@ static int pms_i2c_write(u16 slave, u16 sub, u16 data) | |||
150 | i2cinfo[i2c_count].data=data; | 150 | i2cinfo[i2c_count].data=data; |
151 | i2c_count++; | 151 | i2c_count++; |
152 | } | 152 | } |
153 | 153 | ||
154 | if(skip) | 154 | if(skip) |
155 | return 0; | 155 | return 0; |
156 | 156 | ||
157 | mvv_write(0x29, sub); | 157 | mvv_write(0x29, sub); |
158 | mvv_write(0x2A, data); | 158 | mvv_write(0x2A, data); |
159 | mvv_write(0x28, slave); | 159 | mvv_write(0x28, slave); |
160 | 160 | ||
161 | outb(0x28, io_port); | 161 | outb(0x28, io_port); |
162 | 162 | ||
163 | count=0; | 163 | count=0; |
164 | while((inb(data_port)&1)==0) | 164 | while((inb(data_port)&1)==0) |
165 | if(count>255) | 165 | if(count>255) |
@@ -167,9 +167,9 @@ static int pms_i2c_write(u16 slave, u16 sub, u16 data) | |||
167 | while((inb(data_port)&1)!=0) | 167 | while((inb(data_port)&1)!=0) |
168 | if(count>255) | 168 | if(count>255) |
169 | break; | 169 | break; |
170 | 170 | ||
171 | count=inb(data_port); | 171 | count=inb(data_port); |
172 | 172 | ||
173 | if(count&2) | 173 | if(count&2) |
174 | return -1; | 174 | return -1; |
175 | return count; | 175 | return count; |
@@ -189,8 +189,8 @@ static int pms_i2c_read(int slave, int sub) | |||
189 | 189 | ||
190 | static void pms_i2c_andor(int slave, int sub, int and, int or) | 190 | static void pms_i2c_andor(int slave, int sub, int and, int or) |
191 | { | 191 | { |
192 | u8 tmp; | 192 | u8 tmp; |
193 | 193 | ||
194 | tmp=pms_i2c_read(slave, sub); | 194 | tmp=pms_i2c_read(slave, sub); |
195 | tmp = (tmp&and)|or; | 195 | tmp = (tmp&and)|or; |
196 | pms_i2c_write(slave, sub, tmp); | 196 | pms_i2c_write(slave, sub, tmp); |
@@ -199,7 +199,7 @@ static void pms_i2c_andor(int slave, int sub, int and, int or) | |||
199 | /* | 199 | /* |
200 | * Control functions | 200 | * Control functions |
201 | */ | 201 | */ |
202 | 202 | ||
203 | 203 | ||
204 | static void pms_videosource(short source) | 204 | static void pms_videosource(short source) |
205 | { | 205 | { |
@@ -234,8 +234,8 @@ static void pms_colour(short colour) | |||
234 | break; | 234 | break; |
235 | } | 235 | } |
236 | } | 236 | } |
237 | 237 | ||
238 | 238 | ||
239 | static void pms_contrast(short contrast) | 239 | static void pms_contrast(short contrast) |
240 | { | 240 | { |
241 | switch(decoder) | 241 | switch(decoder) |
@@ -269,14 +269,14 @@ static void pms_format(short format) | |||
269 | { | 269 | { |
270 | int target; | 270 | int target; |
271 | standard = format; | 271 | standard = format; |
272 | 272 | ||
273 | if(decoder==PHILIPS1) | 273 | if(decoder==PHILIPS1) |
274 | target=0x42; | 274 | target=0x42; |
275 | else if(decoder==PHILIPS2) | 275 | else if(decoder==PHILIPS2) |
276 | target=0x8A; | 276 | target=0x8A; |
277 | else | 277 | else |
278 | return; | 278 | return; |
279 | 279 | ||
280 | switch(format) | 280 | switch(format) |
281 | { | 281 | { |
282 | case 0: /* Auto */ | 282 | case 0: /* Auto */ |
@@ -302,7 +302,7 @@ static void pms_format(short format) | |||
302 | 302 | ||
303 | /* | 303 | /* |
304 | * These features of the PMS card are not currently exposes. They | 304 | * These features of the PMS card are not currently exposes. They |
305 | * could become a private v4l ioctl for PMSCONFIG or somesuch if | 305 | * could become a private v4l ioctl for PMSCONFIG or somesuch if |
306 | * people need it. We also don't yet use the PMS interrupt. | 306 | * people need it. We also don't yet use the PMS interrupt. |
307 | */ | 307 | */ |
308 | 308 | ||
@@ -324,7 +324,7 @@ static void pms_hstart(short start) | |||
324 | /* | 324 | /* |
325 | * Bandpass filters | 325 | * Bandpass filters |
326 | */ | 326 | */ |
327 | 327 | ||
328 | static void pms_bandpass(short pass) | 328 | static void pms_bandpass(short pass) |
329 | { | 329 | { |
330 | if(decoder==PHILIPS2) | 330 | if(decoder==PHILIPS2) |
@@ -493,7 +493,7 @@ static void pms_vert(u8 deciden, u8 decinum) | |||
493 | /* | 493 | /* |
494 | * Turn 16bit ratios into best small ratio the chipset can grok | 494 | * Turn 16bit ratios into best small ratio the chipset can grok |
495 | */ | 495 | */ |
496 | 496 | ||
497 | static void pms_vertdeci(unsigned short decinum, unsigned short deciden) | 497 | static void pms_vertdeci(unsigned short decinum, unsigned short deciden) |
498 | { | 498 | { |
499 | /* Knock it down by /5 once */ | 499 | /* Knock it down by /5 once */ |
@@ -546,7 +546,7 @@ static void pms_horzdeci(short decinum, short deciden) | |||
546 | decinum=512; | 546 | decinum=512; |
547 | deciden=640; /* 768 would be ideal */ | 547 | deciden=640; /* 768 would be ideal */ |
548 | } | 548 | } |
549 | 549 | ||
550 | while(((decinum|deciden)&1)==0) | 550 | while(((decinum|deciden)&1)==0) |
551 | { | 551 | { |
552 | decinum>>=1; | 552 | decinum>>=1; |
@@ -559,7 +559,7 @@ static void pms_horzdeci(short decinum, short deciden) | |||
559 | } | 559 | } |
560 | if(deciden==32) | 560 | if(deciden==32) |
561 | deciden--; | 561 | deciden--; |
562 | 562 | ||
563 | mvv_write(0x24, 0x80|deciden); | 563 | mvv_write(0x24, 0x80|deciden); |
564 | mvv_write(0x25, decinum); | 564 | mvv_write(0x25, decinum); |
565 | } | 565 | } |
@@ -567,14 +567,14 @@ static void pms_horzdeci(short decinum, short deciden) | |||
567 | static void pms_resolution(short width, short height) | 567 | static void pms_resolution(short width, short height) |
568 | { | 568 | { |
569 | int fg_height; | 569 | int fg_height; |
570 | 570 | ||
571 | fg_height=height; | 571 | fg_height=height; |
572 | if(fg_height>280) | 572 | if(fg_height>280) |
573 | fg_height=280; | 573 | fg_height=280; |
574 | 574 | ||
575 | mvv_write(0x18, fg_height); | 575 | mvv_write(0x18, fg_height); |
576 | mvv_write(0x19, fg_height>>8); | 576 | mvv_write(0x19, fg_height>>8); |
577 | 577 | ||
578 | if(standard==1) | 578 | if(standard==1) |
579 | { | 579 | { |
580 | mvv_write(0x1A, 0xFC); | 580 | mvv_write(0x1A, 0xFC); |
@@ -598,7 +598,7 @@ static void pms_resolution(short width, short height) | |||
598 | mvv_write(0x42, 0x00); | 598 | mvv_write(0x42, 0x00); |
599 | mvv_write(0x43, 0x00); | 599 | mvv_write(0x43, 0x00); |
600 | mvv_write(0x44, MVVMEMORYWIDTH); | 600 | mvv_write(0x44, MVVMEMORYWIDTH); |
601 | 601 | ||
602 | mvv_write(0x22, width+8); | 602 | mvv_write(0x22, width+8); |
603 | mvv_write(0x23, (width+8)>> 8); | 603 | mvv_write(0x23, (width+8)>> 8); |
604 | 604 | ||
@@ -618,7 +618,7 @@ static void pms_resolution(short width, short height) | |||
618 | /* | 618 | /* |
619 | * Set Input | 619 | * Set Input |
620 | */ | 620 | */ |
621 | 621 | ||
622 | static void pms_vcrinput(short input) | 622 | static void pms_vcrinput(short input) |
623 | { | 623 | { |
624 | if(decoder==PHILIPS2) | 624 | if(decoder==PHILIPS2) |
@@ -643,20 +643,20 @@ static int pms_capture(struct pms_device *dev, char __user *buf, int rgb555, int | |||
643 | mvv_write(0x08,r8); /* capture rgb555/565, init DRAM, PC enable */ | 643 | mvv_write(0x08,r8); /* capture rgb555/565, init DRAM, PC enable */ |
644 | 644 | ||
645 | /* printf("%d %d %d %d %d %x %x\n",width,height,voff,nom,den,mvv_buf); */ | 645 | /* printf("%d %d %d %d %d %x %x\n",width,height,voff,nom,den,mvv_buf); */ |
646 | 646 | ||
647 | for (y = 0; y < dev->height; y++ ) | 647 | for (y = 0; y < dev->height; y++ ) |
648 | { | 648 | { |
649 | writeb(0, mem); /* synchronisiert neue Zeile */ | 649 | writeb(0, mem); /* synchronisiert neue Zeile */ |
650 | 650 | ||
651 | /* | 651 | /* |
652 | * This is in truth a fifo, be very careful as if you | 652 | * This is in truth a fifo, be very careful as if you |
653 | * forgot this odd things will occur 8) | 653 | * forgot this odd things will occur 8) |
654 | */ | 654 | */ |
655 | 655 | ||
656 | memcpy_fromio(tmp, mem, dw+32); /* discard 16 word */ | 656 | memcpy_fromio(tmp, mem, dw+32); /* discard 16 word */ |
657 | cnt -= dev->height; | 657 | cnt -= dev->height; |
658 | while (cnt <= 0) | 658 | while (cnt <= 0) |
659 | { | 659 | { |
660 | /* | 660 | /* |
661 | * Don't copy too far | 661 | * Don't copy too far |
662 | */ | 662 | */ |
@@ -666,7 +666,7 @@ static int pms_capture(struct pms_device *dev, char __user *buf, int rgb555, int | |||
666 | cnt += dev->height; | 666 | cnt += dev->height; |
667 | if (copy_to_user(buf, tmp+32, dt)) | 667 | if (copy_to_user(buf, tmp+32, dt)) |
668 | return len ? len : -EFAULT; | 668 | return len ? len : -EFAULT; |
669 | buf += dt; | 669 | buf += dt; |
670 | len += dt; | 670 | len += dt; |
671 | } | 671 | } |
672 | } | 672 | } |
@@ -683,7 +683,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, | |||
683 | { | 683 | { |
684 | struct video_device *dev = video_devdata(file); | 684 | struct video_device *dev = video_devdata(file); |
685 | struct pms_device *pd=(struct pms_device *)dev; | 685 | struct pms_device *pd=(struct pms_device *)dev; |
686 | 686 | ||
687 | switch(cmd) | 687 | switch(cmd) |
688 | { | 688 | { |
689 | case VIDIOCGCAP: | 689 | case VIDIOCGCAP: |
@@ -806,7 +806,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, | |||
806 | ||(p->palette==VIDEO_PALETTE_RGB555 && p->depth==15))) | 806 | ||(p->palette==VIDEO_PALETTE_RGB555 && p->depth==15))) |
807 | return -EINVAL; | 807 | return -EINVAL; |
808 | pd->picture= *p; | 808 | pd->picture= *p; |
809 | 809 | ||
810 | /* | 810 | /* |
811 | * Now load the card. | 811 | * Now load the card. |
812 | */ | 812 | */ |
@@ -815,7 +815,7 @@ static int pms_do_ioctl(struct inode *inode, struct file *file, | |||
815 | pms_brightness(p->brightness>>8); | 815 | pms_brightness(p->brightness>>8); |
816 | pms_hue(p->hue>>8); | 816 | pms_hue(p->hue>>8); |
817 | pms_colour(p->colour>>8); | 817 | pms_colour(p->colour>>8); |
818 | pms_contrast(p->contrast>>8); | 818 | pms_contrast(p->contrast>>8); |
819 | mutex_unlock(&pd->lock); | 819 | mutex_unlock(&pd->lock); |
820 | return 0; | 820 | return 0; |
821 | } | 821 | } |
@@ -873,7 +873,7 @@ static ssize_t pms_read(struct file *file, char __user *buf, | |||
873 | struct video_device *v = video_devdata(file); | 873 | struct video_device *v = video_devdata(file); |
874 | struct pms_device *pd=(struct pms_device *)v; | 874 | struct pms_device *pd=(struct pms_device *)v; |
875 | int len; | 875 | int len; |
876 | 876 | ||
877 | mutex_lock(&pd->lock); | 877 | mutex_lock(&pd->lock); |
878 | len=pms_capture(pd, buf, (pd->picture.depth==16)?0:1,count); | 878 | len=pms_capture(pd, buf, (pd->picture.depth==16)?0:1,count); |
879 | mutex_unlock(&pd->lock); | 879 | mutex_unlock(&pd->lock); |
@@ -905,13 +905,13 @@ static struct pms_device pms_device; | |||
905 | /* | 905 | /* |
906 | * Probe for and initialise the Mediavision PMS | 906 | * Probe for and initialise the Mediavision PMS |
907 | */ | 907 | */ |
908 | 908 | ||
909 | static int init_mediavision(void) | 909 | static int init_mediavision(void) |
910 | { | 910 | { |
911 | int id; | 911 | int id; |
912 | int idec, decst; | 912 | int idec, decst; |
913 | int i; | 913 | int i; |
914 | 914 | ||
915 | unsigned char i2c_defs[]={ | 915 | unsigned char i2c_defs[]={ |
916 | 0x4C,0x30,0x00,0xE8, | 916 | 0x4C,0x30,0x00,0xE8, |
917 | 0xB6,0xE2,0x00,0x00, | 917 | 0xB6,0xE2,0x00,0x00, |
@@ -925,7 +925,7 @@ static int init_mediavision(void) | |||
925 | mem = ioremap(mem_base, 0x800); | 925 | mem = ioremap(mem_base, 0x800); |
926 | if (!mem) | 926 | if (!mem) |
927 | return -ENOMEM; | 927 | return -ENOMEM; |
928 | 928 | ||
929 | if (!request_region(0x9A01, 1, "Mediavision PMS config")) | 929 | if (!request_region(0x9A01, 1, "Mediavision PMS config")) |
930 | { | 930 | { |
931 | printk(KERN_WARNING "mediavision: unable to detect: 0x9A01 in use.\n"); | 931 | printk(KERN_WARNING "mediavision: unable to detect: 0x9A01 in use.\n"); |
@@ -941,18 +941,18 @@ static int init_mediavision(void) | |||
941 | } | 941 | } |
942 | outb(0xB8, 0x9A01); /* Unlock */ | 942 | outb(0xB8, 0x9A01); /* Unlock */ |
943 | outb(io_port>>4, 0x9A01); /* Set IO port */ | 943 | outb(io_port>>4, 0x9A01); /* Set IO port */ |
944 | 944 | ||
945 | 945 | ||
946 | id=mvv_read(3); | 946 | id=mvv_read(3); |
947 | decst=pms_i2c_stat(0x43); | 947 | decst=pms_i2c_stat(0x43); |
948 | 948 | ||
949 | if(decst!=-1) | 949 | if(decst!=-1) |
950 | idec=2; | 950 | idec=2; |
951 | else if(pms_i2c_stat(0xb9)!=-1) | 951 | else if(pms_i2c_stat(0xb9)!=-1) |
952 | idec=3; | 952 | idec=3; |
953 | else if(pms_i2c_stat(0x8b)!=-1) | 953 | else if(pms_i2c_stat(0x8b)!=-1) |
954 | idec=1; | 954 | idec=1; |
955 | else | 955 | else |
956 | idec=0; | 956 | idec=0; |
957 | 957 | ||
958 | printk(KERN_INFO "PMS type is %d\n", idec); | 958 | printk(KERN_INFO "PMS type is %d\n", idec); |
@@ -966,11 +966,11 @@ static int init_mediavision(void) | |||
966 | /* | 966 | /* |
967 | * Ok we have a PMS of some sort | 967 | * Ok we have a PMS of some sort |
968 | */ | 968 | */ |
969 | 969 | ||
970 | mvv_write(0x04, mem_base>>12); /* Set the memory area */ | 970 | mvv_write(0x04, mem_base>>12); /* Set the memory area */ |
971 | 971 | ||
972 | /* Ok now load the defaults */ | 972 | /* Ok now load the defaults */ |
973 | 973 | ||
974 | for(i=0;i<0x19;i++) | 974 | for(i=0;i<0x19;i++) |
975 | { | 975 | { |
976 | if(i2c_defs[i]==0xFF) | 976 | if(i2c_defs[i]==0xFF) |
@@ -978,7 +978,7 @@ static int init_mediavision(void) | |||
978 | else | 978 | else |
979 | pms_i2c_write(0x8A, i, i2c_defs[i]); | 979 | pms_i2c_write(0x8A, i, i2c_defs[i]); |
980 | } | 980 | } |
981 | 981 | ||
982 | pms_i2c_write(0xB8,0x00,0x12); | 982 | pms_i2c_write(0xB8,0x00,0x12); |
983 | pms_i2c_write(0xB8,0x04,0x00); | 983 | pms_i2c_write(0xB8,0x04,0x00); |
984 | pms_i2c_write(0xB8,0x07,0x00); | 984 | pms_i2c_write(0xB8,0x07,0x00); |
@@ -987,18 +987,18 @@ static int init_mediavision(void) | |||
987 | pms_i2c_write(0xB8,0x0A,0x00); | 987 | pms_i2c_write(0xB8,0x0A,0x00); |
988 | pms_i2c_write(0xB8,0x0B,0x10); | 988 | pms_i2c_write(0xB8,0x0B,0x10); |
989 | pms_i2c_write(0xB8,0x10,0x03); | 989 | pms_i2c_write(0xB8,0x10,0x03); |
990 | 990 | ||
991 | mvv_write(0x01, 0x00); | 991 | mvv_write(0x01, 0x00); |
992 | mvv_write(0x05, 0xA0); | 992 | mvv_write(0x05, 0xA0); |
993 | mvv_write(0x08, 0x25); | 993 | mvv_write(0x08, 0x25); |
994 | mvv_write(0x09, 0x00); | 994 | mvv_write(0x09, 0x00); |
995 | mvv_write(0x0A, 0x20|MVVMEMORYWIDTH); | 995 | mvv_write(0x0A, 0x20|MVVMEMORYWIDTH); |
996 | 996 | ||
997 | mvv_write(0x10, 0x02); | 997 | mvv_write(0x10, 0x02); |
998 | mvv_write(0x1E, 0x0C); | 998 | mvv_write(0x1E, 0x0C); |
999 | mvv_write(0x1F, 0x03); | 999 | mvv_write(0x1F, 0x03); |
1000 | mvv_write(0x26, 0x06); | 1000 | mvv_write(0x26, 0x06); |
1001 | 1001 | ||
1002 | mvv_write(0x2B, 0x00); | 1002 | mvv_write(0x2B, 0x00); |
1003 | mvv_write(0x2C, 0x20); | 1003 | mvv_write(0x2C, 0x20); |
1004 | mvv_write(0x2D, 0x00); | 1004 | mvv_write(0x2D, 0x00); |
@@ -1018,13 +1018,13 @@ static int init_mediavision(void) | |||
1018 | /* | 1018 | /* |
1019 | * Initialization and module stuff | 1019 | * Initialization and module stuff |
1020 | */ | 1020 | */ |
1021 | 1021 | ||
1022 | static int __init init_pms_cards(void) | 1022 | static int __init init_pms_cards(void) |
1023 | { | 1023 | { |
1024 | printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n"); | 1024 | printk(KERN_INFO "Mediavision Pro Movie Studio driver 0.02\n"); |
1025 | 1025 | ||
1026 | data_port = io_port +1; | 1026 | data_port = io_port +1; |
1027 | 1027 | ||
1028 | if(init_mediavision()) | 1028 | if(init_mediavision()) |
1029 | { | 1029 | { |
1030 | printk(KERN_INFO "Board not found.\n"); | 1030 | printk(KERN_INFO "Board not found.\n"); |
diff --git a/drivers/usb/media/pwc/Makefile b/drivers/media/video/pwc/Makefile index 2d93a775011a..8326684f49f3 100644 --- a/drivers/usb/media/pwc/Makefile +++ b/drivers/media/video/pwc/Makefile | |||
@@ -15,6 +15,6 @@ default: | |||
15 | endif | 15 | endif |
16 | 16 | ||
17 | clean: | 17 | clean: |
18 | rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c | 18 | rm -f *.[oas] .*.flags *.ko .*.cmd .*.d .*.tmp *.mod.c |
19 | rm -rf .tmp_versions | 19 | rm -rf .tmp_versions |
20 | 20 | ||
diff --git a/drivers/usb/media/pwc/philips.txt b/drivers/media/video/pwc/philips.txt index 04a640d723ed..11f751a6bda5 100644 --- a/drivers/usb/media/pwc/philips.txt +++ b/drivers/media/video/pwc/philips.txt | |||
@@ -47,17 +47,17 @@ don't know how to set it properly in the driver. The options are: | |||
47 | size | 47 | size |
48 | Can be one of 'sqcif', 'qsif', 'qcif', 'sif', 'cif' or | 48 | Can be one of 'sqcif', 'qsif', 'qcif', 'sif', 'cif' or |
49 | 'vga', for an image size of resp. 128x96, 160x120, 176x144, | 49 | 'vga', for an image size of resp. 128x96, 160x120, 176x144, |
50 | 320x240, 352x288 and 640x480 (of course, only for those cameras that | 50 | 320x240, 352x288 and 640x480 (of course, only for those cameras that |
51 | support these resolutions). | 51 | support these resolutions). |
52 | 52 | ||
53 | fps | 53 | fps |
54 | Specifies the desired framerate. Is an integer in the range of 4-30. | 54 | Specifies the desired framerate. Is an integer in the range of 4-30. |
55 | 55 | ||
56 | fbufs | 56 | fbufs |
57 | This paramter specifies the number of internal buffers to use for storing | 57 | This paramter specifies the number of internal buffers to use for storing |
58 | frames from the cam. This will help if the process that reads images from | 58 | frames from the cam. This will help if the process that reads images from |
59 | the cam is a bit slow or momentarely busy. However, on slow machines it | 59 | the cam is a bit slow or momentarely busy. However, on slow machines it |
60 | only introduces lag, so choose carefully. The default is 3, which is | 60 | only introduces lag, so choose carefully. The default is 3, which is |
61 | reasonable. You can set it between 2 and 5. | 61 | reasonable. You can set it between 2 and 5. |
62 | 62 | ||
63 | mbufs | 63 | mbufs |
@@ -65,9 +65,9 @@ mbufs | |||
65 | buffers to reserve for mmap(), VIDIOCCGMBUF, VIDIOCMCAPTURE and friends. | 65 | buffers to reserve for mmap(), VIDIOCCGMBUF, VIDIOCMCAPTURE and friends. |
66 | The default is 2, which is adequate for most applications (double | 66 | The default is 2, which is adequate for most applications (double |
67 | buffering). | 67 | buffering). |
68 | 68 | ||
69 | Should you experience a lot of 'Dumping frame...' messages during | 69 | Should you experience a lot of 'Dumping frame...' messages during |
70 | grabbing with a tool that uses mmap(), you might want to increase if. | 70 | grabbing with a tool that uses mmap(), you might want to increase if. |
71 | However, it doesn't really buffer images, it just gives you a bit more | 71 | However, it doesn't really buffer images, it just gives you a bit more |
72 | slack when your program is behind. But you need a multi-threaded or | 72 | slack when your program is behind. But you need a multi-threaded or |
73 | forked program to really take advantage of these buffers. | 73 | forked program to really take advantage of these buffers. |
@@ -88,15 +88,15 @@ power_save | |||
88 | 88 | ||
89 | compression (only useful with the plugin) | 89 | compression (only useful with the plugin) |
90 | With this option you can control the compression factor that the camera | 90 | With this option you can control the compression factor that the camera |
91 | uses to squeeze the image through the USB bus. You can set the | 91 | uses to squeeze the image through the USB bus. You can set the |
92 | parameter between 0 and 3: | 92 | parameter between 0 and 3: |
93 | 0 = prefer uncompressed images; if the requested mode is not available | 93 | 0 = prefer uncompressed images; if the requested mode is not available |
94 | in an uncompressed format, the driver will silently switch to low | 94 | in an uncompressed format, the driver will silently switch to low |
95 | compression. | 95 | compression. |
96 | 1 = low compression. | 96 | 1 = low compression. |
97 | 2 = medium compression. | 97 | 2 = medium compression. |
98 | 3 = high compression. | 98 | 3 = high compression. |
99 | 99 | ||
100 | High compression takes less bandwidth of course, but it could also | 100 | High compression takes less bandwidth of course, but it could also |
101 | introduce some unwanted artefacts. The default is 2, medium compression. | 101 | introduce some unwanted artefacts. The default is 2, medium compression. |
102 | See the FAQ on the website for an overview of which modes require | 102 | See the FAQ on the website for an overview of which modes require |
@@ -112,7 +112,7 @@ leds | |||
112 | this is let the LED blink while the camera is in use. This: | 112 | this is let the LED blink while the camera is in use. This: |
113 | 113 | ||
114 | leds=500,500 | 114 | leds=500,500 |
115 | 115 | ||
116 | will blink the LED once every second. But with: | 116 | will blink the LED once every second. But with: |
117 | 117 | ||
118 | leds=0,0 | 118 | leds=0,0 |
@@ -123,7 +123,7 @@ leds | |||
123 | when the camera is not used anymore. | 123 | when the camera is not used anymore. |
124 | 124 | ||
125 | This parameter works only with the ToUCam range of cameras (720, 730, 740, | 125 | This parameter works only with the ToUCam range of cameras (720, 730, 740, |
126 | 750) and OEMs. For other cameras this command is silently ignored, and | 126 | 750) and OEMs. For other cameras this command is silently ignored, and |
127 | the LED cannot be controlled. | 127 | the LED cannot be controlled. |
128 | 128 | ||
129 | Finally: this parameters does not take effect UNTIL the first time you | 129 | Finally: this parameters does not take effect UNTIL the first time you |
@@ -144,35 +144,35 @@ dev_hint | |||
144 | format: | 144 | format: |
145 | 145 | ||
146 | [type[.serialnumber]:]node | 146 | [type[.serialnumber]:]node |
147 | 147 | ||
148 | The square brackets mean that both the type and the serialnumber are | 148 | The square brackets mean that both the type and the serialnumber are |
149 | optional, but a serialnumber cannot be specified without a type (which | 149 | optional, but a serialnumber cannot be specified without a type (which |
150 | would be rather pointless). The serialnumber is separated from the type | 150 | would be rather pointless). The serialnumber is separated from the type |
151 | by a '.'; the node number by a ':'. | 151 | by a '.'; the node number by a ':'. |
152 | 152 | ||
153 | This somewhat cryptic syntax is best explained by a few examples: | 153 | This somewhat cryptic syntax is best explained by a few examples: |
154 | 154 | ||
155 | dev_hint=3,5 The first detected cam gets assigned | 155 | dev_hint=3,5 The first detected cam gets assigned |
156 | /dev/video3, the second /dev/video5. Any | 156 | /dev/video3, the second /dev/video5. Any |
157 | other cameras will get the first free | 157 | other cameras will get the first free |
158 | available slot (see below). | 158 | available slot (see below). |
159 | 159 | ||
160 | dev_hint=645:1,680:2 The PCA645 camera will get /dev/video1, | 160 | dev_hint=645:1,680:2 The PCA645 camera will get /dev/video1, |
161 | and a PCVC680 /dev/video2. | 161 | and a PCVC680 /dev/video2. |
162 | 162 | ||
163 | dev_hint=645.0123:3,645.4567:0 The PCA645 camera with serialnumber | 163 | dev_hint=645.0123:3,645.4567:0 The PCA645 camera with serialnumber |
164 | 0123 goes to /dev/video3, the same | 164 | 0123 goes to /dev/video3, the same |
165 | camera model with the 4567 serial | 165 | camera model with the 4567 serial |
166 | gets /dev/video0. | 166 | gets /dev/video0. |
167 | 167 | ||
168 | dev_hint=750:1,4,5,6 The PCVC750 camera will get /dev/video1, the | 168 | dev_hint=750:1,4,5,6 The PCVC750 camera will get /dev/video1, the |
169 | next 3 Philips cams will use /dev/video4 | 169 | next 3 Philips cams will use /dev/video4 |
170 | through /dev/video6. | 170 | through /dev/video6. |
171 | 171 | ||
172 | Some points worth knowing: | 172 | Some points worth knowing: |
173 | - Serialnumbers are case sensitive and must be written full, including | 173 | - Serialnumbers are case sensitive and must be written full, including |
174 | leading zeroes (it's treated as a string). | 174 | leading zeroes (it's treated as a string). |
175 | - If a device node is already occupied, registration will fail and | 175 | - If a device node is already occupied, registration will fail and |
176 | the webcam is not available. | 176 | the webcam is not available. |
177 | - You can have up to 64 video devices; be sure to make enough device | 177 | - You can have up to 64 video devices; be sure to make enough device |
178 | nodes in /dev if you want to spread the numbers (this does not apply | 178 | nodes in /dev if you want to spread the numbers (this does not apply |
@@ -186,13 +186,13 @@ trace | |||
186 | kernel log at debug level. | 186 | kernel log at debug level. |
187 | 187 | ||
188 | The trace variable is a bitmask; each bit represents a certain feature. | 188 | The trace variable is a bitmask; each bit represents a certain feature. |
189 | If you want to trace something, look up the bit value(s) in the table | 189 | If you want to trace something, look up the bit value(s) in the table |
190 | below, add the values together and supply that to the trace variable. | 190 | below, add the values together and supply that to the trace variable. |
191 | 191 | ||
192 | Value Value Description Default | 192 | Value Value Description Default |
193 | (dec) (hex) | 193 | (dec) (hex) |
194 | 1 0x1 Module initialization; this will log messages On | 194 | 1 0x1 Module initialization; this will log messages On |
195 | while loading and unloading the module | 195 | while loading and unloading the module |
196 | 196 | ||
197 | 2 0x2 probe() and disconnect() traces On | 197 | 2 0x2 probe() and disconnect() traces On |
198 | 198 | ||
@@ -203,7 +203,7 @@ trace | |||
203 | 16 0x10 Memory allocation of buffers, etc. Off | 203 | 16 0x10 Memory allocation of buffers, etc. Off |
204 | 204 | ||
205 | 32 0x20 Showing underflow, overflow and Dumping frame On | 205 | 32 0x20 Showing underflow, overflow and Dumping frame On |
206 | messages | 206 | messages |
207 | 207 | ||
208 | 64 0x40 Show viewport and image sizes Off | 208 | 64 0x40 Show viewport and image sizes Off |
209 | 209 | ||
@@ -217,7 +217,7 @@ trace | |||
217 | 217 | ||
218 | 218 | ||
219 | Example: | 219 | Example: |
220 | 220 | ||
221 | # modprobe pwc size=cif fps=15 power_save=1 | 221 | # modprobe pwc size=cif fps=15 power_save=1 |
222 | 222 | ||
223 | The fbufs, mbufs and trace parameters are global and apply to all connected | 223 | The fbufs, mbufs and trace parameters are global and apply to all connected |
diff --git a/drivers/usb/media/pwc/pwc-ctrl.c b/drivers/media/video/pwc/pwc-ctrl.c index 0398b812e0ce..4ba549bfa0e0 100644 --- a/drivers/usb/media/pwc/pwc-ctrl.c +++ b/drivers/media/video/pwc/pwc-ctrl.c | |||
@@ -31,17 +31,17 @@ | |||
31 | 31 | ||
32 | /* | 32 | /* |
33 | Changes | 33 | Changes |
34 | 2001/08/03 Alvarado Added methods for changing white balance and | 34 | 2001/08/03 Alvarado Added methods for changing white balance and |
35 | red/green gains | 35 | red/green gains |
36 | */ | 36 | */ |
37 | 37 | ||
38 | /* Control functions for the cam; brightness, contrast, video mode, etc. */ | 38 | /* Control functions for the cam; brightness, contrast, video mode, etc. */ |
39 | 39 | ||
40 | #ifdef __KERNEL__ | 40 | #ifdef __KERNEL__ |
41 | #include <asm/uaccess.h> | 41 | #include <asm/uaccess.h> |
42 | #endif | 42 | #endif |
43 | #include <asm/errno.h> | 43 | #include <asm/errno.h> |
44 | 44 | ||
45 | #include "pwc.h" | 45 | #include "pwc.h" |
46 | #include "pwc-ioctl.h" | 46 | #include "pwc-ioctl.h" |
47 | #include "pwc-uncompress.h" | 47 | #include "pwc-uncompress.h" |
@@ -116,13 +116,13 @@ static const char *size2name[PSZ_MAX] = | |||
116 | "SIF", | 116 | "SIF", |
117 | "CIF", | 117 | "CIF", |
118 | "VGA", | 118 | "VGA", |
119 | }; | 119 | }; |
120 | 120 | ||
121 | /********/ | 121 | /********/ |
122 | 122 | ||
123 | /* Entries for the Nala (645/646) camera; the Nala doesn't have compression | 123 | /* Entries for the Nala (645/646) camera; the Nala doesn't have compression |
124 | preferences, so you either get compressed or non-compressed streams. | 124 | preferences, so you either get compressed or non-compressed streams. |
125 | 125 | ||
126 | An alternate value of 0 means this mode is not available at all. | 126 | An alternate value of 0 means this mode is not available at all. |
127 | */ | 127 | */ |
128 | 128 | ||
@@ -205,13 +205,13 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra | |||
205 | { /* closest match of framerate */ | 205 | { /* closest match of framerate */ |
206 | 0, 0, 0, 0, 4, /* 0-4 */ | 206 | 0, 0, 0, 0, 4, /* 0-4 */ |
207 | 5, 5, 7, 7, 10, /* 5-9 */ | 207 | 5, 5, 7, 7, 10, /* 5-9 */ |
208 | 10, 10, 12, 12, 15, /* 10-14 */ | 208 | 10, 10, 12, 12, 15, /* 10-14 */ |
209 | 15, 15, 15, 20, 20, /* 15-19 */ | 209 | 15, 15, 15, 20, 20, /* 15-19 */ |
210 | 20, 20, 20, 24, 24, /* 20-24 */ | 210 | 20, 20, 20, 24, 24, /* 20-24 */ |
211 | 24, 24, 24, 24, 24, /* 25-29 */ | 211 | 24, 24, 24, 24, 24, /* 25-29 */ |
212 | 24 /* 30 */ | 212 | 24 /* 30 */ |
213 | }; | 213 | }; |
214 | int frames2table[31] = | 214 | int frames2table[31] = |
215 | { 0, 0, 0, 0, 0, /* 0-4 */ | 215 | { 0, 0, 0, 0, 0, /* 0-4 */ |
216 | 1, 1, 1, 2, 2, /* 5-9 */ | 216 | 1, 1, 1, 2, 2, /* 5-9 */ |
217 | 3, 3, 4, 4, 4, /* 10-14 */ | 217 | 3, 3, 4, 4, 4, /* 10-14 */ |
@@ -220,7 +220,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra | |||
220 | 7, 7, 7, 7, 7, /* 25-29 */ | 220 | 7, 7, 7, 7, 7, /* 25-29 */ |
221 | 7 /* 30 */ | 221 | 7 /* 30 */ |
222 | }; | 222 | }; |
223 | 223 | ||
224 | if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25) | 224 | if (size < 0 || size > PSZ_CIF || frames < 4 || frames > 25) |
225 | return -EINVAL; | 225 | return -EINVAL; |
226 | frames = frames2frames[frames]; | 226 | frames = frames2frames[frames]; |
@@ -232,7 +232,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra | |||
232 | if (pEntry->compressed) | 232 | if (pEntry->compressed) |
233 | return -ENOENT; /* Not supported. */ | 233 | return -ENOENT; /* Not supported. */ |
234 | 234 | ||
235 | memcpy(buf, pEntry->mode, 3); | 235 | memcpy(buf, pEntry->mode, 3); |
236 | ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 3); | 236 | ret = send_video_command(pdev->udev, pdev->vendpoint, buf, 3); |
237 | if (ret < 0) { | 237 | if (ret < 0) { |
238 | Debug("Failed to send video command... %d\n", ret); | 238 | Debug("Failed to send video command... %d\n", ret); |
@@ -257,7 +257,7 @@ static inline int set_video_mode_Nala(struct pwc_device *pdev, int size, int fra | |||
257 | break; | 257 | break; |
258 | } | 258 | } |
259 | } | 259 | } |
260 | 260 | ||
261 | pdev->cmd_len = 3; | 261 | pdev->cmd_len = 3; |
262 | memcpy(pdev->cmd_buf, buf, 3); | 262 | memcpy(pdev->cmd_buf, buf, 3); |
263 | 263 | ||
@@ -352,13 +352,13 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr | |||
352 | /* special case: VGA @ 5 fps and snapshot is raw bayer mode */ | 352 | /* special case: VGA @ 5 fps and snapshot is raw bayer mode */ |
353 | if (size == PSZ_VGA && frames == 5 && snapshot) | 353 | if (size == PSZ_VGA && frames == 5 && snapshot) |
354 | { | 354 | { |
355 | /* Only available in case the raw palette is selected or | 355 | /* Only available in case the raw palette is selected or |
356 | we have the decompressor available. This mode is | 356 | we have the decompressor available. This mode is |
357 | only available in compressed form | 357 | only available in compressed form |
358 | */ | 358 | */ |
359 | if (pdev->vpalette == VIDEO_PALETTE_RAW) | 359 | if (pdev->vpalette == VIDEO_PALETTE_RAW) |
360 | { | 360 | { |
361 | Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette); | 361 | Info("Choosing VGA/5 BAYER mode (%d).\n", pdev->vpalette); |
362 | pChoose = &RawEntry; | 362 | pChoose = &RawEntry; |
363 | } | 363 | } |
364 | else | 364 | else |
@@ -368,9 +368,9 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr | |||
368 | } | 368 | } |
369 | else | 369 | else |
370 | { | 370 | { |
371 | /* Find a supported framerate with progressively higher compression ratios | 371 | /* Find a supported framerate with progressively higher compression ratios |
372 | if the preferred ratio is not available. | 372 | if the preferred ratio is not available. |
373 | Skip this step when using RAW modes. | 373 | Skip this step when using RAW modes. |
374 | */ | 374 | */ |
375 | while (compression <= 3) { | 375 | while (compression <= 3) { |
376 | pChoose = &Kiara_table[size][fps][compression]; | 376 | pChoose = &Kiara_table[size][fps][compression]; |
@@ -383,7 +383,7 @@ static inline int set_video_mode_Kiara(struct pwc_device *pdev, int size, int fr | |||
383 | return -ENOENT; /* Not supported. */ | 383 | return -ENOENT; /* Not supported. */ |
384 | 384 | ||
385 | Debug("Using alternate setting %d.\n", pChoose->alternate); | 385 | Debug("Using alternate setting %d.\n", pChoose->alternate); |
386 | 386 | ||
387 | /* usb_control_msg won't take staticly allocated arrays as argument?? */ | 387 | /* usb_control_msg won't take staticly allocated arrays as argument?? */ |
388 | memcpy(buf, pChoose->mode, 12); | 388 | memcpy(buf, pChoose->mode, 12); |
389 | if (snapshot) | 389 | if (snapshot) |
@@ -463,9 +463,9 @@ static void pwc_set_image_buffer_size(struct pwc_device *pdev) | |||
463 | */ | 463 | */ |
464 | int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot) | 464 | int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frames, int compression, int snapshot) |
465 | { | 465 | { |
466 | int ret, size; | 466 | int ret, size; |
467 | 467 | ||
468 | Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette); | 468 | Trace(TRACE_FLOW, "set_video_mode(%dx%d @ %d, palette %d).\n", width, height, frames, pdev->vpalette); |
469 | size = pwc_decode_size(pdev, width, height); | 469 | size = pwc_decode_size(pdev, width, height); |
470 | if (size < 0) { | 470 | if (size < 0) { |
471 | Debug("Could not find suitable size.\n"); | 471 | Debug("Could not find suitable size.\n"); |
@@ -473,7 +473,7 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame | |||
473 | } | 473 | } |
474 | Debug("decode_size = %d.\n", size); | 474 | Debug("decode_size = %d.\n", size); |
475 | 475 | ||
476 | ret = -EINVAL; | 476 | ret = -EINVAL; |
477 | switch(pdev->type) { | 477 | switch(pdev->type) { |
478 | case 645: | 478 | case 645: |
479 | case 646: | 479 | case 646: |
@@ -485,7 +485,7 @@ int pwc_set_video_mode(struct pwc_device *pdev, int width, int height, int frame | |||
485 | case 690: | 485 | case 690: |
486 | ret = set_video_mode_Timon(pdev, size, frames, compression, snapshot); | 486 | ret = set_video_mode_Timon(pdev, size, frames, compression, snapshot); |
487 | break; | 487 | break; |
488 | 488 | ||
489 | case 720: | 489 | case 720: |
490 | case 730: | 490 | case 730: |
491 | case 740: | 491 | case 740: |
@@ -517,7 +517,7 @@ int pwc_get_brightness(struct pwc_device *pdev) | |||
517 | char buf; | 517 | char buf; |
518 | int ret; | 518 | int ret; |
519 | 519 | ||
520 | ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1); | 520 | ret = RecvControlMsg(GET_LUM_CTL, BRIGHTNESS_FORMATTER, 1); |
521 | if (ret < 0) | 521 | if (ret < 0) |
522 | return ret; | 522 | return ret; |
523 | return buf << 9; | 523 | return buf << 9; |
@@ -566,7 +566,7 @@ int pwc_get_gamma(struct pwc_device *pdev) | |||
566 | { | 566 | { |
567 | char buf; | 567 | char buf; |
568 | int ret; | 568 | int ret; |
569 | 569 | ||
570 | ret = RecvControlMsg(GET_LUM_CTL, GAMMA_FORMATTER, 1); | 570 | ret = RecvControlMsg(GET_LUM_CTL, GAMMA_FORMATTER, 1); |
571 | if (ret < 0) | 571 | if (ret < 0) |
572 | return ret; | 572 | return ret; |
@@ -622,14 +622,14 @@ static inline int pwc_set_agc(struct pwc_device *pdev, int mode, int value) | |||
622 | { | 622 | { |
623 | char buf; | 623 | char buf; |
624 | int ret; | 624 | int ret; |
625 | 625 | ||
626 | if (mode) | 626 | if (mode) |
627 | buf = 0x0; /* auto */ | 627 | buf = 0x0; /* auto */ |
628 | else | 628 | else |
629 | buf = 0xff; /* fixed */ | 629 | buf = 0xff; /* fixed */ |
630 | 630 | ||
631 | ret = SendControlMsg(SET_LUM_CTL, AGC_MODE_FORMATTER, 1); | 631 | ret = SendControlMsg(SET_LUM_CTL, AGC_MODE_FORMATTER, 1); |
632 | 632 | ||
633 | if (!mode && ret >= 0) { | 633 | if (!mode && ret >= 0) { |
634 | if (value < 0) | 634 | if (value < 0) |
635 | value = 0; | 635 | value = 0; |
@@ -647,7 +647,7 @@ static inline int pwc_get_agc(struct pwc_device *pdev, int *value) | |||
647 | { | 647 | { |
648 | unsigned char buf; | 648 | unsigned char buf; |
649 | int ret; | 649 | int ret; |
650 | 650 | ||
651 | ret = RecvControlMsg(GET_LUM_CTL, AGC_MODE_FORMATTER, 1); | 651 | ret = RecvControlMsg(GET_LUM_CTL, AGC_MODE_FORMATTER, 1); |
652 | if (ret < 0) | 652 | if (ret < 0) |
653 | return ret; | 653 | return ret; |
@@ -658,7 +658,7 @@ static inline int pwc_get_agc(struct pwc_device *pdev, int *value) | |||
658 | return ret; | 658 | return ret; |
659 | if (buf > 0x3F) | 659 | if (buf > 0x3F) |
660 | buf = 0x3F; | 660 | buf = 0x3F; |
661 | *value = (buf << 10); | 661 | *value = (buf << 10); |
662 | } | 662 | } |
663 | else { /* auto */ | 663 | else { /* auto */ |
664 | ret = RecvControlMsg(GET_STATUS_CTL, READ_AGC_FORMATTER, 1); | 664 | ret = RecvControlMsg(GET_STATUS_CTL, READ_AGC_FORMATTER, 1); |
@@ -683,7 +683,7 @@ static inline int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int v | |||
683 | buf[0] = 0x0; /* auto */ | 683 | buf[0] = 0x0; /* auto */ |
684 | else | 684 | else |
685 | buf[0] = 0xff; /* fixed */ | 685 | buf[0] = 0xff; /* fixed */ |
686 | 686 | ||
687 | ret = SendControlMsg(SET_LUM_CTL, SHUTTER_MODE_FORMATTER, 1); | 687 | ret = SendControlMsg(SET_LUM_CTL, SHUTTER_MODE_FORMATTER, 1); |
688 | 688 | ||
689 | if (!mode && ret >= 0) { | 689 | if (!mode && ret >= 0) { |
@@ -713,7 +713,7 @@ static inline int pwc_set_shutter_speed(struct pwc_device *pdev, int mode, int v | |||
713 | ret = SendControlMsg(SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, 2); | 713 | ret = SendControlMsg(SET_LUM_CTL, PRESET_SHUTTER_FORMATTER, 2); |
714 | } | 714 | } |
715 | return ret; | 715 | return ret; |
716 | } | 716 | } |
717 | 717 | ||
718 | 718 | ||
719 | /* POWER */ | 719 | /* POWER */ |
@@ -765,22 +765,22 @@ static inline int pwc_restore_factory(struct pwc_device *pdev) | |||
765 | * 02: fluorescent lighting | 765 | * 02: fluorescent lighting |
766 | * 03: manual | 766 | * 03: manual |
767 | * 04: auto | 767 | * 04: auto |
768 | */ | 768 | */ |
769 | static inline int pwc_set_awb(struct pwc_device *pdev, int mode) | 769 | static inline int pwc_set_awb(struct pwc_device *pdev, int mode) |
770 | { | 770 | { |
771 | char buf; | 771 | char buf; |
772 | int ret; | 772 | int ret; |
773 | 773 | ||
774 | if (mode < 0) | 774 | if (mode < 0) |
775 | mode = 0; | 775 | mode = 0; |
776 | 776 | ||
777 | if (mode > 4) | 777 | if (mode > 4) |
778 | mode = 4; | 778 | mode = 4; |
779 | 779 | ||
780 | buf = mode & 0x07; /* just the lowest three bits */ | 780 | buf = mode & 0x07; /* just the lowest three bits */ |
781 | 781 | ||
782 | ret = SendControlMsg(SET_CHROM_CTL, WB_MODE_FORMATTER, 1); | 782 | ret = SendControlMsg(SET_CHROM_CTL, WB_MODE_FORMATTER, 1); |
783 | 783 | ||
784 | if (ret < 0) | 784 | if (ret < 0) |
785 | return ret; | 785 | return ret; |
786 | return 0; | 786 | return 0; |
@@ -790,17 +790,17 @@ static inline int pwc_get_awb(struct pwc_device *pdev) | |||
790 | { | 790 | { |
791 | unsigned char buf; | 791 | unsigned char buf; |
792 | int ret; | 792 | int ret; |
793 | 793 | ||
794 | ret = RecvControlMsg(GET_CHROM_CTL, WB_MODE_FORMATTER, 1); | 794 | ret = RecvControlMsg(GET_CHROM_CTL, WB_MODE_FORMATTER, 1); |
795 | 795 | ||
796 | if (ret < 0) | 796 | if (ret < 0) |
797 | return ret; | 797 | return ret; |
798 | return buf; | 798 | return buf; |
799 | } | 799 | } |
800 | 800 | ||
801 | static inline int pwc_set_red_gain(struct pwc_device *pdev, int value) | 801 | static inline int pwc_set_red_gain(struct pwc_device *pdev, int value) |
802 | { | 802 | { |
803 | unsigned char buf; | 803 | unsigned char buf; |
804 | 804 | ||
805 | if (value < 0) | 805 | if (value < 0) |
806 | value = 0; | 806 | value = 0; |
@@ -815,7 +815,7 @@ static inline int pwc_get_red_gain(struct pwc_device *pdev, int *value) | |||
815 | { | 815 | { |
816 | unsigned char buf; | 816 | unsigned char buf; |
817 | int ret; | 817 | int ret; |
818 | 818 | ||
819 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1); | 819 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_RED_GAIN_FORMATTER, 1); |
820 | if (ret < 0) | 820 | if (ret < 0) |
821 | return ret; | 821 | return ret; |
@@ -841,7 +841,7 @@ static inline int pwc_get_blue_gain(struct pwc_device *pdev, int *value) | |||
841 | { | 841 | { |
842 | unsigned char buf; | 842 | unsigned char buf; |
843 | int ret; | 843 | int ret; |
844 | 844 | ||
845 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1); | 845 | ret = RecvControlMsg(GET_CHROM_CTL, PRESET_MANUAL_BLUE_GAIN_FORMATTER, 1); |
846 | if (ret < 0) | 846 | if (ret < 0) |
847 | return ret; | 847 | return ret; |
@@ -851,14 +851,14 @@ static inline int pwc_get_blue_gain(struct pwc_device *pdev, int *value) | |||
851 | 851 | ||
852 | 852 | ||
853 | /* The following two functions are different, since they only read the | 853 | /* The following two functions are different, since they only read the |
854 | internal red/blue gains, which may be different from the manual | 854 | internal red/blue gains, which may be different from the manual |
855 | gains set or read above. | 855 | gains set or read above. |
856 | */ | 856 | */ |
857 | static inline int pwc_read_red_gain(struct pwc_device *pdev, int *value) | 857 | static inline int pwc_read_red_gain(struct pwc_device *pdev, int *value) |
858 | { | 858 | { |
859 | unsigned char buf; | 859 | unsigned char buf; |
860 | int ret; | 860 | int ret; |
861 | 861 | ||
862 | ret = RecvControlMsg(GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, 1); | 862 | ret = RecvControlMsg(GET_STATUS_CTL, READ_RED_GAIN_FORMATTER, 1); |
863 | if (ret < 0) | 863 | if (ret < 0) |
864 | return ret; | 864 | return ret; |
@@ -870,7 +870,7 @@ static inline int pwc_read_blue_gain(struct pwc_device *pdev, int *value) | |||
870 | { | 870 | { |
871 | unsigned char buf; | 871 | unsigned char buf; |
872 | int ret; | 872 | int ret; |
873 | 873 | ||
874 | ret = RecvControlMsg(GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, 1); | 874 | ret = RecvControlMsg(GET_STATUS_CTL, READ_BLUE_GAIN_FORMATTER, 1); |
875 | if (ret < 0) | 875 | if (ret < 0) |
876 | return ret; | 876 | return ret; |
@@ -882,7 +882,7 @@ static inline int pwc_read_blue_gain(struct pwc_device *pdev, int *value) | |||
882 | static inline int pwc_set_wb_speed(struct pwc_device *pdev, int speed) | 882 | static inline int pwc_set_wb_speed(struct pwc_device *pdev, int speed) |
883 | { | 883 | { |
884 | unsigned char buf; | 884 | unsigned char buf; |
885 | 885 | ||
886 | /* useful range is 0x01..0x20 */ | 886 | /* useful range is 0x01..0x20 */ |
887 | buf = speed / 0x7f0; | 887 | buf = speed / 0x7f0; |
888 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); | 888 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); |
@@ -892,7 +892,7 @@ static inline int pwc_get_wb_speed(struct pwc_device *pdev, int *value) | |||
892 | { | 892 | { |
893 | unsigned char buf; | 893 | unsigned char buf; |
894 | int ret; | 894 | int ret; |
895 | 895 | ||
896 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); | 896 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_SPEED_FORMATTER, 1); |
897 | if (ret < 0) | 897 | if (ret < 0) |
898 | return ret; | 898 | return ret; |
@@ -904,7 +904,7 @@ static inline int pwc_get_wb_speed(struct pwc_device *pdev, int *value) | |||
904 | static inline int pwc_set_wb_delay(struct pwc_device *pdev, int delay) | 904 | static inline int pwc_set_wb_delay(struct pwc_device *pdev, int delay) |
905 | { | 905 | { |
906 | unsigned char buf; | 906 | unsigned char buf; |
907 | 907 | ||
908 | /* useful range is 0x01..0x3F */ | 908 | /* useful range is 0x01..0x3F */ |
909 | buf = (delay >> 10); | 909 | buf = (delay >> 10); |
910 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); | 910 | return SendControlMsg(SET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); |
@@ -914,7 +914,7 @@ static inline int pwc_get_wb_delay(struct pwc_device *pdev, int *value) | |||
914 | { | 914 | { |
915 | unsigned char buf; | 915 | unsigned char buf; |
916 | int ret; | 916 | int ret; |
917 | 917 | ||
918 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); | 918 | ret = RecvControlMsg(GET_CHROM_CTL, AWB_CONTROL_DELAY_FORMATTER, 1); |
919 | if (ret < 0) | 919 | if (ret < 0) |
920 | return ret; | 920 | return ret; |
@@ -950,7 +950,7 @@ static int pwc_get_leds(struct pwc_device *pdev, int *on_value, int *off_value) | |||
950 | { | 950 | { |
951 | unsigned char buf[2]; | 951 | unsigned char buf[2]; |
952 | int ret; | 952 | int ret; |
953 | 953 | ||
954 | if (pdev->type < 730) { | 954 | if (pdev->type < 730) { |
955 | *on_value = -1; | 955 | *on_value = -1; |
956 | *off_value = -1; | 956 | *off_value = -1; |
@@ -969,7 +969,7 @@ static inline int pwc_set_contour(struct pwc_device *pdev, int contour) | |||
969 | { | 969 | { |
970 | unsigned char buf; | 970 | unsigned char buf; |
971 | int ret; | 971 | int ret; |
972 | 972 | ||
973 | if (contour < 0) | 973 | if (contour < 0) |
974 | buf = 0xff; /* auto contour on */ | 974 | buf = 0xff; /* auto contour on */ |
975 | else | 975 | else |
@@ -977,16 +977,16 @@ static inline int pwc_set_contour(struct pwc_device *pdev, int contour) | |||
977 | ret = SendControlMsg(SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); | 977 | ret = SendControlMsg(SET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); |
978 | if (ret < 0) | 978 | if (ret < 0) |
979 | return ret; | 979 | return ret; |
980 | 980 | ||
981 | if (contour < 0) | 981 | if (contour < 0) |
982 | return 0; | 982 | return 0; |
983 | if (contour > 0xffff) | 983 | if (contour > 0xffff) |
984 | contour = 0xffff; | 984 | contour = 0xffff; |
985 | 985 | ||
986 | buf = (contour >> 10); /* contour preset is [0..3f] */ | 986 | buf = (contour >> 10); /* contour preset is [0..3f] */ |
987 | ret = SendControlMsg(SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); | 987 | ret = SendControlMsg(SET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); |
988 | if (ret < 0) | 988 | if (ret < 0) |
989 | return ret; | 989 | return ret; |
990 | return 0; | 990 | return 0; |
991 | } | 991 | } |
992 | 992 | ||
@@ -994,7 +994,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) | |||
994 | { | 994 | { |
995 | unsigned char buf; | 995 | unsigned char buf; |
996 | int ret; | 996 | int ret; |
997 | 997 | ||
998 | ret = RecvControlMsg(GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); | 998 | ret = RecvControlMsg(GET_LUM_CTL, AUTO_CONTOUR_FORMATTER, 1); |
999 | if (ret < 0) | 999 | if (ret < 0) |
1000 | return ret; | 1000 | return ret; |
@@ -1002,7 +1002,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) | |||
1002 | if (buf == 0) { | 1002 | if (buf == 0) { |
1003 | /* auto mode off, query current preset value */ | 1003 | /* auto mode off, query current preset value */ |
1004 | ret = RecvControlMsg(GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); | 1004 | ret = RecvControlMsg(GET_LUM_CTL, PRESET_CONTOUR_FORMATTER, 1); |
1005 | if (ret < 0) | 1005 | if (ret < 0) |
1006 | return ret; | 1006 | return ret; |
1007 | *contour = buf << 10; | 1007 | *contour = buf << 10; |
1008 | } | 1008 | } |
@@ -1015,7 +1015,7 @@ static inline int pwc_get_contour(struct pwc_device *pdev, int *contour) | |||
1015 | static inline int pwc_set_backlight(struct pwc_device *pdev, int backlight) | 1015 | static inline int pwc_set_backlight(struct pwc_device *pdev, int backlight) |
1016 | { | 1016 | { |
1017 | unsigned char buf; | 1017 | unsigned char buf; |
1018 | 1018 | ||
1019 | if (backlight) | 1019 | if (backlight) |
1020 | buf = 0xff; | 1020 | buf = 0xff; |
1021 | else | 1021 | else |
@@ -1027,7 +1027,7 @@ static inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight) | |||
1027 | { | 1027 | { |
1028 | int ret; | 1028 | int ret; |
1029 | unsigned char buf; | 1029 | unsigned char buf; |
1030 | 1030 | ||
1031 | ret = RecvControlMsg(GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1); | 1031 | ret = RecvControlMsg(GET_LUM_CTL, BACK_LIGHT_COMPENSATION_FORMATTER, 1); |
1032 | if (ret < 0) | 1032 | if (ret < 0) |
1033 | return ret; | 1033 | return ret; |
@@ -1039,7 +1039,7 @@ static inline int pwc_get_backlight(struct pwc_device *pdev, int *backlight) | |||
1039 | static inline int pwc_set_flicker(struct pwc_device *pdev, int flicker) | 1039 | static inline int pwc_set_flicker(struct pwc_device *pdev, int flicker) |
1040 | { | 1040 | { |
1041 | unsigned char buf; | 1041 | unsigned char buf; |
1042 | 1042 | ||
1043 | if (flicker) | 1043 | if (flicker) |
1044 | buf = 0xff; | 1044 | buf = 0xff; |
1045 | else | 1045 | else |
@@ -1051,7 +1051,7 @@ static inline int pwc_get_flicker(struct pwc_device *pdev, int *flicker) | |||
1051 | { | 1051 | { |
1052 | int ret; | 1052 | int ret; |
1053 | unsigned char buf; | 1053 | unsigned char buf; |
1054 | 1054 | ||
1055 | ret = RecvControlMsg(GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1); | 1055 | ret = RecvControlMsg(GET_LUM_CTL, FLICKERLESS_MODE_FORMATTER, 1); |
1056 | if (ret < 0) | 1056 | if (ret < 0) |
1057 | return ret; | 1057 | return ret; |
@@ -1076,7 +1076,7 @@ static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) | |||
1076 | { | 1076 | { |
1077 | int ret; | 1077 | int ret; |
1078 | unsigned char buf; | 1078 | unsigned char buf; |
1079 | 1079 | ||
1080 | ret = RecvControlMsg(GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1); | 1080 | ret = RecvControlMsg(GET_LUM_CTL, DYNAMIC_NOISE_CONTROL_FORMATTER, 1); |
1081 | if (ret < 0) | 1081 | if (ret < 0) |
1082 | return ret; | 1082 | return ret; |
@@ -1087,7 +1087,7 @@ static inline int pwc_get_dynamic_noise(struct pwc_device *pdev, int *noise) | |||
1087 | static int pwc_mpt_reset(struct pwc_device *pdev, int flags) | 1087 | static int pwc_mpt_reset(struct pwc_device *pdev, int flags) |
1088 | { | 1088 | { |
1089 | unsigned char buf; | 1089 | unsigned char buf; |
1090 | 1090 | ||
1091 | buf = flags & 0x03; // only lower two bits are currently used | 1091 | buf = flags & 0x03; // only lower two bits are currently used |
1092 | return SendControlMsg(SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, 1); | 1092 | return SendControlMsg(SET_MPT_CTL, PT_RESET_CONTROL_FORMATTER, 1); |
1093 | } | 1093 | } |
@@ -1095,7 +1095,7 @@ static int pwc_mpt_reset(struct pwc_device *pdev, int flags) | |||
1095 | static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) | 1095 | static inline int pwc_mpt_set_angle(struct pwc_device *pdev, int pan, int tilt) |
1096 | { | 1096 | { |
1097 | unsigned char buf[4]; | 1097 | unsigned char buf[4]; |
1098 | 1098 | ||
1099 | /* set new relative angle; angles are expressed in degrees * 100, | 1099 | /* set new relative angle; angles are expressed in degrees * 100, |
1100 | but cam as .5 degree resolution, hence divide by 200. Also | 1100 | but cam as .5 degree resolution, hence divide by 200. Also |
1101 | the angle must be multiplied by 64 before it's send to | 1101 | the angle must be multiplied by 64 before it's send to |
@@ -1114,7 +1114,7 @@ static inline int pwc_mpt_get_status(struct pwc_device *pdev, struct pwc_mpt_sta | |||
1114 | { | 1114 | { |
1115 | int ret; | 1115 | int ret; |
1116 | unsigned char buf[5]; | 1116 | unsigned char buf[5]; |
1117 | 1117 | ||
1118 | ret = RecvControlMsg(GET_MPT_CTL, PT_STATUS_FORMATTER, 5); | 1118 | ret = RecvControlMsg(GET_MPT_CTL, PT_STATUS_FORMATTER, 5); |
1119 | if (ret < 0) | 1119 | if (ret < 0) |
1120 | return ret; | 1120 | return ret; |
@@ -1129,14 +1129,14 @@ int pwc_get_cmos_sensor(struct pwc_device *pdev, int *sensor) | |||
1129 | { | 1129 | { |
1130 | unsigned char buf; | 1130 | unsigned char buf; |
1131 | int ret = -1, request; | 1131 | int ret = -1, request; |
1132 | 1132 | ||
1133 | if (pdev->type < 675) | 1133 | if (pdev->type < 675) |
1134 | request = SENSOR_TYPE_FORMATTER1; | 1134 | request = SENSOR_TYPE_FORMATTER1; |
1135 | else if (pdev->type < 730) | 1135 | else if (pdev->type < 730) |
1136 | return -1; /* The Vesta series doesn't have this call */ | 1136 | return -1; /* The Vesta series doesn't have this call */ |
1137 | else | 1137 | else |
1138 | request = SENSOR_TYPE_FORMATTER2; | 1138 | request = SENSOR_TYPE_FORMATTER2; |
1139 | 1139 | ||
1140 | ret = RecvControlMsg(GET_STATUS_CTL, request, 1); | 1140 | ret = RecvControlMsg(GET_STATUS_CTL, request, 1); |
1141 | if (ret < 0) | 1141 | if (ret < 0) |
1142 | return ret; | 1142 | return ret; |
@@ -1163,23 +1163,23 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1163 | ret = -EINVAL; | 1163 | ret = -EINVAL; |
1164 | break; | 1164 | break; |
1165 | } | 1165 | } |
1166 | 1166 | ||
1167 | case VIDIOCPWCSUSER: | 1167 | case VIDIOCPWCSUSER: |
1168 | { | 1168 | { |
1169 | if (pwc_save_user(pdev)) | 1169 | if (pwc_save_user(pdev)) |
1170 | ret = -EINVAL; | 1170 | ret = -EINVAL; |
1171 | break; | 1171 | break; |
1172 | } | 1172 | } |
1173 | 1173 | ||
1174 | case VIDIOCPWCFACTORY: | 1174 | case VIDIOCPWCFACTORY: |
1175 | { | 1175 | { |
1176 | if (pwc_restore_factory(pdev)) | 1176 | if (pwc_restore_factory(pdev)) |
1177 | ret = -EINVAL; | 1177 | ret = -EINVAL; |
1178 | break; | 1178 | break; |
1179 | } | 1179 | } |
1180 | 1180 | ||
1181 | case VIDIOCPWCSCQUAL: | 1181 | case VIDIOCPWCSCQUAL: |
1182 | { | 1182 | { |
1183 | int *qual = arg; | 1183 | int *qual = arg; |
1184 | 1184 | ||
1185 | if (*qual < 0 || *qual > 3) | 1185 | if (*qual < 0 || *qual > 3) |
@@ -1190,14 +1190,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1190 | pdev->vcompression = *qual; | 1190 | pdev->vcompression = *qual; |
1191 | break; | 1191 | break; |
1192 | } | 1192 | } |
1193 | 1193 | ||
1194 | case VIDIOCPWCGCQUAL: | 1194 | case VIDIOCPWCGCQUAL: |
1195 | { | 1195 | { |
1196 | int *qual = arg; | 1196 | int *qual = arg; |
1197 | *qual = pdev->vcompression; | 1197 | *qual = pdev->vcompression; |
1198 | break; | 1198 | break; |
1199 | } | 1199 | } |
1200 | 1200 | ||
1201 | case VIDIOCPWCPROBE: | 1201 | case VIDIOCPWCPROBE: |
1202 | { | 1202 | { |
1203 | struct pwc_probe *probe = arg; | 1203 | struct pwc_probe *probe = arg; |
@@ -1220,27 +1220,27 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1220 | ret = -EINVAL; | 1220 | ret = -EINVAL; |
1221 | break; | 1221 | break; |
1222 | } | 1222 | } |
1223 | 1223 | ||
1224 | case VIDIOCPWCGAGC: | 1224 | case VIDIOCPWCGAGC: |
1225 | { | 1225 | { |
1226 | int *agc = arg; | 1226 | int *agc = arg; |
1227 | 1227 | ||
1228 | if (pwc_get_agc(pdev, agc)) | 1228 | if (pwc_get_agc(pdev, agc)) |
1229 | ret = -EINVAL; | 1229 | ret = -EINVAL; |
1230 | break; | 1230 | break; |
1231 | } | 1231 | } |
1232 | 1232 | ||
1233 | case VIDIOCPWCSSHUTTER: | 1233 | case VIDIOCPWCSSHUTTER: |
1234 | { | 1234 | { |
1235 | int *shutter_speed = arg; | 1235 | int *shutter_speed = arg; |
1236 | ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed); | 1236 | ret = pwc_set_shutter_speed(pdev, *shutter_speed < 0 ? 1 : 0, *shutter_speed); |
1237 | break; | 1237 | break; |
1238 | } | 1238 | } |
1239 | 1239 | ||
1240 | case VIDIOCPWCSAWB: | 1240 | case VIDIOCPWCSAWB: |
1241 | { | 1241 | { |
1242 | struct pwc_whitebalance *wb = arg; | 1242 | struct pwc_whitebalance *wb = arg; |
1243 | 1243 | ||
1244 | ret = pwc_set_awb(pdev, wb->mode); | 1244 | ret = pwc_set_awb(pdev, wb->mode); |
1245 | if (ret >= 0 && wb->mode == PWC_WB_MANUAL) { | 1245 | if (ret >= 0 && wb->mode == PWC_WB_MANUAL) { |
1246 | pwc_set_red_gain(pdev, wb->manual_red); | 1246 | pwc_set_red_gain(pdev, wb->manual_red); |
@@ -1270,18 +1270,18 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1270 | ret = pwc_read_red_gain(pdev, &wb->read_red); | 1270 | ret = pwc_read_red_gain(pdev, &wb->read_red); |
1271 | if (ret < 0) | 1271 | if (ret < 0) |
1272 | break; | 1272 | break; |
1273 | ret = pwc_read_blue_gain(pdev, &wb->read_blue); | 1273 | ret = pwc_read_blue_gain(pdev, &wb->read_blue); |
1274 | if (ret < 0) | 1274 | if (ret < 0) |
1275 | break; | 1275 | break; |
1276 | } | 1276 | } |
1277 | } | 1277 | } |
1278 | break; | 1278 | break; |
1279 | } | 1279 | } |
1280 | 1280 | ||
1281 | case VIDIOCPWCSAWBSPEED: | 1281 | case VIDIOCPWCSAWBSPEED: |
1282 | { | 1282 | { |
1283 | struct pwc_wb_speed *wbs = arg; | 1283 | struct pwc_wb_speed *wbs = arg; |
1284 | 1284 | ||
1285 | if (wbs->control_speed > 0) { | 1285 | if (wbs->control_speed > 0) { |
1286 | ret = pwc_set_wb_speed(pdev, wbs->control_speed); | 1286 | ret = pwc_set_wb_speed(pdev, wbs->control_speed); |
1287 | } | 1287 | } |
@@ -1290,11 +1290,11 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1290 | } | 1290 | } |
1291 | break; | 1291 | break; |
1292 | } | 1292 | } |
1293 | 1293 | ||
1294 | case VIDIOCPWCGAWBSPEED: | 1294 | case VIDIOCPWCGAWBSPEED: |
1295 | { | 1295 | { |
1296 | struct pwc_wb_speed *wbs = arg; | 1296 | struct pwc_wb_speed *wbs = arg; |
1297 | 1297 | ||
1298 | ret = pwc_get_wb_speed(pdev, &wbs->control_speed); | 1298 | ret = pwc_get_wb_speed(pdev, &wbs->control_speed); |
1299 | if (ret < 0) | 1299 | if (ret < 0) |
1300 | break; | 1300 | break; |
@@ -1304,7 +1304,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1304 | break; | 1304 | break; |
1305 | } | 1305 | } |
1306 | 1306 | ||
1307 | case VIDIOCPWCSLED: | 1307 | case VIDIOCPWCSLED: |
1308 | { | 1308 | { |
1309 | struct pwc_leds *leds = arg; | 1309 | struct pwc_leds *leds = arg; |
1310 | ret = pwc_set_leds(pdev, leds->led_on, leds->led_off); | 1310 | ret = pwc_set_leds(pdev, leds->led_on, leds->led_off); |
@@ -1325,14 +1325,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1325 | ret = pwc_set_contour(pdev, *contour); | 1325 | ret = pwc_set_contour(pdev, *contour); |
1326 | break; | 1326 | break; |
1327 | } | 1327 | } |
1328 | 1328 | ||
1329 | case VIDIOCPWCGCONTOUR: | 1329 | case VIDIOCPWCGCONTOUR: |
1330 | { | 1330 | { |
1331 | int *contour = arg; | 1331 | int *contour = arg; |
1332 | ret = pwc_get_contour(pdev, contour); | 1332 | ret = pwc_get_contour(pdev, contour); |
1333 | break; | 1333 | break; |
1334 | } | 1334 | } |
1335 | 1335 | ||
1336 | case VIDIOCPWCSBACKLIGHT: | 1336 | case VIDIOCPWCSBACKLIGHT: |
1337 | { | 1337 | { |
1338 | int *backlight = arg; | 1338 | int *backlight = arg; |
@@ -1346,7 +1346,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1346 | ret = pwc_get_backlight(pdev, backlight); | 1346 | ret = pwc_get_backlight(pdev, backlight); |
1347 | break; | 1347 | break; |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | case VIDIOCPWCSFLICKER: | 1350 | case VIDIOCPWCSFLICKER: |
1351 | { | 1351 | { |
1352 | int *flicker = arg; | 1352 | int *flicker = arg; |
@@ -1360,14 +1360,14 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1360 | ret = pwc_get_flicker(pdev, flicker); | 1360 | ret = pwc_get_flicker(pdev, flicker); |
1361 | break; | 1361 | break; |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | case VIDIOCPWCSDYNNOISE: | 1364 | case VIDIOCPWCSDYNNOISE: |
1365 | { | 1365 | { |
1366 | int *dynnoise = arg; | 1366 | int *dynnoise = arg; |
1367 | ret = pwc_set_dynamic_noise(pdev, *dynnoise); | 1367 | ret = pwc_set_dynamic_noise(pdev, *dynnoise); |
1368 | break; | 1368 | break; |
1369 | } | 1369 | } |
1370 | 1370 | ||
1371 | case VIDIOCPWCGDYNNOISE: | 1371 | case VIDIOCPWCGDYNNOISE: |
1372 | { | 1372 | { |
1373 | int *dynnoise = arg; | 1373 | int *dynnoise = arg; |
@@ -1381,61 +1381,61 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1381 | size->width = pdev->image.x; | 1381 | size->width = pdev->image.x; |
1382 | size->height = pdev->image.y; | 1382 | size->height = pdev->image.y; |
1383 | break; | 1383 | break; |
1384 | } | 1384 | } |
1385 | 1385 | ||
1386 | case VIDIOCPWCMPTRESET: | 1386 | case VIDIOCPWCMPTRESET: |
1387 | { | 1387 | { |
1388 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1388 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1389 | { | 1389 | { |
1390 | int *flags = arg; | 1390 | int *flags = arg; |
1391 | 1391 | ||
1392 | ret = pwc_mpt_reset(pdev, *flags); | 1392 | ret = pwc_mpt_reset(pdev, *flags); |
1393 | if (ret >= 0) | 1393 | if (ret >= 0) |
1394 | { | 1394 | { |
1395 | pdev->pan_angle = 0; | 1395 | pdev->pan_angle = 0; |
1396 | pdev->tilt_angle = 0; | 1396 | pdev->tilt_angle = 0; |
1397 | } | 1397 | } |
1398 | } | 1398 | } |
1399 | else | 1399 | else |
1400 | { | 1400 | { |
1401 | ret = -ENXIO; | 1401 | ret = -ENXIO; |
1402 | } | 1402 | } |
1403 | break; | 1403 | break; |
1404 | } | 1404 | } |
1405 | 1405 | ||
1406 | case VIDIOCPWCMPTGRANGE: | 1406 | case VIDIOCPWCMPTGRANGE: |
1407 | { | 1407 | { |
1408 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1408 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1409 | { | 1409 | { |
1410 | struct pwc_mpt_range *range = arg; | 1410 | struct pwc_mpt_range *range = arg; |
1411 | *range = pdev->angle_range; | 1411 | *range = pdev->angle_range; |
1412 | } | 1412 | } |
1413 | else | 1413 | else |
1414 | { | 1414 | { |
1415 | ret = -ENXIO; | 1415 | ret = -ENXIO; |
1416 | } | 1416 | } |
1417 | break; | 1417 | break; |
1418 | } | 1418 | } |
1419 | 1419 | ||
1420 | case VIDIOCPWCMPTSANGLE: | 1420 | case VIDIOCPWCMPTSANGLE: |
1421 | { | 1421 | { |
1422 | int new_pan, new_tilt; | 1422 | int new_pan, new_tilt; |
1423 | 1423 | ||
1424 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1424 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1425 | { | 1425 | { |
1426 | struct pwc_mpt_angles *angles = arg; | 1426 | struct pwc_mpt_angles *angles = arg; |
1427 | /* The camera can only set relative angles, so | 1427 | /* The camera can only set relative angles, so |
1428 | do some calculations when getting an absolute angle . | 1428 | do some calculations when getting an absolute angle . |
1429 | */ | 1429 | */ |
1430 | if (angles->absolute) | 1430 | if (angles->absolute) |
1431 | { | 1431 | { |
1432 | new_pan = angles->pan; | 1432 | new_pan = angles->pan; |
1433 | new_tilt = angles->tilt; | 1433 | new_tilt = angles->tilt; |
1434 | } | 1434 | } |
1435 | else | 1435 | else |
1436 | { | 1436 | { |
1437 | new_pan = pdev->pan_angle + angles->pan; | 1437 | new_pan = pdev->pan_angle + angles->pan; |
1438 | new_tilt = pdev->tilt_angle + angles->tilt; | 1438 | new_tilt = pdev->tilt_angle + angles->tilt; |
1439 | } | 1439 | } |
1440 | /* check absolute ranges */ | 1440 | /* check absolute ranges */ |
1441 | if (new_pan < pdev->angle_range.pan_min || | 1441 | if (new_pan < pdev->angle_range.pan_min || |
@@ -1463,53 +1463,53 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1463 | pdev->tilt_angle += new_tilt; | 1463 | pdev->tilt_angle += new_tilt; |
1464 | } | 1464 | } |
1465 | if (ret == -EPIPE) /* stall -> out of range */ | 1465 | if (ret == -EPIPE) /* stall -> out of range */ |
1466 | ret = -ERANGE; | 1466 | ret = -ERANGE; |
1467 | } | 1467 | } |
1468 | } | 1468 | } |
1469 | else | 1469 | else |
1470 | { | 1470 | { |
1471 | ret = -ENXIO; | 1471 | ret = -ENXIO; |
1472 | } | 1472 | } |
1473 | break; | 1473 | break; |
1474 | } | 1474 | } |
1475 | 1475 | ||
1476 | case VIDIOCPWCMPTGANGLE: | 1476 | case VIDIOCPWCMPTGANGLE: |
1477 | { | 1477 | { |
1478 | 1478 | ||
1479 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1479 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1480 | { | 1480 | { |
1481 | struct pwc_mpt_angles *angles = arg; | 1481 | struct pwc_mpt_angles *angles = arg; |
1482 | 1482 | ||
1483 | angles->absolute = 1; | 1483 | angles->absolute = 1; |
1484 | angles->pan = pdev->pan_angle; | 1484 | angles->pan = pdev->pan_angle; |
1485 | angles->tilt = pdev->tilt_angle; | 1485 | angles->tilt = pdev->tilt_angle; |
1486 | } | 1486 | } |
1487 | else | 1487 | else |
1488 | { | 1488 | { |
1489 | ret = -ENXIO; | 1489 | ret = -ENXIO; |
1490 | } | 1490 | } |
1491 | break; | 1491 | break; |
1492 | } | 1492 | } |
1493 | 1493 | ||
1494 | case VIDIOCPWCMPTSTATUS: | 1494 | case VIDIOCPWCMPTSTATUS: |
1495 | { | 1495 | { |
1496 | if (pdev->features & FEATURE_MOTOR_PANTILT) | 1496 | if (pdev->features & FEATURE_MOTOR_PANTILT) |
1497 | { | 1497 | { |
1498 | struct pwc_mpt_status *status = arg; | 1498 | struct pwc_mpt_status *status = arg; |
1499 | ret = pwc_mpt_get_status(pdev, status); | 1499 | ret = pwc_mpt_get_status(pdev, status); |
1500 | } | 1500 | } |
1501 | else | 1501 | else |
1502 | { | 1502 | { |
1503 | ret = -ENXIO; | 1503 | ret = -ENXIO; |
1504 | } | 1504 | } |
1505 | break; | 1505 | break; |
1506 | } | 1506 | } |
1507 | 1507 | ||
1508 | case VIDIOCPWCGVIDCMD: | 1508 | case VIDIOCPWCGVIDCMD: |
1509 | { | 1509 | { |
1510 | struct pwc_video_command *cmd = arg; | 1510 | struct pwc_video_command *cmd = arg; |
1511 | 1511 | ||
1512 | cmd->type = pdev->type; | 1512 | cmd->type = pdev->type; |
1513 | cmd->release = pdev->release; | 1513 | cmd->release = pdev->release; |
1514 | cmd->command_len = pdev->cmd_len; | 1514 | cmd->command_len = pdev->cmd_len; |
1515 | memcpy(&cmd->command_buf, pdev->cmd_buf, pdev->cmd_len); | 1515 | memcpy(&cmd->command_buf, pdev->cmd_buf, pdev->cmd_len); |
@@ -1531,7 +1531,7 @@ int pwc_ioctl(struct pwc_device *pdev, unsigned int cmd, void *arg) | |||
1531 | ret = -ENOIOCTLCMD; | 1531 | ret = -ENOIOCTLCMD; |
1532 | break; | 1532 | break; |
1533 | } | 1533 | } |
1534 | 1534 | ||
1535 | if (ret > 0) | 1535 | if (ret > 0) |
1536 | return 0; | 1536 | return 0; |
1537 | return ret; | 1537 | return ret; |
diff --git a/drivers/usb/media/pwc/pwc-if.c b/drivers/media/video/pwc/pwc-if.c index 90eb26042817..41418294a32b 100644 --- a/drivers/usb/media/pwc/pwc-if.c +++ b/drivers/media/video/pwc/pwc-if.c | |||
@@ -25,18 +25,18 @@ | |||
25 | 25 | ||
26 | */ | 26 | */ |
27 | 27 | ||
28 | /* | 28 | /* |
29 | This code forms the interface between the USB layers and the Philips | 29 | This code forms the interface between the USB layers and the Philips |
30 | specific stuff. Some adanved stuff of the driver falls under an | 30 | specific stuff. Some adanved stuff of the driver falls under an |
31 | NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, and | 31 | NDA, signed between me and Philips B.V., Eindhoven, the Netherlands, and |
32 | is thus not distributed in source form. The binary pwcx.o module | 32 | is thus not distributed in source form. The binary pwcx.o module |
33 | contains the code that falls under the NDA. | 33 | contains the code that falls under the NDA. |
34 | 34 | ||
35 | In case you're wondering: 'pwc' stands for "Philips WebCam", but | 35 | In case you're wondering: 'pwc' stands for "Philips WebCam", but |
36 | I really didn't want to type 'philips_web_cam' every time (I'm lazy as | 36 | I really didn't want to type 'philips_web_cam' every time (I'm lazy as |
37 | any Linux kernel hacker, but I don't like uncomprehensible abbreviations | 37 | any Linux kernel hacker, but I don't like uncomprehensible abbreviations |
38 | without explanation). | 38 | without explanation). |
39 | 39 | ||
40 | Oh yes, convention: to disctinguish between all the various pointers to | 40 | Oh yes, convention: to disctinguish between all the various pointers to |
41 | device-structures, I use these names for the pointer variables: | 41 | device-structures, I use these names for the pointer variables: |
42 | udev: struct usb_device * | 42 | udev: struct usb_device * |
@@ -170,14 +170,14 @@ static struct video_device pwc_template = { | |||
170 | 170 | ||
171 | /* Okay, this is some magic that I worked out and the reasoning behind it... | 171 | /* Okay, this is some magic that I worked out and the reasoning behind it... |
172 | 172 | ||
173 | The biggest problem with any USB device is of course: "what to do | 173 | The biggest problem with any USB device is of course: "what to do |
174 | when the user unplugs the device while it is in use by an application?" | 174 | when the user unplugs the device while it is in use by an application?" |
175 | We have several options: | 175 | We have several options: |
176 | 1) Curse them with the 7 plagues when they do (requires divine intervention) | 176 | 1) Curse them with the 7 plagues when they do (requires divine intervention) |
177 | 2) Tell them not to (won't work: they'll do it anyway) | 177 | 2) Tell them not to (won't work: they'll do it anyway) |
178 | 3) Oops the kernel (this will have a negative effect on a user's uptime) | 178 | 3) Oops the kernel (this will have a negative effect on a user's uptime) |
179 | 4) Do something sensible. | 179 | 4) Do something sensible. |
180 | 180 | ||
181 | Of course, we go for option 4. | 181 | Of course, we go for option 4. |
182 | 182 | ||
183 | It happens that this device will be linked to two times, once from | 183 | It happens that this device will be linked to two times, once from |
@@ -185,15 +185,15 @@ static struct video_device pwc_template = { | |||
185 | pointers. This is done when the device is probed() and all initialization | 185 | pointers. This is done when the device is probed() and all initialization |
186 | succeeded. The pwc_device struct links back to both structures. | 186 | succeeded. The pwc_device struct links back to both structures. |
187 | 187 | ||
188 | When a device is unplugged while in use it will be removed from the | 188 | When a device is unplugged while in use it will be removed from the |
189 | list of known USB devices; I also de-register it as a V4L device, but | 189 | list of known USB devices; I also de-register it as a V4L device, but |
190 | unfortunately I can't free the memory since the struct is still in use | 190 | unfortunately I can't free the memory since the struct is still in use |
191 | by the file descriptor. This free-ing is then deferend until the first | 191 | by the file descriptor. This free-ing is then deferend until the first |
192 | opportunity. Crude, but it works. | 192 | opportunity. Crude, but it works. |
193 | 193 | ||
194 | A small 'advantage' is that if a user unplugs the cam and plugs it back | 194 | A small 'advantage' is that if a user unplugs the cam and plugs it back |
195 | in, it should get assigned the same video device minor, but unfortunately | 195 | in, it should get assigned the same video device minor, but unfortunately |
196 | it's non-trivial to re-link the cam back to the video device... (that | 196 | it's non-trivial to re-link the cam back to the video device... (that |
197 | would surely be magic! :)) | 197 | would surely be magic! :)) |
198 | */ | 198 | */ |
199 | 199 | ||
@@ -203,14 +203,14 @@ static struct video_device pwc_template = { | |||
203 | /* Here we want the physical address of the memory. | 203 | /* Here we want the physical address of the memory. |
204 | * This is used when initializing the contents of the area. | 204 | * This is used when initializing the contents of the area. |
205 | */ | 205 | */ |
206 | static inline unsigned long kvirt_to_pa(unsigned long adr) | 206 | static inline unsigned long kvirt_to_pa(unsigned long adr) |
207 | { | 207 | { |
208 | unsigned long kva, ret; | 208 | unsigned long kva, ret; |
209 | 209 | ||
210 | kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); | 210 | kva = (unsigned long) page_address(vmalloc_to_page((void *)adr)); |
211 | kva |= adr & (PAGE_SIZE-1); /* restore the offset */ | 211 | kva |= adr & (PAGE_SIZE-1); /* restore the offset */ |
212 | ret = __pa(kva); | 212 | ret = __pa(kva); |
213 | return ret; | 213 | return ret; |
214 | } | 214 | } |
215 | 215 | ||
216 | static void * rvmalloc(unsigned long size) | 216 | static void * rvmalloc(unsigned long size) |
@@ -219,13 +219,13 @@ static void * rvmalloc(unsigned long size) | |||
219 | unsigned long adr; | 219 | unsigned long adr; |
220 | 220 | ||
221 | size=PAGE_ALIGN(size); | 221 | size=PAGE_ALIGN(size); |
222 | mem=vmalloc_32(size); | 222 | mem=vmalloc_32(size); |
223 | if (mem) | 223 | if (mem) |
224 | { | 224 | { |
225 | memset(mem, 0, size); /* Clear the ram out, no junk to the user */ | 225 | memset(mem, 0, size); /* Clear the ram out, no junk to the user */ |
226 | adr=(unsigned long) mem; | 226 | adr=(unsigned long) mem; |
227 | while (size > 0) | 227 | while (size > 0) |
228 | { | 228 | { |
229 | SetPageReserved(vmalloc_to_page((void *)adr)); | 229 | SetPageReserved(vmalloc_to_page((void *)adr)); |
230 | adr+=PAGE_SIZE; | 230 | adr+=PAGE_SIZE; |
231 | size-=PAGE_SIZE; | 231 | size-=PAGE_SIZE; |
@@ -236,13 +236,13 @@ static void * rvmalloc(unsigned long size) | |||
236 | 236 | ||
237 | static void rvfree(void * mem, unsigned long size) | 237 | static void rvfree(void * mem, unsigned long size) |
238 | { | 238 | { |
239 | unsigned long adr; | 239 | unsigned long adr; |
240 | 240 | ||
241 | if (mem) | 241 | if (mem) |
242 | { | 242 | { |
243 | adr=(unsigned long) mem; | 243 | adr=(unsigned long) mem; |
244 | while ((long) size > 0) | 244 | while ((long) size > 0) |
245 | { | 245 | { |
246 | ClearPageReserved(vmalloc_to_page((void *)adr)); | 246 | ClearPageReserved(vmalloc_to_page((void *)adr)); |
247 | adr+=PAGE_SIZE; | 247 | adr+=PAGE_SIZE; |
248 | size-=PAGE_SIZE; | 248 | size-=PAGE_SIZE; |
@@ -263,13 +263,13 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
263 | 263 | ||
264 | if (pdev == NULL) | 264 | if (pdev == NULL) |
265 | return -ENXIO; | 265 | return -ENXIO; |
266 | 266 | ||
267 | #ifdef PWC_MAGIC | 267 | #ifdef PWC_MAGIC |
268 | if (pdev->magic != PWC_MAGIC) { | 268 | if (pdev->magic != PWC_MAGIC) { |
269 | Err("allocate_buffers(): magic failed.\n"); | 269 | Err("allocate_buffers(): magic failed.\n"); |
270 | return -ENXIO; | 270 | return -ENXIO; |
271 | } | 271 | } |
272 | #endif | 272 | #endif |
273 | /* Allocate Isochronous pipe buffers */ | 273 | /* Allocate Isochronous pipe buffers */ |
274 | for (i = 0; i < MAX_ISO_BUFS; i++) { | 274 | for (i = 0; i < MAX_ISO_BUFS; i++) { |
275 | if (pdev->sbuf[i].data == NULL) { | 275 | if (pdev->sbuf[i].data == NULL) { |
@@ -308,7 +308,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
308 | memset(kbuf, 128, PWC_FRAME_SIZE); | 308 | memset(kbuf, 128, PWC_FRAME_SIZE); |
309 | } | 309 | } |
310 | } | 310 | } |
311 | 311 | ||
312 | /* Allocate decompressor table space */ | 312 | /* Allocate decompressor table space */ |
313 | kbuf = NULL; | 313 | kbuf = NULL; |
314 | switch (pdev->type) | 314 | switch (pdev->type) |
@@ -320,7 +320,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
320 | case 730: | 320 | case 730: |
321 | case 740: | 321 | case 740: |
322 | case 750: | 322 | case 750: |
323 | #if 0 | 323 | #if 0 |
324 | Trace(TRACE_MEMORY,"private_data(%zu)\n",sizeof(struct pwc_dec23_private)); | 324 | Trace(TRACE_MEMORY,"private_data(%zu)\n",sizeof(struct pwc_dec23_private)); |
325 | kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); /* Timon & Kiara */ | 325 | kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); /* Timon & Kiara */ |
326 | break; | 326 | break; |
@@ -329,11 +329,11 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
329 | /* TODO & FIXME */ | 329 | /* TODO & FIXME */ |
330 | kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); | 330 | kbuf = kmalloc(sizeof(struct pwc_dec23_private), GFP_KERNEL); |
331 | break; | 331 | break; |
332 | #endif | 332 | #endif |
333 | ; | 333 | ; |
334 | } | 334 | } |
335 | pdev->decompress_data = kbuf; | 335 | pdev->decompress_data = kbuf; |
336 | 336 | ||
337 | /* Allocate image buffer; double buffer for mmap() */ | 337 | /* Allocate image buffer; double buffer for mmap() */ |
338 | kbuf = rvmalloc(default_mbufs * pdev->len_per_image); | 338 | kbuf = rvmalloc(default_mbufs * pdev->len_per_image); |
339 | if (kbuf == NULL) { | 339 | if (kbuf == NULL) { |
@@ -348,7 +348,7 @@ static int pwc_allocate_buffers(struct pwc_device *pdev) | |||
348 | pdev->image_ptr[i] = NULL; | 348 | pdev->image_ptr[i] = NULL; |
349 | 349 | ||
350 | kbuf = NULL; | 350 | kbuf = NULL; |
351 | 351 | ||
352 | Trace(TRACE_MEMORY, "<< pwc_allocate_buffers()\n"); | 352 | Trace(TRACE_MEMORY, "<< pwc_allocate_buffers()\n"); |
353 | return 0; | 353 | return 0; |
354 | } | 354 | } |
@@ -366,7 +366,7 @@ static void pwc_free_buffers(struct pwc_device *pdev) | |||
366 | Err("free_buffers(): magic failed.\n"); | 366 | Err("free_buffers(): magic failed.\n"); |
367 | return; | 367 | return; |
368 | } | 368 | } |
369 | #endif | 369 | #endif |
370 | 370 | ||
371 | /* Release Iso-pipe buffers */ | 371 | /* Release Iso-pipe buffers */ |
372 | for (i = 0; i < MAX_ISO_BUFS; i++) | 372 | for (i = 0; i < MAX_ISO_BUFS; i++) |
@@ -403,17 +403,17 @@ static void pwc_free_buffers(struct pwc_device *pdev) | |||
403 | rvfree(pdev->image_data, default_mbufs * pdev->len_per_image); | 403 | rvfree(pdev->image_data, default_mbufs * pdev->len_per_image); |
404 | } | 404 | } |
405 | pdev->image_data = NULL; | 405 | pdev->image_data = NULL; |
406 | 406 | ||
407 | Trace(TRACE_MEMORY, "Leaving free_buffers().\n"); | 407 | Trace(TRACE_MEMORY, "Leaving free_buffers().\n"); |
408 | } | 408 | } |
409 | 409 | ||
410 | /* The frame & image buffer mess. | 410 | /* The frame & image buffer mess. |
411 | 411 | ||
412 | Yes, this is a mess. Well, it used to be simple, but alas... In this | 412 | Yes, this is a mess. Well, it used to be simple, but alas... In this |
413 | module, 3 buffers schemes are used to get the data from the USB bus to | 413 | module, 3 buffers schemes are used to get the data from the USB bus to |
414 | the user program. The first scheme involves the ISO buffers (called thus | 414 | the user program. The first scheme involves the ISO buffers (called thus |
415 | since they transport ISO data from the USB controller), and not really | 415 | since they transport ISO data from the USB controller), and not really |
416 | interesting. Suffices to say the data from this buffer is quickly | 416 | interesting. Suffices to say the data from this buffer is quickly |
417 | gathered in an interrupt handler (pwc_isoc_handler) and placed into the | 417 | gathered in an interrupt handler (pwc_isoc_handler) and placed into the |
418 | frame buffer. | 418 | frame buffer. |
419 | 419 | ||
@@ -443,8 +443,8 @@ static void pwc_free_buffers(struct pwc_device *pdev) | |||
443 | and a 'full' frame list: | 443 | and a 'full' frame list: |
444 | * Initially, all frame buffers but one are on the 'empty' list; the one | 444 | * Initially, all frame buffers but one are on the 'empty' list; the one |
445 | remaining buffer is our initial fill frame. | 445 | remaining buffer is our initial fill frame. |
446 | * If a frame is needed for filling, we try to take it from the 'empty' | 446 | * If a frame is needed for filling, we try to take it from the 'empty' |
447 | list, unless that list is empty, in which case we take the buffer at | 447 | list, unless that list is empty, in which case we take the buffer at |
448 | the head of the 'full' list. | 448 | the head of the 'full' list. |
449 | * When our fill buffer has been filled, it is appended to the 'full' | 449 | * When our fill buffer has been filled, it is appended to the 'full' |
450 | list. | 450 | list. |
@@ -646,7 +646,7 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) | |||
646 | case -ETIMEDOUT: errmsg = "NAK (device does not respond)"; break; | 646 | case -ETIMEDOUT: errmsg = "NAK (device does not respond)"; break; |
647 | } | 647 | } |
648 | Trace(TRACE_FLOW, "pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg); | 648 | Trace(TRACE_FLOW, "pwc_isoc_handler() called with status %d [%s].\n", urb->status, errmsg); |
649 | /* Give up after a number of contiguous errors on the USB bus. | 649 | /* Give up after a number of contiguous errors on the USB bus. |
650 | Appearantly something is wrong so we simulate an unplug event. | 650 | Appearantly something is wrong so we simulate an unplug event. |
651 | */ | 651 | */ |
652 | if (++pdev->visoc_errors > MAX_ISOC_ERRORS) | 652 | if (++pdev->visoc_errors > MAX_ISOC_ERRORS) |
@@ -673,8 +673,8 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) | |||
673 | pdev->visoc_errors = 0; | 673 | pdev->visoc_errors = 0; |
674 | 674 | ||
675 | /* vsync: 0 = don't copy data | 675 | /* vsync: 0 = don't copy data |
676 | 1 = sync-hunt | 676 | 1 = sync-hunt |
677 | 2 = synched | 677 | 2 = synched |
678 | */ | 678 | */ |
679 | /* Compact data */ | 679 | /* Compact data */ |
680 | for (i = 0; i < urb->number_of_packets; i++) { | 680 | for (i = 0; i < urb->number_of_packets; i++) { |
@@ -701,18 +701,18 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) | |||
701 | } /* ..flen > 0 */ | 701 | } /* ..flen > 0 */ |
702 | 702 | ||
703 | if (flen < pdev->vlast_packet_size) { | 703 | if (flen < pdev->vlast_packet_size) { |
704 | /* Shorter packet... We probably have the end of an image-frame; | 704 | /* Shorter packet... We probably have the end of an image-frame; |
705 | wake up read() process and let select()/poll() do something. | 705 | wake up read() process and let select()/poll() do something. |
706 | Decompression is done in user time over there. | 706 | Decompression is done in user time over there. |
707 | */ | 707 | */ |
708 | if (pdev->vsync == 2) { | 708 | if (pdev->vsync == 2) { |
709 | /* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus | 709 | /* The ToUCam Fun CMOS sensor causes the firmware to send 2 or 3 bogus |
710 | frames on the USB wire after an exposure change. This conditition is | 710 | frames on the USB wire after an exposure change. This conditition is |
711 | however detected in the cam and a bit is set in the header. | 711 | however detected in the cam and a bit is set in the header. |
712 | */ | 712 | */ |
713 | if (pdev->type == 730) { | 713 | if (pdev->type == 730) { |
714 | unsigned char *ptr = (unsigned char *)fbuf->data; | 714 | unsigned char *ptr = (unsigned char *)fbuf->data; |
715 | 715 | ||
716 | if (ptr[1] == 1 && ptr[0] & 0x10) { | 716 | if (ptr[1] == 1 && ptr[0] & 0x10) { |
717 | #if PWC_DEBUG | 717 | #if PWC_DEBUG |
718 | Debug("Hyundai CMOS sensor bug. Dropping frame %d.\n", fbuf->sequence); | 718 | Debug("Hyundai CMOS sensor bug. Dropping frame %d.\n", fbuf->sequence); |
@@ -733,13 +733,13 @@ static void pwc_isoc_handler(struct urb *urb, struct pt_regs *regs) | |||
733 | Info("Image is normal.\n"); | 733 | Info("Image is normal.\n"); |
734 | } | 734 | } |
735 | pdev->vmirror = ptr[0] & 0x03; | 735 | pdev->vmirror = ptr[0] & 0x03; |
736 | /* Sometimes the trailer of the 730 is still sent as a 4 byte packet | 736 | /* Sometimes the trailer of the 730 is still sent as a 4 byte packet |
737 | after a short frame; this condition is filtered out specifically. A 4 byte | 737 | after a short frame; this condition is filtered out specifically. A 4 byte |
738 | frame doesn't make sense anyway. | 738 | frame doesn't make sense anyway. |
739 | So we get either this sequence: | 739 | So we get either this sequence: |
740 | drop_bit set -> 4 byte frame -> short frame -> good frame | 740 | drop_bit set -> 4 byte frame -> short frame -> good frame |
741 | Or this one: | 741 | Or this one: |
742 | drop_bit set -> short frame -> good frame | 742 | drop_bit set -> short frame -> good frame |
743 | So we drop either 3 or 2 frames in all! | 743 | So we drop either 3 or 2 frames in all! |
744 | */ | 744 | */ |
745 | if (fbuf->filled == 4) | 745 | if (fbuf->filled == 4) |
@@ -830,7 +830,7 @@ static int pwc_isoc_init(struct pwc_device *pdev) | |||
830 | intf = usb_ifnum_to_if(udev, 0); | 830 | intf = usb_ifnum_to_if(udev, 0); |
831 | if (intf) | 831 | if (intf) |
832 | idesc = usb_altnum_to_altsetting(intf, pdev->valternate); | 832 | idesc = usb_altnum_to_altsetting(intf, pdev->valternate); |
833 | 833 | ||
834 | if (!idesc) | 834 | if (!idesc) |
835 | return -EFAULT; | 835 | return -EFAULT; |
836 | 836 | ||
@@ -841,7 +841,7 @@ static int pwc_isoc_init(struct pwc_device *pdev) | |||
841 | pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize); | 841 | pdev->vmax_packet_size = le16_to_cpu(idesc->endpoint[i].desc.wMaxPacketSize); |
842 | break; | 842 | break; |
843 | } | 843 | } |
844 | 844 | ||
845 | if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) { | 845 | if (pdev->vmax_packet_size < 0 || pdev->vmax_packet_size > ISO_MAX_FRAME_SIZE) { |
846 | Err("Failed to find packet size for video endpoint in current alternate setting.\n"); | 846 | Err("Failed to find packet size for video endpoint in current alternate setting.\n"); |
847 | return -ENFILE; /* Odd error, that should be noticeable */ | 847 | return -ENFILE; /* Odd error, that should be noticeable */ |
@@ -875,18 +875,18 @@ static int pwc_isoc_init(struct pwc_device *pdev) | |||
875 | return ret; | 875 | return ret; |
876 | } | 876 | } |
877 | 877 | ||
878 | /* init URB structure */ | 878 | /* init URB structure */ |
879 | for (i = 0; i < MAX_ISO_BUFS; i++) { | 879 | for (i = 0; i < MAX_ISO_BUFS; i++) { |
880 | urb = pdev->sbuf[i].urb; | 880 | urb = pdev->sbuf[i].urb; |
881 | 881 | ||
882 | urb->interval = 1; // devik | 882 | urb->interval = 1; // devik |
883 | urb->dev = udev; | 883 | urb->dev = udev; |
884 | urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint); | 884 | urb->pipe = usb_rcvisocpipe(udev, pdev->vendpoint); |
885 | urb->transfer_flags = URB_ISO_ASAP; | 885 | urb->transfer_flags = URB_ISO_ASAP; |
886 | urb->transfer_buffer = pdev->sbuf[i].data; | 886 | urb->transfer_buffer = pdev->sbuf[i].data; |
887 | urb->transfer_buffer_length = ISO_BUFFER_SIZE; | 887 | urb->transfer_buffer_length = ISO_BUFFER_SIZE; |
888 | urb->complete = pwc_isoc_handler; | 888 | urb->complete = pwc_isoc_handler; |
889 | urb->context = pdev; | 889 | urb->context = pdev; |
890 | urb->start_frame = 0; | 890 | urb->start_frame = 0; |
891 | urb->number_of_packets = ISO_FRAMES_PER_DESC; | 891 | urb->number_of_packets = ISO_FRAMES_PER_DESC; |
892 | for (j = 0; j < ISO_FRAMES_PER_DESC; j++) { | 892 | for (j = 0; j < ISO_FRAMES_PER_DESC; j++) { |
@@ -935,7 +935,7 @@ static void pwc_isoc_cleanup(struct pwc_device *pdev) | |||
935 | } | 935 | } |
936 | 936 | ||
937 | /* Stop camera, but only if we are sure the camera is still there (unplug | 937 | /* Stop camera, but only if we are sure the camera is still there (unplug |
938 | is signalled by EPIPE) | 938 | is signalled by EPIPE) |
939 | */ | 939 | */ |
940 | if (pdev->error_status && pdev->error_status != EPIPE) { | 940 | if (pdev->error_status && pdev->error_status != EPIPE) { |
941 | Trace(TRACE_OPEN, "Setting alternate interface 0.\n"); | 941 | Trace(TRACE_OPEN, "Setting alternate interface 0.\n"); |
@@ -956,12 +956,12 @@ int pwc_try_video_mode(struct pwc_device *pdev, int width, int height, int new_f | |||
956 | pwc_reset_buffers(pdev); | 956 | pwc_reset_buffers(pdev); |
957 | /* Try to set video mode... */ | 957 | /* Try to set video mode... */ |
958 | start = ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot); | 958 | start = ret = pwc_set_video_mode(pdev, width, height, new_fps, new_compression, new_snapshot); |
959 | if (ret) { | 959 | if (ret) { |
960 | Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n"); | 960 | Trace(TRACE_FLOW, "pwc_set_video_mode attempt 1 failed.\n"); |
961 | /* That failed... restore old mode (we know that worked) */ | 961 | /* That failed... restore old mode (we know that worked) */ |
962 | start = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot); | 962 | start = pwc_set_video_mode(pdev, pdev->view.x, pdev->view.y, pdev->vframes, pdev->vcompression, pdev->vsnapshot); |
963 | if (start) { | 963 | if (start) { |
964 | Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n"); | 964 | Trace(TRACE_FLOW, "pwc_set_video_mode attempt 2 failed.\n"); |
965 | } | 965 | } |
966 | } | 966 | } |
967 | if (start == 0) | 967 | if (start == 0) |
@@ -987,18 +987,18 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
987 | struct pwc_device *pdev; | 987 | struct pwc_device *pdev; |
988 | 988 | ||
989 | Trace(TRACE_OPEN, ">> video_open called(vdev = 0x%p).\n", vdev); | 989 | Trace(TRACE_OPEN, ">> video_open called(vdev = 0x%p).\n", vdev); |
990 | 990 | ||
991 | pdev = (struct pwc_device *)vdev->priv; | 991 | pdev = (struct pwc_device *)vdev->priv; |
992 | if (pdev == NULL) | 992 | if (pdev == NULL) |
993 | BUG(); | 993 | BUG(); |
994 | if (pdev->vopen) | 994 | if (pdev->vopen) |
995 | return -EBUSY; | 995 | return -EBUSY; |
996 | 996 | ||
997 | down(&pdev->modlock); | 997 | down(&pdev->modlock); |
998 | if (!pdev->usb_init) { | 998 | if (!pdev->usb_init) { |
999 | Trace(TRACE_OPEN, "Doing first time initialization.\n"); | 999 | Trace(TRACE_OPEN, "Doing first time initialization.\n"); |
1000 | pdev->usb_init = 1; | 1000 | pdev->usb_init = 1; |
1001 | 1001 | ||
1002 | if (pwc_trace & TRACE_OPEN) | 1002 | if (pwc_trace & TRACE_OPEN) |
1003 | { | 1003 | { |
1004 | /* Query sensor type */ | 1004 | /* Query sensor type */ |
@@ -1036,7 +1036,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1036 | /* Set LED on/off time */ | 1036 | /* Set LED on/off time */ |
1037 | if (pwc_set_leds(pdev, led_on, led_off) < 0) | 1037 | if (pwc_set_leds(pdev, led_on, led_off) < 0) |
1038 | Info("Failed to set LED on/off time.\n"); | 1038 | Info("Failed to set LED on/off time.\n"); |
1039 | 1039 | ||
1040 | pwc_construct(pdev); /* set min/max sizes correct */ | 1040 | pwc_construct(pdev); /* set min/max sizes correct */ |
1041 | 1041 | ||
1042 | /* So far, so good. Allocate memory. */ | 1042 | /* So far, so good. Allocate memory. */ |
@@ -1046,7 +1046,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1046 | up(&pdev->modlock); | 1046 | up(&pdev->modlock); |
1047 | return i; | 1047 | return i; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | /* Reset buffers & parameters */ | 1050 | /* Reset buffers & parameters */ |
1051 | pwc_reset_buffers(pdev); | 1051 | pwc_reset_buffers(pdev); |
1052 | for (i = 0; i < default_mbufs; i++) | 1052 | for (i = 0; i < default_mbufs; i++) |
@@ -1081,7 +1081,7 @@ static int pwc_video_open(struct inode *inode, struct file *file) | |||
1081 | up(&pdev->modlock); | 1081 | up(&pdev->modlock); |
1082 | return i; | 1082 | return i; |
1083 | } | 1083 | } |
1084 | 1084 | ||
1085 | i = pwc_isoc_init(pdev); | 1085 | i = pwc_isoc_init(pdev); |
1086 | if (i) { | 1086 | if (i) { |
1087 | Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i); | 1087 | Trace(TRACE_OPEN, "Failed to init ISOC stuff = %d.\n", i); |
@@ -1155,13 +1155,13 @@ static int pwc_video_close(struct inode *inode, struct file *file) | |||
1155 | /* | 1155 | /* |
1156 | * FIXME: what about two parallel reads ???? | 1156 | * FIXME: what about two parallel reads ???? |
1157 | * ANSWER: Not supported. You can't open the device more than once, | 1157 | * ANSWER: Not supported. You can't open the device more than once, |
1158 | despite what the V4L1 interface says. First, I don't see | 1158 | despite what the V4L1 interface says. First, I don't see |
1159 | the need, second there's no mechanism of alerting the | 1159 | the need, second there's no mechanism of alerting the |
1160 | 2nd/3rd/... process of events like changing image size. | 1160 | 2nd/3rd/... process of events like changing image size. |
1161 | And I don't see the point of blocking that for the | 1161 | And I don't see the point of blocking that for the |
1162 | 2nd/3rd/... process. | 1162 | 2nd/3rd/... process. |
1163 | In multi-threaded environments reading parallel from any | 1163 | In multi-threaded environments reading parallel from any |
1164 | device is tricky anyhow. | 1164 | device is tricky anyhow. |
1165 | */ | 1165 | */ |
1166 | 1166 | ||
1167 | static ssize_t pwc_video_read(struct file *file, char __user * buf, | 1167 | static ssize_t pwc_video_read(struct file *file, char __user * buf, |
@@ -1171,7 +1171,7 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf, | |||
1171 | struct pwc_device *pdev; | 1171 | struct pwc_device *pdev; |
1172 | int noblock = file->f_flags & O_NONBLOCK; | 1172 | int noblock = file->f_flags & O_NONBLOCK; |
1173 | DECLARE_WAITQUEUE(wait, current); | 1173 | DECLARE_WAITQUEUE(wait, current); |
1174 | int bytes_to_read; | 1174 | int bytes_to_read; |
1175 | 1175 | ||
1176 | Trace(TRACE_READ, "video_read(0x%p, %p, %zu) called.\n", vdev, buf, count); | 1176 | Trace(TRACE_READ, "video_read(0x%p, %p, %zu) called.\n", vdev, buf, count); |
1177 | if (vdev == NULL) | 1177 | if (vdev == NULL) |
@@ -1193,22 +1193,22 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf, | |||
1193 | set_current_state(TASK_RUNNING); | 1193 | set_current_state(TASK_RUNNING); |
1194 | return -pdev->error_status ; | 1194 | return -pdev->error_status ; |
1195 | } | 1195 | } |
1196 | if (noblock) { | 1196 | if (noblock) { |
1197 | remove_wait_queue(&pdev->frameq, &wait); | 1197 | remove_wait_queue(&pdev->frameq, &wait); |
1198 | set_current_state(TASK_RUNNING); | 1198 | set_current_state(TASK_RUNNING); |
1199 | return -EWOULDBLOCK; | 1199 | return -EWOULDBLOCK; |
1200 | } | 1200 | } |
1201 | if (signal_pending(current)) { | 1201 | if (signal_pending(current)) { |
1202 | remove_wait_queue(&pdev->frameq, &wait); | 1202 | remove_wait_queue(&pdev->frameq, &wait); |
1203 | set_current_state(TASK_RUNNING); | 1203 | set_current_state(TASK_RUNNING); |
1204 | return -ERESTARTSYS; | 1204 | return -ERESTARTSYS; |
1205 | } | 1205 | } |
1206 | schedule(); | 1206 | schedule(); |
1207 | set_current_state(TASK_INTERRUPTIBLE); | 1207 | set_current_state(TASK_INTERRUPTIBLE); |
1208 | } | 1208 | } |
1209 | remove_wait_queue(&pdev->frameq, &wait); | 1209 | remove_wait_queue(&pdev->frameq, &wait); |
1210 | set_current_state(TASK_RUNNING); | 1210 | set_current_state(TASK_RUNNING); |
1211 | 1211 | ||
1212 | /* Decompress and release frame */ | 1212 | /* Decompress and release frame */ |
1213 | if (pwc_handle_frame(pdev)) | 1213 | if (pwc_handle_frame(pdev)) |
1214 | return -EFAULT; | 1214 | return -EFAULT; |
@@ -1218,7 +1218,7 @@ static ssize_t pwc_video_read(struct file *file, char __user * buf, | |||
1218 | if (pdev->vpalette == VIDEO_PALETTE_RAW) | 1218 | if (pdev->vpalette == VIDEO_PALETTE_RAW) |
1219 | bytes_to_read = pdev->frame_size; | 1219 | bytes_to_read = pdev->frame_size; |
1220 | else | 1220 | else |
1221 | bytes_to_read = pdev->view.size; | 1221 | bytes_to_read = pdev->view.size; |
1222 | 1222 | ||
1223 | /* copy bytes to user space; we allow for partial reads */ | 1223 | /* copy bytes to user space; we allow for partial reads */ |
1224 | if (count + pdev->image_read_pos > bytes_to_read) | 1224 | if (count + pdev->image_read_pos > bytes_to_read) |
@@ -1348,11 +1348,11 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1348 | struct video_picture *p = arg; | 1348 | struct video_picture *p = arg; |
1349 | /* | 1349 | /* |
1350 | * FIXME: Suppose we are mid read | 1350 | * FIXME: Suppose we are mid read |
1351 | ANSWER: No problem: the firmware of the camera | 1351 | ANSWER: No problem: the firmware of the camera |
1352 | can handle brightness/contrast/etc | 1352 | can handle brightness/contrast/etc |
1353 | changes at _any_ time, and the palette | 1353 | changes at _any_ time, and the palette |
1354 | is used exactly once in the uncompress | 1354 | is used exactly once in the uncompress |
1355 | routine. | 1355 | routine. |
1356 | */ | 1356 | */ |
1357 | pwc_set_brightness(pdev, p->brightness); | 1357 | pwc_set_brightness(pdev, p->brightness); |
1358 | pwc_set_contrast(pdev, p->contrast); | 1358 | pwc_set_contrast(pdev, p->contrast); |
@@ -1373,21 +1373,21 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1373 | break; | 1373 | break; |
1374 | } | 1374 | } |
1375 | 1375 | ||
1376 | /* Window/size parameters */ | 1376 | /* Window/size parameters */ |
1377 | case VIDIOCGWIN: | 1377 | case VIDIOCGWIN: |
1378 | { | 1378 | { |
1379 | struct video_window *vw = arg; | 1379 | struct video_window *vw = arg; |
1380 | 1380 | ||
1381 | vw->x = 0; | 1381 | vw->x = 0; |
1382 | vw->y = 0; | 1382 | vw->y = 0; |
1383 | vw->width = pdev->view.x; | 1383 | vw->width = pdev->view.x; |
1384 | vw->height = pdev->view.y; | 1384 | vw->height = pdev->view.y; |
1385 | vw->chromakey = 0; | 1385 | vw->chromakey = 0; |
1386 | vw->flags = (pdev->vframes << PWC_FPS_SHIFT) | | 1386 | vw->flags = (pdev->vframes << PWC_FPS_SHIFT) | |
1387 | (pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0); | 1387 | (pdev->vsnapshot ? PWC_FPS_SNAPSHOT : 0); |
1388 | break; | 1388 | break; |
1389 | } | 1389 | } |
1390 | 1390 | ||
1391 | case VIDIOCSWIN: | 1391 | case VIDIOCSWIN: |
1392 | { | 1392 | { |
1393 | struct video_window *vw = arg; | 1393 | struct video_window *vw = arg; |
@@ -1402,9 +1402,9 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1402 | ret = pwc_try_video_mode(pdev, vw->width, vw->height, fps, pdev->vcompression, snapshot); | 1402 | ret = pwc_try_video_mode(pdev, vw->width, vw->height, fps, pdev->vcompression, snapshot); |
1403 | if (ret) | 1403 | if (ret) |
1404 | return ret; | 1404 | return ret; |
1405 | break; | 1405 | break; |
1406 | } | 1406 | } |
1407 | 1407 | ||
1408 | /* We don't have overlay support (yet) */ | 1408 | /* We don't have overlay support (yet) */ |
1409 | case VIDIOCGFBUF: | 1409 | case VIDIOCGFBUF: |
1410 | { | 1410 | { |
@@ -1471,8 +1471,8 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1471 | return -EBUSY; /* buffer wasn't available. Bummer */ | 1471 | return -EBUSY; /* buffer wasn't available. Bummer */ |
1472 | pdev->image_used[vm->frame] = 1; | 1472 | pdev->image_used[vm->frame] = 1; |
1473 | 1473 | ||
1474 | /* Okay, we're done here. In the SYNC call we wait until a | 1474 | /* Okay, we're done here. In the SYNC call we wait until a |
1475 | frame comes available, then expand image into the given | 1475 | frame comes available, then expand image into the given |
1476 | buffer. | 1476 | buffer. |
1477 | In contrast to the CPiA cam the Philips cams deliver a | 1477 | In contrast to the CPiA cam the Philips cams deliver a |
1478 | constant stream, almost like a grabber card. Also, | 1478 | constant stream, almost like a grabber card. Also, |
@@ -1487,16 +1487,16 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1487 | { | 1487 | { |
1488 | /* The doc says: "Whenever a buffer is used it should | 1488 | /* The doc says: "Whenever a buffer is used it should |
1489 | call VIDIOCSYNC to free this frame up and continue." | 1489 | call VIDIOCSYNC to free this frame up and continue." |
1490 | 1490 | ||
1491 | The only odd thing about this whole procedure is | 1491 | The only odd thing about this whole procedure is |
1492 | that MCAPTURE flags the buffer as "in use", and | 1492 | that MCAPTURE flags the buffer as "in use", and |
1493 | SYNC immediately unmarks it, while it isn't | 1493 | SYNC immediately unmarks it, while it isn't |
1494 | after SYNC that you know that the buffer actually | 1494 | after SYNC that you know that the buffer actually |
1495 | got filled! So you better not start a CAPTURE in | 1495 | got filled! So you better not start a CAPTURE in |
1496 | the same frame immediately (use double buffering). | 1496 | the same frame immediately (use double buffering). |
1497 | This is not a problem for this cam, since it has | 1497 | This is not a problem for this cam, since it has |
1498 | extra intermediate buffers, but a hardware | 1498 | extra intermediate buffers, but a hardware |
1499 | grabber card will then overwrite the buffer | 1499 | grabber card will then overwrite the buffer |
1500 | you're working on. | 1500 | you're working on. |
1501 | */ | 1501 | */ |
1502 | int *mbuf = arg; | 1502 | int *mbuf = arg; |
@@ -1512,10 +1512,10 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1512 | return -EINVAL; | 1512 | return -EINVAL; |
1513 | 1513 | ||
1514 | /* Add ourselves to the frame wait-queue. | 1514 | /* Add ourselves to the frame wait-queue. |
1515 | 1515 | ||
1516 | FIXME: needs auditing for safety. | 1516 | FIXME: needs auditing for safety. |
1517 | QUESTION: In what respect? I think that using the | 1517 | QUESTION: In what respect? I think that using the |
1518 | frameq is safe now. | 1518 | frameq is safe now. |
1519 | */ | 1519 | */ |
1520 | add_wait_queue(&pdev->frameq, &wait); | 1520 | add_wait_queue(&pdev->frameq, &wait); |
1521 | while (pdev->full_frames == NULL) { | 1521 | while (pdev->full_frames == NULL) { |
@@ -1524,21 +1524,21 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1524 | set_current_state(TASK_RUNNING); | 1524 | set_current_state(TASK_RUNNING); |
1525 | return -pdev->error_status; | 1525 | return -pdev->error_status; |
1526 | } | 1526 | } |
1527 | 1527 | ||
1528 | if (signal_pending(current)) { | 1528 | if (signal_pending(current)) { |
1529 | remove_wait_queue(&pdev->frameq, &wait); | 1529 | remove_wait_queue(&pdev->frameq, &wait); |
1530 | set_current_state(TASK_RUNNING); | 1530 | set_current_state(TASK_RUNNING); |
1531 | return -ERESTARTSYS; | 1531 | return -ERESTARTSYS; |
1532 | } | 1532 | } |
1533 | schedule(); | 1533 | schedule(); |
1534 | set_current_state(TASK_INTERRUPTIBLE); | 1534 | set_current_state(TASK_INTERRUPTIBLE); |
1535 | } | 1535 | } |
1536 | remove_wait_queue(&pdev->frameq, &wait); | 1536 | remove_wait_queue(&pdev->frameq, &wait); |
1537 | set_current_state(TASK_RUNNING); | 1537 | set_current_state(TASK_RUNNING); |
1538 | 1538 | ||
1539 | /* The frame is ready. Expand in the image buffer | 1539 | /* The frame is ready. Expand in the image buffer |
1540 | requested by the user. I don't care if you | 1540 | requested by the user. I don't care if you |
1541 | mmap() 5 buffers and request data in this order: | 1541 | mmap() 5 buffers and request data in this order: |
1542 | buffer 4 2 3 0 1 2 3 0 4 3 1 . . . | 1542 | buffer 4 2 3 0 1 2 3 0 4 3 1 . . . |
1543 | Grabber hardware may not be so forgiving. | 1543 | Grabber hardware may not be so forgiving. |
1544 | */ | 1544 | */ |
@@ -1551,11 +1551,11 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1551 | return -EFAULT; | 1551 | return -EFAULT; |
1552 | break; | 1552 | break; |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | case VIDIOCGAUDIO: | 1555 | case VIDIOCGAUDIO: |
1556 | { | 1556 | { |
1557 | struct video_audio *v = arg; | 1557 | struct video_audio *v = arg; |
1558 | 1558 | ||
1559 | strcpy(v->name, "Microphone"); | 1559 | strcpy(v->name, "Microphone"); |
1560 | v->audio = -1; /* unknown audio minor */ | 1560 | v->audio = -1; /* unknown audio minor */ |
1561 | v->flags = 0; | 1561 | v->flags = 0; |
@@ -1565,19 +1565,19 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1565 | v->treble = 0; | 1565 | v->treble = 0; |
1566 | v->balance = 0x8000; | 1566 | v->balance = 0x8000; |
1567 | v->step = 1; | 1567 | v->step = 1; |
1568 | break; | 1568 | break; |
1569 | } | 1569 | } |
1570 | 1570 | ||
1571 | case VIDIOCSAUDIO: | 1571 | case VIDIOCSAUDIO: |
1572 | { | 1572 | { |
1573 | /* Dummy: nothing can be set */ | 1573 | /* Dummy: nothing can be set */ |
1574 | break; | 1574 | break; |
1575 | } | 1575 | } |
1576 | 1576 | ||
1577 | case VIDIOCGUNIT: | 1577 | case VIDIOCGUNIT: |
1578 | { | 1578 | { |
1579 | struct video_unit *vu = arg; | 1579 | struct video_unit *vu = arg; |
1580 | 1580 | ||
1581 | vu->video = pdev->vdev->minor & 0x3F; | 1581 | vu->video = pdev->vdev->minor & 0x3F; |
1582 | vu->audio = -1; /* not known yet */ | 1582 | vu->audio = -1; /* not known yet */ |
1583 | vu->vbi = -1; | 1583 | vu->vbi = -1; |
@@ -1589,7 +1589,7 @@ static int pwc_video_do_ioctl(struct inode *inode, struct file *file, | |||
1589 | return pwc_ioctl(pdev, cmd, arg); | 1589 | return pwc_ioctl(pdev, cmd, arg); |
1590 | } /* ..switch */ | 1590 | } /* ..switch */ |
1591 | return 0; | 1591 | return 0; |
1592 | } | 1592 | } |
1593 | 1593 | ||
1594 | static int pwc_video_ioctl(struct inode *inode, struct file *file, | 1594 | static int pwc_video_ioctl(struct inode *inode, struct file *file, |
1595 | unsigned int cmd, unsigned long arg) | 1595 | unsigned int cmd, unsigned long arg) |
@@ -1605,10 +1605,10 @@ static int pwc_video_mmap(struct file *file, struct vm_area_struct *vma) | |||
1605 | unsigned long start = vma->vm_start; | 1605 | unsigned long start = vma->vm_start; |
1606 | unsigned long size = vma->vm_end-vma->vm_start; | 1606 | unsigned long size = vma->vm_end-vma->vm_start; |
1607 | unsigned long page, pos; | 1607 | unsigned long page, pos; |
1608 | 1608 | ||
1609 | Trace(TRACE_MEMORY, "mmap(0x%p, 0x%lx, %lu) called.\n", vdev, start, size); | 1609 | Trace(TRACE_MEMORY, "mmap(0x%p, 0x%lx, %lu) called.\n", vdev, start, size); |
1610 | pdev = vdev->priv; | 1610 | pdev = vdev->priv; |
1611 | 1611 | ||
1612 | vma->vm_flags |= VM_IO; | 1612 | vma->vm_flags |= VM_IO; |
1613 | 1613 | ||
1614 | pos = (unsigned long)pdev->image_data; | 1614 | pos = (unsigned long)pdev->image_data; |
@@ -1646,7 +1646,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1646 | char serial_number[30], *name; | 1646 | char serial_number[30], *name; |
1647 | 1647 | ||
1648 | /* Check if we can handle this device */ | 1648 | /* Check if we can handle this device */ |
1649 | Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n", | 1649 | Trace(TRACE_PROBE, "probe() called [%04X %04X], if %d\n", |
1650 | le16_to_cpu(udev->descriptor.idVendor), | 1650 | le16_to_cpu(udev->descriptor.idVendor), |
1651 | le16_to_cpu(udev->descriptor.idProduct), | 1651 | le16_to_cpu(udev->descriptor.idProduct), |
1652 | intf->altsetting->desc.bInterfaceNumber); | 1652 | intf->altsetting->desc.bInterfaceNumber); |
@@ -1770,11 +1770,11 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1770 | name = "Logitech QuickCam (res.)"; | 1770 | name = "Logitech QuickCam (res.)"; |
1771 | type_id = 730; /* Assuming CMOS */ | 1771 | type_id = 730; /* Assuming CMOS */ |
1772 | break; | 1772 | break; |
1773 | default: | 1773 | default: |
1774 | return -ENODEV; | 1774 | return -ENODEV; |
1775 | break; | 1775 | break; |
1776 | } | 1776 | } |
1777 | } | 1777 | } |
1778 | else if (vendor_id == 0x055d) { | 1778 | else if (vendor_id == 0x055d) { |
1779 | /* I don't know the difference between the C10 and the C30; | 1779 | /* I don't know the difference between the C10 and the C30; |
1780 | I suppose the difference is the sensor, but both cameras | 1780 | I suppose the difference is the sensor, but both cameras |
@@ -1837,7 +1837,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1837 | return -ENODEV; | 1837 | return -ENODEV; |
1838 | break; | 1838 | break; |
1839 | } | 1839 | } |
1840 | 1840 | ||
1841 | } | 1841 | } |
1842 | else if (vendor_id == 0x0d81) { | 1842 | else if (vendor_id == 0x0d81) { |
1843 | switch(product_id) { | 1843 | switch(product_id) { |
@@ -1856,7 +1856,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1856 | break; | 1856 | break; |
1857 | } | 1857 | } |
1858 | } | 1858 | } |
1859 | else | 1859 | else |
1860 | return -ENODEV; /* Not any of the know types; but the list keeps growing. */ | 1860 | return -ENODEV; /* Not any of the know types; but the list keeps growing. */ |
1861 | 1861 | ||
1862 | memset(serial_number, 0, 30); | 1862 | memset(serial_number, 0, 30); |
@@ -1880,9 +1880,9 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1880 | if (vendor_id == 0x046D && product_id == 0x08B5) | 1880 | if (vendor_id == 0x046D && product_id == 0x08B5) |
1881 | { | 1881 | { |
1882 | /* Logitech QuickCam Orbit | 1882 | /* Logitech QuickCam Orbit |
1883 | The ranges have been determined experimentally; they may differ from cam to cam. | 1883 | The ranges have been determined experimentally; they may differ from cam to cam. |
1884 | Also, the exact ranges left-right and up-down are different for my cam | 1884 | Also, the exact ranges left-right and up-down are different for my cam |
1885 | */ | 1885 | */ |
1886 | pdev->angle_range.pan_min = -7000; | 1886 | pdev->angle_range.pan_min = -7000; |
1887 | pdev->angle_range.pan_max = 7000; | 1887 | pdev->angle_range.pan_max = 7000; |
1888 | pdev->angle_range.tilt_min = -3000; | 1888 | pdev->angle_range.tilt_min = -3000; |
@@ -1939,7 +1939,7 @@ static int usb_pwc_probe(struct usb_interface *intf, const struct usb_device_id | |||
1939 | } | 1939 | } |
1940 | 1940 | ||
1941 | /* occupy slot */ | 1941 | /* occupy slot */ |
1942 | if (hint < MAX_DEV_HINTS) | 1942 | if (hint < MAX_DEV_HINTS) |
1943 | device_hint[hint].pdev = pdev; | 1943 | device_hint[hint].pdev = pdev; |
1944 | 1944 | ||
1945 | Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev); | 1945 | Trace(TRACE_PROBE, "probe() function returning struct at 0x%p.\n", pdev); |
@@ -1968,13 +1968,13 @@ static void usb_pwc_disconnect(struct usb_interface *intf) | |||
1968 | Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n"); | 1968 | Err("pwc_disconnect() Woops: pointer mismatch udev/pdev.\n"); |
1969 | goto disconnect_out; | 1969 | goto disconnect_out; |
1970 | } | 1970 | } |
1971 | #ifdef PWC_MAGIC | 1971 | #ifdef PWC_MAGIC |
1972 | if (pdev->magic != PWC_MAGIC) { | 1972 | if (pdev->magic != PWC_MAGIC) { |
1973 | Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n"); | 1973 | Err("pwc_disconnect() Magic number failed. Consult your scrolls and try again.\n"); |
1974 | goto disconnect_out; | 1974 | goto disconnect_out; |
1975 | } | 1975 | } |
1976 | #endif | 1976 | #endif |
1977 | 1977 | ||
1978 | /* We got unplugged; this is signalled by an EPIPE error code */ | 1978 | /* We got unplugged; this is signalled by an EPIPE error code */ |
1979 | if (pdev->vopen) { | 1979 | if (pdev->vopen) { |
1980 | Info("Disconnected while webcam is in use!\n"); | 1980 | Info("Disconnected while webcam is in use!\n"); |
@@ -2017,8 +2017,8 @@ static int pwc_atoi(const char *s) | |||
2017 | } | 2017 | } |
2018 | 2018 | ||
2019 | 2019 | ||
2020 | /* | 2020 | /* |
2021 | * Initialization code & module stuff | 2021 | * Initialization code & module stuff |
2022 | */ | 2022 | */ |
2023 | 2023 | ||
2024 | static char size[10]; | 2024 | static char size[10]; |
@@ -2168,7 +2168,7 @@ static int __init usb_pwc_init(void) | |||
2168 | if (*dot != '\0') { | 2168 | if (*dot != '\0') { |
2169 | /* There's a serial number as well */ | 2169 | /* There's a serial number as well */ |
2170 | int k; | 2170 | int k; |
2171 | 2171 | ||
2172 | dot++; | 2172 | dot++; |
2173 | k = 0; | 2173 | k = 0; |
2174 | while (*dot != ':' && k < 29) { | 2174 | while (*dot != ':' && k < 29) { |
@@ -2178,18 +2178,18 @@ static int __init usb_pwc_init(void) | |||
2178 | device_hint[i].serial_number[k] = '\0'; | 2178 | device_hint[i].serial_number[k] = '\0'; |
2179 | } | 2179 | } |
2180 | } | 2180 | } |
2181 | #if PWC_DEBUG | 2181 | #if PWC_DEBUG |
2182 | Debug("device_hint[%d]:\n", i); | 2182 | Debug("device_hint[%d]:\n", i); |
2183 | Debug(" type : %d\n", device_hint[i].type); | 2183 | Debug(" type : %d\n", device_hint[i].type); |
2184 | Debug(" serial# : %s\n", device_hint[i].serial_number); | 2184 | Debug(" serial# : %s\n", device_hint[i].serial_number); |
2185 | Debug(" node : %d\n", device_hint[i].device_node); | 2185 | Debug(" node : %d\n", device_hint[i].device_node); |
2186 | #endif | 2186 | #endif |
2187 | } | 2187 | } |
2188 | else | 2188 | else |
2189 | device_hint[i].type = 0; /* not filled */ | 2189 | device_hint[i].type = 0; /* not filled */ |
2190 | } /* ..for MAX_DEV_HINTS */ | 2190 | } /* ..for MAX_DEV_HINTS */ |
2191 | 2191 | ||
2192 | Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver); | 2192 | Trace(TRACE_PROBE, "Registering driver at address 0x%p.\n", &pwc_driver); |
2193 | return usb_register(&pwc_driver); | 2193 | return usb_register(&pwc_driver); |
2194 | } | 2194 | } |
2195 | 2195 | ||
diff --git a/drivers/usb/media/pwc/pwc-ioctl.h b/drivers/media/video/pwc/pwc-ioctl.h index 5f9cb08bc02e..784bc72521fa 100644 --- a/drivers/usb/media/pwc/pwc-ioctl.h +++ b/drivers/media/video/pwc/pwc-ioctl.h | |||
@@ -33,10 +33,10 @@ | |||
33 | /* | 33 | /* |
34 | Changes | 34 | Changes |
35 | 2001/08/03 Alvarado Added ioctl constants to access methods for | 35 | 2001/08/03 Alvarado Added ioctl constants to access methods for |
36 | changing white balance and red/blue gains | 36 | changing white balance and red/blue gains |
37 | 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE | 37 | 2002/12/15 G. H. Fernandez-Toribio VIDIOCGREALSIZE |
38 | 2003/12/13 Nemosft Unv. Some modifications to make interfacing to | 38 | 2003/12/13 Nemosft Unv. Some modifications to make interfacing to |
39 | PWCX easier | 39 | PWCX easier |
40 | */ | 40 | */ |
41 | 41 | ||
42 | /* These are private ioctl() commands, specific for the Philips webcams. | 42 | /* These are private ioctl() commands, specific for the Philips webcams. |
@@ -45,10 +45,10 @@ | |||
45 | 45 | ||
46 | The #define names are built up like follows: | 46 | The #define names are built up like follows: |
47 | VIDIOC VIDeo IOCtl prefix | 47 | VIDIOC VIDeo IOCtl prefix |
48 | PWC Philps WebCam | 48 | PWC Philps WebCam |
49 | G optional: Get | 49 | G optional: Get |
50 | S optional: Set | 50 | S optional: Set |
51 | ... the function | 51 | ... the function |
52 | */ | 52 | */ |
53 | 53 | ||
54 | 54 | ||
@@ -94,7 +94,7 @@ struct pwc_serial | |||
94 | { | 94 | { |
95 | char serial[30]; /* String with serial number. Contains terminating 0 */ | 95 | char serial[30]; /* String with serial number. Contains terminating 0 */ |
96 | }; | 96 | }; |
97 | 97 | ||
98 | /* pwc_whitebalance.mode values */ | 98 | /* pwc_whitebalance.mode values */ |
99 | #define PWC_WB_INDOOR 0 | 99 | #define PWC_WB_INDOOR 0 |
100 | #define PWC_WB_OUTDOOR 1 | 100 | #define PWC_WB_OUTDOOR 1 |
@@ -102,14 +102,14 @@ struct pwc_serial | |||
102 | #define PWC_WB_MANUAL 3 | 102 | #define PWC_WB_MANUAL 3 |
103 | #define PWC_WB_AUTO 4 | 103 | #define PWC_WB_AUTO 4 |
104 | 104 | ||
105 | /* Used with VIDIOCPWC[SG]AWB (Auto White Balance). | 105 | /* Used with VIDIOCPWC[SG]AWB (Auto White Balance). |
106 | Set mode to one of the PWC_WB_* values above. | 106 | Set mode to one of the PWC_WB_* values above. |
107 | *red and *blue are the respective gains of these colour components inside | 107 | *red and *blue are the respective gains of these colour components inside |
108 | the camera; range 0..65535 | 108 | the camera; range 0..65535 |
109 | When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; | 109 | When 'mode' == PWC_WB_MANUAL, 'manual_red' and 'manual_blue' are set or read; |
110 | otherwise undefined. | 110 | otherwise undefined. |
111 | 'read_red' and 'read_blue' are read-only. | 111 | 'read_red' and 'read_blue' are read-only. |
112 | */ | 112 | */ |
113 | struct pwc_whitebalance | 113 | struct pwc_whitebalance |
114 | { | 114 | { |
115 | int mode; | 115 | int mode; |
@@ -117,9 +117,9 @@ struct pwc_whitebalance | |||
117 | int read_red, read_blue; /* R/O */ | 117 | int read_red, read_blue; /* R/O */ |
118 | }; | 118 | }; |
119 | 119 | ||
120 | /* | 120 | /* |
121 | 'control_speed' and 'control_delay' are used in automatic whitebalance mode, | 121 | 'control_speed' and 'control_delay' are used in automatic whitebalance mode, |
122 | and tell the camera how fast it should react to changes in lighting, and | 122 | and tell the camera how fast it should react to changes in lighting, and |
123 | with how much delay. Valid values are 0..65535. | 123 | with how much delay. Valid values are 0..65535. |
124 | */ | 124 | */ |
125 | struct pwc_wb_speed | 125 | struct pwc_wb_speed |
@@ -148,11 +148,11 @@ struct pwc_imagesize | |||
148 | #define PWC_MPT_TILT 0x02 | 148 | #define PWC_MPT_TILT 0x02 |
149 | #define PWC_MPT_TIMEOUT 0x04 /* for status */ | 149 | #define PWC_MPT_TIMEOUT 0x04 /* for status */ |
150 | 150 | ||
151 | /* Set angles; when absolute != 0, the angle is absolute and the | 151 | /* Set angles; when absolute != 0, the angle is absolute and the |
152 | driver calculates the relative offset for you. This can only | 152 | driver calculates the relative offset for you. This can only |
153 | be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns | 153 | be used with VIDIOCPWCSANGLE; VIDIOCPWCGANGLE always returns |
154 | absolute angles. | 154 | absolute angles. |
155 | */ | 155 | */ |
156 | struct pwc_mpt_angles | 156 | struct pwc_mpt_angles |
157 | { | 157 | { |
158 | int absolute; /* write-only */ | 158 | int absolute; /* write-only */ |
@@ -179,14 +179,14 @@ struct pwc_mpt_status | |||
179 | /* This is used for out-of-kernel decompression. With it, you can get | 179 | /* This is used for out-of-kernel decompression. With it, you can get |
180 | all the necessary information to initialize and use the decompressor | 180 | all the necessary information to initialize and use the decompressor |
181 | routines in standalone applications. | 181 | routines in standalone applications. |
182 | */ | 182 | */ |
183 | struct pwc_video_command | 183 | struct pwc_video_command |
184 | { | 184 | { |
185 | int type; /* camera type (645, 675, 730, etc.) */ | 185 | int type; /* camera type (645, 675, 730, etc.) */ |
186 | int release; /* release number */ | 186 | int release; /* release number */ |
187 | 187 | ||
188 | int size; /* one of PSZ_* */ | 188 | int size; /* one of PSZ_* */ |
189 | int alternate; | 189 | int alternate; |
190 | int command_len; /* length of USB video command */ | 190 | int command_len; /* length of USB video command */ |
191 | unsigned char command_buf[13]; /* Actual USB video command */ | 191 | unsigned char command_buf[13]; /* Actual USB video command */ |
192 | int bandlength; /* >0 = compressed */ | 192 | int bandlength; /* >0 = compressed */ |
@@ -264,7 +264,7 @@ struct pwc_video_command | |||
264 | 264 | ||
265 | /* Flickerless mode; = 0 off, otherwise on */ | 265 | /* Flickerless mode; = 0 off, otherwise on */ |
266 | #define VIDIOCPWCSFLICKER _IOW('v', 208, int) | 266 | #define VIDIOCPWCSFLICKER _IOW('v', 208, int) |
267 | #define VIDIOCPWCGFLICKER _IOR('v', 208, int) | 267 | #define VIDIOCPWCGFLICKER _IOR('v', 208, int) |
268 | 268 | ||
269 | /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ | 269 | /* Dynamic noise reduction; 0 off, 3 = high noise reduction */ |
270 | #define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) | 270 | #define VIDIOCPWCSDYNNOISE _IOW('v', 209, int) |
@@ -273,7 +273,7 @@ struct pwc_video_command | |||
273 | /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */ | 273 | /* Real image size as used by the camera; tells you whether or not there's a gray border around the image */ |
274 | #define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize) | 274 | #define VIDIOCPWCGREALSIZE _IOR('v', 210, struct pwc_imagesize) |
275 | 275 | ||
276 | /* Motorized pan & tilt functions */ | 276 | /* Motorized pan & tilt functions */ |
277 | #define VIDIOCPWCMPTRESET _IOW('v', 211, int) | 277 | #define VIDIOCPWCMPTRESET _IOW('v', 211, int) |
278 | #define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range) | 278 | #define VIDIOCPWCMPTGRANGE _IOR('v', 211, struct pwc_mpt_range) |
279 | #define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles) | 279 | #define VIDIOCPWCMPTSANGLE _IOW('v', 212, struct pwc_mpt_angles) |
diff --git a/drivers/media/video/pwc/pwc-kiara.c b/drivers/media/video/pwc/pwc-kiara.c new file mode 100644 index 000000000000..4c96037f7be5 --- /dev/null +++ b/drivers/media/video/pwc/pwc-kiara.c | |||
@@ -0,0 +1,318 @@ | |||
1 | /* Linux driver for Philips webcam | ||
2 | (C) 2004 Luc Saillard (luc@saillard.org) | ||
3 | |||
4 | NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx | ||
5 | driver and thus may have bugs that are not present in the original version. | ||
6 | Please send bug reports and support requests to <luc@saillard.org>. | ||
7 | The decompression routines have been implemented by reverse-engineering the | ||
8 | Nemosoft binary pwcx module. Caveat emptor. | ||
9 | |||
10 | This program is free software; you can redistribute it and/or modify | ||
11 | it under the terms of the GNU General Public License as published by | ||
12 | the Free Software Foundation; either version 2 of the License, or | ||
13 | (at your option) any later version. | ||
14 | |||
15 | This program is distributed in the hope that it will be useful, | ||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | GNU General Public License for more details. | ||
19 | |||
20 | You should have received a copy of the GNU General Public License | ||
21 | along with this program; if not, write to the Free Software | ||
22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | |||
26 | /* This tables contains entries for the 730/740/750 (Kiara) camera, with | ||
27 | 4 different qualities (no compression, low, medium, high). | ||
28 | It lists the bandwidth requirements for said mode by its alternate interface | ||
29 | number. An alternate of 0 means that the mode is unavailable. | ||
30 | |||
31 | There are 6 * 4 * 4 entries: | ||
32 | 6 different resolutions subqcif, qsif, qcif, sif, cif, vga | ||
33 | 6 framerates: 5, 10, 15, 20, 25, 30 | ||
34 | 4 compression modi: none, low, medium, high | ||
35 | |||
36 | When an uncompressed mode is not available, the next available compressed mode | ||
37 | will be chosen (unless the decompressor is absent). Sometimes there are only | ||
38 | 1 or 2 compressed modes available; in that case entries are duplicated. | ||
39 | */ | ||
40 | |||
41 | |||
42 | #include "pwc-kiara.h" | ||
43 | #include "pwc-uncompress.h" | ||
44 | |||
45 | const struct Kiara_table_entry Kiara_table[PSZ_MAX][6][4] = | ||
46 | { | ||
47 | /* SQCIF */ | ||
48 | { | ||
49 | /* 5 fps */ | ||
50 | { | ||
51 | {0, }, | ||
52 | {0, }, | ||
53 | {0, }, | ||
54 | {0, }, | ||
55 | }, | ||
56 | /* 10 fps */ | ||
57 | { | ||
58 | {0, }, | ||
59 | {0, }, | ||
60 | {0, }, | ||
61 | {0, }, | ||
62 | }, | ||
63 | /* 15 fps */ | ||
64 | { | ||
65 | {0, }, | ||
66 | {0, }, | ||
67 | {0, }, | ||
68 | {0, }, | ||
69 | }, | ||
70 | /* 20 fps */ | ||
71 | { | ||
72 | {0, }, | ||
73 | {0, }, | ||
74 | {0, }, | ||
75 | {0, }, | ||
76 | }, | ||
77 | /* 25 fps */ | ||
78 | { | ||
79 | {0, }, | ||
80 | {0, }, | ||
81 | {0, }, | ||
82 | {0, }, | ||
83 | }, | ||
84 | /* 30 fps */ | ||
85 | { | ||
86 | {0, }, | ||
87 | {0, }, | ||
88 | {0, }, | ||
89 | {0, }, | ||
90 | }, | ||
91 | }, | ||
92 | /* QSIF */ | ||
93 | { | ||
94 | /* 5 fps */ | ||
95 | { | ||
96 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
97 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
98 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
99 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
100 | }, | ||
101 | /* 10 fps */ | ||
102 | { | ||
103 | {2, 291, 0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}}, | ||
104 | {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, | ||
105 | {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, | ||
106 | {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, | ||
107 | }, | ||
108 | /* 15 fps */ | ||
109 | { | ||
110 | {3, 437, 0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}}, | ||
111 | {2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, | ||
112 | {2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, | ||
113 | {1, 192, 420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, | ||
114 | }, | ||
115 | /* 20 fps */ | ||
116 | { | ||
117 | {4, 589, 0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}}, | ||
118 | {3, 448, 730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}}, | ||
119 | {2, 292, 476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}}, | ||
120 | {1, 192, 312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, | ||
121 | }, | ||
122 | /* 25 fps */ | ||
123 | { | ||
124 | {5, 703, 0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}}, | ||
125 | {3, 447, 610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}}, | ||
126 | {2, 292, 398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}}, | ||
127 | {1, 193, 262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}}, | ||
128 | }, | ||
129 | /* 30 fps */ | ||
130 | { | ||
131 | {8, 874, 0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}}, | ||
132 | {5, 704, 730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}}, | ||
133 | {3, 448, 492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}}, | ||
134 | {2, 292, 320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}}, | ||
135 | }, | ||
136 | }, | ||
137 | /* QCIF */ | ||
138 | { | ||
139 | /* 5 fps */ | ||
140 | { | ||
141 | {0, }, | ||
142 | {0, }, | ||
143 | {0, }, | ||
144 | {0, }, | ||
145 | }, | ||
146 | /* 10 fps */ | ||
147 | { | ||
148 | {0, }, | ||
149 | {0, }, | ||
150 | {0, }, | ||
151 | {0, }, | ||
152 | }, | ||
153 | /* 15 fps */ | ||
154 | { | ||
155 | {0, }, | ||
156 | {0, }, | ||
157 | {0, }, | ||
158 | {0, }, | ||
159 | }, | ||
160 | /* 20 fps */ | ||
161 | { | ||
162 | {0, }, | ||
163 | {0, }, | ||
164 | {0, }, | ||
165 | {0, }, | ||
166 | }, | ||
167 | /* 25 fps */ | ||
168 | { | ||
169 | {0, }, | ||
170 | {0, }, | ||
171 | {0, }, | ||
172 | {0, }, | ||
173 | }, | ||
174 | /* 30 fps */ | ||
175 | { | ||
176 | {0, }, | ||
177 | {0, }, | ||
178 | {0, }, | ||
179 | {0, }, | ||
180 | }, | ||
181 | }, | ||
182 | /* SIF */ | ||
183 | { | ||
184 | /* 5 fps */ | ||
185 | { | ||
186 | {4, 582, 0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}}, | ||
187 | {3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}}, | ||
188 | {2, 291, 960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}}, | ||
189 | {1, 191, 630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}}, | ||
190 | }, | ||
191 | /* 10 fps */ | ||
192 | { | ||
193 | {0, }, | ||
194 | {6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}}, | ||
195 | {3, 447, 736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}}, | ||
196 | {2, 292, 480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}}, | ||
197 | }, | ||
198 | /* 15 fps */ | ||
199 | { | ||
200 | {0, }, | ||
201 | {9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}}, | ||
202 | {4, 592, 650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}}, | ||
203 | {3, 448, 492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}}, | ||
204 | }, | ||
205 | /* 20 fps */ | ||
206 | { | ||
207 | {0, }, | ||
208 | {9, 958, 782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}}, | ||
209 | {5, 703, 574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}}, | ||
210 | {3, 446, 364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}}, | ||
211 | }, | ||
212 | /* 25 fps */ | ||
213 | { | ||
214 | {0, }, | ||
215 | {9, 958, 654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}}, | ||
216 | {6, 776, 530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}}, | ||
217 | {4, 592, 404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}}, | ||
218 | }, | ||
219 | /* 30 fps */ | ||
220 | { | ||
221 | {0, }, | ||
222 | {9, 957, 526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}}, | ||
223 | {6, 775, 426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}}, | ||
224 | {4, 590, 324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}}, | ||
225 | }, | ||
226 | }, | ||
227 | /* CIF */ | ||
228 | { | ||
229 | /* 5 fps */ | ||
230 | { | ||
231 | {0, }, | ||
232 | {0, }, | ||
233 | {0, }, | ||
234 | {0, }, | ||
235 | }, | ||
236 | /* 10 fps */ | ||
237 | { | ||
238 | {0, }, | ||
239 | {0, }, | ||
240 | {0, }, | ||
241 | {0, }, | ||
242 | }, | ||
243 | /* 15 fps */ | ||
244 | { | ||
245 | {0, }, | ||
246 | {0, }, | ||
247 | {0, }, | ||
248 | {0, }, | ||
249 | }, | ||
250 | /* 20 fps */ | ||
251 | { | ||
252 | {0, }, | ||
253 | {0, }, | ||
254 | {0, }, | ||
255 | {0, }, | ||
256 | }, | ||
257 | /* 25 fps */ | ||
258 | { | ||
259 | {0, }, | ||
260 | {0, }, | ||
261 | {0, }, | ||
262 | {0, }, | ||
263 | }, | ||
264 | /* 30 fps */ | ||
265 | { | ||
266 | {0, }, | ||
267 | {0, }, | ||
268 | {0, }, | ||
269 | {0, }, | ||
270 | }, | ||
271 | }, | ||
272 | /* VGA */ | ||
273 | { | ||
274 | /* 5 fps */ | ||
275 | { | ||
276 | {0, }, | ||
277 | {6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}}, | ||
278 | {4, 592, 976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}}, | ||
279 | {3, 448, 738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}}, | ||
280 | }, | ||
281 | /* 10 fps */ | ||
282 | { | ||
283 | {0, }, | ||
284 | {9, 956, 788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}}, | ||
285 | {6, 776, 640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}}, | ||
286 | {4, 592, 488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}}, | ||
287 | }, | ||
288 | /* 15 fps */ | ||
289 | { | ||
290 | {0, }, | ||
291 | {9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, | ||
292 | {9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, | ||
293 | {8, 895, 492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}}, | ||
294 | }, | ||
295 | /* 20 fps */ | ||
296 | { | ||
297 | {0, }, | ||
298 | {0, }, | ||
299 | {0, }, | ||
300 | {0, }, | ||
301 | }, | ||
302 | /* 25 fps */ | ||
303 | { | ||
304 | {0, }, | ||
305 | {0, }, | ||
306 | {0, }, | ||
307 | {0, }, | ||
308 | }, | ||
309 | /* 30 fps */ | ||
310 | { | ||
311 | {0, }, | ||
312 | {0, }, | ||
313 | {0, }, | ||
314 | {0, }, | ||
315 | }, | ||
316 | }, | ||
317 | }; | ||
318 | |||
diff --git a/drivers/usb/media/pwc/pwc-kiara.h b/drivers/media/video/pwc/pwc-kiara.h index 12929abbb1f0..12929abbb1f0 100644 --- a/drivers/usb/media/pwc/pwc-kiara.h +++ b/drivers/media/video/pwc/pwc-kiara.h | |||
diff --git a/drivers/usb/media/pwc/pwc-misc.c b/drivers/media/video/pwc/pwc-misc.c index b7a4bd3524c7..58fe79747992 100644 --- a/drivers/usb/media/pwc/pwc-misc.c +++ b/drivers/media/video/pwc/pwc-misc.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* Linux driver for Philips webcam | 1 | /* Linux driver for Philips webcam |
2 | Various miscellaneous functions and tables. | 2 | Various miscellaneous functions and tables. |
3 | (C) 1999-2003 Nemosoft Unv. | 3 | (C) 1999-2003 Nemosoft Unv. |
4 | (C) 2004 Luc Saillard (luc@saillard.org) | 4 | (C) 2004 Luc Saillard (luc@saillard.org) |
@@ -44,17 +44,17 @@ int pwc_decode_size(struct pwc_device *pdev, int width, int height) | |||
44 | int i, find; | 44 | int i, find; |
45 | 45 | ||
46 | /* Make sure we don't go beyond our max size. | 46 | /* Make sure we don't go beyond our max size. |
47 | NB: we have different limits for RAW and normal modes. In case | 47 | NB: we have different limits for RAW and normal modes. In case |
48 | you don't have the decompressor loaded or use RAW mode, | 48 | you don't have the decompressor loaded or use RAW mode, |
49 | the maximum viewable size is smaller. | 49 | the maximum viewable size is smaller. |
50 | */ | 50 | */ |
51 | if (pdev->vpalette == VIDEO_PALETTE_RAW) | 51 | if (pdev->vpalette == VIDEO_PALETTE_RAW) |
52 | { | 52 | { |
53 | if (width > pdev->abs_max.x || height > pdev->abs_max.y) | 53 | if (width > pdev->abs_max.x || height > pdev->abs_max.y) |
54 | { | 54 | { |
55 | Debug("VIDEO_PALETTE_RAW: going beyond abs_max.\n"); | 55 | Debug("VIDEO_PALETTE_RAW: going beyond abs_max.\n"); |
56 | return -1; | 56 | return -1; |
57 | } | 57 | } |
58 | } | 58 | } |
59 | else | 59 | else |
60 | { | 60 | { |
@@ -88,8 +88,8 @@ void pwc_construct(struct pwc_device *pdev) | |||
88 | pdev->view_min.y = 96; | 88 | pdev->view_min.y = 96; |
89 | pdev->view_max.x = 352; | 89 | pdev->view_max.x = 352; |
90 | pdev->view_max.y = 288; | 90 | pdev->view_max.y = 288; |
91 | pdev->abs_max.x = 352; | 91 | pdev->abs_max.x = 352; |
92 | pdev->abs_max.y = 288; | 92 | pdev->abs_max.y = 288; |
93 | pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF; | 93 | pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QCIF | 1 << PSZ_CIF; |
94 | pdev->vcinterface = 2; | 94 | pdev->vcinterface = 2; |
95 | pdev->vendpoint = 4; | 95 | pdev->vendpoint = 4; |
@@ -105,8 +105,8 @@ void pwc_construct(struct pwc_device *pdev) | |||
105 | pdev->view_max.x = 640; | 105 | pdev->view_max.x = 640; |
106 | pdev->view_max.y = 480; | 106 | pdev->view_max.y = 480; |
107 | pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA; | 107 | pdev->image_mask = 1 << PSZ_SQCIF | 1 << PSZ_QSIF | 1 << PSZ_QCIF | 1 << PSZ_SIF | 1 << PSZ_CIF | 1 << PSZ_VGA; |
108 | pdev->abs_max.x = 640; | 108 | pdev->abs_max.x = 640; |
109 | pdev->abs_max.y = 480; | 109 | pdev->abs_max.y = 480; |
110 | pdev->vcinterface = 3; | 110 | pdev->vcinterface = 3; |
111 | pdev->vendpoint = 4; | 111 | pdev->vendpoint = 4; |
112 | pdev->frame_header_size = 0; | 112 | pdev->frame_header_size = 0; |
@@ -121,8 +121,8 @@ void pwc_construct(struct pwc_device *pdev) | |||
121 | pdev->view_max.x = 640; | 121 | pdev->view_max.x = 640; |
122 | pdev->view_max.y = 480; | 122 | pdev->view_max.y = 480; |
123 | pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA; | 123 | pdev->image_mask = 1 << PSZ_QSIF | 1 << PSZ_SIF | 1 << PSZ_VGA; |
124 | pdev->abs_max.x = 640; | 124 | pdev->abs_max.x = 640; |
125 | pdev->abs_max.y = 480; | 125 | pdev->abs_max.y = 480; |
126 | pdev->vcinterface = 3; | 126 | pdev->vcinterface = 3; |
127 | pdev->vendpoint = 5; | 127 | pdev->vendpoint = 5; |
128 | pdev->frame_header_size = TOUCAM_HEADER_SIZE; | 128 | pdev->frame_header_size = TOUCAM_HEADER_SIZE; |
diff --git a/drivers/usb/media/pwc/pwc-nala.h b/drivers/media/video/pwc/pwc-nala.h index e6c5cb69d03b..168c73ef75d8 100644 --- a/drivers/usb/media/pwc/pwc-nala.h +++ b/drivers/media/video/pwc/pwc-nala.h | |||
@@ -54,7 +54,7 @@ | |||
54 | {0}, | 54 | {0}, |
55 | }, | 55 | }, |
56 | /* VGA */ | 56 | /* VGA */ |
57 | { | 57 | { |
58 | {0}, | 58 | {0}, |
59 | {0}, | 59 | {0}, |
60 | {0}, | 60 | {0}, |
diff --git a/drivers/media/video/pwc/pwc-timon.c b/drivers/media/video/pwc/pwc-timon.c new file mode 100644 index 000000000000..175250d089cf --- /dev/null +++ b/drivers/media/video/pwc/pwc-timon.c | |||
@@ -0,0 +1,316 @@ | |||
1 | /* Linux driver for Philips webcam | ||
2 | (C) 2004 Luc Saillard (luc@saillard.org) | ||
3 | |||
4 | NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx | ||
5 | driver and thus may have bugs that are not present in the original version. | ||
6 | Please send bug reports and support requests to <luc@saillard.org>. | ||
7 | The decompression routines have been implemented by reverse-engineering the | ||
8 | Nemosoft binary pwcx module. Caveat emptor. | ||
9 | |||
10 | This program is free software; you can redistribute it and/or modify | ||
11 | it under the terms of the GNU General Public License as published by | ||
12 | the Free Software Foundation; either version 2 of the License, or | ||
13 | (at your option) any later version. | ||
14 | |||
15 | This program is distributed in the hope that it will be useful, | ||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | GNU General Public License for more details. | ||
19 | |||
20 | You should have received a copy of the GNU General Public License | ||
21 | along with this program; if not, write to the Free Software | ||
22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | |||
26 | /* This tables contains entries for the 675/680/690 (Timon) camera, with | ||
27 | 4 different qualities (no compression, low, medium, high). | ||
28 | It lists the bandwidth requirements for said mode by its alternate interface | ||
29 | number. An alternate of 0 means that the mode is unavailable. | ||
30 | |||
31 | There are 6 * 4 * 4 entries: | ||
32 | 6 different resolutions subqcif, qsif, qcif, sif, cif, vga | ||
33 | 6 framerates: 5, 10, 15, 20, 25, 30 | ||
34 | 4 compression modi: none, low, medium, high | ||
35 | |||
36 | When an uncompressed mode is not available, the next available compressed mode | ||
37 | will be chosen (unless the decompressor is absent). Sometimes there are only | ||
38 | 1 or 2 compressed modes available; in that case entries are duplicated. | ||
39 | */ | ||
40 | |||
41 | #include "pwc-timon.h" | ||
42 | |||
43 | const struct Timon_table_entry Timon_table[PSZ_MAX][6][4] = | ||
44 | { | ||
45 | /* SQCIF */ | ||
46 | { | ||
47 | /* 5 fps */ | ||
48 | { | ||
49 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
50 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
51 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
52 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
53 | }, | ||
54 | /* 10 fps */ | ||
55 | { | ||
56 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
57 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
58 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
59 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
60 | }, | ||
61 | /* 15 fps */ | ||
62 | { | ||
63 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
64 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
65 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
66 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
67 | }, | ||
68 | /* 20 fps */ | ||
69 | { | ||
70 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
71 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
72 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
73 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
74 | }, | ||
75 | /* 25 fps */ | ||
76 | { | ||
77 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
78 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
79 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
80 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
81 | }, | ||
82 | /* 30 fps */ | ||
83 | { | ||
84 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
85 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
86 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
87 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
88 | }, | ||
89 | }, | ||
90 | /* QSIF */ | ||
91 | { | ||
92 | /* 5 fps */ | ||
93 | { | ||
94 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
95 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
96 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
97 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
98 | }, | ||
99 | /* 10 fps */ | ||
100 | { | ||
101 | {2, 291, 0, {0x2C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0xA1, 0xC0, 0x02}}, | ||
102 | {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
103 | {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
104 | {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
105 | }, | ||
106 | /* 15 fps */ | ||
107 | { | ||
108 | {3, 437, 0, {0x2B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x6D, 0xC0, 0x02}}, | ||
109 | {2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
110 | {2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
111 | {1, 191, 420, {0x2B, 0xF4, 0x0D, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
112 | }, | ||
113 | /* 20 fps */ | ||
114 | { | ||
115 | {4, 588, 0, {0x2A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4C, 0x52, 0xC0, 0x02}}, | ||
116 | {3, 447, 730, {0x2A, 0xF4, 0x05, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
117 | {2, 292, 476, {0x2A, 0xF4, 0x0D, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, | ||
118 | {1, 192, 312, {0x2A, 0xF4, 0x1D, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, | ||
119 | }, | ||
120 | /* 25 fps */ | ||
121 | { | ||
122 | {5, 703, 0, {0x29, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x42, 0xC0, 0x02}}, | ||
123 | {3, 447, 610, {0x29, 0xF4, 0x05, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
124 | {2, 292, 398, {0x29, 0xF4, 0x0D, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, | ||
125 | {1, 192, 262, {0x29, 0xF4, 0x25, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, | ||
126 | }, | ||
127 | /* 30 fps */ | ||
128 | { | ||
129 | {8, 873, 0, {0x28, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x69, 0x37, 0xC0, 0x02}}, | ||
130 | {5, 704, 774, {0x28, 0xF4, 0x05, 0x18, 0x21, 0x17, 0x59, 0x0F, 0x18, 0xC0, 0x42, 0xC0, 0x02}}, | ||
131 | {3, 448, 492, {0x28, 0xF4, 0x05, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x18, 0xC0, 0x69, 0xC0, 0x02}}, | ||
132 | {2, 291, 320, {0x28, 0xF4, 0x1D, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, | ||
133 | }, | ||
134 | }, | ||
135 | /* QCIF */ | ||
136 | { | ||
137 | /* 5 fps */ | ||
138 | { | ||
139 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
140 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
141 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
142 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
143 | }, | ||
144 | /* 10 fps */ | ||
145 | { | ||
146 | {3, 385, 0, {0x0C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x81, 0x79, 0xC0, 0x02}}, | ||
147 | {2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
148 | {2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
149 | {1, 194, 532, {0x0C, 0xF4, 0x05, 0x10, 0x9A, 0x0F, 0xBE, 0x1B, 0x08, 0xC2, 0xF0, 0xC0, 0x02}}, | ||
150 | }, | ||
151 | /* 15 fps */ | ||
152 | { | ||
153 | {4, 577, 0, {0x0B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x41, 0x52, 0xC0, 0x02}}, | ||
154 | {3, 447, 818, {0x0B, 0xF4, 0x05, 0x19, 0x89, 0x18, 0xAD, 0x0F, 0x10, 0xBF, 0x69, 0xC0, 0x02}}, | ||
155 | {2, 292, 534, {0x0B, 0xF4, 0x05, 0x10, 0xA3, 0x0F, 0xC7, 0x19, 0x10, 0x24, 0xA1, 0xC0, 0x02}}, | ||
156 | {1, 195, 356, {0x0B, 0xF4, 0x15, 0x0B, 0x11, 0x0A, 0x35, 0x1E, 0x10, 0xC3, 0xF0, 0xC0, 0x02}}, | ||
157 | }, | ||
158 | /* 20 fps */ | ||
159 | { | ||
160 | {6, 776, 0, {0x0A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x3F, 0xC0, 0x02}}, | ||
161 | {4, 591, 804, {0x0A, 0xF4, 0x05, 0x19, 0x1E, 0x18, 0x42, 0x0F, 0x18, 0x4F, 0x4E, 0xC0, 0x02}}, | ||
162 | {3, 447, 608, {0x0A, 0xF4, 0x05, 0x12, 0xFD, 0x12, 0x21, 0x15, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
163 | {2, 291, 396, {0x0A, 0xF4, 0x15, 0x0C, 0x5E, 0x0B, 0x82, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, | ||
164 | }, | ||
165 | /* 25 fps */ | ||
166 | { | ||
167 | {9, 928, 0, {0x09, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xA0, 0x33, 0xC0, 0x02}}, | ||
168 | {5, 703, 800, {0x09, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x10, 0x18, 0xBF, 0x42, 0xC0, 0x02}}, | ||
169 | {3, 447, 508, {0x09, 0xF4, 0x0D, 0x0F, 0xD2, 0x0E, 0xF6, 0x1B, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
170 | {2, 292, 332, {0x09, 0xF4, 0x1D, 0x0A, 0x5A, 0x09, 0x7E, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, | ||
171 | }, | ||
172 | /* 30 fps */ | ||
173 | { | ||
174 | {0, }, | ||
175 | {9, 956, 876, {0x08, 0xF4, 0x05, 0x1B, 0x58, 0x1A, 0x7C, 0x0E, 0x20, 0xBC, 0x33, 0x10, 0x02}}, | ||
176 | {4, 592, 542, {0x08, 0xF4, 0x05, 0x10, 0xE4, 0x10, 0x08, 0x17, 0x20, 0x50, 0x4E, 0x10, 0x02}}, | ||
177 | {2, 291, 266, {0x08, 0xF4, 0x25, 0x08, 0x48, 0x07, 0x6C, 0x1E, 0x20, 0x23, 0xA1, 0x10, 0x02}}, | ||
178 | }, | ||
179 | }, | ||
180 | /* SIF */ | ||
181 | { | ||
182 | /* 5 fps */ | ||
183 | { | ||
184 | {4, 582, 0, {0x35, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x52, 0x60, 0x02}}, | ||
185 | {3, 387, 1276, {0x35, 0xF4, 0x05, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x79, 0x60, 0x02}}, | ||
186 | {2, 291, 960, {0x35, 0xF4, 0x0D, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0xA1, 0x60, 0x02}}, | ||
187 | {1, 191, 630, {0x35, 0xF4, 0x1D, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x08, 0xBF, 0xF4, 0x60, 0x02}}, | ||
188 | }, | ||
189 | /* 10 fps */ | ||
190 | { | ||
191 | {0, }, | ||
192 | {6, 775, 1278, {0x34, 0xF4, 0x05, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x3F, 0x10, 0x02}}, | ||
193 | {3, 447, 736, {0x34, 0xF4, 0x15, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x18, 0xBF, 0x69, 0x10, 0x02}}, | ||
194 | {2, 291, 480, {0x34, 0xF4, 0x2D, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x18, 0x23, 0xA1, 0x10, 0x02}}, | ||
195 | }, | ||
196 | /* 15 fps */ | ||
197 | { | ||
198 | {0, }, | ||
199 | {9, 955, 1050, {0x33, 0xF4, 0x05, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x33, 0x10, 0x02}}, | ||
200 | {4, 591, 650, {0x33, 0xF4, 0x15, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x4F, 0x4E, 0x10, 0x02}}, | ||
201 | {3, 448, 492, {0x33, 0xF4, 0x25, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x28, 0xC0, 0x69, 0x10, 0x02}}, | ||
202 | }, | ||
203 | /* 20 fps */ | ||
204 | { | ||
205 | {0, }, | ||
206 | {9, 958, 782, {0x32, 0xF4, 0x0D, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x33, 0xD0, 0x02}}, | ||
207 | {5, 703, 574, {0x32, 0xF4, 0x1D, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x42, 0xD0, 0x02}}, | ||
208 | {3, 446, 364, {0x32, 0xF4, 0x3D, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x30, 0xBE, 0x69, 0xD0, 0x02}}, | ||
209 | }, | ||
210 | /* 25 fps */ | ||
211 | { | ||
212 | {0, }, | ||
213 | {9, 958, 654, {0x31, 0xF4, 0x15, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x33, 0x90, 0x02}}, | ||
214 | {6, 776, 530, {0x31, 0xF4, 0x25, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x3F, 0x90, 0x02}}, | ||
215 | {4, 592, 404, {0x31, 0xF4, 0x35, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x38, 0x50, 0x4E, 0x90, 0x02}}, | ||
216 | }, | ||
217 | /* 30 fps */ | ||
218 | { | ||
219 | {0, }, | ||
220 | {9, 957, 526, {0x30, 0xF4, 0x25, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x33, 0x60, 0x02}}, | ||
221 | {6, 775, 426, {0x30, 0xF4, 0x35, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x3F, 0x60, 0x02}}, | ||
222 | {4, 590, 324, {0x30, 0x7A, 0x4B, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x40, 0x4E, 0x52, 0x60, 0x02}}, | ||
223 | }, | ||
224 | }, | ||
225 | /* CIF */ | ||
226 | { | ||
227 | /* 5 fps */ | ||
228 | { | ||
229 | {6, 771, 0, {0x15, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x3F, 0x80, 0x02}}, | ||
230 | {4, 465, 1278, {0x15, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x03, 0x18, 0xD1, 0x65, 0x80, 0x02}}, | ||
231 | {2, 291, 800, {0x15, 0xF4, 0x15, 0x18, 0xF4, 0x17, 0x3C, 0x05, 0x18, 0x23, 0xA1, 0x80, 0x02}}, | ||
232 | {1, 193, 528, {0x15, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x18, 0xC1, 0xF4, 0x80, 0x02}}, | ||
233 | }, | ||
234 | /* 10 fps */ | ||
235 | { | ||
236 | {0, }, | ||
237 | {9, 932, 1278, {0x14, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x04, 0x30, 0xA4, 0x33, 0x10, 0x02}}, | ||
238 | {4, 591, 812, {0x14, 0xF4, 0x15, 0x19, 0x56, 0x17, 0x9E, 0x06, 0x28, 0x4F, 0x4E, 0x10, 0x02}}, | ||
239 | {2, 291, 400, {0x14, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x28, 0x23, 0xA1, 0x10, 0x02}}, | ||
240 | }, | ||
241 | /* 15 fps */ | ||
242 | { | ||
243 | {0, }, | ||
244 | {9, 956, 876, {0x13, 0xF4, 0x0D, 0x1B, 0x58, 0x19, 0xA0, 0x05, 0x38, 0xBC, 0x33, 0x60, 0x02}}, | ||
245 | {5, 703, 644, {0x13, 0xF4, 0x1D, 0x14, 0x1C, 0x12, 0x64, 0x08, 0x38, 0xBF, 0x42, 0x60, 0x02}}, | ||
246 | {3, 448, 410, {0x13, 0xF4, 0x3D, 0x0C, 0xC4, 0x0B, 0x0C, 0x0E, 0x38, 0xC0, 0x69, 0x60, 0x02}}, | ||
247 | }, | ||
248 | /* 20 fps */ | ||
249 | { | ||
250 | {0, }, | ||
251 | {9, 956, 650, {0x12, 0xF4, 0x1D, 0x14, 0x4A, 0x12, 0x92, 0x09, 0x48, 0xBC, 0x33, 0x10, 0x03}}, | ||
252 | {6, 776, 528, {0x12, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x40, 0x08, 0x3F, 0x10, 0x03}}, | ||
253 | {4, 591, 402, {0x12, 0xF4, 0x3D, 0x0C, 0x8F, 0x0A, 0xD7, 0x0E, 0x40, 0x4F, 0x4E, 0x10, 0x03}}, | ||
254 | }, | ||
255 | /* 25 fps */ | ||
256 | { | ||
257 | {0, }, | ||
258 | {9, 956, 544, {0x11, 0xF4, 0x25, 0x10, 0xF4, 0x0F, 0x3C, 0x0A, 0x48, 0xBC, 0x33, 0xC0, 0x02}}, | ||
259 | {7, 840, 478, {0x11, 0xF4, 0x2D, 0x0E, 0xEB, 0x0D, 0x33, 0x0B, 0x48, 0x48, 0x3B, 0xC0, 0x02}}, | ||
260 | {5, 703, 400, {0x11, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x48, 0xBF, 0x42, 0xC0, 0x02}}, | ||
261 | }, | ||
262 | /* 30 fps */ | ||
263 | { | ||
264 | {0, }, | ||
265 | {9, 956, 438, {0x10, 0xF4, 0x35, 0x0D, 0xAC, 0x0B, 0xF4, 0x0D, 0x50, 0xBC, 0x33, 0x10, 0x02}}, | ||
266 | {7, 838, 384, {0x10, 0xF4, 0x45, 0x0B, 0xFD, 0x0A, 0x45, 0x0F, 0x50, 0x46, 0x3B, 0x10, 0x02}}, | ||
267 | {6, 773, 354, {0x10, 0x7A, 0x4B, 0x0B, 0x0C, 0x09, 0x80, 0x10, 0x50, 0x05, 0x3F, 0x10, 0x02}}, | ||
268 | }, | ||
269 | }, | ||
270 | /* VGA */ | ||
271 | { | ||
272 | /* 5 fps */ | ||
273 | { | ||
274 | {0, }, | ||
275 | {6, 773, 1272, {0x1D, 0xF4, 0x15, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x3F, 0x10, 0x02}}, | ||
276 | {4, 592, 976, {0x1D, 0xF4, 0x25, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x4E, 0x10, 0x02}}, | ||
277 | {3, 448, 738, {0x1D, 0xF4, 0x3D, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x69, 0x10, 0x02}}, | ||
278 | }, | ||
279 | /* 10 fps */ | ||
280 | { | ||
281 | {0, }, | ||
282 | {9, 956, 788, {0x1C, 0xF4, 0x35, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x33, 0x10, 0x02}}, | ||
283 | {6, 776, 640, {0x1C, 0x7A, 0x53, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x3F, 0x10, 0x02}}, | ||
284 | {4, 592, 488, {0x1C, 0x7A, 0x6B, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x4E, 0x10, 0x02}}, | ||
285 | }, | ||
286 | /* 15 fps */ | ||
287 | { | ||
288 | {0, }, | ||
289 | {9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, | ||
290 | {9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, | ||
291 | {8, 895, 492, {0x1B, 0x7A, 0x6B, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x37, 0x80, 0x02}}, | ||
292 | }, | ||
293 | /* 20 fps */ | ||
294 | { | ||
295 | {0, }, | ||
296 | {0, }, | ||
297 | {0, }, | ||
298 | {0, }, | ||
299 | }, | ||
300 | /* 25 fps */ | ||
301 | { | ||
302 | {0, }, | ||
303 | {0, }, | ||
304 | {0, }, | ||
305 | {0, }, | ||
306 | }, | ||
307 | /* 30 fps */ | ||
308 | { | ||
309 | {0, }, | ||
310 | {0, }, | ||
311 | {0, }, | ||
312 | {0, }, | ||
313 | }, | ||
314 | }, | ||
315 | }; | ||
316 | |||
diff --git a/drivers/usb/media/pwc/pwc-timon.h b/drivers/media/video/pwc/pwc-timon.h index a86b3782a081..a86b3782a081 100644 --- a/drivers/usb/media/pwc/pwc-timon.h +++ b/drivers/media/video/pwc/pwc-timon.h | |||
diff --git a/drivers/usb/media/pwc/pwc-uncompress.c b/drivers/media/video/pwc/pwc-uncompress.c index ef4204eab6c4..b37a89a163f9 100644 --- a/drivers/usb/media/pwc/pwc-uncompress.c +++ b/drivers/media/video/pwc/pwc-uncompress.c | |||
@@ -109,9 +109,9 @@ int pwc_decompress(struct pwc_device *pdev) | |||
109 | in planar format immediately. | 109 | in planar format immediately. |
110 | */ | 110 | */ |
111 | int flags; | 111 | int flags; |
112 | 112 | ||
113 | flags = PWCX_FLAG_PLANAR; | 113 | flags = PWCX_FLAG_PLANAR; |
114 | if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot) | 114 | if (pdev->vsize == PSZ_VGA && pdev->vframes == 5 && pdev->vsnapshot) |
115 | { | 115 | { |
116 | printk(KERN_ERR "pwc: Mode Bayer is not supported for now\n"); | 116 | printk(KERN_ERR "pwc: Mode Bayer is not supported for now\n"); |
117 | flags |= PWCX_FLAG_BAYER; | 117 | flags |= PWCX_FLAG_BAYER; |
diff --git a/drivers/usb/media/pwc/pwc-uncompress.h b/drivers/media/video/pwc/pwc-uncompress.h index d3b9250e4ed3..f75e1b6cbe19 100644 --- a/drivers/usb/media/pwc/pwc-uncompress.h +++ b/drivers/media/video/pwc/pwc-uncompress.h | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | /* This file is the bridge between the kernel module and the plugin; it | 25 | /* This file is the bridge between the kernel module and the plugin; it |
26 | describes the structures and datatypes used in both modules. Any | 26 | describes the structures and datatypes used in both modules. Any |
27 | significant change should be reflected by increasing the | 27 | significant change should be reflected by increasing the |
28 | pwc_decompressor_version major number. | 28 | pwc_decompressor_version major number. |
29 | */ | 29 | */ |
30 | #ifndef PWC_UNCOMPRESS_H | 30 | #ifndef PWC_UNCOMPRESS_H |
diff --git a/drivers/usb/media/pwc/pwc.h b/drivers/media/video/pwc/pwc.h index 6dd76bb3dff1..1b0ee0ced0ed 100644 --- a/drivers/usb/media/pwc/pwc.h +++ b/drivers/media/video/pwc/pwc.h | |||
@@ -123,7 +123,7 @@ struct pwc_device | |||
123 | #endif | 123 | #endif |
124 | /* Pointer to our usb_device */ | 124 | /* Pointer to our usb_device */ |
125 | struct usb_device *udev; | 125 | struct usb_device *udev; |
126 | 126 | ||
127 | int type; /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */ | 127 | int type; /* type of cam (645, 646, 675, 680, 690, 720, 730, 740, 750) */ |
128 | int release; /* release number */ | 128 | int release; /* release number */ |
129 | int features; /* feature bits */ | 129 | int features; /* feature bits */ |
@@ -149,7 +149,7 @@ struct pwc_device | |||
149 | char vsnapshot; /* snapshot mode */ | 149 | char vsnapshot; /* snapshot mode */ |
150 | char vsync; /* used by isoc handler */ | 150 | char vsync; /* used by isoc handler */ |
151 | char vmirror; /* for ToUCaM series */ | 151 | char vmirror; /* for ToUCaM series */ |
152 | 152 | ||
153 | int cmd_len; | 153 | int cmd_len; |
154 | unsigned char cmd_buf[13]; | 154 | unsigned char cmd_buf[13]; |
155 | 155 | ||
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index a9f3cf0b1e3c..531e9461cb66 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c | |||
@@ -71,7 +71,7 @@ | |||
71 | #define NUM_BUFS 8 | 71 | #define NUM_BUFS 8 |
72 | #define IF_NAME "SAA5249" | 72 | #define IF_NAME "SAA5249" |
73 | 73 | ||
74 | static const int disp_modes[8][3] = | 74 | static const int disp_modes[8][3] = |
75 | { | 75 | { |
76 | { 0x46, 0x03, 0x03 }, /* DISPOFF */ | 76 | { 0x46, 0x03, 0x03 }, /* DISPOFF */ |
77 | { 0x46, 0xcc, 0xcc }, /* DISPNORM */ | 77 | { 0x46, 0xcc, 0xcc }, /* DISPNORM */ |
@@ -150,8 +150,8 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) | |||
150 | client=kmalloc(sizeof(*client), GFP_KERNEL); | 150 | client=kmalloc(sizeof(*client), GFP_KERNEL); |
151 | if(client==NULL) | 151 | if(client==NULL) |
152 | return -ENOMEM; | 152 | return -ENOMEM; |
153 | client_template.adapter = adap; | 153 | client_template.adapter = adap; |
154 | client_template.addr = addr; | 154 | client_template.addr = addr; |
155 | memcpy(client, &client_template, sizeof(*client)); | 155 | memcpy(client, &client_template, sizeof(*client)); |
156 | t = kzalloc(sizeof(*t), GFP_KERNEL); | 156 | t = kzalloc(sizeof(*t), GFP_KERNEL); |
157 | if(t==NULL) | 157 | if(t==NULL) |
@@ -161,11 +161,11 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) | |||
161 | } | 161 | } |
162 | strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); | 162 | strlcpy(client->name, IF_NAME, I2C_NAME_SIZE); |
163 | mutex_init(&t->lock); | 163 | mutex_init(&t->lock); |
164 | 164 | ||
165 | /* | 165 | /* |
166 | * Now create a video4linux device | 166 | * Now create a video4linux device |
167 | */ | 167 | */ |
168 | 168 | ||
169 | vd = kmalloc(sizeof(struct video_device), GFP_KERNEL); | 169 | vd = kmalloc(sizeof(struct video_device), GFP_KERNEL); |
170 | if(vd==NULL) | 170 | if(vd==NULL) |
171 | { | 171 | { |
@@ -175,8 +175,8 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) | |||
175 | } | 175 | } |
176 | i2c_set_clientdata(client, vd); | 176 | i2c_set_clientdata(client, vd); |
177 | memcpy(vd, &saa_template, sizeof(*vd)); | 177 | memcpy(vd, &saa_template, sizeof(*vd)); |
178 | 178 | ||
179 | for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) | 179 | for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) |
180 | { | 180 | { |
181 | memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); | 181 | memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); |
182 | memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs)); | 182 | memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs)); |
@@ -186,9 +186,9 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) | |||
186 | t->vdau[pgbuf].stopped = TRUE; | 186 | t->vdau[pgbuf].stopped = TRUE; |
187 | t->is_searching[pgbuf] = FALSE; | 187 | t->is_searching[pgbuf] = FALSE; |
188 | } | 188 | } |
189 | vd->priv=t; | 189 | vd->priv=t; |
190 | 190 | ||
191 | 191 | ||
192 | /* | 192 | /* |
193 | * Register it | 193 | * Register it |
194 | */ | 194 | */ |
@@ -208,7 +208,7 @@ static int saa5249_attach(struct i2c_adapter *adap, int addr, int kind) | |||
208 | /* | 208 | /* |
209 | * We do most of the hard work when we become a device on the i2c. | 209 | * We do most of the hard work when we become a device on the i2c. |
210 | */ | 210 | */ |
211 | 211 | ||
212 | static int saa5249_probe(struct i2c_adapter *adap) | 212 | static int saa5249_probe(struct i2c_adapter *adap) |
213 | { | 213 | { |
214 | if (adap->class & I2C_CLASS_TV_ANALOG) | 214 | if (adap->class & I2C_CLASS_TV_ANALOG) |
@@ -229,7 +229,7 @@ static int saa5249_detach(struct i2c_client *client) | |||
229 | 229 | ||
230 | /* new I2C driver support */ | 230 | /* new I2C driver support */ |
231 | 231 | ||
232 | static struct i2c_driver i2c_driver_videotext = | 232 | static struct i2c_driver i2c_driver_videotext = |
233 | { | 233 | { |
234 | .driver = { | 234 | .driver = { |
235 | .name = IF_NAME, /* name */ | 235 | .name = IF_NAME, /* name */ |
@@ -249,7 +249,7 @@ static struct i2c_client client_template = { | |||
249 | * delay may be longer. | 249 | * delay may be longer. |
250 | */ | 250 | */ |
251 | 251 | ||
252 | static void jdelay(unsigned long delay) | 252 | static void jdelay(unsigned long delay) |
253 | { | 253 | { |
254 | sigset_t oldblocked = current->blocked; | 254 | sigset_t oldblocked = current->blocked; |
255 | 255 | ||
@@ -269,14 +269,14 @@ static void jdelay(unsigned long delay) | |||
269 | /* | 269 | /* |
270 | * I2C interfaces | 270 | * I2C interfaces |
271 | */ | 271 | */ |
272 | 272 | ||
273 | static int i2c_sendbuf(struct saa5249_device *t, int reg, int count, u8 *data) | 273 | static int i2c_sendbuf(struct saa5249_device *t, int reg, int count, u8 *data) |
274 | { | 274 | { |
275 | char buf[64]; | 275 | char buf[64]; |
276 | 276 | ||
277 | buf[0] = reg; | 277 | buf[0] = reg; |
278 | memcpy(buf+1, data, count); | 278 | memcpy(buf+1, data, count); |
279 | 279 | ||
280 | if(i2c_master_send(t->client, buf, count+1)==count+1) | 280 | if(i2c_master_send(t->client, buf, count+1)==count+1) |
281 | return 0; | 281 | return 0; |
282 | return -1; | 282 | return -1; |
@@ -289,7 +289,7 @@ static int i2c_senddata(struct saa5249_device *t, ...) | |||
289 | int ct=0; | 289 | int ct=0; |
290 | va_list argp; | 290 | va_list argp; |
291 | va_start(argp,t); | 291 | va_start(argp,t); |
292 | 292 | ||
293 | while((v=va_arg(argp,int))!=-1) | 293 | while((v=va_arg(argp,int))!=-1) |
294 | buf[ct++]=v; | 294 | buf[ct++]=v; |
295 | return i2c_sendbuf(t, buf[0], ct-1, buf+1); | 295 | return i2c_sendbuf(t, buf[0], ct-1, buf+1); |
@@ -301,7 +301,7 @@ static int i2c_senddata(struct saa5249_device *t, ...) | |||
301 | * Returns -1 if I²C-device didn't send acknowledge, 0 otherwise | 301 | * Returns -1 if I²C-device didn't send acknowledge, 0 otherwise |
302 | */ | 302 | */ |
303 | 303 | ||
304 | static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf) | 304 | static int i2c_getdata(struct saa5249_device *t, int count, u8 *buf) |
305 | { | 305 | { |
306 | if(i2c_master_recv(t->client, buf, count)!=count) | 306 | if(i2c_master_recv(t->client, buf, count)!=count) |
307 | return -1; | 307 | return -1; |
@@ -320,9 +320,9 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
320 | struct video_device *vd = video_devdata(file); | 320 | struct video_device *vd = video_devdata(file); |
321 | struct saa5249_device *t=vd->priv; | 321 | struct saa5249_device *t=vd->priv; |
322 | 322 | ||
323 | switch(cmd) | 323 | switch(cmd) |
324 | { | 324 | { |
325 | case VTXIOCGETINFO: | 325 | case VTXIOCGETINFO: |
326 | { | 326 | { |
327 | vtx_info_t *info = arg; | 327 | vtx_info_t *info = arg; |
328 | info->version_major = VTX_VER_MAJ; | 328 | info->version_major = VTX_VER_MAJ; |
@@ -332,10 +332,10 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
332 | return 0; | 332 | return 0; |
333 | } | 333 | } |
334 | 334 | ||
335 | case VTXIOCCLRPAGE: | 335 | case VTXIOCCLRPAGE: |
336 | { | 336 | { |
337 | vtx_pagereq_t *req = arg; | 337 | vtx_pagereq_t *req = arg; |
338 | 338 | ||
339 | if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) | 339 | if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) |
340 | return -EINVAL; | 340 | return -EINVAL; |
341 | memset(t->vdau[req->pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); | 341 | memset(t->vdau[req->pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); |
@@ -343,17 +343,17 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
343 | return 0; | 343 | return 0; |
344 | } | 344 | } |
345 | 345 | ||
346 | case VTXIOCCLRFOUND: | 346 | case VTXIOCCLRFOUND: |
347 | { | 347 | { |
348 | vtx_pagereq_t *req = arg; | 348 | vtx_pagereq_t *req = arg; |
349 | 349 | ||
350 | if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) | 350 | if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) |
351 | return -EINVAL; | 351 | return -EINVAL; |
352 | t->vdau[req->pgbuf].clrfound = TRUE; | 352 | t->vdau[req->pgbuf].clrfound = TRUE; |
353 | return 0; | 353 | return 0; |
354 | } | 354 | } |
355 | 355 | ||
356 | case VTXIOCPAGEREQ: | 356 | case VTXIOCPAGEREQ: |
357 | { | 357 | { |
358 | vtx_pagereq_t *req = arg; | 358 | vtx_pagereq_t *req = arg; |
359 | if (!(req->pagemask & PGMASK_PAGE)) | 359 | if (!(req->pagemask & PGMASK_PAGE)) |
@@ -381,7 +381,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
381 | return 0; | 381 | return 0; |
382 | } | 382 | } |
383 | 383 | ||
384 | case VTXIOCGETSTAT: | 384 | case VTXIOCGETSTAT: |
385 | { | 385 | { |
386 | vtx_pagereq_t *req = arg; | 386 | vtx_pagereq_t *req = arg; |
387 | u8 infobits[10]; | 387 | u8 infobits[10]; |
@@ -390,7 +390,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
390 | 390 | ||
391 | if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) | 391 | if (req->pgbuf < 0 || req->pgbuf >= NUM_DAUS) |
392 | return -EINVAL; | 392 | return -EINVAL; |
393 | if (!t->vdau[req->pgbuf].stopped) | 393 | if (!t->vdau[req->pgbuf].stopped) |
394 | { | 394 | { |
395 | if (i2c_senddata(t, 2, 0, -1) || | 395 | if (i2c_senddata(t, 2, 0, -1) || |
396 | i2c_sendbuf(t, 3, sizeof(t->vdau[0].sregs), t->vdau[req->pgbuf].sregs) || | 396 | i2c_sendbuf(t, 3, sizeof(t->vdau[0].sregs), t->vdau[req->pgbuf].sregs) || |
@@ -403,7 +403,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
403 | return -EIO; | 403 | return -EIO; |
404 | 404 | ||
405 | if (!(infobits[8] & 0x10) && !(infobits[7] & 0xf0) && /* check FOUND-bit */ | 405 | if (!(infobits[8] & 0x10) && !(infobits[7] & 0xf0) && /* check FOUND-bit */ |
406 | (memcmp(infobits, t->vdau[req->pgbuf].laststat, sizeof(infobits)) || | 406 | (memcmp(infobits, t->vdau[req->pgbuf].laststat, sizeof(infobits)) || |
407 | time_after_eq(jiffies, t->vdau[req->pgbuf].expire))) | 407 | time_after_eq(jiffies, t->vdau[req->pgbuf].expire))) |
408 | { /* check if new page arrived */ | 408 | { /* check if new page arrived */ |
409 | if (i2c_senddata(t, 8, 0, 0, 0, -1) || | 409 | if (i2c_senddata(t, 8, 0, 0, 0, -1) || |
@@ -411,7 +411,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
411 | return -EIO; | 411 | return -EIO; |
412 | t->vdau[req->pgbuf].expire = jiffies + PGBUF_EXPIRE; | 412 | t->vdau[req->pgbuf].expire = jiffies + PGBUF_EXPIRE; |
413 | memset(t->vdau[req->pgbuf].pgbuf + VTX_PAGESIZE, ' ', VTX_VIRTUALSIZE - VTX_PAGESIZE); | 413 | memset(t->vdau[req->pgbuf].pgbuf + VTX_PAGESIZE, ' ', VTX_VIRTUALSIZE - VTX_PAGESIZE); |
414 | if (t->virtual_mode) | 414 | if (t->virtual_mode) |
415 | { | 415 | { |
416 | /* Packet X/24 */ | 416 | /* Packet X/24 */ |
417 | if (i2c_senddata(t, 8, 0, 0x20, 0, -1) || | 417 | if (i2c_senddata(t, 8, 0, 0x20, 0, -1) || |
@@ -459,9 +459,9 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
459 | info.notfound = !!(infobits[8] & 0x10); | 459 | info.notfound = !!(infobits[8] & 0x10); |
460 | info.pblf = !!(infobits[9] & 0x20); | 460 | info.pblf = !!(infobits[9] & 0x20); |
461 | info.hamming = 0; | 461 | info.hamming = 0; |
462 | for (a = 0; a <= 7; a++) | 462 | for (a = 0; a <= 7; a++) |
463 | { | 463 | { |
464 | if (infobits[a] & 0xf0) | 464 | if (infobits[a] & 0xf0) |
465 | { | 465 | { |
466 | info.hamming = 1; | 466 | info.hamming = 1; |
467 | break; | 467 | break; |
@@ -471,14 +471,14 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
471 | info.notfound = 1; | 471 | info.notfound = 1; |
472 | if(copy_to_user(req->buffer, &info, sizeof(vtx_pageinfo_t))) | 472 | if(copy_to_user(req->buffer, &info, sizeof(vtx_pageinfo_t))) |
473 | return -EFAULT; | 473 | return -EFAULT; |
474 | if (!info.hamming && !info.notfound) | 474 | if (!info.hamming && !info.notfound) |
475 | { | 475 | { |
476 | t->is_searching[req->pgbuf] = FALSE; | 476 | t->is_searching[req->pgbuf] = FALSE; |
477 | } | 477 | } |
478 | return 0; | 478 | return 0; |
479 | } | 479 | } |
480 | 480 | ||
481 | case VTXIOCGETPAGE: | 481 | case VTXIOCGETPAGE: |
482 | { | 482 | { |
483 | vtx_pagereq_t *req = arg; | 483 | vtx_pagereq_t *req = arg; |
484 | int start, end; | 484 | int start, end; |
@@ -488,15 +488,15 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
488 | return -EINVAL; | 488 | return -EINVAL; |
489 | if(copy_to_user(req->buffer, &t->vdau[req->pgbuf].pgbuf[req->start], req->end - req->start + 1)) | 489 | if(copy_to_user(req->buffer, &t->vdau[req->pgbuf].pgbuf[req->start], req->end - req->start + 1)) |
490 | return -EFAULT; | 490 | return -EFAULT; |
491 | 491 | ||
492 | /* | 492 | /* |
493 | * Always read the time directly from SAA5249 | 493 | * Always read the time directly from SAA5249 |
494 | */ | 494 | */ |
495 | 495 | ||
496 | if (req->start <= 39 && req->end >= 32) | 496 | if (req->start <= 39 && req->end >= 32) |
497 | { | 497 | { |
498 | int len; | 498 | int len; |
499 | char buf[16]; | 499 | char buf[16]; |
500 | start = max(req->start, 32); | 500 | start = max(req->start, 32); |
501 | end = min(req->end, 39); | 501 | end = min(req->end, 39); |
502 | len=end-start+1; | 502 | len=end-start+1; |
@@ -507,7 +507,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
507 | return -EFAULT; | 507 | return -EFAULT; |
508 | } | 508 | } |
509 | /* Insert the current header if DAU is still searching for a page */ | 509 | /* Insert the current header if DAU is still searching for a page */ |
510 | if (req->start <= 31 && req->end >= 7 && t->is_searching[req->pgbuf]) | 510 | if (req->start <= 31 && req->end >= 7 && t->is_searching[req->pgbuf]) |
511 | { | 511 | { |
512 | char buf[32]; | 512 | char buf[32]; |
513 | int len; | 513 | int len; |
@@ -523,7 +523,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
523 | return 0; | 523 | return 0; |
524 | } | 524 | } |
525 | 525 | ||
526 | case VTXIOCSTOPDAU: | 526 | case VTXIOCSTOPDAU: |
527 | { | 527 | { |
528 | vtx_pagereq_t *req = arg; | 528 | vtx_pagereq_t *req = arg; |
529 | 529 | ||
@@ -534,12 +534,12 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
534 | return 0; | 534 | return 0; |
535 | } | 535 | } |
536 | 536 | ||
537 | case VTXIOCPUTPAGE: | 537 | case VTXIOCPUTPAGE: |
538 | case VTXIOCSETDISP: | 538 | case VTXIOCSETDISP: |
539 | case VTXIOCPUTSTAT: | 539 | case VTXIOCPUTSTAT: |
540 | return 0; | 540 | return 0; |
541 | 541 | ||
542 | case VTXIOCCLRCACHE: | 542 | case VTXIOCCLRCACHE: |
543 | { | 543 | { |
544 | if (i2c_senddata(t, 0, NUM_DAUS, 0, 8, -1) || i2c_senddata(t, 11, | 544 | if (i2c_senddata(t, 0, NUM_DAUS, 0, 8, -1) || i2c_senddata(t, 11, |
545 | ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', | 545 | ' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ',' ', |
@@ -551,7 +551,7 @@ static int do_saa5249_ioctl(struct inode *inode, struct file *file, | |||
551 | return 0; | 551 | return 0; |
552 | } | 552 | } |
553 | 553 | ||
554 | case VTXIOCSETVIRT: | 554 | case VTXIOCSETVIRT: |
555 | { | 555 | { |
556 | /* The SAA5249 has virtual-row reception turned on always */ | 556 | /* The SAA5249 has virtual-row reception turned on always */ |
557 | t->virtual_mode = (int)(long)arg; | 557 | t->virtual_mode = (int)(long)arg; |
@@ -612,14 +612,14 @@ static inline unsigned int vtx_fix_command(unsigned int cmd) | |||
612 | /* | 612 | /* |
613 | * Handle the locking | 613 | * Handle the locking |
614 | */ | 614 | */ |
615 | 615 | ||
616 | static int saa5249_ioctl(struct inode *inode, struct file *file, | 616 | static int saa5249_ioctl(struct inode *inode, struct file *file, |
617 | unsigned int cmd, unsigned long arg) | 617 | unsigned int cmd, unsigned long arg) |
618 | { | 618 | { |
619 | struct video_device *vd = video_devdata(file); | 619 | struct video_device *vd = video_devdata(file); |
620 | struct saa5249_device *t=vd->priv; | 620 | struct saa5249_device *t=vd->priv; |
621 | int err; | 621 | int err; |
622 | 622 | ||
623 | cmd = vtx_fix_command(cmd); | 623 | cmd = vtx_fix_command(cmd); |
624 | mutex_lock(&t->lock); | 624 | mutex_lock(&t->lock); |
625 | err = video_usercopy(inode,file,cmd,arg,do_saa5249_ioctl); | 625 | err = video_usercopy(inode,file,cmd,arg,do_saa5249_ioctl); |
@@ -627,7 +627,7 @@ static int saa5249_ioctl(struct inode *inode, struct file *file, | |||
627 | return err; | 627 | return err; |
628 | } | 628 | } |
629 | 629 | ||
630 | static int saa5249_open(struct inode *inode, struct file *file) | 630 | static int saa5249_open(struct inode *inode, struct file *file) |
631 | { | 631 | { |
632 | struct video_device *vd = video_devdata(file); | 632 | struct video_device *vd = video_devdata(file); |
633 | struct saa5249_device *t=vd->priv; | 633 | struct saa5249_device *t=vd->priv; |
@@ -636,7 +636,7 @@ static int saa5249_open(struct inode *inode, struct file *file) | |||
636 | err = video_exclusive_open(inode,file); | 636 | err = video_exclusive_open(inode,file); |
637 | if (err < 0) | 637 | if (err < 0) |
638 | return err; | 638 | return err; |
639 | 639 | ||
640 | if (t->client==NULL) { | 640 | if (t->client==NULL) { |
641 | err = -ENODEV; | 641 | err = -ENODEV; |
642 | goto fail; | 642 | goto fail; |
@@ -647,13 +647,13 @@ static int saa5249_open(struct inode *inode, struct file *file) | |||
647 | i2c_senddata(t, 1, disp_modes[t->disp_mode][0], 0, -1) || | 647 | i2c_senddata(t, 1, disp_modes[t->disp_mode][0], 0, -1) || |
648 | /* Display TV-picture, no virtual rows */ | 648 | /* Display TV-picture, no virtual rows */ |
649 | i2c_senddata(t, 4, NUM_DAUS, disp_modes[t->disp_mode][1], disp_modes[t->disp_mode][2], 7, -1)) /* Set display to page 4 */ | 649 | i2c_senddata(t, 4, NUM_DAUS, disp_modes[t->disp_mode][1], disp_modes[t->disp_mode][2], 7, -1)) /* Set display to page 4 */ |
650 | 650 | ||
651 | { | 651 | { |
652 | err = -EIO; | 652 | err = -EIO; |
653 | goto fail; | 653 | goto fail; |
654 | } | 654 | } |
655 | 655 | ||
656 | for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) | 656 | for (pgbuf = 0; pgbuf < NUM_DAUS; pgbuf++) |
657 | { | 657 | { |
658 | memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); | 658 | memset(t->vdau[pgbuf].pgbuf, ' ', sizeof(t->vdau[0].pgbuf)); |
659 | memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs)); | 659 | memset(t->vdau[pgbuf].sregs, 0, sizeof(t->vdau[0].sregs)); |
@@ -673,7 +673,7 @@ static int saa5249_open(struct inode *inode, struct file *file) | |||
673 | 673 | ||
674 | 674 | ||
675 | 675 | ||
676 | static int saa5249_release(struct inode *inode, struct file *file) | 676 | static int saa5249_release(struct inode *inode, struct file *file) |
677 | { | 677 | { |
678 | struct video_device *vd = video_devdata(file); | 678 | struct video_device *vd = video_devdata(file); |
679 | struct saa5249_device *t=vd->priv; | 679 | struct saa5249_device *t=vd->priv; |
@@ -690,7 +690,7 @@ static int __init init_saa_5249 (void) | |||
690 | return i2c_add_driver(&i2c_driver_videotext); | 690 | return i2c_add_driver(&i2c_driver_videotext); |
691 | } | 691 | } |
692 | 692 | ||
693 | static void __exit cleanup_saa_5249 (void) | 693 | static void __exit cleanup_saa_5249 (void) |
694 | { | 694 | { |
695 | i2c_del_driver(&i2c_driver_videotext); | 695 | i2c_del_driver(&i2c_driver_videotext); |
696 | } | 696 | } |
diff --git a/drivers/media/video/saa6588.c b/drivers/media/video/saa6588.c index d17395c4f55c..a81285ca7d5b 100644 --- a/drivers/media/video/saa6588.c +++ b/drivers/media/video/saa6588.c | |||
@@ -32,7 +32,7 @@ | |||
32 | #include <asm/uaccess.h> | 32 | #include <asm/uaccess.h> |
33 | 33 | ||
34 | 34 | ||
35 | #include "rds.h" | 35 | #include <media/rds.h> |
36 | 36 | ||
37 | /* Addresses to scan */ | 37 | /* Addresses to scan */ |
38 | static unsigned short normal_i2c[] = { | 38 | static unsigned short normal_i2c[] = { |
diff --git a/drivers/media/video/saa7110.c b/drivers/media/video/saa7110.c index e18ea268384b..41d951db6ec0 100644 --- a/drivers/media/video/saa7110.c +++ b/drivers/media/video/saa7110.c | |||
@@ -139,7 +139,7 @@ saa7110_read (struct i2c_client *client) | |||
139 | 139 | ||
140 | static int | 140 | static int |
141 | saa7110_selmux (struct i2c_client *client, | 141 | saa7110_selmux (struct i2c_client *client, |
142 | int chan) | 142 | int chan) |
143 | { | 143 | { |
144 | static const unsigned char modes[9][8] = { | 144 | static const unsigned char modes[9][8] = { |
145 | /* mode 0 */ | 145 | /* mode 0 */ |
@@ -457,7 +457,7 @@ static unsigned short normal_i2c[] = { | |||
457 | }; | 457 | }; |
458 | 458 | ||
459 | static unsigned short ignore = I2C_CLIENT_END; | 459 | static unsigned short ignore = I2C_CLIENT_END; |
460 | 460 | ||
461 | static struct i2c_client_address_data addr_data = { | 461 | static struct i2c_client_address_data addr_data = { |
462 | .normal_i2c = normal_i2c, | 462 | .normal_i2c = normal_i2c, |
463 | .probe = &ignore, | 463 | .probe = &ignore, |
diff --git a/drivers/media/video/saa7111.c b/drivers/media/video/saa7111.c index f9ba0c943adf..686fd4746205 100644 --- a/drivers/media/video/saa7111.c +++ b/drivers/media/video/saa7111.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * saa7111 - Philips SAA7111A video decoder driver version 0.0.3 | 2 | * saa7111 - Philips SAA7111A video decoder driver version 0.0.3 |
3 | * | 3 | * |
4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> | 4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> |
@@ -482,7 +482,7 @@ saa7111_command (struct i2c_client *client, | |||
482 | static unsigned short normal_i2c[] = { I2C_SAA7111 >> 1, I2C_CLIENT_END }; | 482 | static unsigned short normal_i2c[] = { I2C_SAA7111 >> 1, I2C_CLIENT_END }; |
483 | 483 | ||
484 | static unsigned short ignore = I2C_CLIENT_END; | 484 | static unsigned short ignore = I2C_CLIENT_END; |
485 | 485 | ||
486 | static struct i2c_client_address_data addr_data = { | 486 | static struct i2c_client_address_data addr_data = { |
487 | .normal_i2c = normal_i2c, | 487 | .normal_i2c = normal_i2c, |
488 | .probe = &ignore, | 488 | .probe = &ignore, |
diff --git a/drivers/media/video/saa7114.c b/drivers/media/video/saa7114.c index 4a1f841d0c77..90398ab8252e 100644 --- a/drivers/media/video/saa7114.c +++ b/drivers/media/video/saa7114.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * saa7114 - Philips SAA7114H video decoder driver version 0.0.1 | 2 | * saa7114 - Philips SAA7114H video decoder driver version 0.0.1 |
3 | * | 3 | * |
4 | * Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com> | 4 | * Copyright (C) 2002 Maxim Yevtyushkin <max@linuxmedialabs.com> |
@@ -300,7 +300,7 @@ static const unsigned char init[] = { | |||
300 | 0x55, 0xff, | 300 | 0x55, 0xff, |
301 | 0x56, 0xff, | 301 | 0x56, 0xff, |
302 | 0x57, 0xff, | 302 | 0x57, 0xff, |
303 | 0x58, 0x40, // framing code | 303 | 0x58, 0x40, // framing code |
304 | 0x59, 0x47, // horizontal offset | 304 | 0x59, 0x47, // horizontal offset |
305 | 0x5a, 0x06, // vertical offset | 305 | 0x5a, 0x06, // vertical offset |
306 | 0x5b, 0x83, // field offset | 306 | 0x5b, 0x83, // field offset |
@@ -345,7 +345,7 @@ static const unsigned char init[] = { | |||
345 | 0x82, 0x00, | 345 | 0x82, 0x00, |
346 | 0x83, 0x00, | 346 | 0x83, 0x00, |
347 | 0x84, 0xc5, | 347 | 0x84, 0xc5, |
348 | 0x85, 0x0d, // hsync and vsync ? | 348 | 0x85, 0x0d, // hsync and vsync ? |
349 | 0x86, 0x40, | 349 | 0x86, 0x40, |
350 | 0x87, 0x01, | 350 | 0x87, 0x01, |
351 | 0x88, 0x00, | 351 | 0x88, 0x00, |
@@ -434,7 +434,7 @@ static const unsigned char init[] = { | |||
434 | 0xd9, 0x04, | 434 | 0xd9, 0x04, |
435 | 0xda, 0x00, // horizontal luminance phase offset | 435 | 0xda, 0x00, // horizontal luminance phase offset |
436 | 0xdb, 0x00, | 436 | 0xdb, 0x00, |
437 | 0xdc, 0x00, // horizontal chrominance scaling increment | 437 | 0xdc, 0x00, // horizontal chrominance scaling increment |
438 | 0xdd, 0x02, | 438 | 0xdd, 0x02, |
439 | 0xde, 0x00, // horizontal chrominance phase offset | 439 | 0xde, 0x00, // horizontal chrominance phase offset |
440 | 0xdf, 0x00, | 440 | 0xdf, 0x00, |
@@ -754,7 +754,7 @@ saa7114_command (struct i2c_client *client, | |||
754 | saa7114_write(client, 0x87, | 754 | saa7114_write(client, 0x87, |
755 | decoder->reg[REG_ADDR(0x87)]); | 755 | decoder->reg[REG_ADDR(0x87)]); |
756 | saa7114_write(client, 0x88, 0xd8); // sw reset scaler | 756 | saa7114_write(client, 0x88, 0xd8); // sw reset scaler |
757 | saa7114_write(client, 0x88, 0xf8); // sw reset scaler release | 757 | saa7114_write(client, 0x88, 0xf8); // sw reset scaler release |
758 | saa7114_write(client, 0x80, 0x36); | 758 | saa7114_write(client, 0x80, 0x36); |
759 | 759 | ||
760 | } | 760 | } |
@@ -813,7 +813,7 @@ static unsigned short normal_i2c[] = | |||
813 | { I2C_SAA7114 >> 1, I2C_SAA7114A >> 1, I2C_CLIENT_END }; | 813 | { I2C_SAA7114 >> 1, I2C_SAA7114A >> 1, I2C_CLIENT_END }; |
814 | 814 | ||
815 | static unsigned short ignore = I2C_CLIENT_END; | 815 | static unsigned short ignore = I2C_CLIENT_END; |
816 | 816 | ||
817 | static struct i2c_client_address_data addr_data = { | 817 | static struct i2c_client_address_data addr_data = { |
818 | .normal_i2c = normal_i2c, | 818 | .normal_i2c = normal_i2c, |
819 | .probe = &ignore, | 819 | .probe = &ignore, |
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index b184fd00b4e7..b05015282601 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c | |||
@@ -40,7 +40,6 @@ | |||
40 | #include <linux/i2c.h> | 40 | #include <linux/i2c.h> |
41 | #include <linux/videodev2.h> | 41 | #include <linux/videodev2.h> |
42 | #include <media/v4l2-common.h> | 42 | #include <media/v4l2-common.h> |
43 | #include <media/audiochip.h> | ||
44 | #include <asm/div64.h> | 43 | #include <asm/div64.h> |
45 | 44 | ||
46 | MODULE_DESCRIPTION("Philips SAA7113/SAA7114/SAA7115 video decoder driver"); | 45 | MODULE_DESCRIPTION("Philips SAA7113/SAA7114/SAA7115 video decoder driver"); |
diff --git a/drivers/media/video/saa7121.h b/drivers/media/video/saa7121.h index 74e37d405208..66967ae37494 100644 --- a/drivers/media/video/saa7121.h +++ b/drivers/media/video/saa7121.h | |||
@@ -64,7 +64,7 @@ | |||
64 | #define PAL_MSB_VERTICAL 0x40 /* 7c */ | 64 | #define PAL_MSB_VERTICAL 0x40 /* 7c */ |
65 | 65 | ||
66 | /* Initialization Sequence */ | 66 | /* Initialization Sequence */ |
67 | 67 | ||
68 | static __u8 init7121ntsc[] = { | 68 | static __u8 init7121ntsc[] = { |
69 | 0x26, 0x0, 0x27, 0x0, | 69 | 0x26, 0x0, 0x27, 0x0, |
70 | 0x28, NTSC_BURST_START, 0x29, NTSC_BURST_END, | 70 | 0x28, NTSC_BURST_START, 0x29, NTSC_BURST_END, |
@@ -95,7 +95,7 @@ static __u8 init7121ntsc[] = { | |||
95 | 0x78, 0x0, 0x79, 0x0, 0x7a, NTSC_FIRST_ACTIVE, | 95 | 0x78, 0x0, 0x79, 0x0, 0x7a, NTSC_FIRST_ACTIVE, |
96 | 0x7b, NTSC_LAST_ACTIVE, 0x7c, NTSC_MSB_VERTICAL, | 96 | 0x7b, NTSC_LAST_ACTIVE, 0x7c, NTSC_MSB_VERTICAL, |
97 | 0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0 | 97 | 0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0 |
98 | }; | 98 | }; |
99 | #define INIT7121LEN (sizeof(init7121ntsc)/2) | 99 | #define INIT7121LEN (sizeof(init7121ntsc)/2) |
100 | 100 | ||
101 | static __u8 init7121pal[] = { | 101 | static __u8 init7121pal[] = { |
@@ -128,5 +128,5 @@ static __u8 init7121pal[] = { | |||
128 | 0x78, 0x0, 0x79, 0x0, 0x7a, PAL_FIRST_ACTIVE, | 128 | 0x78, 0x0, 0x79, 0x0, 0x7a, PAL_FIRST_ACTIVE, |
129 | 0x7b, PAL_LAST_ACTIVE, 0x7c, PAL_MSB_VERTICAL, | 129 | 0x7b, PAL_LAST_ACTIVE, 0x7c, PAL_MSB_VERTICAL, |
130 | 0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0 | 130 | 0x7d, 0x0, 0x7e, 0x0, 0x7f, 0x0 |
131 | }; | 131 | }; |
132 | #endif | 132 | #endif |
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c index aca84d2f9825..bb3e0ba946d3 100644 --- a/drivers/media/video/saa7134/saa7134-alsa.c +++ b/drivers/media/video/saa7134/saa7134-alsa.c | |||
@@ -507,7 +507,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, | |||
507 | /* release the old buffer */ | 507 | /* release the old buffer */ |
508 | if (substream->runtime->dma_area) { | 508 | if (substream->runtime->dma_area) { |
509 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); | 509 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); |
510 | videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); | 510 | videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); |
511 | dsp_buffer_free(dev); | 511 | dsp_buffer_free(dev); |
512 | substream->runtime->dma_area = NULL; | 512 | substream->runtime->dma_area = NULL; |
513 | } | 513 | } |
@@ -523,12 +523,12 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, | |||
523 | return err; | 523 | return err; |
524 | } | 524 | } |
525 | 525 | ||
526 | if (0 != (err = videobuf_dma_pci_map(dev->pci, &dev->dmasound.dma))) { | 526 | if (0 != (err = videobuf_pci_dma_map(dev->pci, &dev->dmasound.dma))) { |
527 | dsp_buffer_free(dev); | 527 | dsp_buffer_free(dev); |
528 | return err; | 528 | return err; |
529 | } | 529 | } |
530 | if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) { | 530 | if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) { |
531 | videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); | 531 | videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); |
532 | dsp_buffer_free(dev); | 532 | dsp_buffer_free(dev); |
533 | return err; | 533 | return err; |
534 | } | 534 | } |
@@ -537,7 +537,7 @@ static int snd_card_saa7134_hw_params(struct snd_pcm_substream * substream, | |||
537 | dev->dmasound.dma.sglen, | 537 | dev->dmasound.dma.sglen, |
538 | 0))) { | 538 | 0))) { |
539 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); | 539 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); |
540 | videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); | 540 | videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); |
541 | dsp_buffer_free(dev); | 541 | dsp_buffer_free(dev); |
542 | return err; | 542 | return err; |
543 | } | 543 | } |
@@ -571,7 +571,7 @@ static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream) | |||
571 | 571 | ||
572 | if (substream->runtime->dma_area) { | 572 | if (substream->runtime->dma_area) { |
573 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); | 573 | saa7134_pgtable_free(dev->pci, &dev->dmasound.pt); |
574 | videobuf_dma_pci_unmap(dev->pci, &dev->dmasound.dma); | 574 | videobuf_pci_dma_unmap(dev->pci, &dev->dmasound.dma); |
575 | dsp_buffer_free(dev); | 575 | dsp_buffer_free(dev); |
576 | substream->runtime->dma_area = NULL; | 576 | substream->runtime->dma_area = NULL; |
577 | } | 577 | } |
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index 58e568d7d2ee..c98571c9d5a6 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c | |||
@@ -254,12 +254,12 @@ void saa7134_pgtable_free(struct pci_dev *pci, struct saa7134_pgtable *pt) | |||
254 | 254 | ||
255 | /* ------------------------------------------------------------------ */ | 255 | /* ------------------------------------------------------------------ */ |
256 | 256 | ||
257 | void saa7134_dma_free(struct saa7134_dev *dev,struct saa7134_buf *buf) | 257 | void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf) |
258 | { | 258 | { |
259 | BUG_ON(in_interrupt()); | 259 | BUG_ON(in_interrupt()); |
260 | 260 | ||
261 | videobuf_waiton(&buf->vb,0,0); | 261 | videobuf_waiton(&buf->vb,0,0); |
262 | videobuf_dma_pci_unmap(dev->pci, &buf->vb.dma); | 262 | videobuf_dma_unmap(q, &buf->vb.dma); |
263 | videobuf_dma_free(&buf->vb.dma); | 263 | videobuf_dma_free(&buf->vb.dma); |
264 | buf->vb.state = STATE_NEEDS_INIT; | 264 | buf->vb.state = STATE_NEEDS_INIT; |
265 | } | 265 | } |
@@ -960,7 +960,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev, | |||
960 | if (saa7134_no_overlay <= 0) { | 960 | if (saa7134_no_overlay <= 0) { |
961 | saa7134_video_template.type |= VID_TYPE_OVERLAY; | 961 | saa7134_video_template.type |= VID_TYPE_OVERLAY; |
962 | } else { | 962 | } else { |
963 | printk("bttv: Overlay support disabled.\n"); | 963 | printk("%s: Overlay support disabled.\n",dev->name); |
964 | } | 964 | } |
965 | dev->video_dev = vdev_init(dev,&saa7134_video_template,"video"); | 965 | dev->video_dev = vdev_init(dev,&saa7134_video_template,"video"); |
966 | err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER, | 966 | err = video_register_device(dev->video_dev,VFL_TYPE_GRABBER, |
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index d79d05f88705..7aa02b34e012 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c | |||
@@ -124,7 +124,7 @@ static int dsp_rec_start(struct saa7134_dev *dev) | |||
124 | unsigned long flags; | 124 | unsigned long flags; |
125 | 125 | ||
126 | /* prepare buffer */ | 126 | /* prepare buffer */ |
127 | if (0 != (err = videobuf_dma_pci_map(dev->pci,&dev->dmasound.dma))) | 127 | if (0 != (err = videobuf_pci_dma_map(dev->pci,&dev->dmasound.dma))) |
128 | return err; | 128 | return err; |
129 | if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) | 129 | if (0 != (err = saa7134_pgtable_alloc(dev->pci,&dev->dmasound.pt))) |
130 | goto fail1; | 130 | goto fail1; |
@@ -213,7 +213,7 @@ static int dsp_rec_start(struct saa7134_dev *dev) | |||
213 | fail2: | 213 | fail2: |
214 | saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); | 214 | saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); |
215 | fail1: | 215 | fail1: |
216 | videobuf_dma_pci_unmap(dev->pci,&dev->dmasound.dma); | 216 | videobuf_pci_dma_unmap(dev->pci,&dev->dmasound.dma); |
217 | return err; | 217 | return err; |
218 | } | 218 | } |
219 | 219 | ||
@@ -231,7 +231,7 @@ static int dsp_rec_stop(struct saa7134_dev *dev) | |||
231 | 231 | ||
232 | /* unlock buffer */ | 232 | /* unlock buffer */ |
233 | saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); | 233 | saa7134_pgtable_free(dev->pci,&dev->dmasound.pt); |
234 | videobuf_dma_pci_unmap(dev->pci,&dev->dmasound.dma); | 234 | videobuf_pci_dma_unmap(dev->pci,&dev->dmasound.dma); |
235 | return 0; | 235 | return 0; |
236 | } | 236 | } |
237 | 237 | ||
diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c index 470903e2f5e5..60a90a2617ae 100644 --- a/drivers/media/video/saa7134/saa7134-ts.c +++ b/drivers/media/video/saa7134/saa7134-ts.c | |||
@@ -89,7 +89,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
89 | return -EINVAL; | 89 | return -EINVAL; |
90 | 90 | ||
91 | if (buf->vb.size != size) { | 91 | if (buf->vb.size != size) { |
92 | saa7134_dma_free(dev,buf); | 92 | saa7134_dma_free(q,buf); |
93 | } | 93 | } |
94 | 94 | ||
95 | if (STATE_NEEDS_INIT == buf->vb.state) { | 95 | if (STATE_NEEDS_INIT == buf->vb.state) { |
@@ -98,7 +98,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
98 | buf->vb.size = size; | 98 | buf->vb.size = size; |
99 | buf->pt = &dev->ts.pt_ts; | 99 | buf->pt = &dev->ts.pt_ts; |
100 | 100 | ||
101 | err = videobuf_iolock(dev->pci,&buf->vb,NULL); | 101 | err = videobuf_iolock(q,&buf->vb,NULL); |
102 | if (err) | 102 | if (err) |
103 | goto oops; | 103 | goto oops; |
104 | err = saa7134_pgtable_build(dev->pci,buf->pt, | 104 | err = saa7134_pgtable_build(dev->pci,buf->pt, |
@@ -126,7 +126,7 @@ static int buffer_prepare(struct videobuf_queue *q, struct videobuf_buffer *vb, | |||
126 | return 0; | 126 | return 0; |
127 | 127 | ||
128 | oops: | 128 | oops: |
129 | saa7134_dma_free(dev,buf); | 129 | saa7134_dma_free(q,buf); |
130 | return err; | 130 | return err; |
131 | } | 131 | } |
132 | 132 | ||
@@ -152,10 +152,9 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
152 | 152 | ||
153 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 153 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
154 | { | 154 | { |
155 | struct saa7134_dev *dev = q->priv_data; | ||
156 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); | 155 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); |
157 | 156 | ||
158 | saa7134_dma_free(dev,buf); | 157 | saa7134_dma_free(q,buf); |
159 | } | 158 | } |
160 | 159 | ||
161 | struct videobuf_queue_ops saa7134_ts_qops = { | 160 | struct videobuf_queue_ops saa7134_ts_qops = { |
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index 3043233a8b6e..0db53d192b2a 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c | |||
@@ -482,12 +482,14 @@ static int tvaudio_setstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au | |||
482 | [ V4L2_TUNER_MODE_STEREO ] = "stereo", | 482 | [ V4L2_TUNER_MODE_STEREO ] = "stereo", |
483 | [ V4L2_TUNER_MODE_LANG1 ] = "lang1", | 483 | [ V4L2_TUNER_MODE_LANG1 ] = "lang1", |
484 | [ V4L2_TUNER_MODE_LANG2 ] = "lang2", | 484 | [ V4L2_TUNER_MODE_LANG2 ] = "lang2", |
485 | [ V4L2_TUNER_MODE_LANG1_LANG2 ] = "lang1+lang2", | ||
485 | }; | 486 | }; |
486 | static u32 fm[] = { | 487 | static u32 fm[] = { |
487 | [ V4L2_TUNER_MODE_MONO ] = 0x00, /* ch1 */ | 488 | [ V4L2_TUNER_MODE_MONO ] = 0x00, /* ch1 */ |
488 | [ V4L2_TUNER_MODE_STEREO ] = 0x80, /* auto */ | 489 | [ V4L2_TUNER_MODE_STEREO ] = 0x80, /* auto */ |
489 | [ V4L2_TUNER_MODE_LANG1 ] = 0x00, /* ch1 */ | 490 | [ V4L2_TUNER_MODE_LANG1 ] = 0x00, /* ch1 */ |
490 | [ V4L2_TUNER_MODE_LANG2 ] = 0x01, /* ch2 */ | 491 | [ V4L2_TUNER_MODE_LANG2 ] = 0x01, /* ch2 */ |
492 | [ V4L2_TUNER_MODE_LANG1_LANG2 ] = 0x80, /* auto */ | ||
491 | }; | 493 | }; |
492 | u32 reg; | 494 | u32 reg; |
493 | 495 | ||
diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c index f4aee0af80e1..f38366a470fa 100644 --- a/drivers/media/video/saa7134/saa7134-vbi.c +++ b/drivers/media/video/saa7134/saa7134-vbi.c | |||
@@ -135,7 +135,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
135 | return -EINVAL; | 135 | return -EINVAL; |
136 | 136 | ||
137 | if (buf->vb.size != size) | 137 | if (buf->vb.size != size) |
138 | saa7134_dma_free(dev,buf); | 138 | saa7134_dma_free(q,buf); |
139 | 139 | ||
140 | if (STATE_NEEDS_INIT == buf->vb.state) { | 140 | if (STATE_NEEDS_INIT == buf->vb.state) { |
141 | buf->vb.width = llength; | 141 | buf->vb.width = llength; |
@@ -143,7 +143,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
143 | buf->vb.size = size; | 143 | buf->vb.size = size; |
144 | buf->pt = &fh->pt_vbi; | 144 | buf->pt = &fh->pt_vbi; |
145 | 145 | ||
146 | err = videobuf_iolock(dev->pci,&buf->vb,NULL); | 146 | err = videobuf_iolock(q,&buf->vb,NULL); |
147 | if (err) | 147 | if (err) |
148 | goto oops; | 148 | goto oops; |
149 | err = saa7134_pgtable_build(dev->pci,buf->pt, | 149 | err = saa7134_pgtable_build(dev->pci,buf->pt, |
@@ -159,7 +159,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
159 | return 0; | 159 | return 0; |
160 | 160 | ||
161 | oops: | 161 | oops: |
162 | saa7134_dma_free(dev,buf); | 162 | saa7134_dma_free(q,buf); |
163 | return err; | 163 | return err; |
164 | } | 164 | } |
165 | 165 | ||
@@ -190,11 +190,9 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
190 | 190 | ||
191 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 191 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
192 | { | 192 | { |
193 | struct saa7134_fh *fh = q->priv_data; | ||
194 | struct saa7134_dev *dev = fh->dev; | ||
195 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); | 193 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); |
196 | 194 | ||
197 | saa7134_dma_free(dev,buf); | 195 | saa7134_dma_free(q,buf); |
198 | } | 196 | } |
199 | 197 | ||
200 | struct videobuf_queue_ops saa7134_vbi_qops = { | 198 | struct videobuf_queue_ops saa7134_vbi_qops = { |
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 57a11e71d996..aeef80f88a6b 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c | |||
@@ -993,7 +993,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
993 | buf->vb.size != size || | 993 | buf->vb.size != size || |
994 | buf->vb.field != field || | 994 | buf->vb.field != field || |
995 | buf->fmt != fh->fmt) { | 995 | buf->fmt != fh->fmt) { |
996 | saa7134_dma_free(dev,buf); | 996 | saa7134_dma_free(q,buf); |
997 | } | 997 | } |
998 | 998 | ||
999 | if (STATE_NEEDS_INIT == buf->vb.state) { | 999 | if (STATE_NEEDS_INIT == buf->vb.state) { |
@@ -1004,7 +1004,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1004 | buf->fmt = fh->fmt; | 1004 | buf->fmt = fh->fmt; |
1005 | buf->pt = &fh->pt_cap; | 1005 | buf->pt = &fh->pt_cap; |
1006 | 1006 | ||
1007 | err = videobuf_iolock(dev->pci,&buf->vb,&dev->ovbuf); | 1007 | err = videobuf_iolock(q,&buf->vb,&dev->ovbuf); |
1008 | if (err) | 1008 | if (err) |
1009 | goto oops; | 1009 | goto oops; |
1010 | err = saa7134_pgtable_build(dev->pci,buf->pt, | 1010 | err = saa7134_pgtable_build(dev->pci,buf->pt, |
@@ -1019,7 +1019,7 @@ static int buffer_prepare(struct videobuf_queue *q, | |||
1019 | return 0; | 1019 | return 0; |
1020 | 1020 | ||
1021 | oops: | 1021 | oops: |
1022 | saa7134_dma_free(dev,buf); | 1022 | saa7134_dma_free(q,buf); |
1023 | return err; | 1023 | return err; |
1024 | } | 1024 | } |
1025 | 1025 | ||
@@ -1045,10 +1045,9 @@ static void buffer_queue(struct videobuf_queue *q, struct videobuf_buffer *vb) | |||
1045 | 1045 | ||
1046 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) | 1046 | static void buffer_release(struct videobuf_queue *q, struct videobuf_buffer *vb) |
1047 | { | 1047 | { |
1048 | struct saa7134_fh *fh = q->priv_data; | ||
1049 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); | 1048 | struct saa7134_buf *buf = container_of(vb,struct saa7134_buf,vb); |
1050 | 1049 | ||
1051 | saa7134_dma_free(fh->dev,buf); | 1050 | saa7134_dma_free(q,buf); |
1052 | } | 1051 | } |
1053 | 1052 | ||
1054 | static struct videobuf_queue_ops video_qops = { | 1053 | static struct videobuf_queue_ops video_qops = { |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index ce1c2e0b065e..31ba293854c1 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -34,7 +34,6 @@ | |||
34 | #include <asm/io.h> | 34 | #include <asm/io.h> |
35 | 35 | ||
36 | #include <media/tuner.h> | 36 | #include <media/tuner.h> |
37 | #include <media/audiochip.h> | ||
38 | #include <media/ir-common.h> | 37 | #include <media/ir-common.h> |
39 | #include <media/ir-kbd-i2c.h> | 38 | #include <media/ir-kbd-i2c.h> |
40 | #include <media/video-buf.h> | 39 | #include <media/video-buf.h> |
@@ -579,7 +578,7 @@ void saa7134_buffer_finish(struct saa7134_dev *dev, struct saa7134_dmaqueue *q, | |||
579 | unsigned int state); | 578 | unsigned int state); |
580 | void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); | 579 | void saa7134_buffer_next(struct saa7134_dev *dev, struct saa7134_dmaqueue *q); |
581 | void saa7134_buffer_timeout(unsigned long data); | 580 | void saa7134_buffer_timeout(unsigned long data); |
582 | void saa7134_dma_free(struct saa7134_dev *dev,struct saa7134_buf *buf); | 581 | void saa7134_dma_free(struct videobuf_queue *q,struct saa7134_buf *buf); |
583 | 582 | ||
584 | int saa7134_set_dmabits(struct saa7134_dev *dev); | 583 | int saa7134_set_dmabits(struct saa7134_dev *dev); |
585 | 584 | ||
diff --git a/drivers/media/video/saa7146.h b/drivers/media/video/saa7146.h index 756963f01bbd..2830b5e33aec 100644 --- a/drivers/media/video/saa7146.h +++ b/drivers/media/video/saa7146.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | saa7146.h - definitions philips saa7146 based cards | 2 | saa7146.h - definitions philips saa7146 based cards |
3 | Copyright (C) 1999 Nathan Laredo (laredo@gnu.org) | 3 | Copyright (C) 1999 Nathan Laredo (laredo@gnu.org) |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
@@ -27,7 +27,7 @@ | |||
27 | 27 | ||
28 | #include <linux/videodev.h> | 28 | #include <linux/videodev.h> |
29 | 29 | ||
30 | #ifndef O_NONCAP | 30 | #ifndef O_NONCAP |
31 | #define O_NONCAP O_TRUNC | 31 | #define O_NONCAP O_TRUNC |
32 | #endif | 32 | #endif |
33 | 33 | ||
@@ -36,7 +36,7 @@ | |||
36 | 36 | ||
37 | #ifdef __KERNEL__ | 37 | #ifdef __KERNEL__ |
38 | 38 | ||
39 | struct saa7146_window | 39 | struct saa7146_window |
40 | { | 40 | { |
41 | int x, y; | 41 | int x, y; |
42 | ushort width, height; | 42 | ushort width, height; |
@@ -70,7 +70,7 @@ struct saa7146 | |||
70 | int irqstate; /* irq routine is state driven */ | 70 | int irqstate; /* irq routine is state driven */ |
71 | int writemode; | 71 | int writemode; |
72 | int playmode; | 72 | int playmode; |
73 | unsigned int nr; | 73 | unsigned int nr; |
74 | unsigned long irq; /* IRQ used by SAA7146 card */ | 74 | unsigned long irq; /* IRQ used by SAA7146 card */ |
75 | unsigned short id; | 75 | unsigned short id; |
76 | unsigned char revision; | 76 | unsigned char revision; |
diff --git a/drivers/media/video/saa7146reg.h b/drivers/media/video/saa7146reg.h index 6cc910f50a4b..80ec2c146b4c 100644 --- a/drivers/media/video/saa7146reg.h +++ b/drivers/media/video/saa7146reg.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | saa7146.h - definitions philips saa7146 based cards | 2 | saa7146.h - definitions philips saa7146 based cards |
3 | Copyright (C) 1999 Nathan Laredo (laredo@gnu.org) | 3 | Copyright (C) 1999 Nathan Laredo (laredo@gnu.org) |
4 | 4 | ||
5 | This program is free software; you can redistribute it and/or modify | 5 | This program is free software; you can redistribute it and/or modify |
6 | it under the terms of the GNU General Public License as published by | 6 | it under the terms of the GNU General Public License as published by |
7 | the Free Software Foundation; either version 2 of the License, or | 7 | the Free Software Foundation; either version 2 of the License, or |
diff --git a/drivers/media/video/saa7185.c b/drivers/media/video/saa7185.c index 9f99ee1303e0..9c308410856d 100644 --- a/drivers/media/video/saa7185.c +++ b/drivers/media/video/saa7185.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * saa7185 - Philips SAA7185B video encoder driver version 0.0.3 | 2 | * saa7185 - Philips SAA7185B video encoder driver version 0.0.3 |
3 | * | 3 | * |
4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> | 4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> |
@@ -377,7 +377,7 @@ saa7185_command (struct i2c_client *client, | |||
377 | static unsigned short normal_i2c[] = { I2C_SAA7185 >> 1, I2C_CLIENT_END }; | 377 | static unsigned short normal_i2c[] = { I2C_SAA7185 >> 1, I2C_CLIENT_END }; |
378 | 378 | ||
379 | static unsigned short ignore = I2C_CLIENT_END; | 379 | static unsigned short ignore = I2C_CLIENT_END; |
380 | 380 | ||
381 | static struct i2c_client_address_data addr_data = { | 381 | static struct i2c_client_address_data addr_data = { |
382 | .normal_i2c = normal_i2c, | 382 | .normal_i2c = normal_i2c, |
383 | .probe = &ignore, | 383 | .probe = &ignore, |
diff --git a/drivers/media/video/saa7196.h b/drivers/media/video/saa7196.h index f92f21cfbcac..cd4b6354a7b3 100644 --- a/drivers/media/video/saa7196.h +++ b/drivers/media/video/saa7196.h | |||
@@ -2,14 +2,14 @@ | |||
2 | Definitions for the Philips SAA7196 digital video decoder, | 2 | Definitions for the Philips SAA7196 digital video decoder, |
3 | scaler, and clock generator circuit (DESCpro), as used in | 3 | scaler, and clock generator circuit (DESCpro), as used in |
4 | the PlanB video input of the Powermac 7x00/8x00 series. | 4 | the PlanB video input of the Powermac 7x00/8x00 series. |
5 | 5 | ||
6 | Copyright (C) 1998 Michel Lanners (mlan@cpu.lu) | 6 | Copyright (C) 1998 Michel Lanners (mlan@cpu.lu) |
7 | 7 | ||
8 | The register defines are shamelessly copied from the meteor | 8 | The register defines are shamelessly copied from the meteor |
9 | driver out of NetBSD (with permission), | 9 | driver out of NetBSD (with permission), |
10 | and are copyrighted (c) 1995 Mark Tinguely and Jim Lowe | 10 | and are copyrighted (c) 1995 Mark Tinguely and Jim Lowe |
11 | (Thanks !) | 11 | (Thanks !) |
12 | 12 | ||
13 | Additional debugging and coding by Takashi Oe (toe@unlinfo.unl.edu) | 13 | Additional debugging and coding by Takashi Oe (toe@unlinfo.unl.edu) |
14 | 14 | ||
15 | The default values used for PlanB are my mistakes. | 15 | The default values used for PlanB are my mistakes. |
diff --git a/drivers/usb/media/se401.c b/drivers/media/video/se401.c index f03ea7f89596..a846ebc78cd7 100644 --- a/drivers/usb/media/se401.c +++ b/drivers/media/video/se401.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) | 4 | * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) |
5 | * | 5 | * |
6 | * Still somewhat based on the Linux ov511 driver. | 6 | * Still somewhat based on the Linux ov511 driver. |
7 | * | 7 | * |
8 | * This program is free software; you can redistribute it and/or modify it | 8 | * This program is free software; you can redistribute it and/or modify it |
9 | * under the terms of the GNU General Public License as published by the | 9 | * under the terms of the GNU General Public License as published by the |
10 | * Free Software Foundation; either version 2 of the License, or (at your | 10 | * Free Software Foundation; either version 2 of the License, or (at your |
@@ -114,16 +114,16 @@ static int se401_sndctrl(int set, struct usb_se401 *se401, unsigned short req, | |||
114 | unsigned short value, unsigned char *cp, int size) | 114 | unsigned short value, unsigned char *cp, int size) |
115 | { | 115 | { |
116 | return usb_control_msg ( | 116 | return usb_control_msg ( |
117 | se401->dev, | 117 | se401->dev, |
118 | set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0), | 118 | set ? usb_sndctrlpipe(se401->dev, 0) : usb_rcvctrlpipe(se401->dev, 0), |
119 | req, | 119 | req, |
120 | (set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 120 | (set ? USB_DIR_OUT : USB_DIR_IN) | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
121 | value, | 121 | value, |
122 | 0, | 122 | 0, |
123 | cp, | 123 | cp, |
124 | size, | 124 | size, |
125 | 1000 | 125 | 1000 |
126 | ); | 126 | ); |
127 | } | 127 | } |
128 | 128 | ||
129 | static int se401_set_feature(struct usb_se401 *se401, unsigned short selector, | 129 | static int se401_set_feature(struct usb_se401 *se401, unsigned short selector, |
@@ -140,30 +140,30 @@ static int se401_set_feature(struct usb_se401 *se401, unsigned short selector, | |||
140 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 140 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
141 | param, | 141 | param, |
142 | selector, | 142 | selector, |
143 | NULL, | 143 | NULL, |
144 | 0, | 144 | 0, |
145 | 1000 | 145 | 1000 |
146 | ); | 146 | ); |
147 | } | 147 | } |
148 | 148 | ||
149 | static unsigned short se401_get_feature(struct usb_se401 *se401, | 149 | static unsigned short se401_get_feature(struct usb_se401 *se401, |
150 | unsigned short selector) | 150 | unsigned short selector) |
151 | { | 151 | { |
152 | /* For 'set' the selecetor should be in index, not sure if the spec is | 152 | /* For 'set' the selecetor should be in index, not sure if the spec is |
153 | wrong here to.... | 153 | wrong here to.... |
154 | */ | 154 | */ |
155 | unsigned char cp[2]; | 155 | unsigned char cp[2]; |
156 | usb_control_msg ( | 156 | usb_control_msg ( |
157 | se401->dev, | 157 | se401->dev, |
158 | usb_rcvctrlpipe(se401->dev, 0), | 158 | usb_rcvctrlpipe(se401->dev, 0), |
159 | SE401_REQ_GET_EXT_FEATURE, | 159 | SE401_REQ_GET_EXT_FEATURE, |
160 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 160 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
161 | 0, | 161 | 0, |
162 | selector, | 162 | selector, |
163 | cp, | 163 | cp, |
164 | 2, | 164 | 2, |
165 | 1000 | 165 | 1000 |
166 | ); | 166 | ); |
167 | return cp[0]+cp[1]*256; | 167 | return cp[0]+cp[1]*256; |
168 | } | 168 | } |
169 | 169 | ||
@@ -183,14 +183,14 @@ static int se401_send_pict(struct usb_se401 *se401) | |||
183 | se401_set_feature(se401, HV7131_REG_ARCG, se401->rgain);/* red color gain */ | 183 | se401_set_feature(se401, HV7131_REG_ARCG, se401->rgain);/* red color gain */ |
184 | se401_set_feature(se401, HV7131_REG_AGCG, se401->ggain);/* green color gain */ | 184 | se401_set_feature(se401, HV7131_REG_AGCG, se401->ggain);/* green color gain */ |
185 | se401_set_feature(se401, HV7131_REG_ABCG, se401->bgain);/* blue color gain */ | 185 | se401_set_feature(se401, HV7131_REG_ABCG, se401->bgain);/* blue color gain */ |
186 | 186 | ||
187 | return 0; | 187 | return 0; |
188 | } | 188 | } |
189 | 189 | ||
190 | static void se401_set_exposure(struct usb_se401 *se401, int brightness) | 190 | static void se401_set_exposure(struct usb_se401 *se401, int brightness) |
191 | { | 191 | { |
192 | int integration=brightness<<5; | 192 | int integration=brightness<<5; |
193 | 193 | ||
194 | if (flickerless==50) { | 194 | if (flickerless==50) { |
195 | integration=integration-integration%106667; | 195 | integration=integration-integration%106667; |
196 | } | 196 | } |
@@ -255,11 +255,11 @@ static void se401_auto_resetlevel(struct usb_se401 *se401) | |||
255 | /* For some reason this normally read-only register doesn't get reset | 255 | /* For some reason this normally read-only register doesn't get reset |
256 | to zero after reading them just once... | 256 | to zero after reading them just once... |
257 | */ | 257 | */ |
258 | se401_get_feature(se401, HV7131_REG_HIREFNOH); | 258 | se401_get_feature(se401, HV7131_REG_HIREFNOH); |
259 | se401_get_feature(se401, HV7131_REG_HIREFNOL); | 259 | se401_get_feature(se401, HV7131_REG_HIREFNOL); |
260 | se401_get_feature(se401, HV7131_REG_LOREFNOH); | 260 | se401_get_feature(se401, HV7131_REG_LOREFNOH); |
261 | se401_get_feature(se401, HV7131_REG_LOREFNOL); | 261 | se401_get_feature(se401, HV7131_REG_LOREFNOL); |
262 | ahrc=256*se401_get_feature(se401, HV7131_REG_HIREFNOH) + | 262 | ahrc=256*se401_get_feature(se401, HV7131_REG_HIREFNOH) + |
263 | se401_get_feature(se401, HV7131_REG_HIREFNOL); | 263 | se401_get_feature(se401, HV7131_REG_HIREFNOL); |
264 | alrc=256*se401_get_feature(se401, HV7131_REG_LOREFNOH) + | 264 | alrc=256*se401_get_feature(se401, HV7131_REG_LOREFNOH) + |
265 | se401_get_feature(se401, HV7131_REG_LOREFNOL); | 265 | se401_get_feature(se401, HV7131_REG_LOREFNOL); |
@@ -287,12 +287,12 @@ static void se401_button_irq(struct urb *urb, struct pt_regs *regs) | |||
287 | { | 287 | { |
288 | struct usb_se401 *se401 = urb->context; | 288 | struct usb_se401 *se401 = urb->context; |
289 | int status; | 289 | int status; |
290 | 290 | ||
291 | if (!se401->dev) { | 291 | if (!se401->dev) { |
292 | info("ohoh: device vapourished"); | 292 | info("ohoh: device vapourished"); |
293 | return; | 293 | return; |
294 | } | 294 | } |
295 | 295 | ||
296 | switch (urb->status) { | 296 | switch (urb->status) { |
297 | case 0: | 297 | case 0: |
298 | /* success */ | 298 | /* success */ |
@@ -368,7 +368,7 @@ static void se401_video_irq(struct urb *urb, struct pt_regs *regs) | |||
368 | if (se401->nullpackets > SE401_MAX_NULLPACKETS) { | 368 | if (se401->nullpackets > SE401_MAX_NULLPACKETS) { |
369 | if (waitqueue_active(&se401->wq)) { | 369 | if (waitqueue_active(&se401->wq)) { |
370 | wake_up_interruptible(&se401->wq); | 370 | wake_up_interruptible(&se401->wq); |
371 | } | 371 | } |
372 | } | 372 | } |
373 | } | 373 | } |
374 | 374 | ||
@@ -433,8 +433,8 @@ static int se401_start_stream(struct usb_se401 *se401) | |||
433 | int err=0, i; | 433 | int err=0, i; |
434 | se401->streaming=1; | 434 | se401->streaming=1; |
435 | 435 | ||
436 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); | 436 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); |
437 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); | 437 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); |
438 | 438 | ||
439 | /* Set picture settings */ | 439 | /* Set picture settings */ |
440 | se401_set_feature(se401, HV7131_REG_MODE_B, 0x05);/*windowed + pix intg */ | 440 | se401_set_feature(se401, HV7131_REG_MODE_B, 0x05);/*windowed + pix intg */ |
@@ -571,7 +571,7 @@ static inline void decode_JangGu_integrate(struct usb_se401 *se401, int data) | |||
571 | } | 571 | } |
572 | 572 | ||
573 | /* First three are absolute, all others relative. | 573 | /* First three are absolute, all others relative. |
574 | * Format is rgb from right to left (mirrorred image), | 574 | * Format is rgb from right to left (mirrorred image), |
575 | * we flip it to get bgr from left to right. */ | 575 | * we flip it to get bgr from left to right. */ |
576 | if (frame->curlinepix < 3) { | 576 | if (frame->curlinepix < 3) { |
577 | *(frame->curline-frame->curlinepix)=1+data*4; | 577 | *(frame->curline-frame->curlinepix)=1+data*4; |
@@ -703,7 +703,7 @@ static inline void decode_bayer (struct usb_se401 *se401, struct se401_scratch * | |||
703 | int width=se401->cwidth; | 703 | int width=se401->cwidth; |
704 | int blineoffset=0, bline; | 704 | int blineoffset=0, bline; |
705 | int linelength=width*3, i; | 705 | int linelength=width*3, i; |
706 | 706 | ||
707 | 707 | ||
708 | if (frame->curpix==0) { | 708 | if (frame->curpix==0) { |
709 | if (frame->grabstate==FRAME_READY) { | 709 | if (frame->grabstate==FRAME_READY) { |
@@ -831,7 +831,7 @@ static int se401_newframe(struct usb_se401 *se401, int framenr) | |||
831 | se401->nullpackets=0; | 831 | se401->nullpackets=0; |
832 | info("to many null length packets, restarting capture"); | 832 | info("to many null length packets, restarting capture"); |
833 | se401_stop_stream(se401); | 833 | se401_stop_stream(se401); |
834 | se401_start_stream(se401); | 834 | se401_start_stream(se401); |
835 | } else { | 835 | } else { |
836 | if (se401->scratch[se401->scratch_use].state!=BUFFER_READY) { | 836 | if (se401->scratch[se401->scratch_use].state!=BUFFER_READY) { |
837 | se401->frame[framenr].grabstate=FRAME_ERROR; | 837 | se401->frame[framenr].grabstate=FRAME_ERROR; |
@@ -866,7 +866,7 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401) | |||
866 | { | 866 | { |
867 | int i; | 867 | int i; |
868 | 868 | ||
869 | se401->dev = NULL; | 869 | se401->dev = NULL; |
870 | 870 | ||
871 | for (i=0; i<SE401_NUMSBUF; i++) | 871 | for (i=0; i<SE401_NUMSBUF; i++) |
872 | if (se401->urb[i]) { | 872 | if (se401->urb[i]) { |
@@ -882,9 +882,9 @@ static void usb_se401_remove_disconnected (struct usb_se401 *se401) | |||
882 | usb_kill_urb(se401->inturb); | 882 | usb_kill_urb(se401->inturb); |
883 | usb_free_urb(se401->inturb); | 883 | usb_free_urb(se401->inturb); |
884 | } | 884 | } |
885 | info("%s disconnected", se401->camera_name); | 885 | info("%s disconnected", se401->camera_name); |
886 | 886 | ||
887 | /* Free the memory */ | 887 | /* Free the memory */ |
888 | kfree(se401->width); | 888 | kfree(se401->width); |
889 | kfree(se401->height); | 889 | kfree(se401->height); |
890 | kfree(se401); | 890 | kfree(se401); |
@@ -910,7 +910,7 @@ static int se401_open(struct inode *inode, struct file *file) | |||
910 | se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); | 910 | se401->fbuf = rvmalloc(se401->maxframesize * SE401_NUMFRAMES); |
911 | if (se401->fbuf) | 911 | if (se401->fbuf) |
912 | file->private_data = dev; | 912 | file->private_data = dev; |
913 | else | 913 | else |
914 | err = -ENOMEM; | 914 | err = -ENOMEM; |
915 | se401->user = !err; | 915 | se401->user = !err; |
916 | 916 | ||
@@ -920,11 +920,11 @@ static int se401_open(struct inode *inode, struct file *file) | |||
920 | static int se401_close(struct inode *inode, struct file *file) | 920 | static int se401_close(struct inode *inode, struct file *file) |
921 | { | 921 | { |
922 | struct video_device *dev = file->private_data; | 922 | struct video_device *dev = file->private_data; |
923 | struct usb_se401 *se401 = (struct usb_se401 *)dev; | 923 | struct usb_se401 *se401 = (struct usb_se401 *)dev; |
924 | int i; | 924 | int i; |
925 | 925 | ||
926 | rvfree(se401->fbuf, se401->maxframesize * SE401_NUMFRAMES); | 926 | rvfree(se401->fbuf, se401->maxframesize * SE401_NUMFRAMES); |
927 | if (se401->removed) { | 927 | if (se401->removed) { |
928 | usb_se401_remove_disconnected(se401); | 928 | usb_se401_remove_disconnected(se401); |
929 | info("device unregistered"); | 929 | info("device unregistered"); |
930 | } else { | 930 | } else { |
@@ -942,12 +942,12 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, | |||
942 | unsigned int cmd, void *arg) | 942 | unsigned int cmd, void *arg) |
943 | { | 943 | { |
944 | struct video_device *vdev = file->private_data; | 944 | struct video_device *vdev = file->private_data; |
945 | struct usb_se401 *se401 = (struct usb_se401 *)vdev; | 945 | struct usb_se401 *se401 = (struct usb_se401 *)vdev; |
946 | 946 | ||
947 | if (!se401->dev) | 947 | if (!se401->dev) |
948 | return -EIO; | 948 | return -EIO; |
949 | 949 | ||
950 | switch (cmd) { | 950 | switch (cmd) { |
951 | case VIDIOCGCAP: | 951 | case VIDIOCGCAP: |
952 | { | 952 | { |
953 | struct video_capability *b = arg; | 953 | struct video_capability *b = arg; |
@@ -981,8 +981,8 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, | |||
981 | return -EINVAL; | 981 | return -EINVAL; |
982 | return 0; | 982 | return 0; |
983 | } | 983 | } |
984 | case VIDIOCGPICT: | 984 | case VIDIOCGPICT: |
985 | { | 985 | { |
986 | struct video_picture *p = arg; | 986 | struct video_picture *p = arg; |
987 | 987 | ||
988 | se401_get_pict(se401, p); | 988 | se401_get_pict(se401, p); |
@@ -1007,7 +1007,7 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, | |||
1007 | if (se401_set_size(se401, vw->width, vw->height)) | 1007 | if (se401_set_size(se401, vw->width, vw->height)) |
1008 | return -EINVAL; | 1008 | return -EINVAL; |
1009 | return 0; | 1009 | return 0; |
1010 | } | 1010 | } |
1011 | case VIDIOCGWIN: | 1011 | case VIDIOCGWIN: |
1012 | { | 1012 | { |
1013 | struct video_window *vw = arg; | 1013 | struct video_window *vw = arg; |
@@ -1095,11 +1095,11 @@ static int se401_do_ioctl(struct inode *inode, struct file *file, | |||
1095 | case VIDIOCGAUDIO: | 1095 | case VIDIOCGAUDIO: |
1096 | case VIDIOCSAUDIO: | 1096 | case VIDIOCSAUDIO: |
1097 | return -EINVAL; | 1097 | return -EINVAL; |
1098 | default: | 1098 | default: |
1099 | return -ENOIOCTLCMD; | 1099 | return -ENOIOCTLCMD; |
1100 | } /* end switch */ | 1100 | } /* end switch */ |
1101 | 1101 | ||
1102 | return 0; | 1102 | return 0; |
1103 | } | 1103 | } |
1104 | 1104 | ||
1105 | static int se401_ioctl(struct inode *inode, struct file *file, | 1105 | static int se401_ioctl(struct inode *inode, struct file *file, |
@@ -1142,7 +1142,7 @@ static ssize_t se401_read(struct file *file, char __user *buf, | |||
1142 | 1142 | ||
1143 | se401->frame[0].grabstate=FRAME_UNUSED; | 1143 | se401->frame[0].grabstate=FRAME_UNUSED; |
1144 | if (ret) | 1144 | if (ret) |
1145 | return ret; | 1145 | return ret; |
1146 | if (copy_to_user(buf, se401->frame[0].data, realcount)) | 1146 | if (copy_to_user(buf, se401->frame[0].data, realcount)) |
1147 | return -EFAULT; | 1147 | return -EFAULT; |
1148 | 1148 | ||
@@ -1183,24 +1183,24 @@ static int se401_mmap(struct file *file, struct vm_area_struct *vma) | |||
1183 | } | 1183 | } |
1184 | mutex_unlock(&se401->lock); | 1184 | mutex_unlock(&se401->lock); |
1185 | 1185 | ||
1186 | return 0; | 1186 | return 0; |
1187 | } | 1187 | } |
1188 | 1188 | ||
1189 | static struct file_operations se401_fops = { | 1189 | static struct file_operations se401_fops = { |
1190 | .owner = THIS_MODULE, | 1190 | .owner = THIS_MODULE, |
1191 | .open = se401_open, | 1191 | .open = se401_open, |
1192 | .release = se401_close, | 1192 | .release = se401_close, |
1193 | .read = se401_read, | 1193 | .read = se401_read, |
1194 | .mmap = se401_mmap, | 1194 | .mmap = se401_mmap, |
1195 | .ioctl = se401_ioctl, | 1195 | .ioctl = se401_ioctl, |
1196 | .compat_ioctl = v4l_compat_ioctl32, | 1196 | .compat_ioctl = v4l_compat_ioctl32, |
1197 | .llseek = no_llseek, | 1197 | .llseek = no_llseek, |
1198 | }; | 1198 | }; |
1199 | static struct video_device se401_template = { | 1199 | static struct video_device se401_template = { |
1200 | .owner = THIS_MODULE, | 1200 | .owner = THIS_MODULE, |
1201 | .name = "se401 USB camera", | 1201 | .name = "se401 USB camera", |
1202 | .type = VID_TYPE_CAPTURE, | 1202 | .type = VID_TYPE_CAPTURE, |
1203 | .hardware = VID_HARDWARE_SE401, | 1203 | .hardware = VID_HARDWARE_SE401, |
1204 | .fops = &se401_fops, | 1204 | .fops = &se401_fops, |
1205 | }; | 1205 | }; |
1206 | 1206 | ||
@@ -1209,12 +1209,12 @@ static struct video_device se401_template = { | |||
1209 | /***************************/ | 1209 | /***************************/ |
1210 | static int se401_init(struct usb_se401 *se401, int button) | 1210 | static int se401_init(struct usb_se401 *se401, int button) |
1211 | { | 1211 | { |
1212 | int i=0, rc; | 1212 | int i=0, rc; |
1213 | unsigned char cp[0x40]; | 1213 | unsigned char cp[0x40]; |
1214 | char temp[200]; | 1214 | char temp[200]; |
1215 | 1215 | ||
1216 | /* led on */ | 1216 | /* led on */ |
1217 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); | 1217 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); |
1218 | 1218 | ||
1219 | /* get camera descriptor */ | 1219 | /* get camera descriptor */ |
1220 | rc=se401_sndctrl(0, se401, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0, cp, sizeof(cp)); | 1220 | rc=se401_sndctrl(0, se401, SE401_REQ_GET_CAMERA_DESCRIPTOR, 0, cp, sizeof(cp)); |
@@ -1254,7 +1254,7 @@ static int se401_init(struct usb_se401 *se401, int button) | |||
1254 | return 1; | 1254 | return 1; |
1255 | } | 1255 | } |
1256 | /* set output mode (BAYER) */ | 1256 | /* set output mode (BAYER) */ |
1257 | se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE, SE401_FORMAT_BAYER, NULL, 0); | 1257 | se401_sndctrl(1, se401, SE401_REQ_SET_OUTPUT_MODE, SE401_FORMAT_BAYER, NULL, 0); |
1258 | 1258 | ||
1259 | rc=se401_sndctrl(0, se401, SE401_REQ_GET_BRT, 0, cp, sizeof(cp)); | 1259 | rc=se401_sndctrl(0, se401, SE401_REQ_GET_BRT, 0, cp, sizeof(cp)); |
1260 | se401->brightness=cp[0]+cp[1]*256; | 1260 | se401->brightness=cp[0]+cp[1]*256; |
@@ -1292,71 +1292,71 @@ static int se401_init(struct usb_se401 *se401, int button) | |||
1292 | } else | 1292 | } else |
1293 | se401->inturb=NULL; | 1293 | se401->inturb=NULL; |
1294 | 1294 | ||
1295 | /* Flash the led */ | 1295 | /* Flash the led */ |
1296 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); | 1296 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 1, NULL, 0); |
1297 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); | 1297 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 1, NULL, 0); |
1298 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0); | 1298 | se401_sndctrl(1, se401, SE401_REQ_CAMERA_POWER, 0, NULL, 0); |
1299 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 0, NULL, 0); | 1299 | se401_sndctrl(1, se401, SE401_REQ_LED_CONTROL, 0, NULL, 0); |
1300 | 1300 | ||
1301 | return 0; | 1301 | return 0; |
1302 | } | 1302 | } |
1303 | 1303 | ||
1304 | static int se401_probe(struct usb_interface *intf, | 1304 | static int se401_probe(struct usb_interface *intf, |
1305 | const struct usb_device_id *id) | 1305 | const struct usb_device_id *id) |
1306 | { | 1306 | { |
1307 | struct usb_device *dev = interface_to_usbdev(intf); | 1307 | struct usb_device *dev = interface_to_usbdev(intf); |
1308 | struct usb_interface_descriptor *interface; | 1308 | struct usb_interface_descriptor *interface; |
1309 | struct usb_se401 *se401; | 1309 | struct usb_se401 *se401; |
1310 | char *camera_name=NULL; | 1310 | char *camera_name=NULL; |
1311 | int button=1; | 1311 | int button=1; |
1312 | 1312 | ||
1313 | /* We don't handle multi-config cameras */ | 1313 | /* We don't handle multi-config cameras */ |
1314 | if (dev->descriptor.bNumConfigurations != 1) | 1314 | if (dev->descriptor.bNumConfigurations != 1) |
1315 | return -ENODEV; | 1315 | return -ENODEV; |
1316 | 1316 | ||
1317 | interface = &intf->cur_altsetting->desc; | 1317 | interface = &intf->cur_altsetting->desc; |
1318 | 1318 | ||
1319 | /* Is it an se401? */ | 1319 | /* Is it an se401? */ |
1320 | if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 && | 1320 | if (le16_to_cpu(dev->descriptor.idVendor) == 0x03e8 && |
1321 | le16_to_cpu(dev->descriptor.idProduct) == 0x0004) { | 1321 | le16_to_cpu(dev->descriptor.idProduct) == 0x0004) { |
1322 | camera_name="Endpoints/Aox SE401"; | 1322 | camera_name="Endpoints/Aox SE401"; |
1323 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 && | 1323 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x0471 && |
1324 | le16_to_cpu(dev->descriptor.idProduct) == 0x030b) { | 1324 | le16_to_cpu(dev->descriptor.idProduct) == 0x030b) { |
1325 | camera_name="Philips PCVC665K"; | 1325 | camera_name="Philips PCVC665K"; |
1326 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && | 1326 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && |
1327 | le16_to_cpu(dev->descriptor.idProduct) == 0x5001) { | 1327 | le16_to_cpu(dev->descriptor.idProduct) == 0x5001) { |
1328 | camera_name="Kensington VideoCAM 67014"; | 1328 | camera_name="Kensington VideoCAM 67014"; |
1329 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && | 1329 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && |
1330 | le16_to_cpu(dev->descriptor.idProduct) == 0x5002) { | 1330 | le16_to_cpu(dev->descriptor.idProduct) == 0x5002) { |
1331 | camera_name="Kensington VideoCAM 6701(5/7)"; | 1331 | camera_name="Kensington VideoCAM 6701(5/7)"; |
1332 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && | 1332 | } else if (le16_to_cpu(dev->descriptor.idVendor) == 0x047d && |
1333 | le16_to_cpu(dev->descriptor.idProduct) == 0x5003) { | 1333 | le16_to_cpu(dev->descriptor.idProduct) == 0x5003) { |
1334 | camera_name="Kensington VideoCAM 67016"; | 1334 | camera_name="Kensington VideoCAM 67016"; |
1335 | button=0; | 1335 | button=0; |
1336 | } else | 1336 | } else |
1337 | return -ENODEV; | 1337 | return -ENODEV; |
1338 | 1338 | ||
1339 | /* Checking vendor/product should be enough, but what the hell */ | 1339 | /* Checking vendor/product should be enough, but what the hell */ |
1340 | if (interface->bInterfaceClass != 0x00) | 1340 | if (interface->bInterfaceClass != 0x00) |
1341 | return -ENODEV; | 1341 | return -ENODEV; |
1342 | if (interface->bInterfaceSubClass != 0x00) | 1342 | if (interface->bInterfaceSubClass != 0x00) |
1343 | return -ENODEV; | 1343 | return -ENODEV; |
1344 | 1344 | ||
1345 | /* We found one */ | 1345 | /* We found one */ |
1346 | info("SE401 camera found: %s", camera_name); | 1346 | info("SE401 camera found: %s", camera_name); |
1347 | 1347 | ||
1348 | if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) { | 1348 | if ((se401 = kzalloc(sizeof(*se401), GFP_KERNEL)) == NULL) { |
1349 | err("couldn't kmalloc se401 struct"); | 1349 | err("couldn't kmalloc se401 struct"); |
1350 | return -ENOMEM; | 1350 | return -ENOMEM; |
1351 | } | 1351 | } |
1352 | 1352 | ||
1353 | se401->dev = dev; | 1353 | se401->dev = dev; |
1354 | se401->iface = interface->bInterfaceNumber; | 1354 | se401->iface = interface->bInterfaceNumber; |
1355 | se401->camera_name = camera_name; | 1355 | se401->camera_name = camera_name; |
1356 | 1356 | ||
1357 | info("firmware version: %02x", le16_to_cpu(dev->descriptor.bcdDevice) & 255); | 1357 | info("firmware version: %02x", le16_to_cpu(dev->descriptor.bcdDevice) & 255); |
1358 | 1358 | ||
1359 | if (se401_init(se401, button)) { | 1359 | if (se401_init(se401, button)) { |
1360 | kfree(se401); | 1360 | kfree(se401); |
1361 | return -EIO; | 1361 | return -EIO; |
1362 | } | 1362 | } |
@@ -1375,7 +1375,7 @@ static int se401_probe(struct usb_interface *intf, | |||
1375 | info("registered new video device: video%d", se401->vdev.minor); | 1375 | info("registered new video device: video%d", se401->vdev.minor); |
1376 | 1376 | ||
1377 | usb_set_intfdata (intf, se401); | 1377 | usb_set_intfdata (intf, se401); |
1378 | return 0; | 1378 | return 0; |
1379 | } | 1379 | } |
1380 | 1380 | ||
1381 | static void se401_disconnect(struct usb_interface *intf) | 1381 | static void se401_disconnect(struct usb_interface *intf) |
@@ -1400,10 +1400,10 @@ static void se401_disconnect(struct usb_interface *intf) | |||
1400 | } | 1400 | } |
1401 | 1401 | ||
1402 | static struct usb_driver se401_driver = { | 1402 | static struct usb_driver se401_driver = { |
1403 | .name = "se401", | 1403 | .name = "se401", |
1404 | .id_table = device_table, | 1404 | .id_table = device_table, |
1405 | .probe = se401_probe, | 1405 | .probe = se401_probe, |
1406 | .disconnect = se401_disconnect, | 1406 | .disconnect = se401_disconnect, |
1407 | }; | 1407 | }; |
1408 | 1408 | ||
1409 | 1409 | ||
diff --git a/drivers/usb/media/se401.h b/drivers/media/video/se401.h index e88a40d4c86a..a7a216bd4413 100644 --- a/drivers/usb/media/se401.h +++ b/drivers/media/video/se401.h | |||
@@ -177,7 +177,7 @@ struct usb_se401 { | |||
177 | int expose_m; | 177 | int expose_m; |
178 | int expose_l; | 178 | int expose_l; |
179 | int resetlevel; | 179 | int resetlevel; |
180 | 180 | ||
181 | int enhance; | 181 | int enhance; |
182 | 182 | ||
183 | int format; | 183 | int format; |
@@ -200,12 +200,12 @@ struct usb_se401 { | |||
200 | 200 | ||
201 | struct urb *urb[SE401_NUMSBUF]; | 201 | struct urb *urb[SE401_NUMSBUF]; |
202 | struct urb *inturb; | 202 | struct urb *inturb; |
203 | 203 | ||
204 | int button; | 204 | int button; |
205 | int buttonpressed; | 205 | int buttonpressed; |
206 | 206 | ||
207 | int curframe; /* Current receiving frame */ | 207 | int curframe; /* Current receiving frame */ |
208 | struct se401_frame frame[SE401_NUMFRAMES]; | 208 | struct se401_frame frame[SE401_NUMFRAMES]; |
209 | int readcount; | 209 | int readcount; |
210 | int framecount; | 210 | int framecount; |
211 | int error; | 211 | int error; |
diff --git a/drivers/media/video/sn9c102/Makefile b/drivers/media/video/sn9c102/Makefile new file mode 100644 index 000000000000..536ad3098da4 --- /dev/null +++ b/drivers/media/video/sn9c102/Makefile | |||
@@ -0,0 +1,7 @@ | |||
1 | sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o \ | ||
2 | sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bca.o \ | ||
3 | sn9c102_pas202bcb.o sn9c102_tas5110c1b.o \ | ||
4 | sn9c102_tas5130d1b.o | ||
5 | |||
6 | obj-$(CONFIG_USB_SN9C102) += sn9c102.o | ||
7 | |||
diff --git a/drivers/usb/media/sn9c102.h b/drivers/media/video/sn9c102/sn9c102.h index 1d70a62b9f23..2c6ff396dafc 100644 --- a/drivers/usb/media/sn9c102.h +++ b/drivers/media/video/sn9c102/sn9c102.h | |||
@@ -164,7 +164,7 @@ sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id) | |||
164 | 164 | ||
165 | void | 165 | void |
166 | sn9c102_attach_sensor(struct sn9c102_device* cam, | 166 | sn9c102_attach_sensor(struct sn9c102_device* cam, |
167 | struct sn9c102_sensor* sensor) | 167 | struct sn9c102_sensor* sensor) |
168 | { | 168 | { |
169 | memcpy(&cam->sensor, sensor, sizeof(struct sn9c102_sensor)); | 169 | memcpy(&cam->sensor, sensor, sizeof(struct sn9c102_sensor)); |
170 | } | 170 | } |
@@ -183,7 +183,7 @@ do { \ | |||
183 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ | 183 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ |
184 | else if ((level) >= 3) \ | 184 | else if ((level) >= 3) \ |
185 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 185 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
186 | __FUNCTION__, __LINE__ , ## args); \ | 186 | __FUNCTION__, __LINE__ , ## args); \ |
187 | } \ | 187 | } \ |
188 | } while (0) | 188 | } while (0) |
189 | # define V4LDBG(level, name, cmd) \ | 189 | # define V4LDBG(level, name, cmd) \ |
@@ -198,7 +198,7 @@ do { \ | |||
198 | pr_info("sn9c102: " fmt "\n", ## args); \ | 198 | pr_info("sn9c102: " fmt "\n", ## args); \ |
199 | else if ((level) == 3) \ | 199 | else if ((level) == 3) \ |
200 | pr_debug("sn9c102: [%s:%d] " fmt "\n", __FUNCTION__, \ | 200 | pr_debug("sn9c102: [%s:%d] " fmt "\n", __FUNCTION__, \ |
201 | __LINE__ , ## args); \ | 201 | __LINE__ , ## args); \ |
202 | } \ | 202 | } \ |
203 | } while (0) | 203 | } while (0) |
204 | #else | 204 | #else |
@@ -210,7 +210,7 @@ do { \ | |||
210 | #undef PDBG | 210 | #undef PDBG |
211 | #define PDBG(fmt, args...) \ | 211 | #define PDBG(fmt, args...) \ |
212 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 212 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
213 | __FUNCTION__, __LINE__ , ## args) | 213 | __FUNCTION__, __LINE__ , ## args) |
214 | 214 | ||
215 | #undef PDBGG | 215 | #undef PDBGG |
216 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ | 216 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |
diff --git a/drivers/usb/media/sn9c102_core.c b/drivers/media/video/sn9c102/sn9c102_core.c index 4c6cc6395723..ea4394dc9415 100644 --- a/drivers/usb/media/sn9c102_core.c +++ b/drivers/media/video/sn9c102/sn9c102_core.c | |||
@@ -62,53 +62,53 @@ MODULE_LICENSE(SN9C102_MODULE_LICENSE); | |||
62 | static short video_nr[] = {[0 ... SN9C102_MAX_DEVICES-1] = -1}; | 62 | static short video_nr[] = {[0 ... SN9C102_MAX_DEVICES-1] = -1}; |
63 | module_param_array(video_nr, short, NULL, 0444); | 63 | module_param_array(video_nr, short, NULL, 0444); |
64 | MODULE_PARM_DESC(video_nr, | 64 | MODULE_PARM_DESC(video_nr, |
65 | "\n<-1|n[,...]> Specify V4L2 minor mode number." | 65 | "\n<-1|n[,...]> Specify V4L2 minor mode number." |
66 | "\n -1 = use next available (default)" | 66 | "\n -1 = use next available (default)" |
67 | "\n n = use minor number n (integer >= 0)" | 67 | "\n n = use minor number n (integer >= 0)" |
68 | "\nYou can specify up to "__MODULE_STRING(SN9C102_MAX_DEVICES) | 68 | "\nYou can specify up to "__MODULE_STRING(SN9C102_MAX_DEVICES) |
69 | " cameras this way." | 69 | " cameras this way." |
70 | "\nFor example:" | 70 | "\nFor example:" |
71 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" | 71 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" |
72 | "\nthe second camera and use auto for the first" | 72 | "\nthe second camera and use auto for the first" |
73 | "\none and for every other camera." | 73 | "\none and for every other camera." |
74 | "\n"); | 74 | "\n"); |
75 | 75 | ||
76 | static short force_munmap[] = {[0 ... SN9C102_MAX_DEVICES-1] = | 76 | static short force_munmap[] = {[0 ... SN9C102_MAX_DEVICES-1] = |
77 | SN9C102_FORCE_MUNMAP}; | 77 | SN9C102_FORCE_MUNMAP}; |
78 | module_param_array(force_munmap, bool, NULL, 0444); | 78 | module_param_array(force_munmap, bool, NULL, 0444); |
79 | MODULE_PARM_DESC(force_munmap, | 79 | MODULE_PARM_DESC(force_munmap, |
80 | "\n<0|1[,...]> Force the application to unmap previously" | 80 | "\n<0|1[,...]> Force the application to unmap previously" |
81 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" | 81 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" |
82 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" | 82 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" |
83 | "\nthis feature. This parameter is specific for each" | 83 | "\nthis feature. This parameter is specific for each" |
84 | "\ndetected camera." | 84 | "\ndetected camera." |
85 | "\n 0 = do not force memory unmapping" | 85 | "\n 0 = do not force memory unmapping" |
86 | "\n 1 = force memory unmapping (save memory)" | 86 | "\n 1 = force memory unmapping (save memory)" |
87 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." | 87 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." |
88 | "\n"); | 88 | "\n"); |
89 | 89 | ||
90 | static unsigned int frame_timeout[] = {[0 ... SN9C102_MAX_DEVICES-1] = | 90 | static unsigned int frame_timeout[] = {[0 ... SN9C102_MAX_DEVICES-1] = |
91 | SN9C102_FRAME_TIMEOUT}; | 91 | SN9C102_FRAME_TIMEOUT}; |
92 | module_param_array(frame_timeout, uint, NULL, 0644); | 92 | module_param_array(frame_timeout, uint, NULL, 0644); |
93 | MODULE_PARM_DESC(frame_timeout, | 93 | MODULE_PARM_DESC(frame_timeout, |
94 | "\n<n[,...]> Timeout for a video frame in seconds." | 94 | "\n<n[,...]> Timeout for a video frame in seconds." |
95 | "\nThis parameter is specific for each detected camera." | 95 | "\nThis parameter is specific for each detected camera." |
96 | "\nDefault value is "__MODULE_STRING(SN9C102_FRAME_TIMEOUT)"." | 96 | "\nDefault value is "__MODULE_STRING(SN9C102_FRAME_TIMEOUT)"." |
97 | "\n"); | 97 | "\n"); |
98 | 98 | ||
99 | #ifdef SN9C102_DEBUG | 99 | #ifdef SN9C102_DEBUG |
100 | static unsigned short debug = SN9C102_DEBUG_LEVEL; | 100 | static unsigned short debug = SN9C102_DEBUG_LEVEL; |
101 | module_param(debug, ushort, 0644); | 101 | module_param(debug, ushort, 0644); |
102 | MODULE_PARM_DESC(debug, | 102 | MODULE_PARM_DESC(debug, |
103 | "\n<n> Debugging information level, from 0 to 3:" | 103 | "\n<n> Debugging information level, from 0 to 3:" |
104 | "\n0 = none (use carefully)" | 104 | "\n0 = none (use carefully)" |
105 | "\n1 = critical errors" | 105 | "\n1 = critical errors" |
106 | "\n2 = significant informations" | 106 | "\n2 = significant informations" |
107 | "\n3 = more verbose messages" | 107 | "\n3 = more verbose messages" |
108 | "\nLevel 3 is useful for testing only, when only " | 108 | "\nLevel 3 is useful for testing only, when only " |
109 | "one device is used." | 109 | "one device is used." |
110 | "\nDefault value is "__MODULE_STRING(SN9C102_DEBUG_LEVEL)"." | 110 | "\nDefault value is "__MODULE_STRING(SN9C102_DEBUG_LEVEL)"." |
111 | "\n"); | 111 | "\n"); |
112 | #endif | 112 | #endif |
113 | 113 | ||
114 | /*****************************************************************************/ | 114 | /*****************************************************************************/ |
@@ -131,16 +131,16 @@ static sn9c102_eof_header_t sn9c102_eof_header[] = { | |||
131 | 131 | ||
132 | /*****************************************************************************/ | 132 | /*****************************************************************************/ |
133 | 133 | ||
134 | static u32 | 134 | static u32 |
135 | sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, | 135 | sn9c102_request_buffers(struct sn9c102_device* cam, u32 count, |
136 | enum sn9c102_io_method io) | 136 | enum sn9c102_io_method io) |
137 | { | 137 | { |
138 | struct v4l2_pix_format* p = &(cam->sensor.pix_format); | 138 | struct v4l2_pix_format* p = &(cam->sensor.pix_format); |
139 | struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); | 139 | struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); |
140 | const size_t imagesize = cam->module_param.force_munmap || | 140 | const size_t imagesize = cam->module_param.force_munmap || |
141 | io == IO_READ ? | 141 | io == IO_READ ? |
142 | (p->width * p->height * p->priv) / 8 : | 142 | (p->width * p->height * p->priv) / 8 : |
143 | (r->width * r->height * p->priv) / 8; | 143 | (r->width * r->height * p->priv) / 8; |
144 | void* buff = NULL; | 144 | void* buff = NULL; |
145 | u32 i; | 145 | u32 i; |
146 | 146 | ||
@@ -232,8 +232,8 @@ int sn9c102_write_regs(struct sn9c102_device* cam, u8* buff, u16 index) | |||
232 | return -1; | 232 | return -1; |
233 | 233 | ||
234 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, | 234 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, |
235 | index, 0, buff, sizeof(buff), | 235 | index, 0, buff, sizeof(buff), |
236 | SN9C102_CTRL_TIMEOUT*sizeof(buff)); | 236 | SN9C102_CTRL_TIMEOUT*sizeof(buff)); |
237 | if (res < 0) { | 237 | if (res < 0) { |
238 | DBG(3, "Failed to write registers (index 0x%02X, error %d)", | 238 | DBG(3, "Failed to write registers (index 0x%02X, error %d)", |
239 | index, res); | 239 | index, res); |
@@ -259,7 +259,7 @@ int sn9c102_write_reg(struct sn9c102_device* cam, u8 value, u16 index) | |||
259 | *buff = value; | 259 | *buff = value; |
260 | 260 | ||
261 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, | 261 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, |
262 | index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); | 262 | index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); |
263 | if (res < 0) { | 263 | if (res < 0) { |
264 | DBG(3, "Failed to write a register (value 0x%02X, index " | 264 | DBG(3, "Failed to write a register (value 0x%02X, index " |
265 | "0x%02X, error %d)", value, index, res); | 265 | "0x%02X, error %d)", value, index, res); |
@@ -280,7 +280,7 @@ static int sn9c102_read_reg(struct sn9c102_device* cam, u16 index) | |||
280 | int res; | 280 | int res; |
281 | 281 | ||
282 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, | 282 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, |
283 | index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); | 283 | index, 0, buff, 1, SN9C102_CTRL_TIMEOUT); |
284 | if (res < 0) | 284 | if (res < 0) |
285 | DBG(3, "Failed to read a register (index 0x%02X, error %d)", | 285 | DBG(3, "Failed to read a register (index 0x%02X, error %d)", |
286 | index, res); | 286 | index, res); |
@@ -319,8 +319,8 @@ sn9c102_i2c_wait(struct sn9c102_device* cam, struct sn9c102_sensor* sensor) | |||
319 | 319 | ||
320 | 320 | ||
321 | static int | 321 | static int |
322 | sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, | 322 | sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, |
323 | struct sn9c102_sensor* sensor) | 323 | struct sn9c102_sensor* sensor) |
324 | { | 324 | { |
325 | int r; | 325 | int r; |
326 | r = sn9c102_read_reg(cam, 0x08); | 326 | r = sn9c102_read_reg(cam, 0x08); |
@@ -329,8 +329,8 @@ sn9c102_i2c_detect_read_error(struct sn9c102_device* cam, | |||
329 | 329 | ||
330 | 330 | ||
331 | static int | 331 | static int |
332 | sn9c102_i2c_detect_write_error(struct sn9c102_device* cam, | 332 | sn9c102_i2c_detect_write_error(struct sn9c102_device* cam, |
333 | struct sn9c102_sensor* sensor) | 333 | struct sn9c102_sensor* sensor) |
334 | { | 334 | { |
335 | int r; | 335 | int r; |
336 | r = sn9c102_read_reg(cam, 0x08); | 336 | r = sn9c102_read_reg(cam, 0x08); |
@@ -338,10 +338,10 @@ sn9c102_i2c_detect_write_error(struct sn9c102_device* cam, | |||
338 | } | 338 | } |
339 | 339 | ||
340 | 340 | ||
341 | int | 341 | int |
342 | sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | 342 | sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, |
343 | struct sn9c102_sensor* sensor, u8 data0, u8 data1, | 343 | struct sn9c102_sensor* sensor, u8 data0, u8 data1, |
344 | u8 n, u8 buffer[]) | 344 | u8 n, u8 buffer[]) |
345 | { | 345 | { |
346 | struct usb_device* udev = cam->usbdev; | 346 | struct usb_device* udev = cam->usbdev; |
347 | u8* data = cam->control_buffer; | 347 | u8* data = cam->control_buffer; |
@@ -349,12 +349,12 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | |||
349 | 349 | ||
350 | /* Write cycle */ | 350 | /* Write cycle */ |
351 | data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | | 351 | data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | |
352 | ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | 0x10; | 352 | ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | 0x10; |
353 | data[1] = data0; /* I2C slave id */ | 353 | data[1] = data0; /* I2C slave id */ |
354 | data[2] = data1; /* address */ | 354 | data[2] = data1; /* address */ |
355 | data[7] = 0x10; | 355 | data[7] = 0x10; |
356 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, | 356 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, |
357 | 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); | 357 | 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); |
358 | if (res < 0) | 358 | if (res < 0) |
359 | err += res; | 359 | err += res; |
360 | 360 | ||
@@ -362,12 +362,12 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | |||
362 | 362 | ||
363 | /* Read cycle - n bytes */ | 363 | /* Read cycle - n bytes */ |
364 | data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | | 364 | data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | |
365 | ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | | 365 | ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | |
366 | (n << 4) | 0x02; | 366 | (n << 4) | 0x02; |
367 | data[1] = data0; | 367 | data[1] = data0; |
368 | data[7] = 0x10; | 368 | data[7] = 0x10; |
369 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, | 369 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, |
370 | 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); | 370 | 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); |
371 | if (res < 0) | 371 | if (res < 0) |
372 | err += res; | 372 | err += res; |
373 | 373 | ||
@@ -375,7 +375,7 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | |||
375 | 375 | ||
376 | /* The first read byte will be placed in data[4] */ | 376 | /* The first read byte will be placed in data[4] */ |
377 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, | 377 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0x00, 0xc1, |
378 | 0x0a, 0, data, 5, SN9C102_CTRL_TIMEOUT); | 378 | 0x0a, 0, data, 5, SN9C102_CTRL_TIMEOUT); |
379 | if (res < 0) | 379 | if (res < 0) |
380 | err += res; | 380 | err += res; |
381 | 381 | ||
@@ -396,10 +396,10 @@ sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | |||
396 | } | 396 | } |
397 | 397 | ||
398 | 398 | ||
399 | int | 399 | int |
400 | sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, | 400 | sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, |
401 | struct sn9c102_sensor* sensor, u8 n, u8 data0, | 401 | struct sn9c102_sensor* sensor, u8 n, u8 data0, |
402 | u8 data1, u8 data2, u8 data3, u8 data4, u8 data5) | 402 | u8 data1, u8 data2, u8 data3, u8 data4, u8 data5) |
403 | { | 403 | { |
404 | struct usb_device* udev = cam->usbdev; | 404 | struct usb_device* udev = cam->usbdev; |
405 | u8* data = cam->control_buffer; | 405 | u8* data = cam->control_buffer; |
@@ -407,8 +407,8 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, | |||
407 | 407 | ||
408 | /* Write cycle. It usually is address + value */ | 408 | /* Write cycle. It usually is address + value */ |
409 | data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | | 409 | data[0] = ((sensor->interface == SN9C102_I2C_2WIRES) ? 0x80 : 0) | |
410 | ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) | 410 | ((sensor->frequency & SN9C102_I2C_400KHZ) ? 0x01 : 0) |
411 | | ((n - 1) << 4); | 411 | | ((n - 1) << 4); |
412 | data[1] = data0; | 412 | data[1] = data0; |
413 | data[2] = data1; | 413 | data[2] = data1; |
414 | data[3] = data2; | 414 | data[3] = data2; |
@@ -417,7 +417,7 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, | |||
417 | data[6] = data5; | 417 | data[6] = data5; |
418 | data[7] = 0x14; | 418 | data[7] = 0x14; |
419 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, | 419 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0x08, 0x41, |
420 | 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); | 420 | 0x08, 0, data, 8, SN9C102_CTRL_TIMEOUT); |
421 | if (res < 0) | 421 | if (res < 0) |
422 | err += res; | 422 | err += res; |
423 | 423 | ||
@@ -437,20 +437,20 @@ sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, | |||
437 | 437 | ||
438 | int | 438 | int |
439 | sn9c102_i2c_try_read(struct sn9c102_device* cam, | 439 | sn9c102_i2c_try_read(struct sn9c102_device* cam, |
440 | struct sn9c102_sensor* sensor, u8 address) | 440 | struct sn9c102_sensor* sensor, u8 address) |
441 | { | 441 | { |
442 | return sn9c102_i2c_try_raw_read(cam, sensor, sensor->i2c_slave_id, | 442 | return sn9c102_i2c_try_raw_read(cam, sensor, sensor->i2c_slave_id, |
443 | address, 1, NULL); | 443 | address, 1, NULL); |
444 | } | 444 | } |
445 | 445 | ||
446 | 446 | ||
447 | int | 447 | int |
448 | sn9c102_i2c_try_write(struct sn9c102_device* cam, | 448 | sn9c102_i2c_try_write(struct sn9c102_device* cam, |
449 | struct sn9c102_sensor* sensor, u8 address, u8 value) | 449 | struct sn9c102_sensor* sensor, u8 address, u8 value) |
450 | { | 450 | { |
451 | return sn9c102_i2c_try_raw_write(cam, sensor, 3, | 451 | return sn9c102_i2c_try_raw_write(cam, sensor, 3, |
452 | sensor->i2c_slave_id, address, | 452 | sensor->i2c_slave_id, address, |
453 | value, 0, 0, 0); | 453 | value, 0, 0, 0); |
454 | } | 454 | } |
455 | 455 | ||
456 | 456 | ||
@@ -484,7 +484,7 @@ sn9c102_find_sof_header(struct sn9c102_device* cam, void* mem, size_t len) | |||
484 | n = sizeof(sn9c103_sof_header) / soflen; | 484 | n = sizeof(sn9c103_sof_header) / soflen; |
485 | } | 485 | } |
486 | 486 | ||
487 | for (i = 0; (len >= soflen) && (i <= len - soflen); i++) | 487 | for (i = 0; (len >= soflen) && (i <= len - soflen); i++) |
488 | for (j = 0; j < n; j++) | 488 | for (j = 0; j < n; j++) |
489 | /* The invariable part of the header is 6 bytes long */ | 489 | /* The invariable part of the header is 6 bytes long */ |
490 | if ((cam->bridge != BRIDGE_SN9C103 && | 490 | if ((cam->bridge != BRIDGE_SN9C103 && |
@@ -552,15 +552,15 @@ static void sn9c102_urb_complete(struct urb *urb, struct pt_regs* regs) | |||
552 | 552 | ||
553 | if (!(*f)) | 553 | if (!(*f)) |
554 | (*f) = list_entry(cam->inqueue.next, struct sn9c102_frame_t, | 554 | (*f) = list_entry(cam->inqueue.next, struct sn9c102_frame_t, |
555 | frame); | 555 | frame); |
556 | 556 | ||
557 | imagesize = (cam->sensor.pix_format.width * | 557 | imagesize = (cam->sensor.pix_format.width * |
558 | cam->sensor.pix_format.height * | 558 | cam->sensor.pix_format.height * |
559 | cam->sensor.pix_format.priv) / 8; | 559 | cam->sensor.pix_format.priv) / 8; |
560 | 560 | ||
561 | soflen = (cam->bridge) == BRIDGE_SN9C103 ? | 561 | soflen = (cam->bridge) == BRIDGE_SN9C103 ? |
562 | sizeof(sn9c103_sof_header_t) : | 562 | sizeof(sn9c103_sof_header_t) : |
563 | sizeof(sn9c102_sof_header_t); | 563 | sizeof(sn9c102_sof_header_t); |
564 | 564 | ||
565 | for (i = 0; i < urb->number_of_packets; i++) { | 565 | for (i = 0; i < urb->number_of_packets; i++) { |
566 | unsigned int img, len, status; | 566 | unsigned int img, len, status; |
@@ -611,19 +611,19 @@ end_of_frame: | |||
611 | 611 | ||
612 | if ((*f)->buf.bytesused == imagesize || | 612 | if ((*f)->buf.bytesused == imagesize || |
613 | (cam->sensor.pix_format.pixelformat == | 613 | (cam->sensor.pix_format.pixelformat == |
614 | V4L2_PIX_FMT_SN9C10X && eof)) { | 614 | V4L2_PIX_FMT_SN9C10X && eof)) { |
615 | u32 b; | 615 | u32 b; |
616 | b = (*f)->buf.bytesused; | 616 | b = (*f)->buf.bytesused; |
617 | (*f)->state = F_DONE; | 617 | (*f)->state = F_DONE; |
618 | (*f)->buf.sequence= ++cam->frame_count; | 618 | (*f)->buf.sequence= ++cam->frame_count; |
619 | spin_lock(&cam->queue_lock); | 619 | spin_lock(&cam->queue_lock); |
620 | list_move_tail(&(*f)->frame, | 620 | list_move_tail(&(*f)->frame, |
621 | &cam->outqueue); | 621 | &cam->outqueue); |
622 | if (!list_empty(&cam->inqueue)) | 622 | if (!list_empty(&cam->inqueue)) |
623 | (*f) = list_entry( | 623 | (*f) = list_entry( |
624 | cam->inqueue.next, | 624 | cam->inqueue.next, |
625 | struct sn9c102_frame_t, | 625 | struct sn9c102_frame_t, |
626 | frame ); | 626 | frame ); |
627 | else | 627 | else |
628 | (*f) = NULL; | 628 | (*f) = NULL; |
629 | spin_unlock(&cam->queue_lock); | 629 | spin_unlock(&cam->queue_lock); |
@@ -638,7 +638,7 @@ end_of_frame: | |||
638 | } else if (eof) { | 638 | } else if (eof) { |
639 | (*f)->state = F_ERROR; | 639 | (*f)->state = F_ERROR; |
640 | DBG(3, "Not expected EOF after %lu " | 640 | DBG(3, "Not expected EOF after %lu " |
641 | "bytes of image data", | 641 | "bytes of image data", |
642 | (unsigned long) | 642 | (unsigned long) |
643 | ((*f)->buf.bytesused)); | 643 | ((*f)->buf.bytesused)); |
644 | } | 644 | } |
@@ -676,7 +676,7 @@ start_of_frame: | |||
676 | goto end_of_frame; | 676 | goto end_of_frame; |
677 | } else { | 677 | } else { |
678 | DBG(3, "SOF before expected EOF after " | 678 | DBG(3, "SOF before expected EOF after " |
679 | "%lu bytes of image data", | 679 | "%lu bytes of image data", |
680 | (unsigned long) | 680 | (unsigned long) |
681 | ((*f)->buf.bytesused)); | 681 | ((*f)->buf.bytesused)); |
682 | goto start_of_frame; | 682 | goto start_of_frame; |
@@ -702,18 +702,18 @@ static int sn9c102_start_transfer(struct sn9c102_device* cam) | |||
702 | struct usb_device *udev = cam->usbdev; | 702 | struct usb_device *udev = cam->usbdev; |
703 | struct urb* urb; | 703 | struct urb* urb; |
704 | const unsigned int sn9c102_wMaxPacketSize[] = {0, 128, 256, 384, 512, | 704 | const unsigned int sn9c102_wMaxPacketSize[] = {0, 128, 256, 384, 512, |
705 | 680, 800, 900, 1023}; | 705 | 680, 800, 900, 1023}; |
706 | const unsigned int sn9c103_wMaxPacketSize[] = {0, 128, 256, 384, 512, | 706 | const unsigned int sn9c103_wMaxPacketSize[] = {0, 128, 256, 384, 512, |
707 | 680, 800, 900, 1003}; | 707 | 680, 800, 900, 1003}; |
708 | const unsigned int psz = (cam->bridge == BRIDGE_SN9C103) ? | 708 | const unsigned int psz = (cam->bridge == BRIDGE_SN9C103) ? |
709 | sn9c103_wMaxPacketSize[SN9C102_ALTERNATE_SETTING] : | 709 | sn9c103_wMaxPacketSize[SN9C102_ALTERNATE_SETTING] : |
710 | sn9c102_wMaxPacketSize[SN9C102_ALTERNATE_SETTING]; | 710 | sn9c102_wMaxPacketSize[SN9C102_ALTERNATE_SETTING]; |
711 | s8 i, j; | 711 | s8 i, j; |
712 | int err = 0; | 712 | int err = 0; |
713 | 713 | ||
714 | for (i = 0; i < SN9C102_URBS; i++) { | 714 | for (i = 0; i < SN9C102_URBS; i++) { |
715 | cam->transfer_buffer[i] = kzalloc(SN9C102_ISO_PACKETS * psz, | 715 | cam->transfer_buffer[i] = kzalloc(SN9C102_ISO_PACKETS * psz, |
716 | GFP_KERNEL); | 716 | GFP_KERNEL); |
717 | if (!cam->transfer_buffer[i]) { | 717 | if (!cam->transfer_buffer[i]) { |
718 | err = -ENOMEM; | 718 | err = -ENOMEM; |
719 | DBG(1, "Not enough memory"); | 719 | DBG(1, "Not enough memory"); |
@@ -815,9 +815,9 @@ static int sn9c102_stream_interrupt(struct sn9c102_device* cam) | |||
815 | 815 | ||
816 | cam->stream = STREAM_INTERRUPT; | 816 | cam->stream = STREAM_INTERRUPT; |
817 | timeout = wait_event_timeout(cam->wait_stream, | 817 | timeout = wait_event_timeout(cam->wait_stream, |
818 | (cam->stream == STREAM_OFF) || | 818 | (cam->stream == STREAM_OFF) || |
819 | (cam->state & DEV_DISCONNECTED), | 819 | (cam->state & DEV_DISCONNECTED), |
820 | SN9C102_URB_TIMEOUT); | 820 | SN9C102_URB_TIMEOUT); |
821 | if (cam->state & DEV_DISCONNECTED) | 821 | if (cam->state & DEV_DISCONNECTED) |
822 | return -ENODEV; | 822 | return -ENODEV; |
823 | else if (cam->stream != STREAM_OFF) { | 823 | else if (cam->stream != STREAM_OFF) { |
@@ -861,7 +861,7 @@ static u8 sn9c102_strtou8(const char* buff, size_t len, ssize_t* count) | |||
861 | 861 | ||
862 | /* | 862 | /* |
863 | NOTE 1: being inside one of the following methods implies that the v4l | 863 | NOTE 1: being inside one of the following methods implies that the v4l |
864 | device exists for sure (see kobjects and reference counters) | 864 | device exists for sure (see kobjects and reference counters) |
865 | NOTE 2: buffers are PAGE_SIZE long | 865 | NOTE 2: buffers are PAGE_SIZE long |
866 | */ | 866 | */ |
867 | 867 | ||
@@ -884,10 +884,10 @@ static ssize_t sn9c102_show_reg(struct class_device* cd, char* buf) | |||
884 | mutex_unlock(&sn9c102_sysfs_lock); | 884 | mutex_unlock(&sn9c102_sysfs_lock); |
885 | 885 | ||
886 | return count; | 886 | return count; |
887 | } | 887 | } |
888 | 888 | ||
889 | 889 | ||
890 | static ssize_t | 890 | static ssize_t |
891 | sn9c102_store_reg(struct class_device* cd, const char* buf, size_t len) | 891 | sn9c102_store_reg(struct class_device* cd, const char* buf, size_t len) |
892 | { | 892 | { |
893 | struct sn9c102_device* cam; | 893 | struct sn9c102_device* cam; |
@@ -947,7 +947,7 @@ static ssize_t sn9c102_show_val(struct class_device* cd, char* buf) | |||
947 | mutex_unlock(&sn9c102_sysfs_lock); | 947 | mutex_unlock(&sn9c102_sysfs_lock); |
948 | 948 | ||
949 | return count; | 949 | return count; |
950 | } | 950 | } |
951 | 951 | ||
952 | 952 | ||
953 | static ssize_t | 953 | static ssize_t |
@@ -1013,7 +1013,7 @@ static ssize_t sn9c102_show_i2c_reg(struct class_device* cd, char* buf) | |||
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | 1015 | ||
1016 | static ssize_t | 1016 | static ssize_t |
1017 | sn9c102_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) | 1017 | sn9c102_store_i2c_reg(struct class_device* cd, const char* buf, size_t len) |
1018 | { | 1018 | { |
1019 | struct sn9c102_device* cam; | 1019 | struct sn9c102_device* cam; |
@@ -1078,7 +1078,7 @@ static ssize_t sn9c102_show_i2c_val(struct class_device* cd, char* buf) | |||
1078 | mutex_unlock(&sn9c102_sysfs_lock); | 1078 | mutex_unlock(&sn9c102_sysfs_lock); |
1079 | 1079 | ||
1080 | return count; | 1080 | return count; |
1081 | } | 1081 | } |
1082 | 1082 | ||
1083 | 1083 | ||
1084 | static ssize_t | 1084 | static ssize_t |
@@ -1222,22 +1222,22 @@ static ssize_t sn9c102_show_frame_header(struct class_device* cd, char* buf) | |||
1222 | DBG(3, "Frame header, read bytes: %zd", count); | 1222 | DBG(3, "Frame header, read bytes: %zd", count); |
1223 | 1223 | ||
1224 | return count; | 1224 | return count; |
1225 | } | 1225 | } |
1226 | 1226 | ||
1227 | 1227 | ||
1228 | static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, | 1228 | static CLASS_DEVICE_ATTR(reg, S_IRUGO | S_IWUSR, |
1229 | sn9c102_show_reg, sn9c102_store_reg); | 1229 | sn9c102_show_reg, sn9c102_store_reg); |
1230 | static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, | 1230 | static CLASS_DEVICE_ATTR(val, S_IRUGO | S_IWUSR, |
1231 | sn9c102_show_val, sn9c102_store_val); | 1231 | sn9c102_show_val, sn9c102_store_val); |
1232 | static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, | 1232 | static CLASS_DEVICE_ATTR(i2c_reg, S_IRUGO | S_IWUSR, |
1233 | sn9c102_show_i2c_reg, sn9c102_store_i2c_reg); | 1233 | sn9c102_show_i2c_reg, sn9c102_store_i2c_reg); |
1234 | static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, | 1234 | static CLASS_DEVICE_ATTR(i2c_val, S_IRUGO | S_IWUSR, |
1235 | sn9c102_show_i2c_val, sn9c102_store_i2c_val); | 1235 | sn9c102_show_i2c_val, sn9c102_store_i2c_val); |
1236 | static CLASS_DEVICE_ATTR(green, S_IWUGO, NULL, sn9c102_store_green); | 1236 | static CLASS_DEVICE_ATTR(green, S_IWUGO, NULL, sn9c102_store_green); |
1237 | static CLASS_DEVICE_ATTR(blue, S_IWUGO, NULL, sn9c102_store_blue); | 1237 | static CLASS_DEVICE_ATTR(blue, S_IWUGO, NULL, sn9c102_store_blue); |
1238 | static CLASS_DEVICE_ATTR(red, S_IWUGO, NULL, sn9c102_store_red); | 1238 | static CLASS_DEVICE_ATTR(red, S_IWUGO, NULL, sn9c102_store_red); |
1239 | static CLASS_DEVICE_ATTR(frame_header, S_IRUGO, | 1239 | static CLASS_DEVICE_ATTR(frame_header, S_IRUGO, |
1240 | sn9c102_show_frame_header, NULL); | 1240 | sn9c102_show_frame_header, NULL); |
1241 | 1241 | ||
1242 | 1242 | ||
1243 | static void sn9c102_create_sysfs(struct sn9c102_device* cam) | 1243 | static void sn9c102_create_sysfs(struct sn9c102_device* cam) |
@@ -1278,7 +1278,7 @@ sn9c102_set_pix_format(struct sn9c102_device* cam, struct v4l2_pix_format* pix) | |||
1278 | 1278 | ||
1279 | static int | 1279 | static int |
1280 | sn9c102_set_compression(struct sn9c102_device* cam, | 1280 | sn9c102_set_compression(struct sn9c102_device* cam, |
1281 | struct v4l2_jpegcompression* compression) | 1281 | struct v4l2_jpegcompression* compression) |
1282 | { | 1282 | { |
1283 | int err = 0; | 1283 | int err = 0; |
1284 | 1284 | ||
@@ -1469,8 +1469,8 @@ static int sn9c102_open(struct inode* inode, struct file* filp) | |||
1469 | } | 1469 | } |
1470 | mutex_unlock(&cam->dev_mutex); | 1470 | mutex_unlock(&cam->dev_mutex); |
1471 | err = wait_event_interruptible_exclusive(cam->open, | 1471 | err = wait_event_interruptible_exclusive(cam->open, |
1472 | cam->state & DEV_DISCONNECTED | 1472 | cam->state & DEV_DISCONNECTED |
1473 | || !cam->users); | 1473 | || !cam->users); |
1474 | if (err) { | 1474 | if (err) { |
1475 | up_read(&sn9c102_disconnect); | 1475 | up_read(&sn9c102_disconnect); |
1476 | return err; | 1476 | return err; |
@@ -1600,12 +1600,12 @@ sn9c102_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
1600 | return -EAGAIN; | 1600 | return -EAGAIN; |
1601 | } | 1601 | } |
1602 | timeout = wait_event_interruptible_timeout | 1602 | timeout = wait_event_interruptible_timeout |
1603 | ( cam->wait_frame, | 1603 | ( cam->wait_frame, |
1604 | (!list_empty(&cam->outqueue)) || | 1604 | (!list_empty(&cam->outqueue)) || |
1605 | (cam->state & DEV_DISCONNECTED) || | 1605 | (cam->state & DEV_DISCONNECTED) || |
1606 | (cam->state & DEV_MISCONFIGURED), | 1606 | (cam->state & DEV_MISCONFIGURED), |
1607 | cam->module_param.frame_timeout * | 1607 | cam->module_param.frame_timeout * |
1608 | 1000 * msecs_to_jiffies(1) ); | 1608 | 1000 * msecs_to_jiffies(1) ); |
1609 | if (timeout < 0) { | 1609 | if (timeout < 0) { |
1610 | mutex_unlock(&cam->fileop_mutex); | 1610 | mutex_unlock(&cam->fileop_mutex); |
1611 | return timeout; | 1611 | return timeout; |
@@ -1672,7 +1672,7 @@ static unsigned int sn9c102_poll(struct file *filp, poll_table *wait) | |||
1672 | 1672 | ||
1673 | if (cam->io == IO_NONE) { | 1673 | if (cam->io == IO_NONE) { |
1674 | if (!sn9c102_request_buffers(cam, cam->nreadbuffers, | 1674 | if (!sn9c102_request_buffers(cam, cam->nreadbuffers, |
1675 | IO_READ)) { | 1675 | IO_READ)) { |
1676 | DBG(1, "poll() failed, not enough memory"); | 1676 | DBG(1, "poll() failed, not enough memory"); |
1677 | goto error; | 1677 | goto error; |
1678 | } | 1678 | } |
@@ -1729,7 +1729,7 @@ static int sn9c102_mmap(struct file* filp, struct vm_area_struct *vma) | |||
1729 | { | 1729 | { |
1730 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); | 1730 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); |
1731 | unsigned long size = vma->vm_end - vma->vm_start, | 1731 | unsigned long size = vma->vm_end - vma->vm_start, |
1732 | start = vma->vm_start; | 1732 | start = vma->vm_start; |
1733 | void *pos; | 1733 | void *pos; |
1734 | u32 i; | 1734 | u32 i; |
1735 | 1735 | ||
@@ -1797,13 +1797,13 @@ sn9c102_vidioc_querycap(struct sn9c102_device* cam, void __user * arg) | |||
1797 | .driver = "sn9c102", | 1797 | .driver = "sn9c102", |
1798 | .version = SN9C102_MODULE_VERSION_CODE, | 1798 | .version = SN9C102_MODULE_VERSION_CODE, |
1799 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | | 1799 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
1800 | V4L2_CAP_STREAMING, | 1800 | V4L2_CAP_STREAMING, |
1801 | }; | 1801 | }; |
1802 | 1802 | ||
1803 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); | 1803 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); |
1804 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) | 1804 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) |
1805 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, | 1805 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, |
1806 | sizeof(cap.bus_info)); | 1806 | sizeof(cap.bus_info)); |
1807 | 1807 | ||
1808 | if (copy_to_user(arg, &cap, sizeof(cap))) | 1808 | if (copy_to_user(arg, &cap, sizeof(cap))) |
1809 | return -EFAULT; | 1809 | return -EFAULT; |
@@ -2138,7 +2138,7 @@ sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg) | |||
2138 | return -EINVAL; | 2138 | return -EINVAL; |
2139 | 2139 | ||
2140 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_SN9C10X) | 2140 | pfmt->bytesperline = (pfmt->pixelformat==V4L2_PIX_FMT_SN9C10X) |
2141 | ? 0 : (pfmt->width * pfmt->priv) / 8; | 2141 | ? 0 : (pfmt->width * pfmt->priv) / 8; |
2142 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); | 2142 | pfmt->sizeimage = pfmt->height * ((pfmt->width*pfmt->priv)/8); |
2143 | pfmt->field = V4L2_FIELD_NONE; | 2143 | pfmt->field = V4L2_FIELD_NONE; |
2144 | memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); | 2144 | memcpy(&(format.fmt.pix), pfmt, sizeof(*pfmt)); |
@@ -2152,7 +2152,7 @@ sn9c102_vidioc_g_fmt(struct sn9c102_device* cam, void __user * arg) | |||
2152 | 2152 | ||
2153 | static int | 2153 | static int |
2154 | sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, | 2154 | sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, |
2155 | void __user * arg) | 2155 | void __user * arg) |
2156 | { | 2156 | { |
2157 | struct sn9c102_sensor* s = &cam->sensor; | 2157 | struct sn9c102_sensor* s = &cam->sensor; |
2158 | struct v4l2_format format; | 2158 | struct v4l2_format format; |
@@ -2214,7 +2214,7 @@ sn9c102_vidioc_try_s_fmt(struct sn9c102_device* cam, unsigned int cmd, | |||
2214 | pix->priv = pfmt->priv; /* bpp */ | 2214 | pix->priv = pfmt->priv; /* bpp */ |
2215 | pix->colorspace = pfmt->colorspace; | 2215 | pix->colorspace = pfmt->colorspace; |
2216 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) | 2216 | pix->bytesperline = (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) |
2217 | ? 0 : (pix->width * pix->priv) / 8; | 2217 | ? 0 : (pix->width * pix->priv) / 8; |
2218 | pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); | 2218 | pix->sizeimage = pix->height * ((pix->width * pix->priv) / 8); |
2219 | pix->field = V4L2_FIELD_NONE; | 2219 | pix->field = V4L2_FIELD_NONE; |
2220 | 2220 | ||
@@ -2287,7 +2287,7 @@ static int | |||
2287 | sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg) | 2287 | sn9c102_vidioc_g_jpegcomp(struct sn9c102_device* cam, void __user * arg) |
2288 | { | 2288 | { |
2289 | if (copy_to_user(arg, &cam->compression, | 2289 | if (copy_to_user(arg, &cam->compression, |
2290 | sizeof(cam->compression))) | 2290 | sizeof(cam->compression))) |
2291 | return -EFAULT; | 2291 | return -EFAULT; |
2292 | 2292 | ||
2293 | return 0; | 2293 | return 0; |
@@ -2436,7 +2436,7 @@ sn9c102_vidioc_qbuf(struct sn9c102_device* cam, void __user * arg) | |||
2436 | 2436 | ||
2437 | static int | 2437 | static int |
2438 | sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, | 2438 | sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, |
2439 | void __user * arg) | 2439 | void __user * arg) |
2440 | { | 2440 | { |
2441 | struct v4l2_buffer b; | 2441 | struct v4l2_buffer b; |
2442 | struct sn9c102_frame_t *f; | 2442 | struct sn9c102_frame_t *f; |
@@ -2455,12 +2455,12 @@ sn9c102_vidioc_dqbuf(struct sn9c102_device* cam, struct file* filp, | |||
2455 | if (filp->f_flags & O_NONBLOCK) | 2455 | if (filp->f_flags & O_NONBLOCK) |
2456 | return -EAGAIN; | 2456 | return -EAGAIN; |
2457 | timeout = wait_event_interruptible_timeout | 2457 | timeout = wait_event_interruptible_timeout |
2458 | ( cam->wait_frame, | 2458 | ( cam->wait_frame, |
2459 | (!list_empty(&cam->outqueue)) || | 2459 | (!list_empty(&cam->outqueue)) || |
2460 | (cam->state & DEV_DISCONNECTED) || | 2460 | (cam->state & DEV_DISCONNECTED) || |
2461 | (cam->state & DEV_MISCONFIGURED), | 2461 | (cam->state & DEV_MISCONFIGURED), |
2462 | cam->module_param.frame_timeout * | 2462 | cam->module_param.frame_timeout * |
2463 | 1000 * msecs_to_jiffies(1) ); | 2463 | 1000 * msecs_to_jiffies(1) ); |
2464 | if (timeout < 0) | 2464 | if (timeout < 0) |
2465 | return timeout; | 2465 | return timeout; |
2466 | if (cam->state & DEV_DISCONNECTED) | 2466 | if (cam->state & DEV_DISCONNECTED) |
@@ -2584,7 +2584,7 @@ sn9c102_vidioc_s_parm(struct sn9c102_device* cam, void __user * arg) | |||
2584 | 2584 | ||
2585 | 2585 | ||
2586 | static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, | 2586 | static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, |
2587 | unsigned int cmd, void __user * arg) | 2587 | unsigned int cmd, void __user * arg) |
2588 | { | 2588 | { |
2589 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); | 2589 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); |
2590 | 2590 | ||
@@ -2678,7 +2678,7 @@ static int sn9c102_ioctl_v4l2(struct inode* inode, struct file* filp, | |||
2678 | 2678 | ||
2679 | 2679 | ||
2680 | static int sn9c102_ioctl(struct inode* inode, struct file* filp, | 2680 | static int sn9c102_ioctl(struct inode* inode, struct file* filp, |
2681 | unsigned int cmd, unsigned long arg) | 2681 | unsigned int cmd, unsigned long arg) |
2682 | { | 2682 | { |
2683 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); | 2683 | struct sn9c102_device* cam = video_get_drvdata(video_devdata(filp)); |
2684 | int err = 0; | 2684 | int err = 0; |
@@ -2761,7 +2761,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2761 | } | 2761 | } |
2762 | 2762 | ||
2763 | cam->bridge = (id->idProduct & 0xffc0) == 0x6080 ? | 2763 | cam->bridge = (id->idProduct & 0xffc0) == 0x6080 ? |
2764 | BRIDGE_SN9C103 : BRIDGE_SN9C102; | 2764 | BRIDGE_SN9C103 : BRIDGE_SN9C102; |
2765 | switch (cam->bridge) { | 2765 | switch (cam->bridge) { |
2766 | case BRIDGE_SN9C101: | 2766 | case BRIDGE_SN9C101: |
2767 | case BRIDGE_SN9C102: | 2767 | case BRIDGE_SN9C102: |
@@ -2807,7 +2807,7 @@ sn9c102_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
2807 | mutex_lock(&cam->dev_mutex); | 2807 | mutex_lock(&cam->dev_mutex); |
2808 | 2808 | ||
2809 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | 2809 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, |
2810 | video_nr[dev_nr]); | 2810 | video_nr[dev_nr]); |
2811 | if (err) { | 2811 | if (err) { |
2812 | DBG(1, "V4L2 device registration failed"); | 2812 | DBG(1, "V4L2 device registration failed"); |
2813 | if (err == -ENFILE && video_nr[dev_nr] == -1) | 2813 | if (err == -ENFILE && video_nr[dev_nr] == -1) |
diff --git a/drivers/usb/media/sn9c102_hv7131d.c b/drivers/media/video/sn9c102/sn9c102_hv7131d.c index 46c12ec3ca62..c4117bf64b69 100644 --- a/drivers/usb/media/sn9c102_hv7131d.c +++ b/drivers/media/video/sn9c102/sn9c102_hv7131d.c | |||
@@ -44,8 +44,8 @@ static int hv7131d_init(struct sn9c102_device* cam) | |||
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | static int hv7131d_get_ctrl(struct sn9c102_device* cam, | 47 | static int hv7131d_get_ctrl(struct sn9c102_device* cam, |
48 | struct v4l2_control* ctrl) | 48 | struct v4l2_control* ctrl) |
49 | { | 49 | { |
50 | switch (ctrl->id) { | 50 | switch (ctrl->id) { |
51 | case V4L2_CID_EXPOSURE: | 51 | case V4L2_CID_EXPOSURE: |
@@ -88,8 +88,8 @@ static int hv7131d_get_ctrl(struct sn9c102_device* cam, | |||
88 | } | 88 | } |
89 | 89 | ||
90 | 90 | ||
91 | static int hv7131d_set_ctrl(struct sn9c102_device* cam, | 91 | static int hv7131d_set_ctrl(struct sn9c102_device* cam, |
92 | const struct v4l2_control* ctrl) | 92 | const struct v4l2_control* ctrl) |
93 | { | 93 | { |
94 | int err = 0; | 94 | int err = 0; |
95 | 95 | ||
@@ -121,8 +121,8 @@ static int hv7131d_set_ctrl(struct sn9c102_device* cam, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | static int hv7131d_set_crop(struct sn9c102_device* cam, | 124 | static int hv7131d_set_crop(struct sn9c102_device* cam, |
125 | const struct v4l2_rect* rect) | 125 | const struct v4l2_rect* rect) |
126 | { | 126 | { |
127 | struct sn9c102_sensor* s = &hv7131d; | 127 | struct sn9c102_sensor* s = &hv7131d; |
128 | int err = 0; | 128 | int err = 0; |
@@ -136,8 +136,8 @@ static int hv7131d_set_crop(struct sn9c102_device* cam, | |||
136 | } | 136 | } |
137 | 137 | ||
138 | 138 | ||
139 | static int hv7131d_set_pix_format(struct sn9c102_device* cam, | 139 | static int hv7131d_set_pix_format(struct sn9c102_device* cam, |
140 | const struct v4l2_pix_format* pix) | 140 | const struct v4l2_pix_format* pix) |
141 | { | 141 | { |
142 | int err = 0; | 142 | int err = 0; |
143 | 143 | ||
diff --git a/drivers/usb/media/sn9c102_mi0343.c b/drivers/media/video/sn9c102/sn9c102_mi0343.c index d9aa7a61095d..4169ea4a2e20 100644 --- a/drivers/usb/media/sn9c102_mi0343.c +++ b/drivers/media/video/sn9c102/sn9c102_mi0343.c | |||
@@ -39,64 +39,64 @@ static int mi0343_init(struct sn9c102_device* cam) | |||
39 | err += sn9c102_write_reg(cam, 0xa0, 0x19); | 39 | err += sn9c102_write_reg(cam, 0xa0, 0x19); |
40 | 40 | ||
41 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 41 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
42 | 0x0d, 0x00, 0x01, 0, 0); | 42 | 0x0d, 0x00, 0x01, 0, 0); |
43 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 43 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
44 | 0x0d, 0x00, 0x00, 0, 0); | 44 | 0x0d, 0x00, 0x00, 0, 0); |
45 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 45 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
46 | 0x03, 0x01, 0xe1, 0, 0); | 46 | 0x03, 0x01, 0xe1, 0, 0); |
47 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 47 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
48 | 0x04, 0x02, 0x81, 0, 0); | 48 | 0x04, 0x02, 0x81, 0, 0); |
49 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 49 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
50 | 0x05, 0x00, 0x17, 0, 0); | 50 | 0x05, 0x00, 0x17, 0, 0); |
51 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 51 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
52 | 0x06, 0x00, 0x11, 0, 0); | 52 | 0x06, 0x00, 0x11, 0, 0); |
53 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, | 53 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, mi0343.i2c_slave_id, |
54 | 0x62, 0x04, 0x9a, 0, 0); | 54 | 0x62, 0x04, 0x9a, 0, 0); |
55 | 55 | ||
56 | return err; | 56 | return err; |
57 | } | 57 | } |
58 | 58 | ||
59 | 59 | ||
60 | static int mi0343_get_ctrl(struct sn9c102_device* cam, | 60 | static int mi0343_get_ctrl(struct sn9c102_device* cam, |
61 | struct v4l2_control* ctrl) | 61 | struct v4l2_control* ctrl) |
62 | { | 62 | { |
63 | switch (ctrl->id) { | 63 | switch (ctrl->id) { |
64 | case V4L2_CID_EXPOSURE: | 64 | case V4L2_CID_EXPOSURE: |
65 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 65 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
66 | 0x09, 2+1, mi0343_i2c_data) < 0) | 66 | 0x09, 2+1, mi0343_i2c_data) < 0) |
67 | return -EIO; | 67 | return -EIO; |
68 | ctrl->value = mi0343_i2c_data[2]; | 68 | ctrl->value = mi0343_i2c_data[2]; |
69 | return 0; | 69 | return 0; |
70 | case V4L2_CID_GAIN: | 70 | case V4L2_CID_GAIN: |
71 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 71 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
72 | 0x35, 2+1, mi0343_i2c_data) < 0) | 72 | 0x35, 2+1, mi0343_i2c_data) < 0) |
73 | return -EIO; | 73 | return -EIO; |
74 | break; | 74 | break; |
75 | case V4L2_CID_HFLIP: | 75 | case V4L2_CID_HFLIP: |
76 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 76 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
77 | 0x20, 2+1, mi0343_i2c_data) < 0) | 77 | 0x20, 2+1, mi0343_i2c_data) < 0) |
78 | return -EIO; | 78 | return -EIO; |
79 | ctrl->value = mi0343_i2c_data[3] & 0x20 ? 1 : 0; | 79 | ctrl->value = mi0343_i2c_data[3] & 0x20 ? 1 : 0; |
80 | return 0; | 80 | return 0; |
81 | case V4L2_CID_VFLIP: | 81 | case V4L2_CID_VFLIP: |
82 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 82 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
83 | 0x20, 2+1, mi0343_i2c_data) < 0) | 83 | 0x20, 2+1, mi0343_i2c_data) < 0) |
84 | return -EIO; | 84 | return -EIO; |
85 | ctrl->value = mi0343_i2c_data[3] & 0x80 ? 1 : 0; | 85 | ctrl->value = mi0343_i2c_data[3] & 0x80 ? 1 : 0; |
86 | return 0; | 86 | return 0; |
87 | case V4L2_CID_RED_BALANCE: | 87 | case V4L2_CID_RED_BALANCE: |
88 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 88 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
89 | 0x2d, 2+1, mi0343_i2c_data) < 0) | 89 | 0x2d, 2+1, mi0343_i2c_data) < 0) |
90 | return -EIO; | 90 | return -EIO; |
91 | break; | 91 | break; |
92 | case V4L2_CID_BLUE_BALANCE: | 92 | case V4L2_CID_BLUE_BALANCE: |
93 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 93 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
94 | 0x2c, 2+1, mi0343_i2c_data) < 0) | 94 | 0x2c, 2+1, mi0343_i2c_data) < 0) |
95 | return -EIO; | 95 | return -EIO; |
96 | break; | 96 | break; |
97 | case SN9C102_V4L2_CID_GREEN_BALANCE: | 97 | case SN9C102_V4L2_CID_GREEN_BALANCE: |
98 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, | 98 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, |
99 | 0x2e, 2+1, mi0343_i2c_data) < 0) | 99 | 0x2e, 2+1, mi0343_i2c_data) < 0) |
100 | return -EIO; | 100 | return -EIO; |
101 | break; | 101 | break; |
102 | default: | 102 | default: |
@@ -121,8 +121,8 @@ static int mi0343_get_ctrl(struct sn9c102_device* cam, | |||
121 | } | 121 | } |
122 | 122 | ||
123 | 123 | ||
124 | static int mi0343_set_ctrl(struct sn9c102_device* cam, | 124 | static int mi0343_set_ctrl(struct sn9c102_device* cam, |
125 | const struct v4l2_control* ctrl) | 125 | const struct v4l2_control* ctrl) |
126 | { | 126 | { |
127 | u16 reg = 0; | 127 | u16 reg = 0; |
128 | int err = 0; | 128 | int err = 0; |
@@ -144,51 +144,51 @@ static int mi0343_set_ctrl(struct sn9c102_device* cam, | |||
144 | switch (ctrl->id) { | 144 | switch (ctrl->id) { |
145 | case V4L2_CID_EXPOSURE: | 145 | case V4L2_CID_EXPOSURE: |
146 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 146 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
147 | mi0343.i2c_slave_id, | 147 | mi0343.i2c_slave_id, |
148 | 0x09, ctrl->value, 0x00, | 148 | 0x09, ctrl->value, 0x00, |
149 | 0, 0); | 149 | 0, 0); |
150 | break; | 150 | break; |
151 | case V4L2_CID_GAIN: | 151 | case V4L2_CID_GAIN: |
152 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 152 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
153 | mi0343.i2c_slave_id, | 153 | mi0343.i2c_slave_id, |
154 | 0x35, reg >> 8, reg & 0xff, | 154 | 0x35, reg >> 8, reg & 0xff, |
155 | 0, 0); | 155 | 0, 0); |
156 | break; | 156 | break; |
157 | case V4L2_CID_HFLIP: | 157 | case V4L2_CID_HFLIP: |
158 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 158 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
159 | mi0343.i2c_slave_id, | 159 | mi0343.i2c_slave_id, |
160 | 0x20, ctrl->value ? 0x40:0x00, | 160 | 0x20, ctrl->value ? 0x40:0x00, |
161 | ctrl->value ? 0x20:0x00, | 161 | ctrl->value ? 0x20:0x00, |
162 | 0, 0); | 162 | 0, 0); |
163 | break; | 163 | break; |
164 | case V4L2_CID_VFLIP: | 164 | case V4L2_CID_VFLIP: |
165 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 165 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
166 | mi0343.i2c_slave_id, | 166 | mi0343.i2c_slave_id, |
167 | 0x20, ctrl->value ? 0x80:0x00, | 167 | 0x20, ctrl->value ? 0x80:0x00, |
168 | ctrl->value ? 0x80:0x00, | 168 | ctrl->value ? 0x80:0x00, |
169 | 0, 0); | 169 | 0, 0); |
170 | break; | 170 | break; |
171 | case V4L2_CID_RED_BALANCE: | 171 | case V4L2_CID_RED_BALANCE: |
172 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 172 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
173 | mi0343.i2c_slave_id, | 173 | mi0343.i2c_slave_id, |
174 | 0x2d, reg >> 8, reg & 0xff, | 174 | 0x2d, reg >> 8, reg & 0xff, |
175 | 0, 0); | 175 | 0, 0); |
176 | break; | 176 | break; |
177 | case V4L2_CID_BLUE_BALANCE: | 177 | case V4L2_CID_BLUE_BALANCE: |
178 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 178 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
179 | mi0343.i2c_slave_id, | 179 | mi0343.i2c_slave_id, |
180 | 0x2c, reg >> 8, reg & 0xff, | 180 | 0x2c, reg >> 8, reg & 0xff, |
181 | 0, 0); | 181 | 0, 0); |
182 | break; | 182 | break; |
183 | case SN9C102_V4L2_CID_GREEN_BALANCE: | 183 | case SN9C102_V4L2_CID_GREEN_BALANCE: |
184 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 184 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
185 | mi0343.i2c_slave_id, | 185 | mi0343.i2c_slave_id, |
186 | 0x2b, reg >> 8, reg & 0xff, | 186 | 0x2b, reg >> 8, reg & 0xff, |
187 | 0, 0); | 187 | 0, 0); |
188 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 188 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
189 | mi0343.i2c_slave_id, | 189 | mi0343.i2c_slave_id, |
190 | 0x2e, reg >> 8, reg & 0xff, | 190 | 0x2e, reg >> 8, reg & 0xff, |
191 | 0, 0); | 191 | 0, 0); |
192 | break; | 192 | break; |
193 | default: | 193 | default: |
194 | return -EINVAL; | 194 | return -EINVAL; |
@@ -198,8 +198,8 @@ static int mi0343_set_ctrl(struct sn9c102_device* cam, | |||
198 | } | 198 | } |
199 | 199 | ||
200 | 200 | ||
201 | static int mi0343_set_crop(struct sn9c102_device* cam, | 201 | static int mi0343_set_crop(struct sn9c102_device* cam, |
202 | const struct v4l2_rect* rect) | 202 | const struct v4l2_rect* rect) |
203 | { | 203 | { |
204 | struct sn9c102_sensor* s = &mi0343; | 204 | struct sn9c102_sensor* s = &mi0343; |
205 | int err = 0; | 205 | int err = 0; |
@@ -213,20 +213,20 @@ static int mi0343_set_crop(struct sn9c102_device* cam, | |||
213 | } | 213 | } |
214 | 214 | ||
215 | 215 | ||
216 | static int mi0343_set_pix_format(struct sn9c102_device* cam, | 216 | static int mi0343_set_pix_format(struct sn9c102_device* cam, |
217 | const struct v4l2_pix_format* pix) | 217 | const struct v4l2_pix_format* pix) |
218 | { | 218 | { |
219 | int err = 0; | 219 | int err = 0; |
220 | 220 | ||
221 | if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) { | 221 | if (pix->pixelformat == V4L2_PIX_FMT_SN9C10X) { |
222 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 222 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
223 | mi0343.i2c_slave_id, | 223 | mi0343.i2c_slave_id, |
224 | 0x0a, 0x00, 0x03, 0, 0); | 224 | 0x0a, 0x00, 0x03, 0, 0); |
225 | err += sn9c102_write_reg(cam, 0x20, 0x19); | 225 | err += sn9c102_write_reg(cam, 0x20, 0x19); |
226 | } else { | 226 | } else { |
227 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, | 227 | err += sn9c102_i2c_try_raw_write(cam, &mi0343, 4, |
228 | mi0343.i2c_slave_id, | 228 | mi0343.i2c_slave_id, |
229 | 0x0a, 0x00, 0x05, 0, 0); | 229 | 0x0a, 0x00, 0x05, 0, 0); |
230 | err += sn9c102_write_reg(cam, 0xa0, 0x19); | 230 | err += sn9c102_write_reg(cam, 0xa0, 0x19); |
231 | } | 231 | } |
232 | 232 | ||
@@ -351,7 +351,7 @@ int sn9c102_probe_mi0343(struct sn9c102_device* cam) | |||
351 | return -EIO; | 351 | return -EIO; |
352 | 352 | ||
353 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, 0x00, | 353 | if (sn9c102_i2c_try_raw_read(cam, &mi0343, mi0343.i2c_slave_id, 0x00, |
354 | 2, mi0343_i2c_data) < 0) | 354 | 2, mi0343_i2c_data) < 0) |
355 | return -EIO; | 355 | return -EIO; |
356 | 356 | ||
357 | if (mi0343_i2c_data[4] != 0x32 && mi0343_i2c_data[3] != 0xe3) | 357 | if (mi0343_i2c_data[4] != 0x32 && mi0343_i2c_data[3] != 0xe3) |
diff --git a/drivers/usb/media/sn9c102_ov7630.c b/drivers/media/video/sn9c102/sn9c102_ov7630.c index 42852b7cb042..3da042021787 100644 --- a/drivers/usb/media/sn9c102_ov7630.c +++ b/drivers/media/video/sn9c102/sn9c102_ov7630.c | |||
@@ -69,7 +69,7 @@ static int ov7630_init(struct sn9c102_device* cam) | |||
69 | 69 | ||
70 | 70 | ||
71 | static int ov7630_set_ctrl(struct sn9c102_device* cam, | 71 | static int ov7630_set_ctrl(struct sn9c102_device* cam, |
72 | const struct v4l2_control* ctrl) | 72 | const struct v4l2_control* ctrl) |
73 | { | 73 | { |
74 | int err = 0; | 74 | int err = 0; |
75 | 75 | ||
@@ -89,8 +89,8 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam, | |||
89 | break; | 89 | break; |
90 | case V4L2_CID_CONTRAST: | 90 | case V4L2_CID_CONTRAST: |
91 | err += ctrl->value ? sn9c102_i2c_write(cam, 0x05, | 91 | err += ctrl->value ? sn9c102_i2c_write(cam, 0x05, |
92 | (ctrl->value-1) | 0x20) | 92 | (ctrl->value-1) | 0x20) |
93 | : sn9c102_i2c_write(cam, 0x05, 0x00); | 93 | : sn9c102_i2c_write(cam, 0x05, 0x00); |
94 | break; | 94 | break; |
95 | case V4L2_CID_BRIGHTNESS: | 95 | case V4L2_CID_BRIGHTNESS: |
96 | err += sn9c102_i2c_write(cam, 0x06, ctrl->value); | 96 | err += sn9c102_i2c_write(cam, 0x06, ctrl->value); |
@@ -100,8 +100,8 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam, | |||
100 | break; | 100 | break; |
101 | case V4L2_CID_HUE: | 101 | case V4L2_CID_HUE: |
102 | err += ctrl->value ? sn9c102_i2c_write(cam, 0x04, | 102 | err += ctrl->value ? sn9c102_i2c_write(cam, 0x04, |
103 | (ctrl->value-1) | 0x20) | 103 | (ctrl->value-1) | 0x20) |
104 | : sn9c102_i2c_write(cam, 0x04, 0x00); | 104 | : sn9c102_i2c_write(cam, 0x04, 0x00); |
105 | break; | 105 | break; |
106 | case V4L2_CID_DO_WHITE_BALANCE: | 106 | case V4L2_CID_DO_WHITE_BALANCE: |
107 | err += sn9c102_i2c_write(cam, 0x0c, ctrl->value); | 107 | err += sn9c102_i2c_write(cam, 0x0c, ctrl->value); |
@@ -139,7 +139,7 @@ static int ov7630_set_ctrl(struct sn9c102_device* cam, | |||
139 | 139 | ||
140 | 140 | ||
141 | static int ov7630_set_crop(struct sn9c102_device* cam, | 141 | static int ov7630_set_crop(struct sn9c102_device* cam, |
142 | const struct v4l2_rect* rect) | 142 | const struct v4l2_rect* rect) |
143 | { | 143 | { |
144 | struct sn9c102_sensor* s = &ov7630; | 144 | struct sn9c102_sensor* s = &ov7630; |
145 | int err = 0; | 145 | int err = 0; |
@@ -152,7 +152,7 @@ static int ov7630_set_crop(struct sn9c102_device* cam, | |||
152 | 152 | ||
153 | 153 | ||
154 | static int ov7630_set_pix_format(struct sn9c102_device* cam, | 154 | static int ov7630_set_pix_format(struct sn9c102_device* cam, |
155 | const struct v4l2_pix_format* pix) | 155 | const struct v4l2_pix_format* pix) |
156 | { | 156 | { |
157 | int err = 0; | 157 | int err = 0; |
158 | 158 | ||
diff --git a/drivers/usb/media/sn9c102_pas106b.c b/drivers/media/video/sn9c102/sn9c102_pas106b.c index b1dee78abe04..9915944235e8 100644 --- a/drivers/usb/media/sn9c102_pas106b.c +++ b/drivers/media/video/sn9c102/sn9c102_pas106b.c | |||
@@ -53,8 +53,8 @@ static int pas106b_init(struct sn9c102_device* cam) | |||
53 | } | 53 | } |
54 | 54 | ||
55 | 55 | ||
56 | static int pas106b_get_ctrl(struct sn9c102_device* cam, | 56 | static int pas106b_get_ctrl(struct sn9c102_device* cam, |
57 | struct v4l2_control* ctrl) | 57 | struct v4l2_control* ctrl) |
58 | { | 58 | { |
59 | switch (ctrl->id) { | 59 | switch (ctrl->id) { |
60 | case V4L2_CID_EXPOSURE: | 60 | case V4L2_CID_EXPOSURE: |
@@ -102,8 +102,8 @@ static int pas106b_get_ctrl(struct sn9c102_device* cam, | |||
102 | } | 102 | } |
103 | 103 | ||
104 | 104 | ||
105 | static int pas106b_set_ctrl(struct sn9c102_device* cam, | 105 | static int pas106b_set_ctrl(struct sn9c102_device* cam, |
106 | const struct v4l2_control* ctrl) | 106 | const struct v4l2_control* ctrl) |
107 | { | 107 | { |
108 | int err = 0; | 108 | int err = 0; |
109 | 109 | ||
@@ -140,8 +140,8 @@ static int pas106b_set_ctrl(struct sn9c102_device* cam, | |||
140 | } | 140 | } |
141 | 141 | ||
142 | 142 | ||
143 | static int pas106b_set_crop(struct sn9c102_device* cam, | 143 | static int pas106b_set_crop(struct sn9c102_device* cam, |
144 | const struct v4l2_rect* rect) | 144 | const struct v4l2_rect* rect) |
145 | { | 145 | { |
146 | struct sn9c102_sensor* s = &pas106b; | 146 | struct sn9c102_sensor* s = &pas106b; |
147 | int err = 0; | 147 | int err = 0; |
@@ -155,8 +155,8 @@ static int pas106b_set_crop(struct sn9c102_device* cam, | |||
155 | } | 155 | } |
156 | 156 | ||
157 | 157 | ||
158 | static int pas106b_set_pix_format(struct sn9c102_device* cam, | 158 | static int pas106b_set_pix_format(struct sn9c102_device* cam, |
159 | const struct v4l2_pix_format* pix) | 159 | const struct v4l2_pix_format* pix) |
160 | { | 160 | { |
161 | int err = 0; | 161 | int err = 0; |
162 | 162 | ||
diff --git a/drivers/usb/media/sn9c102_pas202bca.c b/drivers/media/video/sn9c102/sn9c102_pas202bca.c index 3453237055bb..c8f1ae2152b8 100644 --- a/drivers/usb/media/sn9c102_pas202bca.c +++ b/drivers/media/video/sn9c102/sn9c102_pas202bca.c | |||
@@ -54,7 +54,7 @@ static int pas202bca_init(struct sn9c102_device* cam) | |||
54 | 54 | ||
55 | 55 | ||
56 | static int pas202bca_set_pix_format(struct sn9c102_device* cam, | 56 | static int pas202bca_set_pix_format(struct sn9c102_device* cam, |
57 | const struct v4l2_pix_format* pix) | 57 | const struct v4l2_pix_format* pix) |
58 | { | 58 | { |
59 | int err = 0; | 59 | int err = 0; |
60 | 60 | ||
@@ -68,7 +68,7 @@ static int pas202bca_set_pix_format(struct sn9c102_device* cam, | |||
68 | 68 | ||
69 | 69 | ||
70 | static int pas202bca_set_ctrl(struct sn9c102_device* cam, | 70 | static int pas202bca_set_ctrl(struct sn9c102_device* cam, |
71 | const struct v4l2_control* ctrl) | 71 | const struct v4l2_control* ctrl) |
72 | { | 72 | { |
73 | int err = 0; | 73 | int err = 0; |
74 | 74 | ||
@@ -102,7 +102,7 @@ static int pas202bca_set_ctrl(struct sn9c102_device* cam, | |||
102 | 102 | ||
103 | 103 | ||
104 | static int pas202bca_set_crop(struct sn9c102_device* cam, | 104 | static int pas202bca_set_crop(struct sn9c102_device* cam, |
105 | const struct v4l2_rect* rect) | 105 | const struct v4l2_rect* rect) |
106 | { | 106 | { |
107 | struct sn9c102_sensor* s = &pas202bca; | 107 | struct sn9c102_sensor* s = &pas202bca; |
108 | int err = 0; | 108 | int err = 0; |
diff --git a/drivers/usb/media/sn9c102_pas202bcb.c b/drivers/media/video/sn9c102/sn9c102_pas202bcb.c index d068616ab337..e3c1178e339c 100644 --- a/drivers/usb/media/sn9c102_pas202bcb.c +++ b/drivers/media/video/sn9c102/sn9c102_pas202bcb.c | |||
@@ -58,8 +58,8 @@ static int pas202bcb_init(struct sn9c102_device* cam) | |||
58 | } | 58 | } |
59 | 59 | ||
60 | 60 | ||
61 | static int pas202bcb_get_ctrl(struct sn9c102_device* cam, | 61 | static int pas202bcb_get_ctrl(struct sn9c102_device* cam, |
62 | struct v4l2_control* ctrl) | 62 | struct v4l2_control* ctrl) |
63 | { | 63 | { |
64 | switch (ctrl->id) { | 64 | switch (ctrl->id) { |
65 | case V4L2_CID_EXPOSURE: | 65 | case V4L2_CID_EXPOSURE: |
@@ -101,8 +101,8 @@ static int pas202bcb_get_ctrl(struct sn9c102_device* cam, | |||
101 | } | 101 | } |
102 | 102 | ||
103 | 103 | ||
104 | static int pas202bcb_set_pix_format(struct sn9c102_device* cam, | 104 | static int pas202bcb_set_pix_format(struct sn9c102_device* cam, |
105 | const struct v4l2_pix_format* pix) | 105 | const struct v4l2_pix_format* pix) |
106 | { | 106 | { |
107 | int err = 0; | 107 | int err = 0; |
108 | 108 | ||
@@ -115,8 +115,8 @@ static int pas202bcb_set_pix_format(struct sn9c102_device* cam, | |||
115 | } | 115 | } |
116 | 116 | ||
117 | 117 | ||
118 | static int pas202bcb_set_ctrl(struct sn9c102_device* cam, | 118 | static int pas202bcb_set_ctrl(struct sn9c102_device* cam, |
119 | const struct v4l2_control* ctrl) | 119 | const struct v4l2_control* ctrl) |
120 | { | 120 | { |
121 | int err = 0; | 121 | int err = 0; |
122 | 122 | ||
@@ -149,8 +149,8 @@ static int pas202bcb_set_ctrl(struct sn9c102_device* cam, | |||
149 | } | 149 | } |
150 | 150 | ||
151 | 151 | ||
152 | static int pas202bcb_set_crop(struct sn9c102_device* cam, | 152 | static int pas202bcb_set_crop(struct sn9c102_device* cam, |
153 | const struct v4l2_rect* rect) | 153 | const struct v4l2_rect* rect) |
154 | { | 154 | { |
155 | struct sn9c102_sensor* s = &pas202bcb; | 155 | struct sn9c102_sensor* s = &pas202bcb; |
156 | int err = 0; | 156 | int err = 0; |
@@ -167,7 +167,7 @@ static int pas202bcb_set_crop(struct sn9c102_device* cam, | |||
167 | static struct sn9c102_sensor pas202bcb = { | 167 | static struct sn9c102_sensor pas202bcb = { |
168 | .name = "PAS202BCB", | 168 | .name = "PAS202BCB", |
169 | .maintainer = "Carlos Eduardo Medaglia Dyonisio " | 169 | .maintainer = "Carlos Eduardo Medaglia Dyonisio " |
170 | "<medaglia@undl.org.br>", | 170 | "<medaglia@undl.org.br>", |
171 | .sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE, | 171 | .sysfs_ops = SN9C102_I2C_READ | SN9C102_I2C_WRITE, |
172 | .frequency = SN9C102_I2C_400KHZ | SN9C102_I2C_100KHZ, | 172 | .frequency = SN9C102_I2C_400KHZ | SN9C102_I2C_100KHZ, |
173 | .interface = SN9C102_I2C_2WIRES, | 173 | .interface = SN9C102_I2C_2WIRES, |
diff --git a/drivers/usb/media/sn9c102_sensor.h b/drivers/media/video/sn9c102/sn9c102_sensor.h index 2afd9e9d09bb..2a874ee6f9f5 100644 --- a/drivers/usb/media/sn9c102_sensor.h +++ b/drivers/media/video/sn9c102/sn9c102_sensor.h | |||
@@ -58,7 +58,7 @@ struct sn9c102_sensor; | |||
58 | Probing functions: on success, you must attach the sensor to the camera | 58 | Probing functions: on success, you must attach the sensor to the camera |
59 | by calling sn9c102_attach_sensor() provided below. | 59 | by calling sn9c102_attach_sensor() provided below. |
60 | To enable the I2C communication, you might need to perform a really basic | 60 | To enable the I2C communication, you might need to perform a really basic |
61 | initialization of the SN9C10X chip by using the write function declared | 61 | initialization of the SN9C10X chip by using the write function declared |
62 | ahead. | 62 | ahead. |
63 | Functions must return 0 on success, the appropriate error otherwise. | 63 | Functions must return 0 on success, the appropriate error otherwise. |
64 | */ | 64 | */ |
@@ -73,7 +73,7 @@ extern int sn9c102_probe_tas5130d1b(struct sn9c102_device* cam); | |||
73 | 73 | ||
74 | /* | 74 | /* |
75 | Add the above entries to this table. Be sure to add the entry in the right | 75 | Add the above entries to this table. Be sure to add the entry in the right |
76 | place, since, on failure, the next probing routine is called according to | 76 | place, since, on failure, the next probing routine is called according to |
77 | the order of the list below, from top to bottom. | 77 | the order of the list below, from top to bottom. |
78 | */ | 78 | */ |
79 | #define SN9C102_SENSOR_TABLE \ | 79 | #define SN9C102_SENSOR_TABLE \ |
@@ -94,9 +94,9 @@ extern struct sn9c102_device* | |||
94 | sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id); | 94 | sn9c102_match_id(struct sn9c102_device* cam, const struct usb_device_id *id); |
95 | 95 | ||
96 | /* Attach a probed sensor to the camera. */ | 96 | /* Attach a probed sensor to the camera. */ |
97 | extern void | 97 | extern void |
98 | sn9c102_attach_sensor(struct sn9c102_device* cam, | 98 | sn9c102_attach_sensor(struct sn9c102_device* cam, |
99 | struct sn9c102_sensor* sensor); | 99 | struct sn9c102_sensor* sensor); |
100 | 100 | ||
101 | /* | 101 | /* |
102 | Each SN9C10x camera has proper PID/VID identifiers. | 102 | Each SN9C10x camera has proper PID/VID identifiers. |
@@ -105,7 +105,7 @@ sn9c102_attach_sensor(struct sn9c102_device* cam, | |||
105 | */ | 105 | */ |
106 | #define SN9C102_USB_DEVICE(vend, prod, intclass) \ | 106 | #define SN9C102_USB_DEVICE(vend, prod, intclass) \ |
107 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ | 107 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ |
108 | USB_DEVICE_ID_MATCH_INT_CLASS, \ | 108 | USB_DEVICE_ID_MATCH_INT_CLASS, \ |
109 | .idVendor = (vend), \ | 109 | .idVendor = (vend), \ |
110 | .idProduct = (prod), \ | 110 | .idProduct = (prod), \ |
111 | .bInterfaceClass = (intclass) | 111 | .bInterfaceClass = (intclass) |
@@ -162,19 +162,19 @@ static const struct usb_device_id sn9c102_id_table[] = { \ | |||
162 | Read/write routines: they always return -1 on error, 0 or the read value | 162 | Read/write routines: they always return -1 on error, 0 or the read value |
163 | otherwise. NOTE that a real read operation is not supported by the SN9C10X | 163 | otherwise. NOTE that a real read operation is not supported by the SN9C10X |
164 | chip for some of its registers. To work around this problem, a pseudo-read | 164 | chip for some of its registers. To work around this problem, a pseudo-read |
165 | call is provided instead: it returns the last successfully written value | 165 | call is provided instead: it returns the last successfully written value |
166 | on the register (0 if it has never been written), the usual -1 on error. | 166 | on the register (0 if it has never been written), the usual -1 on error. |
167 | */ | 167 | */ |
168 | 168 | ||
169 | /* The "try" I2C I/O versions are used when probing the sensor */ | 169 | /* The "try" I2C I/O versions are used when probing the sensor */ |
170 | extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*, | 170 | extern int sn9c102_i2c_try_write(struct sn9c102_device*,struct sn9c102_sensor*, |
171 | u8 address, u8 value); | 171 | u8 address, u8 value); |
172 | extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, | 172 | extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, |
173 | u8 address); | 173 | u8 address); |
174 | 174 | ||
175 | /* | 175 | /* |
176 | These must be used if and only if the sensor doesn't implement the standard | 176 | These must be used if and only if the sensor doesn't implement the standard |
177 | I2C protocol. There are a number of good reasons why you must use the | 177 | I2C protocol. There are a number of good reasons why you must use the |
178 | single-byte versions of these functions: do not abuse. The first function | 178 | single-byte versions of these functions: do not abuse. The first function |
179 | writes n bytes, from data0 to datan, to registers 0x09 - 0x09+n of SN9C10X | 179 | writes n bytes, from data0 to datan, to registers 0x09 - 0x09+n of SN9C10X |
180 | chip. The second one programs the registers 0x09 and 0x10 with data0 and | 180 | chip. The second one programs the registers 0x09 and 0x10 with data0 and |
@@ -184,12 +184,12 @@ extern int sn9c102_i2c_try_read(struct sn9c102_device*,struct sn9c102_sensor*, | |||
184 | byte. | 184 | byte. |
185 | */ | 185 | */ |
186 | extern int sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, | 186 | extern int sn9c102_i2c_try_raw_write(struct sn9c102_device* cam, |
187 | struct sn9c102_sensor* sensor, u8 n, | 187 | struct sn9c102_sensor* sensor, u8 n, |
188 | u8 data0, u8 data1, u8 data2, u8 data3, | 188 | u8 data0, u8 data1, u8 data2, u8 data3, |
189 | u8 data4, u8 data5); | 189 | u8 data4, u8 data5); |
190 | extern int sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, | 190 | extern int sn9c102_i2c_try_raw_read(struct sn9c102_device* cam, |
191 | struct sn9c102_sensor* sensor, u8 data0, | 191 | struct sn9c102_sensor* sensor, u8 data0, |
192 | u8 data1, u8 n, u8 buffer[]); | 192 | u8 data1, u8 n, u8 buffer[]); |
193 | 193 | ||
194 | /* To be used after the sensor struct has been attached to the camera struct */ | 194 | /* To be used after the sensor struct has been attached to the camera struct */ |
195 | extern int sn9c102_i2c_write(struct sn9c102_device*, u8 address, u8 value); | 195 | extern int sn9c102_i2c_write(struct sn9c102_device*, u8 address, u8 value); |
@@ -252,17 +252,17 @@ struct sn9c102_sensor { | |||
252 | 252 | ||
253 | /* | 253 | /* |
254 | NOTE: Where not noted,most of the functions below are not mandatory. | 254 | NOTE: Where not noted,most of the functions below are not mandatory. |
255 | Set to null if you do not implement them. If implemented, | 255 | Set to null if you do not implement them. If implemented, |
256 | they must return 0 on success, the proper error otherwise. | 256 | they must return 0 on success, the proper error otherwise. |
257 | */ | 257 | */ |
258 | 258 | ||
259 | int (*init)(struct sn9c102_device* cam); | 259 | int (*init)(struct sn9c102_device* cam); |
260 | /* | 260 | /* |
261 | This function will be called after the sensor has been attached. | 261 | This function will be called after the sensor has been attached. |
262 | It should be used to initialize the sensor only, but may also | 262 | It should be used to initialize the sensor only, but may also |
263 | configure part of the SN9C10X chip if necessary. You don't need to | 263 | configure part of the SN9C10X chip if necessary. You don't need to |
264 | setup picture settings like brightness, contrast, etc.. here, if | 264 | setup picture settings like brightness, contrast, etc.. here, if |
265 | the corrisponding controls are implemented (see below), since | 265 | the corrisponding controls are implemented (see below), since |
266 | they are adjusted in the core driver by calling the set_ctrl() | 266 | they are adjusted in the core driver by calling the set_ctrl() |
267 | method after init(), where the arguments are the default values | 267 | method after init(), where the arguments are the default values |
268 | specified in the v4l2_queryctrl list of supported controls; | 268 | specified in the v4l2_queryctrl list of supported controls; |
@@ -273,13 +273,13 @@ struct sn9c102_sensor { | |||
273 | 273 | ||
274 | struct v4l2_queryctrl qctrl[SN9C102_MAX_CTRLS]; | 274 | struct v4l2_queryctrl qctrl[SN9C102_MAX_CTRLS]; |
275 | /* | 275 | /* |
276 | Optional list of default controls, defined as indicated in the | 276 | Optional list of default controls, defined as indicated in the |
277 | V4L2 API. Menu type controls are not handled by this interface. | 277 | V4L2 API. Menu type controls are not handled by this interface. |
278 | */ | 278 | */ |
279 | 279 | ||
280 | int (*get_ctrl)(struct sn9c102_device* cam, struct v4l2_control* ctrl); | 280 | int (*get_ctrl)(struct sn9c102_device* cam, struct v4l2_control* ctrl); |
281 | int (*set_ctrl)(struct sn9c102_device* cam, | 281 | int (*set_ctrl)(struct sn9c102_device* cam, |
282 | const struct v4l2_control* ctrl); | 282 | const struct v4l2_control* ctrl); |
283 | /* | 283 | /* |
284 | You must implement at least the set_ctrl method if you have defined | 284 | You must implement at least the set_ctrl method if you have defined |
285 | the list above. The returned value must follow the V4L2 | 285 | the list above. The returned value must follow the V4L2 |
@@ -306,7 +306,7 @@ struct sn9c102_sensor { | |||
306 | specified in the cropcap substructures 'bounds' and 'defrect'. | 306 | specified in the cropcap substructures 'bounds' and 'defrect'. |
307 | By default, the source rectangle should cover the largest possible | 307 | By default, the source rectangle should cover the largest possible |
308 | area. Again, it is not always true that the largest source rectangle | 308 | area. Again, it is not always true that the largest source rectangle |
309 | can cover the entire active window, although it is a rare case for | 309 | can cover the entire active window, although it is a rare case for |
310 | the hardware we have. The bounds of the source rectangle _must_ be | 310 | the hardware we have. The bounds of the source rectangle _must_ be |
311 | multiple of 16 and must use the same coordinate system as indicated | 311 | multiple of 16 and must use the same coordinate system as indicated |
312 | before; their centers shall align initially. | 312 | before; their centers shall align initially. |
@@ -317,13 +317,13 @@ struct sn9c102_sensor { | |||
317 | defined the correct default bounds in the structures. | 317 | defined the correct default bounds in the structures. |
318 | See the V4L2 API for further details. | 318 | See the V4L2 API for further details. |
319 | NOTE: once you have defined the bounds of the active window | 319 | NOTE: once you have defined the bounds of the active window |
320 | (struct cropcap.bounds) you must not change them.anymore. | 320 | (struct cropcap.bounds) you must not change them.anymore. |
321 | Only 'bounds' and 'defrect' fields are mandatory, other fields | 321 | Only 'bounds' and 'defrect' fields are mandatory, other fields |
322 | will be ignored. | 322 | will be ignored. |
323 | */ | 323 | */ |
324 | 324 | ||
325 | int (*set_crop)(struct sn9c102_device* cam, | 325 | int (*set_crop)(struct sn9c102_device* cam, |
326 | const struct v4l2_rect* rect); | 326 | const struct v4l2_rect* rect); |
327 | /* | 327 | /* |
328 | To be called on VIDIOC_C_SETCROP. The core module always calls a | 328 | To be called on VIDIOC_C_SETCROP. The core module always calls a |
329 | default routine which configures the appropriate SN9C10X regs (also | 329 | default routine which configures the appropriate SN9C10X regs (also |
@@ -332,12 +332,12 @@ struct sn9c102_sensor { | |||
332 | case you override the default function, you always have to program | 332 | case you override the default function, you always have to program |
333 | the chip to match those values; on error return the corresponding | 333 | the chip to match those values; on error return the corresponding |
334 | error code without rolling back. | 334 | error code without rolling back. |
335 | NOTE: in case, you must program the SN9C10X chip to get rid of | 335 | NOTE: in case, you must program the SN9C10X chip to get rid of |
336 | blank pixels or blank lines at the _start_ of each line or | 336 | blank pixels or blank lines at the _start_ of each line or |
337 | frame after each HSYNC or VSYNC, so that the image starts with | 337 | frame after each HSYNC or VSYNC, so that the image starts with |
338 | real RGB data (see regs 0x12, 0x13) (having set H_SIZE and, | 338 | real RGB data (see regs 0x12, 0x13) (having set H_SIZE and, |
339 | V_SIZE you don't have to care about blank pixels or blank | 339 | V_SIZE you don't have to care about blank pixels or blank |
340 | lines at the end of each line or frame). | 340 | lines at the end of each line or frame). |
341 | */ | 341 | */ |
342 | 342 | ||
343 | struct v4l2_pix_format pix_format; | 343 | struct v4l2_pix_format pix_format; |
@@ -349,17 +349,17 @@ struct sn9c102_sensor { | |||
349 | number of bits per pixel for uncompressed video, 8 or 9 (despite the | 349 | number of bits per pixel for uncompressed video, 8 or 9 (despite the |
350 | current value of 'pixelformat'). | 350 | current value of 'pixelformat'). |
351 | NOTE 1: both 'width' and 'height' _must_ be either 1/1 or 1/2 or 1/4 | 351 | NOTE 1: both 'width' and 'height' _must_ be either 1/1 or 1/2 or 1/4 |
352 | of cropcap.defrect.width and cropcap.defrect.height. I | 352 | of cropcap.defrect.width and cropcap.defrect.height. I |
353 | suggest 1/1. | 353 | suggest 1/1. |
354 | NOTE 2: The initial compression quality is defined by the first bit | 354 | NOTE 2: The initial compression quality is defined by the first bit |
355 | of reg 0x17 during the initialization of the image sensor. | 355 | of reg 0x17 during the initialization of the image sensor. |
356 | NOTE 3: as said above, you have to program the SN9C10X chip to get | 356 | NOTE 3: as said above, you have to program the SN9C10X chip to get |
357 | rid of any blank pixels, so that the output of the sensor | 357 | rid of any blank pixels, so that the output of the sensor |
358 | matches the RGB bayer sequence (i.e. BGBGBG...GRGRGR). | 358 | matches the RGB bayer sequence (i.e. BGBGBG...GRGRGR). |
359 | */ | 359 | */ |
360 | 360 | ||
361 | int (*set_pix_format)(struct sn9c102_device* cam, | 361 | int (*set_pix_format)(struct sn9c102_device* cam, |
362 | const struct v4l2_pix_format* pix); | 362 | const struct v4l2_pix_format* pix); |
363 | /* | 363 | /* |
364 | To be called on VIDIOC_S_FMT, when switching from the SBGGR8 to | 364 | To be called on VIDIOC_S_FMT, when switching from the SBGGR8 to |
365 | SN9C10X pixel format or viceversa. On error return the corresponding | 365 | SN9C10X pixel format or viceversa. On error return the corresponding |
diff --git a/drivers/usb/media/sn9c102_tas5110c1b.c b/drivers/media/video/sn9c102/sn9c102_tas5110c1b.c index 2e08c552f40a..294eb02fbd88 100644 --- a/drivers/usb/media/sn9c102_tas5110c1b.c +++ b/drivers/media/video/sn9c102/sn9c102_tas5110c1b.c | |||
@@ -44,8 +44,8 @@ static int tas5110c1b_init(struct sn9c102_device* cam) | |||
44 | } | 44 | } |
45 | 45 | ||
46 | 46 | ||
47 | static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, | 47 | static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, |
48 | const struct v4l2_control* ctrl) | 48 | const struct v4l2_control* ctrl) |
49 | { | 49 | { |
50 | int err = 0; | 50 | int err = 0; |
51 | 51 | ||
@@ -61,8 +61,8 @@ static int tas5110c1b_set_ctrl(struct sn9c102_device* cam, | |||
61 | } | 61 | } |
62 | 62 | ||
63 | 63 | ||
64 | static int tas5110c1b_set_crop(struct sn9c102_device* cam, | 64 | static int tas5110c1b_set_crop(struct sn9c102_device* cam, |
65 | const struct v4l2_rect* rect) | 65 | const struct v4l2_rect* rect) |
66 | { | 66 | { |
67 | struct sn9c102_sensor* s = &tas5110c1b; | 67 | struct sn9c102_sensor* s = &tas5110c1b; |
68 | int err = 0; | 68 | int err = 0; |
@@ -81,8 +81,8 @@ static int tas5110c1b_set_crop(struct sn9c102_device* cam, | |||
81 | } | 81 | } |
82 | 82 | ||
83 | 83 | ||
84 | static int tas5110c1b_set_pix_format(struct sn9c102_device* cam, | 84 | static int tas5110c1b_set_pix_format(struct sn9c102_device* cam, |
85 | const struct v4l2_pix_format* pix) | 85 | const struct v4l2_pix_format* pix) |
86 | { | 86 | { |
87 | int err = 0; | 87 | int err = 0; |
88 | 88 | ||
diff --git a/drivers/usb/media/sn9c102_tas5130d1b.c b/drivers/media/video/sn9c102/sn9c102_tas5130d1b.c index c7b339740bbf..9ecb09032b68 100644 --- a/drivers/usb/media/sn9c102_tas5130d1b.c +++ b/drivers/media/video/sn9c102/sn9c102_tas5130d1b.c | |||
@@ -42,8 +42,8 @@ static int tas5130d1b_init(struct sn9c102_device* cam) | |||
42 | } | 42 | } |
43 | 43 | ||
44 | 44 | ||
45 | static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, | 45 | static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, |
46 | const struct v4l2_control* ctrl) | 46 | const struct v4l2_control* ctrl) |
47 | { | 47 | { |
48 | int err = 0; | 48 | int err = 0; |
49 | 49 | ||
@@ -62,8 +62,8 @@ static int tas5130d1b_set_ctrl(struct sn9c102_device* cam, | |||
62 | } | 62 | } |
63 | 63 | ||
64 | 64 | ||
65 | static int tas5130d1b_set_crop(struct sn9c102_device* cam, | 65 | static int tas5130d1b_set_crop(struct sn9c102_device* cam, |
66 | const struct v4l2_rect* rect) | 66 | const struct v4l2_rect* rect) |
67 | { | 67 | { |
68 | struct sn9c102_sensor* s = &tas5130d1b; | 68 | struct sn9c102_sensor* s = &tas5130d1b; |
69 | u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 104, | 69 | u8 h_start = (u8)(rect->left - s->cropcap.bounds.left) + 104, |
@@ -82,8 +82,8 @@ static int tas5130d1b_set_crop(struct sn9c102_device* cam, | |||
82 | } | 82 | } |
83 | 83 | ||
84 | 84 | ||
85 | static int tas5130d1b_set_pix_format(struct sn9c102_device* cam, | 85 | static int tas5130d1b_set_pix_format(struct sn9c102_device* cam, |
86 | const struct v4l2_pix_format* pix) | 86 | const struct v4l2_pix_format* pix) |
87 | { | 87 | { |
88 | int err = 0; | 88 | int err = 0; |
89 | 89 | ||
diff --git a/drivers/media/video/stradis.c b/drivers/media/video/stradis.c index 9d769264a329..07476c71174a 100644 --- a/drivers/media/video/stradis.c +++ b/drivers/media/video/stradis.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * stradis.c - stradis 4:2:2 mpeg decoder driver | 2 | * stradis.c - stradis 4:2:2 mpeg decoder driver |
3 | * | 3 | * |
4 | * Stradis 4:2:2 MPEG-2 Decoder Driver | 4 | * Stradis 4:2:2 MPEG-2 Decoder Driver |
@@ -1191,9 +1191,9 @@ static void saa7146_set_winsize(struct saa7146 *saa) | |||
1191 | } | 1191 | } |
1192 | 1192 | ||
1193 | /* clip_draw_rectangle(cm,x,y,w,h) -- handle clipping an area | 1193 | /* clip_draw_rectangle(cm,x,y,w,h) -- handle clipping an area |
1194 | * bitmap is fixed width, 128 bytes (1024 pixels represented) | 1194 | * bitmap is fixed width, 128 bytes (1024 pixels represented) |
1195 | * arranged most-sigificant-bit-left in 32-bit words | 1195 | * arranged most-sigificant-bit-left in 32-bit words |
1196 | * based on saa7146 clipping hardware, it swaps bytes if LE | 1196 | * based on saa7146 clipping hardware, it swaps bytes if LE |
1197 | * much of this makes up for egcs brain damage -- so if you | 1197 | * much of this makes up for egcs brain damage -- so if you |
1198 | * are wondering "why did he do this?" it is because the C | 1198 | * are wondering "why did he do this?" it is because the C |
1199 | * was adjusted to generate the optimal asm output without | 1199 | * was adjusted to generate the optimal asm output without |
@@ -1259,7 +1259,7 @@ static void make_clip_tab(struct saa7146 *saa, struct video_clip *cr, int ncr) | |||
1259 | clip_draw_rectangle(clipmap, cr[i].x, cr[i].y, | 1259 | clip_draw_rectangle(clipmap, cr[i].x, cr[i].y, |
1260 | cr[i].width, cr[i].height); | 1260 | cr[i].width, cr[i].height); |
1261 | } | 1261 | } |
1262 | /* clip against viewing window AND screen | 1262 | /* clip against viewing window AND screen |
1263 | so we do not have to rely on the user program | 1263 | so we do not have to rely on the user program |
1264 | */ | 1264 | */ |
1265 | clip_draw_rectangle(clipmap, (saa->win.x + width > saa->win.swidth) ? | 1265 | clip_draw_rectangle(clipmap, (saa->win.x + width > saa->win.swidth) ? |
diff --git a/drivers/usb/media/stv680.c b/drivers/media/video/stv680.c index 9636da20748d..b38bda83a7c5 100644 --- a/drivers/usb/media/stv680.c +++ b/drivers/media/video/stv680.c | |||
@@ -1,16 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * STV0680 USB Camera Driver, by Kevin Sisson (kjsisson@bellsouth.net) | 2 | * STV0680 USB Camera Driver, by Kevin Sisson (kjsisson@bellsouth.net) |
3 | * | 3 | * |
4 | * Thanks to STMicroelectronics for information on the usb commands, and | 4 | * Thanks to STMicroelectronics for information on the usb commands, and |
5 | * to Steve Miller at STM for his help and encouragement while I was | 5 | * to Steve Miller at STM for his help and encouragement while I was |
6 | * writing this driver. | 6 | * writing this driver. |
7 | * | 7 | * |
8 | * This driver is based heavily on the | 8 | * This driver is based heavily on the |
9 | * Endpoints (formerly known as AOX) se401 USB Camera Driver | 9 | * Endpoints (formerly known as AOX) se401 USB Camera Driver |
10 | * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) | 10 | * Copyright (c) 2000 Jeroen B. Vreeken (pe1rxq@amsat.org) |
11 | * | 11 | * |
12 | * Still somewhat based on the Linux ov511 driver. | 12 | * Still somewhat based on the Linux ov511 driver. |
13 | * | 13 | * |
14 | * This program is free software; you can redistribute it and/or modify it | 14 | * This program is free software; you can redistribute it and/or modify it |
15 | * under the terms of the GNU General Public License as published by the | 15 | * under the terms of the GNU General Public License as published by the |
16 | * Free Software Foundation; either version 2 of the License, or (at your | 16 | * Free Software Foundation; either version 2 of the License, or (at your |
@@ -25,18 +25,18 @@ | |||
25 | * along with this program; if not, write to the Free Software Foundation, | 25 | * along with this program; if not, write to the Free Software Foundation, |
26 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 26 | * Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
27 | * | 27 | * |
28 | * History: | 28 | * History: |
29 | * ver 0.1 October, 2001. Initial attempt. | 29 | * ver 0.1 October, 2001. Initial attempt. |
30 | * | 30 | * |
31 | * ver 0.2 November, 2001. Fixed asbility to resize, added brightness | 31 | * ver 0.2 November, 2001. Fixed asbility to resize, added brightness |
32 | * function, made more stable (?) | 32 | * function, made more stable (?) |
33 | * | 33 | * |
34 | * ver 0.21 Nov, 2001. Added gamma correction and white balance, | 34 | * ver 0.21 Nov, 2001. Added gamma correction and white balance, |
35 | * due to Alexander Schwartz. Still trying to | 35 | * due to Alexander Schwartz. Still trying to |
36 | * improve stablility. Moved stuff into stv680.h | 36 | * improve stablility. Moved stuff into stv680.h |
37 | * | 37 | * |
38 | * ver 0.22 Nov, 2001. Added sharpen function (by Michael Sweet, | 38 | * ver 0.22 Nov, 2001. Added sharpen function (by Michael Sweet, |
39 | * mike@easysw.com) from GIMP, also used in pencam. | 39 | * mike@easysw.com) from GIMP, also used in pencam. |
40 | * Simple, fast, good integer math routine. | 40 | * Simple, fast, good integer math routine. |
41 | * | 41 | * |
42 | * ver 0.23 Dec, 2001 (gkh) | 42 | * ver 0.23 Dec, 2001 (gkh) |
@@ -44,11 +44,11 @@ | |||
44 | * Lindent, and did other minor tweaks to get | 44 | * Lindent, and did other minor tweaks to get |
45 | * things to work properly with 2.5.1 | 45 | * things to work properly with 2.5.1 |
46 | * | 46 | * |
47 | * ver 0.24 Jan, 2002 (kjs) | 47 | * ver 0.24 Jan, 2002 (kjs) |
48 | * Fixed the problem with webcam crashing after | 48 | * Fixed the problem with webcam crashing after |
49 | * two pictures. Changed the way pic is halved to | 49 | * two pictures. Changed the way pic is halved to |
50 | * improve quality. Got rid of green line around | 50 | * improve quality. Got rid of green line around |
51 | * frame. Fix brightness reset when changing size | 51 | * frame. Fix brightness reset when changing size |
52 | * bug. Adjusted gamma filters slightly. | 52 | * bug. Adjusted gamma filters slightly. |
53 | * | 53 | * |
54 | * ver 0.25 Jan, 2002 (kjs) | 54 | * ver 0.25 Jan, 2002 (kjs) |
@@ -484,7 +484,7 @@ exit: | |||
484 | PDEBUG (1, "STV(i): swapRGB is (forced) ON"); | 484 | PDEBUG (1, "STV(i): swapRGB is (forced) ON"); |
485 | else if (swapRGB_on == -1) | 485 | else if (swapRGB_on == -1) |
486 | PDEBUG (1, "STV(i): swapRGB is (forced) OFF"); | 486 | PDEBUG (1, "STV(i): swapRGB is (forced) OFF"); |
487 | 487 | ||
488 | if (stv_set_video_mode (stv680) < 0) { | 488 | if (stv_set_video_mode (stv680) < 0) { |
489 | PDEBUG (0, "STV(e): Could not set video mode in stv_init"); | 489 | PDEBUG (0, "STV(e): Could not set video mode in stv_init"); |
490 | return -1; | 490 | return -1; |
@@ -570,7 +570,7 @@ static int stv680_set_pict (struct usb_stv *stv680, struct video_picture *p) | |||
570 | if (stv680->brightness != p->brightness) { | 570 | if (stv680->brightness != p->brightness) { |
571 | stv680->chgbright = 1; | 571 | stv680->chgbright = 1; |
572 | stv680->brightness = p->brightness; | 572 | stv680->brightness = p->brightness; |
573 | } | 573 | } |
574 | 574 | ||
575 | stv680->whiteness = p->whiteness; /* greyscale */ | 575 | stv680->whiteness = p->whiteness; /* greyscale */ |
576 | stv680->colour = p->colour; | 576 | stv680->colour = p->colour; |
@@ -612,7 +612,7 @@ static void stv680_video_irq (struct urb *urb, struct pt_regs *regs) | |||
612 | 612 | ||
613 | case BUFFER_UNUSED: | 613 | case BUFFER_UNUSED: |
614 | memcpy (stv680->scratch[stv680->scratch_next].data, | 614 | memcpy (stv680->scratch[stv680->scratch_next].data, |
615 | (unsigned char *) urb->transfer_buffer, length); | 615 | (unsigned char *) urb->transfer_buffer, length); |
616 | stv680->scratch[stv680->scratch_next].state = BUFFER_READY; | 616 | stv680->scratch[stv680->scratch_next].state = BUFFER_READY; |
617 | stv680->scratch[stv680->scratch_next].length = length; | 617 | stv680->scratch[stv680->scratch_next].length = length; |
618 | if (waitqueue_active (&stv680->wq)) { | 618 | if (waitqueue_active (&stv680->wq)) { |
@@ -752,7 +752,7 @@ static int stv680_set_size (struct usb_stv *stv680, int width, int height) | |||
752 | PDEBUG (1, "STV(e): request for non-supported size: request: v.width = %i, v.height = %i actual: stv.width = %i, stv.height = %i", width, height, stv680->vwidth, stv680->vheight); | 752 | PDEBUG (1, "STV(e): request for non-supported size: request: v.width = %i, v.height = %i actual: stv.width = %i, stv.height = %i", width, height, stv680->vwidth, stv680->vheight); |
753 | return 1; | 753 | return 1; |
754 | } | 754 | } |
755 | 755 | ||
756 | /* Stop a current stream and start it again at the new size */ | 756 | /* Stop a current stream and start it again at the new size */ |
757 | if (wasstreaming) | 757 | if (wasstreaming) |
758 | stv680_stop_stream (stv680); | 758 | stv680_stop_stream (stv680); |
@@ -773,7 +773,7 @@ static int stv680_set_size (struct usb_stv *stv680, int width, int height) | |||
773 | 773 | ||
774 | /* | 774 | /* |
775 | * STV0680 Vision Camera Chipset Driver | 775 | * STV0680 Vision Camera Chipset Driver |
776 | * Copyright (C) 2000 Adam Harrison <adam@antispin.org> | 776 | * Copyright (C) 2000 Adam Harrison <adam@antispin.org> |
777 | */ | 777 | */ |
778 | 778 | ||
779 | #define RED 0 | 779 | #define RED 0 |
@@ -842,7 +842,7 @@ static void bayer_unshuffle (struct usb_stv *stv680, struct stv680_scratch *buff | |||
842 | colour = 2; | 842 | colour = 2; |
843 | break; | 843 | break; |
844 | } | 844 | } |
845 | i = (y * vw + x) * 3; | 845 | i = (y * vw + x) * 3; |
846 | *(output + i + colour) = (unsigned char) p; | 846 | *(output + i + colour) = (unsigned char) p; |
847 | } /* for x */ | 847 | } /* for x */ |
848 | 848 | ||
@@ -850,9 +850,9 @@ static void bayer_unshuffle (struct usb_stv *stv680, struct stv680_scratch *buff | |||
850 | 850 | ||
851 | /****** gamma correction plus hardcoded white balance */ | 851 | /****** gamma correction plus hardcoded white balance */ |
852 | /* Thanks to Alexander Schwartx <alexander.schwartx@gmx.net> for this code. | 852 | /* Thanks to Alexander Schwartx <alexander.schwartx@gmx.net> for this code. |
853 | Correction values red[], green[], blue[], are generated by | 853 | Correction values red[], green[], blue[], are generated by |
854 | (pow(i/256.0, GAMMA)*255.0)*white balanceRGB where GAMMA=0.55, 1<i<255. | 854 | (pow(i/256.0, GAMMA)*255.0)*white balanceRGB where GAMMA=0.55, 1<i<255. |
855 | White balance (RGB)= 1.0, 1.17, 1.48. Values are calculated as double float and | 855 | White balance (RGB)= 1.0, 1.17, 1.48. Values are calculated as double float and |
856 | converted to unsigned char. Values are in stv680.h */ | 856 | converted to unsigned char. Values are in stv680.h */ |
857 | 857 | ||
858 | for (y = 0; y < vh; y++) { | 858 | for (y = 0; y < vh; y++) { |
diff --git a/drivers/usb/media/stv680.h b/drivers/media/video/stv680.h index ea46e0001e6d..a08f1b08a4b0 100644 --- a/drivers/usb/media/stv680.h +++ b/drivers/media/video/stv680.h | |||
@@ -9,12 +9,12 @@ | |||
9 | * it under the terms of the GNU General Public License as published by | 9 | * it under the terms of the GNU General Public License as published by |
10 | * the Free Software Foundation; either version 2 of the License, or | 10 | * the Free Software Foundation; either version 2 of the License, or |
11 | * (at your option) any later version. | 11 | * (at your option) any later version. |
12 | * | 12 | * |
13 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
16 | * GNU General Public License for more details. | 16 | * GNU General Public License for more details. |
17 | * | 17 | * |
18 | * You should have received a copy of the GNU General Public License | 18 | * You should have received a copy of the GNU General Public License |
19 | * along with this program; if not, write to the Free Software | 19 | * along with this program; if not, write to the Free Software |
20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | 20 | * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
@@ -152,76 +152,76 @@ struct usb_stv { | |||
152 | 152 | ||
153 | 153 | ||
154 | static const unsigned char red[256] = { | 154 | static const unsigned char red[256] = { |
155 | 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, | 155 | 0, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, 18, |
156 | 18, 18, 18, 18, 18, 18, 18, 25, 30, 35, 38, 42, | 156 | 18, 18, 18, 18, 18, 18, 18, 25, 30, 35, 38, 42, |
157 | 44, 47, 50, 53, 54, 57, 59, 61, 63, 65, 67, 69, | 157 | 44, 47, 50, 53, 54, 57, 59, 61, 63, 65, 67, 69, |
158 | 71, 71, 73, 75, 77, 78, 80, 81, 82, 84, 85, 87, | 158 | 71, 71, 73, 75, 77, 78, 80, 81, 82, 84, 85, 87, |
159 | 88, 89, 90, 91, 93, 94, 95, 97, 98, 98, 99, 101, | 159 | 88, 89, 90, 91, 93, 94, 95, 97, 98, 98, 99, 101, |
160 | 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, | 160 | 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, |
161 | 114, 115, 116, 116, 117, 118, 119, 120, 121, 122, 123, 124, | 161 | 114, 115, 116, 116, 117, 118, 119, 120, 121, 122, 123, 124, |
162 | 125, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, | 162 | 125, 125, 126, 127, 128, 129, 129, 130, 131, 132, 133, 134, |
163 | 134, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, | 163 | 134, 135, 135, 136, 137, 138, 139, 140, 140, 141, 142, 143, |
164 | 143, 143, 144, 145, 146, 147, 147, 148, 149, 150, 150, 151, | 164 | 143, 143, 144, 145, 146, 147, 147, 148, 149, 150, 150, 151, |
165 | 152, 152, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159, | 165 | 152, 152, 152, 153, 154, 154, 155, 156, 157, 157, 158, 159, |
166 | 159, 160, 161, 161, 161, 162, 163, 163, 164, 165, 165, 166, | 166 | 159, 160, 161, 161, 161, 162, 163, 163, 164, 165, 165, 166, |
167 | 167, 167, 168, 168, 169, 170, 170, 170, 171, 171, 172, 173, | 167 | 167, 167, 168, 168, 169, 170, 170, 170, 171, 171, 172, 173, |
168 | 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 179, 179, | 168 | 173, 174, 174, 175, 176, 176, 177, 178, 178, 179, 179, 179, |
169 | 180, 180, 181, 181, 182, 183, 183, 184, 184, 185, 185, 186, | 169 | 180, 180, 181, 181, 182, 183, 183, 184, 184, 185, 185, 186, |
170 | 187, 187, 188, 188, 188, 188, 189, 190, 190, 191, 191, 192, | 170 | 187, 187, 188, 188, 188, 188, 189, 190, 190, 191, 191, 192, |
171 | 192, 193, 193, 194, 195, 195, 196, 196, 197, 197, 197, 197, | 171 | 192, 193, 193, 194, 195, 195, 196, 196, 197, 197, 197, 197, |
172 | 198, 198, 199, 199, 200, 201, 201, 202, 202, 203, 203, 204, | 172 | 198, 198, 199, 199, 200, 201, 201, 202, 202, 203, 203, 204, |
173 | 204, 205, 205, 206, 206, 206, 206, 207, 207, 208, 208, 209, | 173 | 204, 205, 205, 206, 206, 206, 206, 207, 207, 208, 208, 209, |
174 | 209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215, | 174 | 209, 210, 210, 211, 211, 212, 212, 213, 213, 214, 214, 215, |
175 | 215, 215, 215, 216, 216, 217, 217, 218, 218, 218, 219, 219, | 175 | 215, 215, 215, 216, 216, 217, 217, 218, 218, 218, 219, 219, |
176 | 220, 220, 221, 221 | 176 | 220, 220, 221, 221 |
177 | }; | 177 | }; |
178 | 178 | ||
179 | static const unsigned char green[256] = { | 179 | static const unsigned char green[256] = { |
180 | 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, | 180 | 0, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, 21, |
181 | 21, 21, 21, 21, 21, 21, 21, 28, 34, 39, 43, 47, | 181 | 21, 21, 21, 21, 21, 21, 21, 28, 34, 39, 43, 47, |
182 | 50, 53, 56, 59, 61, 64, 66, 68, 71, 73, 75, 77, | 182 | 50, 53, 56, 59, 61, 64, 66, 68, 71, 73, 75, 77, |
183 | 79, 80, 82, 84, 86, 87, 89, 91, 92, 94, 95, 97, | 183 | 79, 80, 82, 84, 86, 87, 89, 91, 92, 94, 95, 97, |
184 | 98, 100, 101, 102, 104, 105, 106, 108, 109, 110, 111, 113, | 184 | 98, 100, 101, 102, 104, 105, 106, 108, 109, 110, 111, 113, |
185 | 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, | 185 | 114, 115, 116, 117, 118, 120, 121, 122, 123, 124, 125, 126, |
186 | 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, | 186 | 127, 128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, |
187 | 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, | 187 | 139, 140, 141, 142, 143, 144, 144, 145, 146, 147, 148, 149, |
188 | 150, 151, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, | 188 | 150, 151, 151, 152, 153, 154, 155, 156, 156, 157, 158, 159, |
189 | 160, 160, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168, | 189 | 160, 160, 161, 162, 163, 164, 164, 165, 166, 167, 167, 168, |
190 | 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, | 190 | 169, 170, 170, 171, 172, 172, 173, 174, 175, 175, 176, 177, |
191 | 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 184, 185, | 191 | 177, 178, 179, 179, 180, 181, 182, 182, 183, 184, 184, 185, |
192 | 186, 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, | 192 | 186, 186, 187, 187, 188, 189, 189, 190, 191, 191, 192, 193, |
193 | 193, 194, 194, 195, 196, 196, 197, 198, 198, 199, 199, 200, | 193 | 193, 194, 194, 195, 196, 196, 197, 198, 198, 199, 199, 200, |
194 | 201, 201, 202, 202, 203, 204, 204, 205, 205, 206, 206, 207, | 194 | 201, 201, 202, 202, 203, 204, 204, 205, 205, 206, 206, 207, |
195 | 208, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, | 195 | 208, 208, 209, 209, 210, 210, 211, 212, 212, 213, 213, 214, |
196 | 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 220, | 196 | 214, 215, 215, 216, 217, 217, 218, 218, 219, 219, 220, 220, |
197 | 221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, | 197 | 221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, |
198 | 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, | 198 | 227, 228, 228, 229, 229, 230, 230, 231, 231, 232, 232, 233, |
199 | 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, | 199 | 233, 234, 234, 235, 235, 236, 236, 237, 237, 238, 238, 239, |
200 | 239, 240, 240, 241, 241, 242, 242, 243, 243, 243, 244, 244, | 200 | 239, 240, 240, 241, 241, 242, 242, 243, 243, 243, 244, 244, |
201 | 245, 245, 246, 246 | 201 | 245, 245, 246, 246 |
202 | }; | 202 | }; |
203 | 203 | ||
204 | static const unsigned char blue[256] = { | 204 | static const unsigned char blue[256] = { |
205 | 0, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, | 205 | 0, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, 23, |
206 | 23, 23, 23, 23, 23, 23, 23, 30, 37, 42, 47, 51, | 206 | 23, 23, 23, 23, 23, 23, 23, 30, 37, 42, 47, 51, |
207 | 55, 58, 61, 64, 67, 70, 72, 74, 78, 80, 82, 84, | 207 | 55, 58, 61, 64, 67, 70, 72, 74, 78, 80, 82, 84, |
208 | 86, 88, 90, 92, 94, 95, 97, 100, 101, 103, 104, 106, | 208 | 86, 88, 90, 92, 94, 95, 97, 100, 101, 103, 104, 106, |
209 | 107, 110, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, | 209 | 107, 110, 111, 112, 114, 115, 116, 118, 119, 121, 122, 124, |
210 | 125, 126, 127, 128, 129, 132, 133, 134, 135, 136, 137, 138, | 210 | 125, 126, 127, 128, 129, 132, 133, 134, 135, 136, 137, 138, |
211 | 139, 140, 141, 143, 144, 145, 146, 147, 148, 149, 150, 151, | 211 | 139, 140, 141, 143, 144, 145, 146, 147, 148, 149, 150, 151, |
212 | 152, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, | 212 | 152, 154, 155, 156, 157, 158, 158, 159, 160, 161, 162, 163, |
213 | 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, | 213 | 165, 166, 166, 167, 168, 169, 170, 171, 171, 172, 173, 174, |
214 | 176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184, | 214 | 176, 176, 177, 178, 179, 180, 180, 181, 182, 183, 183, 184, |
215 | 185, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, | 215 | 185, 187, 187, 188, 189, 189, 190, 191, 192, 192, 193, 194, |
216 | 194, 195, 196, 196, 198, 199, 200, 200, 201, 202, 202, 203, | 216 | 194, 195, 196, 196, 198, 199, 200, 200, 201, 202, 202, 203, |
217 | 204, 204, 205, 205, 206, 207, 207, 209, 210, 210, 211, 212, | 217 | 204, 204, 205, 205, 206, 207, 207, 209, 210, 210, 211, 212, |
218 | 212, 213, 213, 214, 215, 215, 216, 217, 217, 218, 218, 220, | 218 | 212, 213, 213, 214, 215, 215, 216, 217, 217, 218, 218, 220, |
219 | 221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, | 219 | 221, 221, 222, 222, 223, 224, 224, 225, 225, 226, 226, 227, |
220 | 228, 228, 229, 229, 231, 231, 232, 233, 233, 234, 234, 235, | 220 | 228, 228, 229, 229, 231, 231, 232, 233, 233, 234, 234, 235, |
221 | 235, 236, 236, 237, 238, 238, 239, 239, 240, 240, 242, 242, | 221 | 235, 236, 236, 237, 238, 238, 239, 239, 240, 240, 242, 242, |
222 | 243, 243, 244, 244, 245, 246, 246, 247, 247, 248, 248, 249, | 222 | 243, 243, 244, 244, 245, 246, 246, 247, 247, 248, 248, 249, |
223 | 249, 250, 250, 251, 251, 253, 253, 254, 254, 255, 255, 255, | 223 | 249, 250, 250, 251, 251, 253, 253, 254, 254, 255, 255, 255, |
224 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, | 224 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, |
225 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, | 225 | 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, 255, |
226 | 255, 255, 255, 255 | 226 | 255, 255, 255, 255 |
227 | }; | 227 | }; |
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c index fc3d5824efff..78e043ac9ea0 100644 --- a/drivers/media/video/tda7432.c +++ b/drivers/media/video/tda7432.c | |||
@@ -48,9 +48,8 @@ | |||
48 | #include <linux/i2c.h> | 48 | #include <linux/i2c.h> |
49 | #include <linux/i2c-algo-bit.h> | 49 | #include <linux/i2c-algo-bit.h> |
50 | 50 | ||
51 | #include "bttv.h" | ||
52 | #include <media/audiochip.h> | ||
53 | #include <media/v4l2-common.h> | 51 | #include <media/v4l2-common.h> |
52 | #include <media/i2c-addr.h> | ||
54 | 53 | ||
55 | #ifndef VIDEO_AUDIO_BALANCE | 54 | #ifndef VIDEO_AUDIO_BALANCE |
56 | # define VIDEO_AUDIO_BALANCE 32 | 55 | # define VIDEO_AUDIO_BALANCE 32 |
@@ -71,7 +70,7 @@ module_param(maxvol, int, S_IRUGO | S_IWUSR); | |||
71 | 70 | ||
72 | /* Address to scan (I2C address of this chip) */ | 71 | /* Address to scan (I2C address of this chip) */ |
73 | static unsigned short normal_i2c[] = { | 72 | static unsigned short normal_i2c[] = { |
74 | I2C_TDA7432 >> 1, | 73 | I2C_ADDR_TDA7432 >> 1, |
75 | I2C_CLIENT_END, | 74 | I2C_CLIENT_END, |
76 | }; | 75 | }; |
77 | I2C_CLIENT_INSMOD; | 76 | I2C_CLIENT_INSMOD; |
diff --git a/drivers/media/video/tda9840.c b/drivers/media/video/tda9840.c index 0243700f58ae..ef494febb5e4 100644 --- a/drivers/media/video/tda9840.c +++ b/drivers/media/video/tda9840.c | |||
@@ -35,7 +35,7 @@ static int debug = 0; /* insmod parameter */ | |||
35 | module_param(debug, int, 0644); | 35 | module_param(debug, int, 0644); |
36 | MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); | 36 | MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); |
37 | #define dprintk(args...) \ | 37 | #define dprintk(args...) \ |
38 | do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) | 38 | do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) |
39 | 39 | ||
40 | #define SWITCH 0x00 | 40 | #define SWITCH 0x00 |
41 | #define LEVEL_ADJUST 0x02 | 41 | #define LEVEL_ADJUST 0x02 |
@@ -43,7 +43,7 @@ MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); | |||
43 | #define TEST 0x04 | 43 | #define TEST 0x04 |
44 | 44 | ||
45 | /* addresses to scan, found only at 0x42 (7-Bit) */ | 45 | /* addresses to scan, found only at 0x42 (7-Bit) */ |
46 | static unsigned short normal_i2c[] = { I2C_TDA9840, I2C_CLIENT_END }; | 46 | static unsigned short normal_i2c[] = { I2C_ADDR_TDA9840, I2C_CLIENT_END }; |
47 | 47 | ||
48 | /* magic definition of all other variables and things */ | 48 | /* magic definition of all other variables and things */ |
49 | I2C_CLIENT_INSMOD; | 49 | I2C_CLIENT_INSMOD; |
diff --git a/drivers/media/video/tda9840.h b/drivers/media/video/tda9840.h index 28021053bd09..7da8432cdca7 100644 --- a/drivers/media/video/tda9840.h +++ b/drivers/media/video/tda9840.h | |||
@@ -1,7 +1,7 @@ | |||
1 | #ifndef __INCLUDED_TDA9840__ | 1 | #ifndef __INCLUDED_TDA9840__ |
2 | #define __INCLUDED_TDA9840__ | 2 | #define __INCLUDED_TDA9840__ |
3 | 3 | ||
4 | #define I2C_TDA9840 0x42 | 4 | #define I2C_ADDR_TDA9840 0x42 |
5 | 5 | ||
6 | #define TDA9840_DETECT _IOR('v',1,int) | 6 | #define TDA9840_DETECT _IOR('v',1,int) |
7 | /* return values for TDA9840_DETCT */ | 7 | /* return values for TDA9840_DETCT */ |
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c index ef98c4982250..103ccb919292 100644 --- a/drivers/media/video/tda9875.c +++ b/drivers/media/video/tda9875.c | |||
@@ -30,24 +30,22 @@ | |||
30 | #include <linux/i2c-algo-bit.h> | 30 | #include <linux/i2c-algo-bit.h> |
31 | #include <linux/init.h> | 31 | #include <linux/init.h> |
32 | 32 | ||
33 | #include "bttv.h" | 33 | |
34 | #include <media/audiochip.h> | 34 | #include <media/i2c-addr.h> |
35 | 35 | ||
36 | static int debug; /* insmod parameter */ | 36 | static int debug; /* insmod parameter */ |
37 | module_param(debug, int, S_IRUGO | S_IWUSR); | 37 | module_param(debug, int, S_IRUGO | S_IWUSR); |
38 | MODULE_LICENSE("GPL"); | 38 | MODULE_LICENSE("GPL"); |
39 | 39 | ||
40 | |||
41 | /* Addresses to scan */ | 40 | /* Addresses to scan */ |
42 | static unsigned short normal_i2c[] = { | 41 | static unsigned short normal_i2c[] = { |
43 | I2C_TDA9875 >> 1, | 42 | I2C_ADDR_TDA9875 >> 1, |
44 | I2C_CLIENT_END | 43 | I2C_CLIENT_END |
45 | }; | 44 | }; |
46 | I2C_CLIENT_INSMOD; | 45 | I2C_CLIENT_INSMOD; |
47 | 46 | ||
48 | /* This is a superset of the TDA9875 */ | 47 | /* This is a superset of the TDA9875 */ |
49 | struct tda9875 { | 48 | struct tda9875 { |
50 | int mode; | ||
51 | int rvol, lvol; | 49 | int rvol, lvol; |
52 | int bass, treble; | 50 | int bass, treble; |
53 | struct i2c_client c; | 51 | struct i2c_client c; |
@@ -197,7 +195,6 @@ static void do_tda9875_init(struct i2c_client *client) | |||
197 | 195 | ||
198 | tda9875_write(client, TDA9875_MUT, 0xcc ); /* General mute */ | 196 | tda9875_write(client, TDA9875_MUT, 0xcc ); /* General mute */ |
199 | 197 | ||
200 | t->mode=AUDIO_UNMUTE; | ||
201 | t->lvol=t->rvol =0; /* 0dB */ | 198 | t->lvol=t->rvol =0; /* 0dB */ |
202 | t->bass=0; /* 0dB */ | 199 | t->bass=0; /* 0dB */ |
203 | t->treble=0; /* 0dB */ | 200 | t->treble=0; /* 0dB */ |
diff --git a/drivers/media/video/tea6415c.c b/drivers/media/video/tea6415c.c index 774ed0dbc56d..523df0b8cc63 100644 --- a/drivers/media/video/tea6415c.c +++ b/drivers/media/video/tea6415c.c | |||
@@ -37,7 +37,7 @@ static int debug = 0; /* insmod parameter */ | |||
37 | module_param(debug, int, 0644); | 37 | module_param(debug, int, 0644); |
38 | MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); | 38 | MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); |
39 | #define dprintk(args...) \ | 39 | #define dprintk(args...) \ |
40 | do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) | 40 | do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) |
41 | 41 | ||
42 | #define TEA6415C_NUM_INPUTS 8 | 42 | #define TEA6415C_NUM_INPUTS 8 |
43 | #define TEA6415C_NUM_OUTPUTS 6 | 43 | #define TEA6415C_NUM_OUTPUTS 6 |
diff --git a/drivers/media/video/tea6420.c b/drivers/media/video/tea6420.c index ad7d2872cfbf..e0ff811fab6f 100644 --- a/drivers/media/video/tea6420.c +++ b/drivers/media/video/tea6420.c | |||
@@ -37,10 +37,10 @@ static int debug = 0; /* insmod parameter */ | |||
37 | module_param(debug, int, 0644); | 37 | module_param(debug, int, 0644); |
38 | MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); | 38 | MODULE_PARM_DESC(debug, "Turn on/off device debugging (default:off)."); |
39 | #define dprintk(args...) \ | 39 | #define dprintk(args...) \ |
40 | do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) | 40 | do { if (debug) { printk("%s: %s()[%d]: ", KBUILD_MODNAME, __FUNCTION__, __LINE__); printk(args); } } while (0) |
41 | 41 | ||
42 | /* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */ | 42 | /* addresses to scan, found only at 0x4c and/or 0x4d (7-Bit) */ |
43 | static unsigned short normal_i2c[] = { I2C_TEA6420_1, I2C_TEA6420_2, I2C_CLIENT_END }; | 43 | static unsigned short normal_i2c[] = { I2C_ADDR_TEA6420_1, I2C_ADDR_TEA6420_2, I2C_CLIENT_END }; |
44 | 44 | ||
45 | /* magic definition of all other variables and things */ | 45 | /* magic definition of all other variables and things */ |
46 | I2C_CLIENT_INSMOD; | 46 | I2C_CLIENT_INSMOD; |
diff --git a/drivers/media/video/tea6420.h b/drivers/media/video/tea6420.h index ea664df15ad4..5ef7c18e0c54 100644 --- a/drivers/media/video/tea6420.h +++ b/drivers/media/video/tea6420.h | |||
@@ -2,8 +2,8 @@ | |||
2 | #define __INCLUDED_TEA6420__ | 2 | #define __INCLUDED_TEA6420__ |
3 | 3 | ||
4 | /* possible addresses */ | 4 | /* possible addresses */ |
5 | #define I2C_TEA6420_1 0x4c | 5 | #define I2C_ADDR_TEA6420_1 0x4c |
6 | #define I2C_TEA6420_2 0x4d | 6 | #define I2C_ADDR_TEA6420_2 0x4d |
7 | 7 | ||
8 | struct tea6420_multiplex | 8 | struct tea6420_multiplex |
9 | { | 9 | { |
diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c index c4a78e7a5a58..74ab48c09c6a 100644 --- a/drivers/media/video/tuner-3036.c +++ b/drivers/media/video/tuner-3036.c | |||
@@ -5,7 +5,7 @@ | |||
5 | * | 5 | * |
6 | * The SAB3036 is just about different enough from the chips that | 6 | * The SAB3036 is just about different enough from the chips that |
7 | * tuner.c copes with to make it not worth the effort to crowbar | 7 | * tuner.c copes with to make it not worth the effort to crowbar |
8 | * the support into that file. So instead we have a separate driver. | 8 | * the support into that file. So instead we have a separate driver. |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or | 10 | * This program is free software; you can redistribute it and/or |
11 | * modify it under the terms of the GNU General Public License | 11 | * modify it under the terms of the GNU General Public License |
@@ -56,15 +56,15 @@ tuner_getstatus (struct i2c_client *c) | |||
56 | 56 | ||
57 | #define TUNER_FL 0x80 | 57 | #define TUNER_FL 0x80 |
58 | 58 | ||
59 | static int | 59 | static int |
60 | tuner_islocked (struct i2c_client *c) | 60 | tuner_islocked (struct i2c_client *c) |
61 | { | 61 | { |
62 | return (tuner_getstatus(c) & TUNER_FL); | 62 | return (tuner_getstatus(c) & TUNER_FL); |
63 | } | 63 | } |
64 | 64 | ||
65 | /* ---------------------------------------------------------------------- */ | 65 | /* ---------------------------------------------------------------------- */ |
66 | 66 | ||
67 | static void | 67 | static void |
68 | set_tv_freq(struct i2c_client *c, int freq) | 68 | set_tv_freq(struct i2c_client *c, int freq) |
69 | { | 69 | { |
70 | u16 div = ((freq * 20) / 16); | 70 | u16 div = ((freq * 20) / 16); |
@@ -73,26 +73,26 @@ set_tv_freq(struct i2c_client *c, int freq) | |||
73 | 73 | ||
74 | if (debug) | 74 | if (debug) |
75 | printk(KERN_DEBUG "tuner: setting frequency %dMHz, divisor %x\n", freq / 16, div); | 75 | printk(KERN_DEBUG "tuner: setting frequency %dMHz, divisor %x\n", freq / 16, div); |
76 | 76 | ||
77 | /* Select high tuning current */ | 77 | /* Select high tuning current */ |
78 | buffer[0] = 0x29; | 78 | buffer[0] = 0x29; |
79 | buffer[1] = 0x3e; | 79 | buffer[1] = 0x3e; |
80 | 80 | ||
81 | if (i2c_master_send(c, buffer, 2) != 2) | 81 | if (i2c_master_send(c, buffer, 2) != 2) |
82 | printk("tuner: i2c i/o error 1\n"); | 82 | printk("tuner: i2c i/o error 1\n"); |
83 | 83 | ||
84 | buffer[0] = 0x80 | ((div>>8) & 0x7f); | 84 | buffer[0] = 0x80 | ((div>>8) & 0x7f); |
85 | buffer[1] = div & 0xff; | 85 | buffer[1] = div & 0xff; |
86 | 86 | ||
87 | if (i2c_master_send(c, buffer, 2) != 2) | 87 | if (i2c_master_send(c, buffer, 2) != 2) |
88 | printk("tuner: i2c i/o error 2\n"); | 88 | printk("tuner: i2c i/o error 2\n"); |
89 | 89 | ||
90 | while (!tuner_islocked(c) && time_before(jiffies, give_up)) | 90 | while (!tuner_islocked(c) && time_before(jiffies, give_up)) |
91 | schedule(); | 91 | schedule(); |
92 | 92 | ||
93 | if (!tuner_islocked(c)) | 93 | if (!tuner_islocked(c)) |
94 | printk(KERN_WARNING "tuner: failed to achieve PLL lock\n"); | 94 | printk(KERN_WARNING "tuner: failed to achieve PLL lock\n"); |
95 | 95 | ||
96 | /* Select low tuning current and engage AFC */ | 96 | /* Select low tuning current and engage AFC */ |
97 | buffer[0] = 0x29; | 97 | buffer[0] = 0x29; |
98 | buffer[1] = 0xb2; | 98 | buffer[1] = 0xb2; |
@@ -106,7 +106,7 @@ set_tv_freq(struct i2c_client *c, int freq) | |||
106 | 106 | ||
107 | /* ---------------------------------------------------------------------- */ | 107 | /* ---------------------------------------------------------------------- */ |
108 | 108 | ||
109 | static int | 109 | static int |
110 | tuner_attach(struct i2c_adapter *adap, int addr, int kind) | 110 | tuner_attach(struct i2c_adapter *adap, int addr, int kind) |
111 | { | 111 | { |
112 | static unsigned char buffer[] = { 0x29, 0x32, 0x2a, 0, 0x2b, 0 }; | 112 | static unsigned char buffer[] = { 0x29, 0x32, 0x2a, 0, 0x2b, 0 }; |
@@ -116,18 +116,18 @@ tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
116 | if (this_adap > 0) | 116 | if (this_adap > 0) |
117 | return -1; | 117 | return -1; |
118 | this_adap++; | 118 | this_adap++; |
119 | 119 | ||
120 | client_template.adapter = adap; | 120 | client_template.adapter = adap; |
121 | client_template.addr = addr; | 121 | client_template.addr = addr; |
122 | 122 | ||
123 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); | 123 | client = kmalloc(sizeof(struct i2c_client), GFP_KERNEL); |
124 | if (client == NULL) | 124 | if (client == NULL) |
125 | return -ENOMEM; | 125 | return -ENOMEM; |
126 | memcpy(client, &client_template, sizeof(struct i2c_client)); | 126 | memcpy(client, &client_template, sizeof(struct i2c_client)); |
127 | 127 | ||
128 | printk("tuner: SAB3036 found, status %02x\n", tuner_getstatus(client)); | 128 | printk("tuner: SAB3036 found, status %02x\n", tuner_getstatus(client)); |
129 | 129 | ||
130 | i2c_attach_client(client); | 130 | i2c_attach_client(client); |
131 | 131 | ||
132 | if (i2c_master_send(client, buffer, 2) != 2) | 132 | if (i2c_master_send(client, buffer, 2) != 2) |
133 | printk("tuner: i2c i/o error 1\n"); | 133 | printk("tuner: i2c i/o error 1\n"); |
@@ -138,30 +138,30 @@ tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
138 | return 0; | 138 | return 0; |
139 | } | 139 | } |
140 | 140 | ||
141 | static int | 141 | static int |
142 | tuner_detach(struct i2c_client *c) | 142 | tuner_detach(struct i2c_client *c) |
143 | { | 143 | { |
144 | return 0; | 144 | return 0; |
145 | } | 145 | } |
146 | 146 | ||
147 | static int | 147 | static int |
148 | tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | 148 | tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) |
149 | { | 149 | { |
150 | int *iarg = (int*)arg; | 150 | int *iarg = (int*)arg; |
151 | 151 | ||
152 | switch (cmd) | 152 | switch (cmd) |
153 | { | 153 | { |
154 | case VIDIOCSFREQ: | 154 | case VIDIOCSFREQ: |
155 | set_tv_freq(client, *iarg); | 155 | set_tv_freq(client, *iarg); |
156 | break; | 156 | break; |
157 | 157 | ||
158 | default: | 158 | default: |
159 | return -EINVAL; | 159 | return -EINVAL; |
160 | } | 160 | } |
161 | return 0; | 161 | return 0; |
162 | } | 162 | } |
163 | 163 | ||
164 | static int | 164 | static int |
165 | tuner_probe(struct i2c_adapter *adap) | 165 | tuner_probe(struct i2c_adapter *adap) |
166 | { | 166 | { |
167 | this_adap = 0; | 167 | this_adap = 0; |
@@ -172,8 +172,8 @@ tuner_probe(struct i2c_adapter *adap) | |||
172 | 172 | ||
173 | /* ----------------------------------------------------------------------- */ | 173 | /* ----------------------------------------------------------------------- */ |
174 | 174 | ||
175 | static struct i2c_driver | 175 | static struct i2c_driver |
176 | i2c_driver_tuner = | 176 | i2c_driver_tuner = |
177 | { | 177 | { |
178 | .driver = { | 178 | .driver = { |
179 | .name = "sab3036", | 179 | .name = "sab3036", |
@@ -186,7 +186,7 @@ i2c_driver_tuner = | |||
186 | 186 | ||
187 | static struct i2c_client client_template = | 187 | static struct i2c_client client_template = |
188 | { | 188 | { |
189 | .driver = &i2c_driver_tuner, | 189 | .driver = &i2c_driver_tuner, |
190 | .name = "SAB3036", | 190 | .name = "SAB3036", |
191 | }; | 191 | }; |
192 | 192 | ||
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 32e1849441fb..df195c905366 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -21,7 +21,6 @@ | |||
21 | 21 | ||
22 | #include <media/tuner.h> | 22 | #include <media/tuner.h> |
23 | #include <media/v4l2-common.h> | 23 | #include <media/v4l2-common.h> |
24 | #include <media/audiochip.h> | ||
25 | 24 | ||
26 | #define UNSET (-1U) | 25 | #define UNSET (-1U) |
27 | 26 | ||
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 4efb01bb44ac..356bff455ad1 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c | |||
@@ -30,10 +30,10 @@ | |||
30 | #include <linux/init.h> | 30 | #include <linux/init.h> |
31 | #include <linux/smp_lock.h> | 31 | #include <linux/smp_lock.h> |
32 | 32 | ||
33 | #include <media/audiochip.h> | 33 | #include <media/tvaudio.h> |
34 | #include <media/v4l2-common.h> | 34 | #include <media/v4l2-common.h> |
35 | 35 | ||
36 | #include "tvaudio.h" | 36 | #include <media/i2c-addr.h> |
37 | 37 | ||
38 | /* ---------------------------------------------------------------------- */ | 38 | /* ---------------------------------------------------------------------- */ |
39 | /* insmod args */ | 39 | /* insmod args */ |
@@ -102,7 +102,7 @@ struct CHIPDESC { | |||
102 | 102 | ||
103 | /* input switch register + values for v4l inputs */ | 103 | /* input switch register + values for v4l inputs */ |
104 | int inputreg; | 104 | int inputreg; |
105 | int inputmap[8]; | 105 | int inputmap[4]; |
106 | int inputmute; | 106 | int inputmute; |
107 | int inputmask; | 107 | int inputmask; |
108 | }; | 108 | }; |
@@ -119,9 +119,10 @@ struct CHIPSTATE { | |||
119 | audiocmd shadow; | 119 | audiocmd shadow; |
120 | 120 | ||
121 | /* current settings */ | 121 | /* current settings */ |
122 | __u16 left,right,treble,bass,mode; | 122 | __u16 left,right,treble,bass,muted,mode; |
123 | int prevmode; | 123 | int prevmode; |
124 | int radio; | 124 | int radio; |
125 | int input; | ||
125 | 126 | ||
126 | /* thread */ | 127 | /* thread */ |
127 | pid_t tpid; | 128 | pid_t tpid; |
@@ -137,14 +138,14 @@ struct CHIPSTATE { | |||
137 | /* i2c addresses */ | 138 | /* i2c addresses */ |
138 | 139 | ||
139 | static unsigned short normal_i2c[] = { | 140 | static unsigned short normal_i2c[] = { |
140 | I2C_TDA8425 >> 1, | 141 | I2C_ADDR_TDA8425 >> 1, |
141 | I2C_TEA6300 >> 1, | 142 | I2C_ADDR_TEA6300 >> 1, |
142 | I2C_TEA6420 >> 1, | 143 | I2C_ADDR_TEA6420 >> 1, |
143 | I2C_TDA9840 >> 1, | 144 | I2C_ADDR_TDA9840 >> 1, |
144 | I2C_TDA985x_L >> 1, | 145 | I2C_ADDR_TDA985x_L >> 1, |
145 | I2C_TDA985x_H >> 1, | 146 | I2C_ADDR_TDA985x_H >> 1, |
146 | I2C_TDA9874 >> 1, | 147 | I2C_ADDR_TDA9874 >> 1, |
147 | I2C_PIC16C54 >> 1, | 148 | I2C_ADDR_PIC16C54 >> 1, |
148 | I2C_CLIENT_END }; | 149 | I2C_CLIENT_END }; |
149 | I2C_CLIENT_INSMOD; | 150 | I2C_CLIENT_INSMOD; |
150 | 151 | ||
@@ -1101,9 +1102,8 @@ static int tda8425_shift12(int val) { return (val >> 12) | 0xf0; } | |||
1101 | static int tda8425_initialize(struct CHIPSTATE *chip) | 1102 | static int tda8425_initialize(struct CHIPSTATE *chip) |
1102 | { | 1103 | { |
1103 | struct CHIPDESC *desc = chiplist + chip->type; | 1104 | struct CHIPDESC *desc = chiplist + chip->type; |
1104 | int inputmap[8] = { /* tuner */ TDA8425_S1_CH2, /* radio */ TDA8425_S1_CH1, | 1105 | int inputmap[4] = { /* tuner */ TDA8425_S1_CH2, /* radio */ TDA8425_S1_CH1, |
1105 | /* extern */ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF, | 1106 | /* extern */ TDA8425_S1_CH1, /* intern */ TDA8425_S1_OFF}; |
1106 | /* off */ TDA8425_S1_OFF, /* on */ TDA8425_S1_CH2}; | ||
1107 | 1107 | ||
1108 | if (chip->c.adapter->id == I2C_HW_B_RIVA) { | 1108 | if (chip->c.adapter->id == I2C_HW_B_RIVA) { |
1109 | memcpy (desc->inputmap, inputmap, sizeof (inputmap)); | 1109 | memcpy (desc->inputmap, inputmap, sizeof (inputmap)); |
@@ -1269,8 +1269,8 @@ static struct CHIPDESC chiplist[] = { | |||
1269 | .name = "tda9840", | 1269 | .name = "tda9840", |
1270 | .id = I2C_DRIVERID_TDA9840, | 1270 | .id = I2C_DRIVERID_TDA9840, |
1271 | .insmodopt = &tda9840, | 1271 | .insmodopt = &tda9840, |
1272 | .addr_lo = I2C_TDA9840 >> 1, | 1272 | .addr_lo = I2C_ADDR_TDA9840 >> 1, |
1273 | .addr_hi = I2C_TDA9840 >> 1, | 1273 | .addr_hi = I2C_ADDR_TDA9840 >> 1, |
1274 | .registers = 5, | 1274 | .registers = 5, |
1275 | 1275 | ||
1276 | .checkit = tda9840_checkit, | 1276 | .checkit = tda9840_checkit, |
@@ -1286,8 +1286,8 @@ static struct CHIPDESC chiplist[] = { | |||
1286 | .id = I2C_DRIVERID_TDA9873, | 1286 | .id = I2C_DRIVERID_TDA9873, |
1287 | .checkit = tda9873_checkit, | 1287 | .checkit = tda9873_checkit, |
1288 | .insmodopt = &tda9873, | 1288 | .insmodopt = &tda9873, |
1289 | .addr_lo = I2C_TDA985x_L >> 1, | 1289 | .addr_lo = I2C_ADDR_TDA985x_L >> 1, |
1290 | .addr_hi = I2C_TDA985x_H >> 1, | 1290 | .addr_hi = I2C_ADDR_TDA985x_H >> 1, |
1291 | .registers = 3, | 1291 | .registers = 3, |
1292 | .flags = CHIP_HAS_INPUTSEL, | 1292 | .flags = CHIP_HAS_INPUTSEL, |
1293 | 1293 | ||
@@ -1298,7 +1298,7 @@ static struct CHIPDESC chiplist[] = { | |||
1298 | .init = { 4, { TDA9873_SW, 0xa4, 0x06, 0x03 } }, | 1298 | .init = { 4, { TDA9873_SW, 0xa4, 0x06, 0x03 } }, |
1299 | .inputreg = TDA9873_SW, | 1299 | .inputreg = TDA9873_SW, |
1300 | .inputmute = TDA9873_MUTE | TDA9873_AUTOMUTE, | 1300 | .inputmute = TDA9873_MUTE | TDA9873_AUTOMUTE, |
1301 | .inputmap = {0xa0, 0xa2, 0xa0, 0xa0, 0xc0}, | 1301 | .inputmap = {0xa0, 0xa2, 0xa0, 0xa0}, |
1302 | .inputmask = TDA9873_INP_MASK|TDA9873_MUTE|TDA9873_AUTOMUTE, | 1302 | .inputmask = TDA9873_INP_MASK|TDA9873_MUTE|TDA9873_AUTOMUTE, |
1303 | 1303 | ||
1304 | }, | 1304 | }, |
@@ -1308,8 +1308,8 @@ static struct CHIPDESC chiplist[] = { | |||
1308 | .checkit = tda9874a_checkit, | 1308 | .checkit = tda9874a_checkit, |
1309 | .initialize = tda9874a_initialize, | 1309 | .initialize = tda9874a_initialize, |
1310 | .insmodopt = &tda9874a, | 1310 | .insmodopt = &tda9874a, |
1311 | .addr_lo = I2C_TDA9874 >> 1, | 1311 | .addr_lo = I2C_ADDR_TDA9874 >> 1, |
1312 | .addr_hi = I2C_TDA9874 >> 1, | 1312 | .addr_hi = I2C_ADDR_TDA9874 >> 1, |
1313 | 1313 | ||
1314 | .getmode = tda9874a_getmode, | 1314 | .getmode = tda9874a_getmode, |
1315 | .setmode = tda9874a_setmode, | 1315 | .setmode = tda9874a_setmode, |
@@ -1319,8 +1319,8 @@ static struct CHIPDESC chiplist[] = { | |||
1319 | .name = "tda9850", | 1319 | .name = "tda9850", |
1320 | .id = I2C_DRIVERID_TDA9850, | 1320 | .id = I2C_DRIVERID_TDA9850, |
1321 | .insmodopt = &tda9850, | 1321 | .insmodopt = &tda9850, |
1322 | .addr_lo = I2C_TDA985x_L >> 1, | 1322 | .addr_lo = I2C_ADDR_TDA985x_L >> 1, |
1323 | .addr_hi = I2C_TDA985x_H >> 1, | 1323 | .addr_hi = I2C_ADDR_TDA985x_H >> 1, |
1324 | .registers = 11, | 1324 | .registers = 11, |
1325 | 1325 | ||
1326 | .getmode = tda985x_getmode, | 1326 | .getmode = tda985x_getmode, |
@@ -1332,8 +1332,8 @@ static struct CHIPDESC chiplist[] = { | |||
1332 | .name = "tda9855", | 1332 | .name = "tda9855", |
1333 | .id = I2C_DRIVERID_TDA9855, | 1333 | .id = I2C_DRIVERID_TDA9855, |
1334 | .insmodopt = &tda9855, | 1334 | .insmodopt = &tda9855, |
1335 | .addr_lo = I2C_TDA985x_L >> 1, | 1335 | .addr_lo = I2C_ADDR_TDA985x_L >> 1, |
1336 | .addr_hi = I2C_TDA985x_H >> 1, | 1336 | .addr_hi = I2C_ADDR_TDA985x_H >> 1, |
1337 | .registers = 11, | 1337 | .registers = 11, |
1338 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE, | 1338 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE, |
1339 | 1339 | ||
@@ -1357,8 +1357,8 @@ static struct CHIPDESC chiplist[] = { | |||
1357 | .name = "tea6300", | 1357 | .name = "tea6300", |
1358 | .id = I2C_DRIVERID_TEA6300, | 1358 | .id = I2C_DRIVERID_TEA6300, |
1359 | .insmodopt = &tea6300, | 1359 | .insmodopt = &tea6300, |
1360 | .addr_lo = I2C_TEA6300 >> 1, | 1360 | .addr_lo = I2C_ADDR_TEA6300 >> 1, |
1361 | .addr_hi = I2C_TEA6300 >> 1, | 1361 | .addr_hi = I2C_ADDR_TEA6300 >> 1, |
1362 | .registers = 6, | 1362 | .registers = 6, |
1363 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, | 1363 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, |
1364 | 1364 | ||
@@ -1379,8 +1379,8 @@ static struct CHIPDESC chiplist[] = { | |||
1379 | .id = I2C_DRIVERID_TEA6300, | 1379 | .id = I2C_DRIVERID_TEA6300, |
1380 | .initialize = tea6320_initialize, | 1380 | .initialize = tea6320_initialize, |
1381 | .insmodopt = &tea6320, | 1381 | .insmodopt = &tea6320, |
1382 | .addr_lo = I2C_TEA6300 >> 1, | 1382 | .addr_lo = I2C_ADDR_TEA6300 >> 1, |
1383 | .addr_hi = I2C_TEA6300 >> 1, | 1383 | .addr_hi = I2C_ADDR_TEA6300 >> 1, |
1384 | .registers = 8, | 1384 | .registers = 8, |
1385 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, | 1385 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, |
1386 | 1386 | ||
@@ -1400,8 +1400,8 @@ static struct CHIPDESC chiplist[] = { | |||
1400 | .name = "tea6420", | 1400 | .name = "tea6420", |
1401 | .id = I2C_DRIVERID_TEA6420, | 1401 | .id = I2C_DRIVERID_TEA6420, |
1402 | .insmodopt = &tea6420, | 1402 | .insmodopt = &tea6420, |
1403 | .addr_lo = I2C_TEA6420 >> 1, | 1403 | .addr_lo = I2C_ADDR_TEA6420 >> 1, |
1404 | .addr_hi = I2C_TEA6420 >> 1, | 1404 | .addr_hi = I2C_ADDR_TEA6420 >> 1, |
1405 | .registers = 1, | 1405 | .registers = 1, |
1406 | .flags = CHIP_HAS_INPUTSEL, | 1406 | .flags = CHIP_HAS_INPUTSEL, |
1407 | 1407 | ||
@@ -1413,8 +1413,8 @@ static struct CHIPDESC chiplist[] = { | |||
1413 | .name = "tda8425", | 1413 | .name = "tda8425", |
1414 | .id = I2C_DRIVERID_TDA8425, | 1414 | .id = I2C_DRIVERID_TDA8425, |
1415 | .insmodopt = &tda8425, | 1415 | .insmodopt = &tda8425, |
1416 | .addr_lo = I2C_TDA8425 >> 1, | 1416 | .addr_lo = I2C_ADDR_TDA8425 >> 1, |
1417 | .addr_hi = I2C_TDA8425 >> 1, | 1417 | .addr_hi = I2C_ADDR_TDA8425 >> 1, |
1418 | .registers = 9, | 1418 | .registers = 9, |
1419 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, | 1419 | .flags = CHIP_HAS_VOLUME | CHIP_HAS_BASSTREBLE | CHIP_HAS_INPUTSEL, |
1420 | 1420 | ||
@@ -1437,8 +1437,8 @@ static struct CHIPDESC chiplist[] = { | |||
1437 | .name = "pic16c54 (PV951)", | 1437 | .name = "pic16c54 (PV951)", |
1438 | .id = I2C_DRIVERID_PIC16C54_PV9, | 1438 | .id = I2C_DRIVERID_PIC16C54_PV9, |
1439 | .insmodopt = &pic16c54, | 1439 | .insmodopt = &pic16c54, |
1440 | .addr_lo = I2C_PIC16C54 >> 1, | 1440 | .addr_lo = I2C_ADDR_PIC16C54 >> 1, |
1441 | .addr_hi = I2C_PIC16C54>> 1, | 1441 | .addr_hi = I2C_ADDR_PIC16C54>> 1, |
1442 | .registers = 2, | 1442 | .registers = 2, |
1443 | .flags = CHIP_HAS_INPUTSEL, | 1443 | .flags = CHIP_HAS_INPUTSEL, |
1444 | 1444 | ||
@@ -1446,8 +1446,7 @@ static struct CHIPDESC chiplist[] = { | |||
1446 | .inputmap = {PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_TUNER, | 1446 | .inputmap = {PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_TUNER, |
1447 | PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_LINE, | 1447 | PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_LINE, |
1448 | PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_LINE, | 1448 | PIC16C54_MISC_SND_NOTMUTE|PIC16C54_MISC_SWITCH_LINE, |
1449 | PIC16C54_MISC_SND_MUTE,PIC16C54_MISC_SND_MUTE, | 1449 | PIC16C54_MISC_SND_MUTE}, |
1450 | PIC16C54_MISC_SND_NOTMUTE}, | ||
1451 | .inputmute = PIC16C54_MISC_SND_MUTE, | 1450 | .inputmute = PIC16C54_MISC_SND_MUTE, |
1452 | }, | 1451 | }, |
1453 | { | 1452 | { |
@@ -1456,8 +1455,8 @@ static struct CHIPDESC chiplist[] = { | |||
1456 | /*.id = I2C_DRIVERID_TA8874Z, */ | 1455 | /*.id = I2C_DRIVERID_TA8874Z, */ |
1457 | .checkit = ta8874z_checkit, | 1456 | .checkit = ta8874z_checkit, |
1458 | .insmodopt = &ta8874z, | 1457 | .insmodopt = &ta8874z, |
1459 | .addr_lo = I2C_TDA9840 >> 1, | 1458 | .addr_lo = I2C_ADDR_TDA9840 >> 1, |
1460 | .addr_hi = I2C_TDA9840 >> 1, | 1459 | .addr_hi = I2C_ADDR_TDA9840 >> 1, |
1461 | .registers = 2, | 1460 | .registers = 2, |
1462 | 1461 | ||
1463 | .getmode = ta8874z_getmode, | 1462 | .getmode = ta8874z_getmode, |
@@ -1583,28 +1582,40 @@ static int chip_detach(struct i2c_client *client) | |||
1583 | return 0; | 1582 | return 0; |
1584 | } | 1583 | } |
1585 | 1584 | ||
1585 | static int tvaudio_set_ctrl(struct CHIPSTATE *chip, struct v4l2_control *ctrl) | ||
1586 | { | ||
1587 | struct CHIPDESC *desc = chiplist + chip->type; | ||
1588 | |||
1589 | switch (ctrl->id) { | ||
1590 | case V4L2_CID_AUDIO_MUTE: | ||
1591 | if (ctrl->value < 0 || ctrl->value >= 2) | ||
1592 | return -ERANGE; | ||
1593 | chip->muted = ctrl->value; | ||
1594 | if (chip->muted) | ||
1595 | chip_write_masked(chip,desc->inputreg,desc->inputmute,desc->inputmask); | ||
1596 | else | ||
1597 | chip_write_masked(chip,desc->inputreg, | ||
1598 | desc->inputmap[chip->input],desc->inputmask); | ||
1599 | break; | ||
1600 | default: | ||
1601 | return -EINVAL; | ||
1602 | } | ||
1603 | return 0; | ||
1604 | } | ||
1605 | |||
1606 | |||
1586 | /* ---------------------------------------------------------------------- */ | 1607 | /* ---------------------------------------------------------------------- */ |
1587 | /* video4linux interface */ | 1608 | /* video4linux interface */ |
1588 | 1609 | ||
1589 | static int chip_command(struct i2c_client *client, | 1610 | static int chip_command(struct i2c_client *client, |
1590 | unsigned int cmd, void *arg) | 1611 | unsigned int cmd, void *arg) |
1591 | { | 1612 | { |
1592 | __u16 *sarg = arg; | ||
1593 | struct CHIPSTATE *chip = i2c_get_clientdata(client); | 1613 | struct CHIPSTATE *chip = i2c_get_clientdata(client); |
1594 | struct CHIPDESC *desc = chiplist + chip->type; | 1614 | struct CHIPDESC *desc = chiplist + chip->type; |
1595 | 1615 | ||
1596 | v4l_dbg(1, debug, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd); | 1616 | v4l_dbg(1, debug, &chip->c, "%s: chip_command 0x%x\n", chip->c.name, cmd); |
1597 | 1617 | ||
1598 | switch (cmd) { | 1618 | switch (cmd) { |
1599 | case AUDC_SET_INPUT: | ||
1600 | if (desc->flags & CHIP_HAS_INPUTSEL) { | ||
1601 | if (*sarg & 0x80) | ||
1602 | chip_write_masked(chip,desc->inputreg,desc->inputmute,desc->inputmask); | ||
1603 | else | ||
1604 | chip_write_masked(chip,desc->inputreg,desc->inputmap[*sarg],desc->inputmask); | ||
1605 | } | ||
1606 | break; | ||
1607 | |||
1608 | case AUDC_SET_RADIO: | 1619 | case AUDC_SET_RADIO: |
1609 | chip->radio = 1; | 1620 | chip->radio = 1; |
1610 | chip->watch_stereo = 0; | 1621 | chip->watch_stereo = 0; |
@@ -1668,6 +1679,48 @@ static int chip_command(struct i2c_client *client, | |||
1668 | break; | 1679 | break; |
1669 | } | 1680 | } |
1670 | 1681 | ||
1682 | case VIDIOC_S_CTRL: | ||
1683 | return tvaudio_set_ctrl(chip, arg); | ||
1684 | |||
1685 | case VIDIOC_INT_G_AUDIO_ROUTING: | ||
1686 | { | ||
1687 | struct v4l2_routing *rt = arg; | ||
1688 | |||
1689 | rt->input = chip->input; | ||
1690 | rt->output = 0; | ||
1691 | break; | ||
1692 | } | ||
1693 | |||
1694 | case VIDIOC_INT_S_AUDIO_ROUTING: | ||
1695 | { | ||
1696 | struct v4l2_routing *rt = arg; | ||
1697 | |||
1698 | if (!(desc->flags & CHIP_HAS_INPUTSEL) || rt->input >= 4) | ||
1699 | return -EINVAL; | ||
1700 | /* There are four inputs: tuner, radio, extern and intern. */ | ||
1701 | chip->input = rt->input; | ||
1702 | if (chip->muted) | ||
1703 | break; | ||
1704 | chip_write_masked(chip, desc->inputreg, | ||
1705 | desc->inputmap[chip->input], desc->inputmask); | ||
1706 | break; | ||
1707 | } | ||
1708 | |||
1709 | case VIDIOC_S_AUDIO: | ||
1710 | { | ||
1711 | struct v4l2_audio *sarg = arg; | ||
1712 | |||
1713 | if (!(desc->flags & CHIP_HAS_INPUTSEL) || sarg->index >= 4) | ||
1714 | return -EINVAL; | ||
1715 | /* There are four inputs: tuner, radio, extern and intern. */ | ||
1716 | chip->input = sarg->index; | ||
1717 | if (chip->muted) | ||
1718 | break; | ||
1719 | chip_write_masked(chip, desc->inputreg, | ||
1720 | desc->inputmap[chip->input], desc->inputmask); | ||
1721 | break; | ||
1722 | } | ||
1723 | |||
1671 | case VIDIOC_S_TUNER: | 1724 | case VIDIOC_S_TUNER: |
1672 | { | 1725 | { |
1673 | struct v4l2_tuner *vt = arg; | 1726 | struct v4l2_tuner *vt = arg; |
@@ -1680,6 +1733,7 @@ static int chip_command(struct i2c_client *client, | |||
1680 | mode = VIDEO_SOUND_MONO; | 1733 | mode = VIDEO_SOUND_MONO; |
1681 | break; | 1734 | break; |
1682 | case V4L2_TUNER_MODE_STEREO: | 1735 | case V4L2_TUNER_MODE_STEREO: |
1736 | case V4L2_TUNER_MODE_LANG1_LANG2: | ||
1683 | mode = VIDEO_SOUND_STEREO; | 1737 | mode = VIDEO_SOUND_STEREO; |
1684 | break; | 1738 | break; |
1685 | case V4L2_TUNER_MODE_LANG1: | 1739 | case V4L2_TUNER_MODE_LANG1: |
diff --git a/drivers/media/video/tvaudio.h b/drivers/media/video/tvaudio.h deleted file mode 100644 index af7e116af9a9..000000000000 --- a/drivers/media/video/tvaudio.h +++ /dev/null | |||
@@ -1,14 +0,0 @@ | |||
1 | /* | ||
2 | * i2c bus addresses for the chips supported by tvaudio.c | ||
3 | */ | ||
4 | |||
5 | #define I2C_TDA8425 0x82 | ||
6 | #define I2C_TDA9840 0x84 /* also used by TA8874Z */ | ||
7 | #define I2C_TDA985x_L 0xb4 /* also used by 9873 */ | ||
8 | #define I2C_TDA985x_H 0xb6 | ||
9 | #define I2C_TDA9874 0xb0 /* also used by 9875 */ | ||
10 | |||
11 | #define I2C_TEA6300 0x80 /* also used by 6320 */ | ||
12 | #define I2C_TEA6420 0x98 | ||
13 | |||
14 | #define I2C_PIC16C54 0x96 /* PV951 */ | ||
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 582551b0969b..e0d2ff83fc91 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -248,32 +248,32 @@ audioIC[] = | |||
248 | {AUDIO_CHIP_MSP34XX, "MSP3410D"}, | 248 | {AUDIO_CHIP_MSP34XX, "MSP3410D"}, |
249 | {AUDIO_CHIP_MSP34XX, "MSP3415"}, | 249 | {AUDIO_CHIP_MSP34XX, "MSP3415"}, |
250 | {AUDIO_CHIP_MSP34XX, "MSP3430"}, | 250 | {AUDIO_CHIP_MSP34XX, "MSP3430"}, |
251 | {AUDIO_CHIP_UNKNOWN, "MSP3438"}, | 251 | {AUDIO_CHIP_MSP34XX, "MSP3438"}, |
252 | {AUDIO_CHIP_UNKNOWN, "CS5331"}, | 252 | {AUDIO_CHIP_UNKNOWN, "CS5331"}, |
253 | /* 10-14 */ | 253 | /* 10-14 */ |
254 | {AUDIO_CHIP_MSP34XX, "MSP3435"}, | 254 | {AUDIO_CHIP_MSP34XX, "MSP3435"}, |
255 | {AUDIO_CHIP_MSP34XX, "MSP3440"}, | 255 | {AUDIO_CHIP_MSP34XX, "MSP3440"}, |
256 | {AUDIO_CHIP_MSP34XX, "MSP3445"}, | 256 | {AUDIO_CHIP_MSP34XX, "MSP3445"}, |
257 | {AUDIO_CHIP_UNKNOWN, "MSP3411"}, | 257 | {AUDIO_CHIP_MSP34XX, "MSP3411"}, |
258 | {AUDIO_CHIP_UNKNOWN, "MSP3416"}, | 258 | {AUDIO_CHIP_MSP34XX, "MSP3416"}, |
259 | /* 15-19 */ | 259 | /* 15-19 */ |
260 | {AUDIO_CHIP_MSP34XX, "MSP3425"}, | 260 | {AUDIO_CHIP_MSP34XX, "MSP3425"}, |
261 | {AUDIO_CHIP_UNKNOWN, "MSP3451"}, | 261 | {AUDIO_CHIP_MSP34XX, "MSP3451"}, |
262 | {AUDIO_CHIP_UNKNOWN, "MSP3418"}, | 262 | {AUDIO_CHIP_MSP34XX, "MSP3418"}, |
263 | {AUDIO_CHIP_UNKNOWN, "Type 0x12"}, | 263 | {AUDIO_CHIP_UNKNOWN, "Type 0x12"}, |
264 | {AUDIO_CHIP_UNKNOWN, "OKI7716"}, | 264 | {AUDIO_CHIP_UNKNOWN, "OKI7716"}, |
265 | /* 20-24 */ | 265 | /* 20-24 */ |
266 | {AUDIO_CHIP_UNKNOWN, "MSP4410"}, | 266 | {AUDIO_CHIP_MSP34XX, "MSP4410"}, |
267 | {AUDIO_CHIP_UNKNOWN, "MSP4420"}, | 267 | {AUDIO_CHIP_MSP34XX, "MSP4420"}, |
268 | {AUDIO_CHIP_UNKNOWN, "MSP4440"}, | 268 | {AUDIO_CHIP_MSP34XX, "MSP4440"}, |
269 | {AUDIO_CHIP_UNKNOWN, "MSP4450"}, | 269 | {AUDIO_CHIP_MSP34XX, "MSP4450"}, |
270 | {AUDIO_CHIP_UNKNOWN, "MSP4408"}, | 270 | {AUDIO_CHIP_MSP34XX, "MSP4408"}, |
271 | /* 25-29 */ | 271 | /* 25-29 */ |
272 | {AUDIO_CHIP_UNKNOWN, "MSP4418"}, | 272 | {AUDIO_CHIP_MSP34XX, "MSP4418"}, |
273 | {AUDIO_CHIP_UNKNOWN, "MSP4428"}, | 273 | {AUDIO_CHIP_MSP34XX, "MSP4428"}, |
274 | {AUDIO_CHIP_UNKNOWN, "MSP4448"}, | 274 | {AUDIO_CHIP_MSP34XX, "MSP4448"}, |
275 | {AUDIO_CHIP_UNKNOWN, "MSP4458"}, | 275 | {AUDIO_CHIP_MSP34XX, "MSP4458"}, |
276 | {AUDIO_CHIP_UNKNOWN, "Type 0x1d"}, | 276 | {AUDIO_CHIP_MSP34XX, "Type 0x1d"}, |
277 | /* 30-34 */ | 277 | /* 30-34 */ |
278 | {AUDIO_CHIP_INTERNAL, "CX880"}, | 278 | {AUDIO_CHIP_INTERNAL, "CX880"}, |
279 | {AUDIO_CHIP_INTERNAL, "CX881"}, | 279 | {AUDIO_CHIP_INTERNAL, "CX881"}, |
diff --git a/drivers/media/video/usbvideo/Makefile b/drivers/media/video/usbvideo/Makefile new file mode 100644 index 000000000000..ed410a5ee8c9 --- /dev/null +++ b/drivers/media/video/usbvideo/Makefile | |||
@@ -0,0 +1,4 @@ | |||
1 | obj-$(CONFIG_USB_IBMCAM) += ibmcam.o usbvideo.o ultracam.o | ||
2 | obj-$(CONFIG_USB_KONICAWC) += konicawc.o usbvideo.o | ||
3 | obj-$(CONFIG_USB_VICAM) += vicam.o usbvideo.o | ||
4 | |||
diff --git a/drivers/usb/media/ibmcam.c b/drivers/media/video/usbvideo/ibmcam.c index a42c22294124..76f771b6a32f 100644 --- a/drivers/usb/media/ibmcam.c +++ b/drivers/media/video/usbvideo/ibmcam.c | |||
@@ -1300,11 +1300,11 @@ static void ibmcam_model2_Packet1(struct uvd *uvd, unsigned short v1, unsigned s | |||
1300 | /* | 1300 | /* |
1301 | * ibmcam_model3_Packet1() | 1301 | * ibmcam_model3_Packet1() |
1302 | * | 1302 | * |
1303 | * 00_0078_012d | 1303 | * 00_0078_012d |
1304 | * 00_0097_012f | 1304 | * 00_0097_012f |
1305 | * 00_d141_0124 | 1305 | * 00_d141_0124 |
1306 | * 00_0096_0127 | 1306 | * 00_0096_0127 |
1307 | * 00_fea8_0124 | 1307 | * 00_fea8_0124 |
1308 | */ | 1308 | */ |
1309 | static void ibmcam_model3_Packet1(struct uvd *uvd, unsigned short v1, unsigned short v2) | 1309 | static void ibmcam_model3_Packet1(struct uvd *uvd, unsigned short v1, unsigned short v2) |
1310 | { | 1310 | { |
@@ -2687,7 +2687,7 @@ static void ibmcam_model4_setup_after_video_if(struct uvd *uvd) | |||
2687 | ibmcam_veio(uvd, 0, 0x0004, 0x0127); | 2687 | ibmcam_veio(uvd, 0, 0x0004, 0x0127); |
2688 | ibmcam_veio(uvd, 0, 0xfea8, 0x0124); | 2688 | ibmcam_veio(uvd, 0, 0xfea8, 0x0124); |
2689 | ibmcam_veio(uvd, 0, 0x00c0, 0x010c); | 2689 | ibmcam_veio(uvd, 0, 0x00c0, 0x010c); |
2690 | break; | 2690 | break; |
2691 | } | 2691 | } |
2692 | usb_clear_halt(uvd->dev, usb_rcvisocpipe(uvd->dev, uvd->video_endp)); | 2692 | usb_clear_halt(uvd->dev, usb_rcvisocpipe(uvd->dev, uvd->video_endp)); |
2693 | } | 2693 | } |
@@ -3238,7 +3238,7 @@ static void ibmcam_model3_setup_after_video_if(struct uvd *uvd) | |||
3238 | {0, 0x0062, 0x0107}, | 3238 | {0, 0x0062, 0x0107}, |
3239 | {0, 0x0003, 0x0111}, | 3239 | {0, 0x0003, 0x0111}, |
3240 | }; | 3240 | }; |
3241 | #define NUM_INIT_DATA | 3241 | #define NUM_INIT_DATA |
3242 | 3242 | ||
3243 | unsigned short compression = 0; /* 0=none, 7=best frame rate */ | 3243 | unsigned short compression = 0; /* 0=none, 7=best frame rate */ |
3244 | int f_rate; /* 0=Fastest 7=slowest */ | 3244 | int f_rate; /* 0=Fastest 7=slowest */ |
diff --git a/drivers/usb/media/konicawc.c b/drivers/media/video/usbvideo/konicawc.c index e2ede583518f..c11f5d46b114 100644 --- a/drivers/usb/media/konicawc.c +++ b/drivers/media/video/usbvideo/konicawc.c | |||
@@ -36,7 +36,7 @@ | |||
36 | enum ctrl_req { | 36 | enum ctrl_req { |
37 | SetWhitebal = 0x01, | 37 | SetWhitebal = 0x01, |
38 | SetBrightness = 0x02, | 38 | SetBrightness = 0x02, |
39 | SetSharpness = 0x03, | 39 | SetSharpness = 0x03, |
40 | SetContrast = 0x04, | 40 | SetContrast = 0x04, |
41 | SetSaturation = 0x05, | 41 | SetSaturation = 0x05, |
42 | }; | 42 | }; |
@@ -47,7 +47,7 @@ enum frame_sizes { | |||
47 | SIZE_160X136 = 1, | 47 | SIZE_160X136 = 1, |
48 | SIZE_176X144 = 2, | 48 | SIZE_176X144 = 2, |
49 | SIZE_320X240 = 3, | 49 | SIZE_320X240 = 3, |
50 | 50 | ||
51 | }; | 51 | }; |
52 | 52 | ||
53 | #define MAX_FRAME_SIZE SIZE_320X240 | 53 | #define MAX_FRAME_SIZE SIZE_320X240 |
@@ -69,7 +69,7 @@ static const int debug = 0; | |||
69 | /* Some default values for initial camera settings, | 69 | /* Some default values for initial camera settings, |
70 | can be set by modprobe */ | 70 | can be set by modprobe */ |
71 | 71 | ||
72 | static int size; | 72 | static int size; |
73 | static int speed = 6; /* Speed (fps) 0 (slowest) to 6 (fastest) */ | 73 | static int speed = 6; /* Speed (fps) 0 (slowest) to 6 (fastest) */ |
74 | static int brightness = MAX_BRIGHTNESS/2; | 74 | static int brightness = MAX_BRIGHTNESS/2; |
75 | static int contrast = MAX_CONTRAST/2; | 75 | static int contrast = MAX_CONTRAST/2; |
@@ -132,24 +132,24 @@ struct konicawc { | |||
132 | 132 | ||
133 | static int konicawc_ctrl_msg(struct uvd *uvd, u8 dir, u8 request, u16 value, u16 index, void *buf, int len) | 133 | static int konicawc_ctrl_msg(struct uvd *uvd, u8 dir, u8 request, u16 value, u16 index, void *buf, int len) |
134 | { | 134 | { |
135 | int retval = usb_control_msg(uvd->dev, | 135 | int retval = usb_control_msg(uvd->dev, |
136 | dir ? usb_rcvctrlpipe(uvd->dev, 0) : usb_sndctrlpipe(uvd->dev, 0), | 136 | dir ? usb_rcvctrlpipe(uvd->dev, 0) : usb_sndctrlpipe(uvd->dev, 0), |
137 | request, 0x40 | dir, value, index, buf, len, 1000); | 137 | request, 0x40 | dir, value, index, buf, len, 1000); |
138 | return retval < 0 ? retval : 0; | 138 | return retval < 0 ? retval : 0; |
139 | } | 139 | } |
140 | 140 | ||
141 | 141 | ||
142 | static inline void konicawc_camera_on(struct uvd *uvd) | 142 | static inline void konicawc_camera_on(struct uvd *uvd) |
143 | { | 143 | { |
144 | DEBUG(0, "camera on"); | 144 | DEBUG(0, "camera on"); |
145 | konicawc_set_misc(uvd, 0x2, 1, 0x0b); | 145 | konicawc_set_misc(uvd, 0x2, 1, 0x0b); |
146 | } | 146 | } |
147 | 147 | ||
148 | 148 | ||
149 | static inline void konicawc_camera_off(struct uvd *uvd) | 149 | static inline void konicawc_camera_off(struct uvd *uvd) |
150 | { | 150 | { |
151 | DEBUG(0, "camera off"); | 151 | DEBUG(0, "camera off"); |
152 | konicawc_set_misc(uvd, 0x2, 0, 0x0b); | 152 | konicawc_set_misc(uvd, 0x2, 0, 0x0b); |
153 | } | 153 | } |
154 | 154 | ||
155 | 155 | ||
@@ -317,7 +317,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur | |||
317 | button = !!(sts & 0x40); | 317 | button = !!(sts & 0x40); |
318 | sts &= ~0x40; | 318 | sts &= ~0x40; |
319 | } | 319 | } |
320 | 320 | ||
321 | /* work out the button status, but don't do | 321 | /* work out the button status, but don't do |
322 | anything with it for now */ | 322 | anything with it for now */ |
323 | 323 | ||
@@ -331,7 +331,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur | |||
331 | discard++; | 331 | discard++; |
332 | continue; | 332 | continue; |
333 | } | 333 | } |
334 | 334 | ||
335 | if((sts > 0x01) && (sts < 0x80)) { | 335 | if((sts > 0x01) && (sts < 0x80)) { |
336 | info("unknown status %2.2x", sts); | 336 | info("unknown status %2.2x", sts); |
337 | bad++; | 337 | bad++; |
@@ -350,7 +350,7 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur | |||
350 | DEBUG(2, "found initial image"); | 350 | DEBUG(2, "found initial image"); |
351 | cam->lastframe = -1; | 351 | cam->lastframe = -1; |
352 | } | 352 | } |
353 | 353 | ||
354 | marker[3] = sts & 0x7F; | 354 | marker[3] = sts & 0x7F; |
355 | RingQueue_Enqueue(&uvd->dp, marker, 4); | 355 | RingQueue_Enqueue(&uvd->dp, marker, 4); |
356 | totlen += 4; | 356 | totlen += 4; |
@@ -367,16 +367,16 @@ static int konicawc_compress_iso(struct uvd *uvd, struct urb *dataurb, struct ur | |||
367 | 367 | ||
368 | static void resubmit_urb(struct uvd *uvd, struct urb *urb) | 368 | static void resubmit_urb(struct uvd *uvd, struct urb *urb) |
369 | { | 369 | { |
370 | int i, ret; | 370 | int i, ret; |
371 | for (i = 0; i < FRAMES_PER_DESC; i++) { | 371 | for (i = 0; i < FRAMES_PER_DESC; i++) { |
372 | urb->iso_frame_desc[i].status = 0; | 372 | urb->iso_frame_desc[i].status = 0; |
373 | } | 373 | } |
374 | urb->dev = uvd->dev; | 374 | urb->dev = uvd->dev; |
375 | urb->status = 0; | 375 | urb->status = 0; |
376 | ret = usb_submit_urb(urb, GFP_ATOMIC); | 376 | ret = usb_submit_urb(urb, GFP_ATOMIC); |
377 | DEBUG(3, "submitting urb of length %d", urb->transfer_buffer_length); | 377 | DEBUG(3, "submitting urb of length %d", urb->transfer_buffer_length); |
378 | if(ret) | 378 | if(ret) |
379 | err("usb_submit_urb error (%d)", ret); | 379 | err("usb_submit_urb error (%d)", ret); |
380 | 380 | ||
381 | } | 381 | } |
382 | 382 | ||
@@ -490,7 +490,7 @@ static int konicawc_start_data(struct uvd *uvd) | |||
490 | } | 490 | } |
491 | 491 | ||
492 | cam->last_data_urb = NULL; | 492 | cam->last_data_urb = NULL; |
493 | 493 | ||
494 | /* Submit all URBs */ | 494 | /* Submit all URBs */ |
495 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { | 495 | for (i=0; i < USBVIDEO_NUMSBUF; i++) { |
496 | errFlag = usb_submit_urb(cam->sts_urb[i], GFP_KERNEL); | 496 | errFlag = usb_submit_urb(cam->sts_urb[i], GFP_KERNEL); |
@@ -539,7 +539,7 @@ static void konicawc_stop_data(struct uvd *uvd) | |||
539 | 539 | ||
540 | 540 | ||
541 | static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame) | 541 | static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame) |
542 | { | 542 | { |
543 | struct konicawc *cam = (struct konicawc *)uvd->user_data; | 543 | struct konicawc *cam = (struct konicawc *)uvd->user_data; |
544 | int maxline = cam->maxline; | 544 | int maxline = cam->maxline; |
545 | int yplanesz = cam->yplanesz; | 545 | int yplanesz = cam->yplanesz; |
@@ -583,13 +583,13 @@ static void konicawc_process_isoc(struct uvd *uvd, struct usbvideo_frame *frame) | |||
583 | 583 | ||
584 | if(frame->scanstate == ScanState_Scanning) | 584 | if(frame->scanstate == ScanState_Scanning) |
585 | return; | 585 | return; |
586 | 586 | ||
587 | /* Try to move data from queue into frame buffer | 587 | /* Try to move data from queue into frame buffer |
588 | * We get data in blocks of 384 bytes made up of: | 588 | * We get data in blocks of 384 bytes made up of: |
589 | * 256 Y, 64 U, 64 V. | 589 | * 256 Y, 64 U, 64 V. |
590 | * This needs to be written out as a Y plane, a U plane and a V plane. | 590 | * This needs to be written out as a Y plane, a U plane and a V plane. |
591 | */ | 591 | */ |
592 | 592 | ||
593 | while ( frame->curline < maxline && (RingQueue_GetLength(&uvd->dp) >= 384)) { | 593 | while ( frame->curline < maxline && (RingQueue_GetLength(&uvd->dp) >= 384)) { |
594 | /* Y */ | 594 | /* Y */ |
595 | RingQueue_Dequeue(&uvd->dp, frame->data + (frame->curline * 256), 256); | 595 | RingQueue_Dequeue(&uvd->dp, frame->data + (frame->curline * 256), 256); |
diff --git a/drivers/usb/media/ultracam.c b/drivers/media/video/usbvideo/ultracam.c index 75ff755224df..10c58b4a2e5b 100644 --- a/drivers/usb/media/ultracam.c +++ b/drivers/media/video/usbvideo/ultracam.c | |||
@@ -23,7 +23,7 @@ | |||
23 | typedef struct { | 23 | typedef struct { |
24 | int initialized; /* Had we already sent init sequence? */ | 24 | int initialized; /* Had we already sent init sequence? */ |
25 | int camera_model; /* What type of IBM camera we got? */ | 25 | int camera_model; /* What type of IBM camera we got? */ |
26 | int has_hdr; | 26 | int has_hdr; |
27 | } ultracam_t; | 27 | } ultracam_t; |
28 | #define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data)) | 28 | #define ULTRACAM_T(uvd) ((ultracam_t *)((uvd)->user_data)) |
29 | 29 | ||
diff --git a/drivers/usb/media/usbvideo.c b/drivers/media/video/usbvideo/usbvideo.c index 0b51fae720a9..13b37c8c0d56 100644 --- a/drivers/usb/media/usbvideo.c +++ b/drivers/media/video/usbvideo/usbvideo.c | |||
@@ -574,7 +574,7 @@ void usbvideo_TestPattern(struct uvd *uvd, int fullframe, int pmode) | |||
574 | } else { | 574 | } else { |
575 | /* Just the blue screen */ | 575 | /* Just the blue screen */ |
576 | } | 576 | } |
577 | 577 | ||
578 | *f++ = cb; | 578 | *f++ = cb; |
579 | *f++ = cg; | 579 | *f++ = cg; |
580 | *f++ = cr; | 580 | *f++ = cr; |
@@ -1243,7 +1243,7 @@ static int usbvideo_v4l_close(struct inode *inode, struct file *file) | |||
1243 | 1243 | ||
1244 | #if USBVIDEO_REPORT_STATS | 1244 | #if USBVIDEO_REPORT_STATS |
1245 | usbvideo_ReportStatistics(uvd); | 1245 | usbvideo_ReportStatistics(uvd); |
1246 | #endif | 1246 | #endif |
1247 | 1247 | ||
1248 | uvd->user--; | 1248 | uvd->user--; |
1249 | if (uvd->remove_pending) { | 1249 | if (uvd->remove_pending) { |
@@ -1290,7 +1290,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
1290 | return 0; | 1290 | return 0; |
1291 | } | 1291 | } |
1292 | case VIDIOCSCHAN: | 1292 | case VIDIOCSCHAN: |
1293 | { | 1293 | { |
1294 | struct video_channel *v = arg; | 1294 | struct video_channel *v = arg; |
1295 | if (v->channel != 0) | 1295 | if (v->channel != 0) |
1296 | return -EINVAL; | 1296 | return -EINVAL; |
@@ -1347,7 +1347,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
1347 | vw->chromakey = 0; | 1347 | vw->chromakey = 0; |
1348 | if (VALID_CALLBACK(uvd, getFPS)) | 1348 | if (VALID_CALLBACK(uvd, getFPS)) |
1349 | vw->flags = GET_CALLBACK(uvd, getFPS)(uvd); | 1349 | vw->flags = GET_CALLBACK(uvd, getFPS)(uvd); |
1350 | else | 1350 | else |
1351 | vw->flags = 10; /* FIXME: do better! */ | 1351 | vw->flags = 10; /* FIXME: do better! */ |
1352 | return 0; | 1352 | return 0; |
1353 | } | 1353 | } |
@@ -1359,7 +1359,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
1359 | memset(vm, 0, sizeof(*vm)); | 1359 | memset(vm, 0, sizeof(*vm)); |
1360 | vm->size = uvd->max_frame_size * USBVIDEO_NUMFRAMES; | 1360 | vm->size = uvd->max_frame_size * USBVIDEO_NUMFRAMES; |
1361 | vm->frames = USBVIDEO_NUMFRAMES; | 1361 | vm->frames = USBVIDEO_NUMFRAMES; |
1362 | for(i = 0; i < USBVIDEO_NUMFRAMES; i++) | 1362 | for(i = 0; i < USBVIDEO_NUMFRAMES; i++) |
1363 | vm->offsets[i] = i * uvd->max_frame_size; | 1363 | vm->offsets[i] = i * uvd->max_frame_size; |
1364 | 1364 | ||
1365 | return 0; | 1365 | return 0; |
@@ -1425,7 +1425,7 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
1425 | 1425 | ||
1426 | if (*frameNum < 0 || *frameNum >= USBVIDEO_NUMFRAMES) | 1426 | if (*frameNum < 0 || *frameNum >= USBVIDEO_NUMFRAMES) |
1427 | return -EINVAL; | 1427 | return -EINVAL; |
1428 | 1428 | ||
1429 | if (uvd->debug >= 1) | 1429 | if (uvd->debug >= 1) |
1430 | info("VIDIOCSYNC: syncing to frame %d.", *frameNum); | 1430 | info("VIDIOCSYNC: syncing to frame %d.", *frameNum); |
1431 | if (uvd->flags & FLAGS_NO_DECODING) | 1431 | if (uvd->flags & FLAGS_NO_DECODING) |
@@ -1454,8 +1454,8 @@ static int usbvideo_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
1454 | struct video_buffer *vb = arg; | 1454 | struct video_buffer *vb = arg; |
1455 | 1455 | ||
1456 | memset(vb, 0, sizeof(*vb)); | 1456 | memset(vb, 0, sizeof(*vb)); |
1457 | return 0; | 1457 | return 0; |
1458 | } | 1458 | } |
1459 | case VIDIOCKEY: | 1459 | case VIDIOCKEY: |
1460 | return 0; | 1460 | return 0; |
1461 | 1461 | ||
@@ -1704,7 +1704,7 @@ static void usbvideo_IsocIrq(struct urb *urb, struct pt_regs *regs) | |||
1704 | info("Not streaming, but interrupt!"); | 1704 | info("Not streaming, but interrupt!"); |
1705 | return; | 1705 | return; |
1706 | } | 1706 | } |
1707 | 1707 | ||
1708 | uvd->stats.urb_count++; | 1708 | uvd->stats.urb_count++; |
1709 | if (urb->actual_length <= 0) | 1709 | if (urb->actual_length <= 0) |
1710 | goto urb_done_with; | 1710 | goto urb_done_with; |
@@ -1763,7 +1763,7 @@ static int usbvideo_StartDataPump(struct uvd *uvd) | |||
1763 | } | 1763 | } |
1764 | if (VALID_CALLBACK(uvd, videoStart)) | 1764 | if (VALID_CALLBACK(uvd, videoStart)) |
1765 | GET_CALLBACK(uvd, videoStart)(uvd); | 1765 | GET_CALLBACK(uvd, videoStart)(uvd); |
1766 | else | 1766 | else |
1767 | err("%s: videoStart not set", __FUNCTION__); | 1767 | err("%s: videoStart not set", __FUNCTION__); |
1768 | 1768 | ||
1769 | /* We double buffer the Iso lists */ | 1769 | /* We double buffer the Iso lists */ |
@@ -1830,7 +1830,7 @@ static void usbvideo_StopDataPump(struct uvd *uvd) | |||
1830 | /* Invoke minidriver's magic to stop the camera */ | 1830 | /* Invoke minidriver's magic to stop the camera */ |
1831 | if (VALID_CALLBACK(uvd, videoStop)) | 1831 | if (VALID_CALLBACK(uvd, videoStop)) |
1832 | GET_CALLBACK(uvd, videoStop)(uvd); | 1832 | GET_CALLBACK(uvd, videoStop)(uvd); |
1833 | else | 1833 | else |
1834 | err("%s: videoStop not set", __FUNCTION__); | 1834 | err("%s: videoStop not set", __FUNCTION__); |
1835 | 1835 | ||
1836 | /* Set packet size to 0 */ | 1836 | /* Set packet size to 0 */ |
@@ -1963,14 +1963,14 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
1963 | info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum); | 1963 | info("%s($%p,%d.)", __FUNCTION__, uvd, frameNum); |
1964 | 1964 | ||
1965 | switch (frame->frameState) { | 1965 | switch (frame->frameState) { |
1966 | case FrameState_Unused: | 1966 | case FrameState_Unused: |
1967 | if (uvd->debug >= 2) | 1967 | if (uvd->debug >= 2) |
1968 | info("%s: FrameState_Unused", __FUNCTION__); | 1968 | info("%s: FrameState_Unused", __FUNCTION__); |
1969 | return -EINVAL; | 1969 | return -EINVAL; |
1970 | case FrameState_Ready: | 1970 | case FrameState_Ready: |
1971 | case FrameState_Grabbing: | 1971 | case FrameState_Grabbing: |
1972 | case FrameState_Error: | 1972 | case FrameState_Error: |
1973 | { | 1973 | { |
1974 | int ntries, signalPending; | 1974 | int ntries, signalPending; |
1975 | redo: | 1975 | redo: |
1976 | if (!CAMERA_IS_OPERATIONAL(uvd)) { | 1976 | if (!CAMERA_IS_OPERATIONAL(uvd)) { |
@@ -1978,7 +1978,7 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
1978 | info("%s: Camera is not operational (1)", __FUNCTION__); | 1978 | info("%s: Camera is not operational (1)", __FUNCTION__); |
1979 | return -EIO; | 1979 | return -EIO; |
1980 | } | 1980 | } |
1981 | ntries = 0; | 1981 | ntries = 0; |
1982 | do { | 1982 | do { |
1983 | RingQueue_InterruptibleSleepOn(&uvd->dp); | 1983 | RingQueue_InterruptibleSleepOn(&uvd->dp); |
1984 | signalPending = signal_pending(current); | 1984 | signalPending = signal_pending(current); |
@@ -2010,7 +2010,7 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
2010 | usbvideo_CollectRawData(uvd, frame); | 2010 | usbvideo_CollectRawData(uvd, frame); |
2011 | else if (VALID_CALLBACK(uvd, processData)) | 2011 | else if (VALID_CALLBACK(uvd, processData)) |
2012 | GET_CALLBACK(uvd, processData)(uvd, frame); | 2012 | GET_CALLBACK(uvd, processData)(uvd, frame); |
2013 | else | 2013 | else |
2014 | err("%s: processData not set", __FUNCTION__); | 2014 | err("%s: processData not set", __FUNCTION__); |
2015 | } | 2015 | } |
2016 | } while (frame->frameState == FrameState_Grabbing); | 2016 | } while (frame->frameState == FrameState_Grabbing); |
@@ -2027,8 +2027,8 @@ static int usbvideo_GetFrame(struct uvd *uvd, int frameNum) | |||
2027 | goto redo; | 2027 | goto redo; |
2028 | } | 2028 | } |
2029 | /* Note that we fall through to meet our destiny below */ | 2029 | /* Note that we fall through to meet our destiny below */ |
2030 | } | 2030 | } |
2031 | case FrameState_Done: | 2031 | case FrameState_Done: |
2032 | /* | 2032 | /* |
2033 | * Do all necessary postprocessing of data prepared in | 2033 | * Do all necessary postprocessing of data prepared in |
2034 | * "interrupt" code and the collecting code above. The | 2034 | * "interrupt" code and the collecting code above. The |
@@ -2157,7 +2157,7 @@ EXPORT_SYMBOL(usbvideo_DeinterlaceFrame); | |||
2157 | * History: | 2157 | * History: |
2158 | * 09-Feb-2001 Created. | 2158 | * 09-Feb-2001 Created. |
2159 | */ | 2159 | */ |
2160 | static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, | 2160 | static void usbvideo_SoftwareContrastAdjustment(struct uvd *uvd, |
2161 | struct usbvideo_frame *frame) | 2161 | struct usbvideo_frame *frame) |
2162 | { | 2162 | { |
2163 | int i, j, v4l_linesize; | 2163 | int i, j, v4l_linesize; |
diff --git a/drivers/usb/media/usbvideo.h b/drivers/media/video/usbvideo/usbvideo.h index 135433c2680a..3cbf4fc499a3 100644 --- a/drivers/usb/media/usbvideo.h +++ b/drivers/media/video/usbvideo/usbvideo.h | |||
@@ -189,11 +189,11 @@ struct usbvideo_frame { | |||
189 | 189 | ||
190 | /* Statistics that can be overlaid on screen */ | 190 | /* Statistics that can be overlaid on screen */ |
191 | struct usbvideo_statistics { | 191 | struct usbvideo_statistics { |
192 | unsigned long frame_num; /* Sequential number of the frame */ | 192 | unsigned long frame_num; /* Sequential number of the frame */ |
193 | unsigned long urb_count; /* How many URBs we received so far */ | 193 | unsigned long urb_count; /* How many URBs we received so far */ |
194 | unsigned long urb_length; /* Length of last URB */ | 194 | unsigned long urb_length; /* Length of last URB */ |
195 | unsigned long data_count; /* How many bytes we received */ | 195 | unsigned long data_count; /* How many bytes we received */ |
196 | unsigned long header_count; /* How many frame headers we found */ | 196 | unsigned long header_count; /* How many frame headers we found */ |
197 | unsigned long iso_skip_count; /* How many empty ISO packets received */ | 197 | unsigned long iso_skip_count; /* How many empty ISO packets received */ |
198 | unsigned long iso_err_count; /* How many bad ISO packets received */ | 198 | unsigned long iso_err_count; /* How many bad ISO packets received */ |
199 | }; | 199 | }; |
diff --git a/drivers/usb/media/vicam.c b/drivers/media/video/usbvideo/vicam.c index 1d06e53ec7c5..90d48e8510ba 100644 --- a/drivers/usb/media/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c | |||
@@ -69,10 +69,10 @@ | |||
69 | #define VICAM_HEADER_SIZE 64 | 69 | #define VICAM_HEADER_SIZE 64 |
70 | 70 | ||
71 | #define clamp( x, l, h ) max_t( __typeof__( x ), \ | 71 | #define clamp( x, l, h ) max_t( __typeof__( x ), \ |
72 | ( l ), \ | 72 | ( l ), \ |
73 | min_t( __typeof__( x ), \ | 73 | min_t( __typeof__( x ), \ |
74 | ( h ), \ | 74 | ( h ), \ |
75 | ( x ) ) ) | 75 | ( x ) ) ) |
76 | 76 | ||
77 | /* Not sure what all the bytes in these char | 77 | /* Not sure what all the bytes in these char |
78 | * arrays do, but they're necessary to make | 78 | * arrays do, but they're necessary to make |
@@ -357,7 +357,7 @@ static unsigned char setup5[] = { | |||
357 | * Not sure why these are not yet non-statics which I can reference through | 357 | * Not sure why these are not yet non-statics which I can reference through |
358 | * usbvideo.h the same as it is in 2.4.20. I bet this will get fixed sometime | 358 | * usbvideo.h the same as it is in 2.4.20. I bet this will get fixed sometime |
359 | * in the future. | 359 | * in the future. |
360 | * | 360 | * |
361 | */ | 361 | */ |
362 | static void *rvmalloc(unsigned long size) | 362 | static void *rvmalloc(unsigned long size) |
363 | { | 363 | { |
@@ -603,12 +603,12 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign | |||
603 | case VIDIOCSPICT: | 603 | case VIDIOCSPICT: |
604 | { | 604 | { |
605 | struct video_picture vp; | 605 | struct video_picture vp; |
606 | 606 | ||
607 | if (copy_from_user(&vp, user_arg, sizeof(vp))) { | 607 | if (copy_from_user(&vp, user_arg, sizeof(vp))) { |
608 | retval = -EFAULT; | 608 | retval = -EFAULT; |
609 | break; | 609 | break; |
610 | } | 610 | } |
611 | 611 | ||
612 | DBG("VIDIOCSPICT depth = %d, pal = %d\n", vp.depth, | 612 | DBG("VIDIOCSPICT depth = %d, pal = %d\n", vp.depth, |
613 | vp.palette); | 613 | vp.palette); |
614 | 614 | ||
@@ -655,7 +655,7 @@ vicam_ioctl(struct inode *inode, struct file *file, unsigned int ioctlnr, unsign | |||
655 | } | 655 | } |
656 | 656 | ||
657 | DBG("VIDIOCSWIN %d x %d\n", vw.width, vw.height); | 657 | DBG("VIDIOCSWIN %d x %d\n", vw.width, vw.height); |
658 | 658 | ||
659 | if ( vw.width != 320 || vw.height != 240 ) | 659 | if ( vw.width != 320 || vw.height != 240 ) |
660 | retval = -EFAULT; | 660 | retval = -EFAULT; |
661 | 661 | ||
@@ -809,12 +809,12 @@ vicam_open(struct inode *inode, struct file *file) | |||
809 | cam->needsDummyRead = 1; | 809 | cam->needsDummyRead = 1; |
810 | cam->open_count++; | 810 | cam->open_count++; |
811 | 811 | ||
812 | file->private_data = cam; | 812 | file->private_data = cam; |
813 | 813 | ||
814 | return 0; | 814 | return 0; |
815 | } | 815 | } |
816 | 816 | ||
817 | static int | 817 | static int |
818 | vicam_close(struct inode *inode, struct file *file) | 818 | vicam_close(struct inode *inode, struct file *file) |
819 | { | 819 | { |
820 | struct vicam_camera *cam = file->private_data; | 820 | struct vicam_camera *cam = file->private_data; |
@@ -1187,7 +1187,7 @@ vicam_create_proc_entry(struct vicam_camera *cam) | |||
1187 | 1187 | ||
1188 | if ( !cam->proc_dir ) | 1188 | if ( !cam->proc_dir ) |
1189 | return; // FIXME: We should probably return an error here | 1189 | return; // FIXME: We should probably return an error here |
1190 | 1190 | ||
1191 | ent = create_proc_entry("shutter", S_IFREG | S_IRUGO | S_IWUSR, | 1191 | ent = create_proc_entry("shutter", S_IFREG | S_IRUGO | S_IWUSR, |
1192 | cam->proc_dir); | 1192 | cam->proc_dir); |
1193 | if (ent) { | 1193 | if (ent) { |
@@ -1282,7 +1282,7 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) | |||
1282 | const struct usb_host_interface *interface; | 1282 | const struct usb_host_interface *interface; |
1283 | const struct usb_endpoint_descriptor *endpoint; | 1283 | const struct usb_endpoint_descriptor *endpoint; |
1284 | struct vicam_camera *cam; | 1284 | struct vicam_camera *cam; |
1285 | 1285 | ||
1286 | printk(KERN_INFO "ViCam based webcam connected\n"); | 1286 | printk(KERN_INFO "ViCam based webcam connected\n"); |
1287 | 1287 | ||
1288 | interface = intf->cur_altsetting; | 1288 | interface = intf->cur_altsetting; |
@@ -1331,7 +1331,7 @@ vicam_probe( struct usb_interface *intf, const struct usb_device_id *id) | |||
1331 | printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor); | 1331 | printk(KERN_INFO "ViCam webcam driver now controlling video device %d\n",cam->vdev.minor); |
1332 | 1332 | ||
1333 | usb_set_intfdata (intf, cam); | 1333 | usb_set_intfdata (intf, cam); |
1334 | 1334 | ||
1335 | return 0; | 1335 | return 0; |
1336 | } | 1336 | } |
1337 | 1337 | ||
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 95a6e47c99f1..11a97f30b876 100644 --- a/drivers/media/video/v4l2-common.c +++ b/drivers/media/video/v4l2-common.c | |||
@@ -312,8 +312,6 @@ static const char *v4l2_int_ioctls[] = { | |||
312 | [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP", | 312 | [_IOC_NR(DECODER_DUMP)] = "DECODER_DUMP", |
313 | #endif | 313 | #endif |
314 | [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", | 314 | [_IOC_NR(AUDC_SET_RADIO)] = "AUDC_SET_RADIO", |
315 | [_IOC_NR(AUDC_SET_INPUT)] = "AUDC_SET_INPUT", | ||
316 | [_IOC_NR(MSP_SET_MATRIX)] = "MSP_SET_MATRIX", | ||
317 | 315 | ||
318 | [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", | 316 | [_IOC_NR(TUNER_SET_TYPE_ADDR)] = "TUNER_SET_TYPE_ADDR", |
319 | [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", | 317 | [_IOC_NR(TUNER_SET_STANDBY)] = "TUNER_SET_STANDBY", |
@@ -419,7 +417,6 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
419 | case TUNER_SET_TYPE_ADDR: | 417 | case TUNER_SET_TYPE_ADDR: |
420 | case TUNER_SET_STANDBY: | 418 | case TUNER_SET_STANDBY: |
421 | case TDA9887_SET_CONFIG: | 419 | case TDA9887_SET_CONFIG: |
422 | case AUDC_SET_INPUT: | ||
423 | case VIDIOC_OVERLAY_OLD: | 420 | case VIDIOC_OVERLAY_OLD: |
424 | case VIDIOC_STREAMOFF: | 421 | case VIDIOC_STREAMOFF: |
425 | case VIDIOC_G_OUTPUT: | 422 | case VIDIOC_G_OUTPUT: |
@@ -433,12 +430,6 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
433 | printk ("%s: value=%d\n", s, *p); | 430 | printk ("%s: value=%d\n", s, *p); |
434 | break; | 431 | break; |
435 | } | 432 | } |
436 | case MSP_SET_MATRIX: | ||
437 | { | ||
438 | struct msp_matrix *p=arg; | ||
439 | printk ("%s: input=%d, output=%d\n", s, p->input, p->output); | ||
440 | break; | ||
441 | } | ||
442 | case VIDIOC_G_AUDIO: | 433 | case VIDIOC_G_AUDIO: |
443 | case VIDIOC_S_AUDIO: | 434 | case VIDIOC_S_AUDIO: |
444 | case VIDIOC_ENUMAUDIO: | 435 | case VIDIOC_ENUMAUDIO: |
@@ -467,7 +458,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
467 | struct v4l2_buffer *p=arg; | 458 | struct v4l2_buffer *p=arg; |
468 | struct v4l2_timecode *tc=&p->timecode; | 459 | struct v4l2_timecode *tc=&p->timecode; |
469 | printk ("%s: %02ld:%02d:%02d.%08ld index=%d, type=%s, " | 460 | printk ("%s: %02ld:%02d:%02d.%08ld index=%d, type=%s, " |
470 | "bytesused=%d, flags=0x%08d, " | 461 | "bytesused=%d, flags=0x%08x, " |
471 | "field=%0d, sequence=%d, memory=%s, offset/userptr=0x%08lx\n", | 462 | "field=%0d, sequence=%d, memory=%s, offset/userptr=0x%08lx\n", |
472 | s, | 463 | s, |
473 | (p->timestamp.tv_sec/3600), | 464 | (p->timestamp.tv_sec/3600), |
@@ -481,16 +472,16 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
481 | prt_names(p->memory,v4l2_memory_names), | 472 | prt_names(p->memory,v4l2_memory_names), |
482 | p->m.userptr); | 473 | p->m.userptr); |
483 | printk ("%s: timecode= %02d:%02d:%02d type=%d, " | 474 | printk ("%s: timecode= %02d:%02d:%02d type=%d, " |
484 | "flags=0x%08d, frames=%d, userbits=0x%08x", | 475 | "flags=0x%08x, frames=%d, userbits=0x%p\n", |
485 | s,tc->hours,tc->minutes,tc->seconds, | 476 | s,tc->hours,tc->minutes,tc->seconds, |
486 | tc->type, tc->flags, tc->frames, (__u32) tc->userbits); | 477 | tc->type, tc->flags, tc->frames, tc->userbits); |
487 | break; | 478 | break; |
488 | } | 479 | } |
489 | case VIDIOC_QUERYCAP: | 480 | case VIDIOC_QUERYCAP: |
490 | { | 481 | { |
491 | struct v4l2_capability *p=arg; | 482 | struct v4l2_capability *p=arg; |
492 | printk ("%s: driver=%s, card=%s, bus=%s, version=%d, " | 483 | printk ("%s: driver=%s, card=%s, bus=%s, version=0x%08x, " |
493 | "capabilities=%d\n", s, | 484 | "capabilities=0x%08x\n", s, |
494 | p->driver,p->card,p->bus_info, | 485 | p->driver,p->card,p->bus_info, |
495 | p->version, | 486 | p->version, |
496 | p->capabilities); | 487 | p->capabilities); |
@@ -574,9 +565,10 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
574 | { | 565 | { |
575 | struct v4l2_input *p=arg; | 566 | struct v4l2_input *p=arg; |
576 | printk ("%s: index=%d, name=%s, type=%d, audioset=%d, " | 567 | printk ("%s: index=%d, name=%s, type=%d, audioset=%d, " |
577 | "tuner=%d, std=%lld, status=%d\n", s, | 568 | "tuner=%d, std=%Ld, status=%d\n", s, |
578 | p->index,p->name,p->type,p->audioset, | 569 | p->index,p->name,p->type,p->audioset, |
579 | p->tuner,p->std, | 570 | p->tuner, |
571 | (unsigned long long)p->std, | ||
580 | p->status); | 572 | p->status); |
581 | break; | 573 | break; |
582 | } | 574 | } |
@@ -620,9 +612,10 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
620 | { | 612 | { |
621 | struct v4l2_output *p=arg; | 613 | struct v4l2_output *p=arg; |
622 | printk ("%s: index=%d, name=%s,type=%d, audioset=%d, " | 614 | printk ("%s: index=%d, name=%s,type=%d, audioset=%d, " |
623 | "modulator=%d, std=%lld\n", | 615 | "modulator=%d, std=%Ld\n", |
624 | s,p->index,p->name,p->type,p->audioset, | 616 | s,p->index,p->name,p->type,p->audioset, |
625 | p->modulator,p->std); | 617 | p->modulator, |
618 | (unsigned long long)p->std); | ||
626 | break; | 619 | break; |
627 | } | 620 | } |
628 | case VIDIOC_QUERYCTRL: | 621 | case VIDIOC_QUERYCTRL: |
@@ -665,7 +658,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
665 | case VIDIOC_INT_G_VIDEO_ROUTING: | 658 | case VIDIOC_INT_G_VIDEO_ROUTING: |
666 | { | 659 | { |
667 | struct v4l2_routing *p=arg; | 660 | struct v4l2_routing *p=arg; |
668 | printk ("%s: input=%d, output=%d\n", s, p->input, p->output); | 661 | printk ("%s: input=0x%x, output=0x%x\n", s, p->input, p->output); |
669 | break; | 662 | break; |
670 | } | 663 | } |
671 | case VIDIOC_G_SLICED_VBI_CAP: | 664 | case VIDIOC_G_SLICED_VBI_CAP: |
@@ -686,8 +679,9 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
686 | case VIDIOC_ENUMSTD: | 679 | case VIDIOC_ENUMSTD: |
687 | { | 680 | { |
688 | struct v4l2_standard *p=arg; | 681 | struct v4l2_standard *p=arg; |
689 | printk ("%s: index=%d, id=%lld, name=%s, fps=%d/%d, framelines=%d\n", s, | 682 | printk ("%s: index=%d, id=%Ld, name=%s, fps=%d/%d, " |
690 | p->index, p->id, p->name, | 683 | "framelines=%d\n", s, p->index, |
684 | (unsigned long long)p->id, p->name, | ||
691 | p->frameperiod.numerator, | 685 | p->frameperiod.numerator, |
692 | p->frameperiod.denominator, | 686 | p->frameperiod.denominator, |
693 | p->framelines); | 687 | p->framelines); |
@@ -907,7 +901,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) | |||
907 | { | 901 | { |
908 | v4l2_std_id *p=arg; | 902 | v4l2_std_id *p=arg; |
909 | 903 | ||
910 | printk ("%s: value=%llu\n", s, *p); | 904 | printk ("%s: value=%Lu\n", s, (unsigned long long)*p); |
911 | break; | 905 | break; |
912 | } | 906 | } |
913 | } | 907 | } |
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c index 87e937581d5a..d2ca0f08d0df 100644 --- a/drivers/media/video/video-buf.c +++ b/drivers/media/video/video-buf.c | |||
@@ -1,15 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * generic helper functions for video4linux capture buffers, to handle | 3 | * generic helper functions for video4linux capture buffers, to handle |
4 | * memory management and PCI DMA. Right now bttv + saa7134 use it. | 4 | * memory management and PCI DMA. |
5 | * Right now, bttv, saa7134, saa7146 and cx88 use it. | ||
5 | * | 6 | * |
6 | * The functions expect the hardware being able to scatter gatter | 7 | * The functions expect the hardware being able to scatter gatter |
7 | * (i.e. the buffers are not linear in physical memory, but fragmented | 8 | * (i.e. the buffers are not linear in physical memory, but fragmented |
8 | * into PAGE_SIZE chunks). They also assume the driver does not need | 9 | * into PAGE_SIZE chunks). They also assume the driver does not need |
9 | * to touch the video data (thus it is probably not useful for USB 1.1 | 10 | * to touch the video data. |
10 | * as data often must be uncompressed by the drivers). | 11 | * |
12 | * device specific map/unmap/sync stuff now are mapped as operations | ||
13 | * to allow its usage by USB and virtual devices. | ||
11 | * | 14 | * |
12 | * (c) 2001-2004 Gerd Knorr <kraxel@bytesex.org> [SUSE Labs] | 15 | * (c) 2001-2004 Gerd Knorr <kraxel@bytesex.org> [SUSE Labs] |
16 | * (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org> | ||
17 | * (c) 2006 Ted Walther and John Sokol | ||
13 | * | 18 | * |
14 | * This program is free software; you can redistribute it and/or modify | 19 | * This program is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License as published by | 20 | * it under the terms of the GNU General Public License as published by |
@@ -167,6 +172,9 @@ int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, | |||
167 | dprintk(1,"vmalloc_32(%d pages) failed\n",nr_pages); | 172 | dprintk(1,"vmalloc_32(%d pages) failed\n",nr_pages); |
168 | return -ENOMEM; | 173 | return -ENOMEM; |
169 | } | 174 | } |
175 | dprintk(1,"vmalloc is at addr 0x%08lx, size=%d\n", | ||
176 | (unsigned long)dma->vmalloc, | ||
177 | nr_pages << PAGE_SHIFT); | ||
170 | memset(dma->vmalloc,0,nr_pages << PAGE_SHIFT); | 178 | memset(dma->vmalloc,0,nr_pages << PAGE_SHIFT); |
171 | dma->nr_pages = nr_pages; | 179 | dma->nr_pages = nr_pages; |
172 | return 0; | 180 | return 0; |
@@ -186,8 +194,10 @@ int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, | |||
186 | return 0; | 194 | return 0; |
187 | } | 195 | } |
188 | 196 | ||
189 | int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) | 197 | int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma) |
190 | { | 198 | { |
199 | void *dev=q->dev; | ||
200 | |||
191 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 201 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
192 | BUG_ON(0 == dma->nr_pages); | 202 | BUG_ON(0 == dma->nr_pages); |
193 | 203 | ||
@@ -197,7 +207,7 @@ int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) | |||
197 | } | 207 | } |
198 | if (dma->vmalloc) { | 208 | if (dma->vmalloc) { |
199 | dma->sglist = videobuf_vmalloc_to_sg | 209 | dma->sglist = videobuf_vmalloc_to_sg |
200 | (dma->vmalloc,dma->nr_pages); | 210 | (dma->vmalloc,dma->nr_pages); |
201 | } | 211 | } |
202 | if (dma->bus_addr) { | 212 | if (dma->bus_addr) { |
203 | dma->sglist = kmalloc(sizeof(struct scatterlist), GFP_KERNEL); | 213 | dma->sglist = kmalloc(sizeof(struct scatterlist), GFP_KERNEL); |
@@ -212,13 +222,14 @@ int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) | |||
212 | dprintk(1,"scatterlist is NULL\n"); | 222 | dprintk(1,"scatterlist is NULL\n"); |
213 | return -ENOMEM; | 223 | return -ENOMEM; |
214 | } | 224 | } |
215 | |||
216 | if (!dma->bus_addr) { | 225 | if (!dma->bus_addr) { |
217 | dma->sglen = pci_map_sg(dev,dma->sglist,dma->nr_pages, | 226 | if (q->ops->vb_map_sg) { |
218 | dma->direction); | 227 | dma->sglen = q->ops->vb_map_sg(dev,dma->sglist, |
228 | dma->nr_pages, dma->direction); | ||
229 | } | ||
219 | if (0 == dma->sglen) { | 230 | if (0 == dma->sglen) { |
220 | printk(KERN_WARNING | 231 | printk(KERN_WARNING |
221 | "%s: pci_map_sg failed\n",__FUNCTION__); | 232 | "%s: videobuf_map_sg failed\n",__FUNCTION__); |
222 | kfree(dma->sglist); | 233 | kfree(dma->sglist); |
223 | dma->sglist = NULL; | 234 | dma->sglist = NULL; |
224 | dma->sglen = 0; | 235 | dma->sglen = 0; |
@@ -228,24 +239,31 @@ int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma) | |||
228 | return 0; | 239 | return 0; |
229 | } | 240 | } |
230 | 241 | ||
231 | int videobuf_dma_pci_sync(struct pci_dev *dev, struct videobuf_dmabuf *dma) | 242 | int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma) |
232 | { | 243 | { |
244 | void *dev=q->dev; | ||
245 | |||
233 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 246 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
234 | BUG_ON(!dma->sglen); | 247 | BUG_ON(!dma->sglen); |
235 | 248 | ||
236 | if (!dma->bus_addr) | 249 | if (!dma->bus_addr && q->ops->vb_dma_sync_sg) |
237 | pci_dma_sync_sg_for_cpu(dev,dma->sglist,dma->nr_pages,dma->direction); | 250 | q->ops->vb_dma_sync_sg(dev,dma->sglist,dma->nr_pages, |
251 | dma->direction); | ||
252 | |||
238 | return 0; | 253 | return 0; |
239 | } | 254 | } |
240 | 255 | ||
241 | int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma) | 256 | int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma) |
242 | { | 257 | { |
258 | void *dev=q->dev; | ||
259 | |||
243 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); | 260 | MAGIC_CHECK(dma->magic,MAGIC_DMABUF); |
244 | if (!dma->sglen) | 261 | if (!dma->sglen) |
245 | return 0; | 262 | return 0; |
246 | 263 | ||
247 | if (!dma->bus_addr) | 264 | if (!dma->bus_addr && q->ops->vb_unmap_sg) |
248 | pci_unmap_sg(dev,dma->sglist,dma->nr_pages,dma->direction); | 265 | q->ops->vb_unmap_sg(dev,dma->sglist,dma->nr_pages, |
266 | dma->direction); | ||
249 | kfree(dma->sglist); | 267 | kfree(dma->sglist); |
250 | dma->sglist = NULL; | 268 | dma->sglist = NULL; |
251 | dma->sglen = 0; | 269 | dma->sglen = 0; |
@@ -318,7 +336,7 @@ int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr) | |||
318 | } | 336 | } |
319 | 337 | ||
320 | int | 338 | int |
321 | videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, | 339 | videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, |
322 | struct v4l2_framebuffer *fbuf) | 340 | struct v4l2_framebuffer *fbuf) |
323 | { | 341 | { |
324 | int err,pages; | 342 | int err,pages; |
@@ -357,7 +375,7 @@ videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, | |||
357 | default: | 375 | default: |
358 | BUG(); | 376 | BUG(); |
359 | } | 377 | } |
360 | err = videobuf_dma_pci_map(pci,&vb->dma); | 378 | err = videobuf_dma_map(q,&vb->dma); |
361 | if (0 != err) | 379 | if (0 != err) |
362 | return err; | 380 | return err; |
363 | 381 | ||
@@ -366,9 +384,41 @@ videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, | |||
366 | 384 | ||
367 | /* --------------------------------------------------------------------- */ | 385 | /* --------------------------------------------------------------------- */ |
368 | 386 | ||
387 | void videobuf_queue_pci(struct videobuf_queue* q) | ||
388 | { | ||
389 | /* If not specified, defaults to PCI map sg */ | ||
390 | if (!q->ops->vb_map_sg) | ||
391 | q->ops->vb_map_sg=(vb_map_sg_t *)pci_map_sg; | ||
392 | |||
393 | if (!q->ops->vb_dma_sync_sg) | ||
394 | q->ops->vb_dma_sync_sg=(vb_map_sg_t *)pci_dma_sync_sg_for_cpu; | ||
395 | if (!q->ops->vb_unmap_sg) | ||
396 | q->ops->vb_unmap_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
397 | } | ||
398 | |||
399 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma) | ||
400 | { | ||
401 | struct videobuf_queue q; | ||
402 | |||
403 | q.dev=pci; | ||
404 | q.ops->vb_map_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
405 | |||
406 | return (videobuf_dma_unmap(&q,dma)); | ||
407 | } | ||
408 | |||
409 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma) | ||
410 | { | ||
411 | struct videobuf_queue q; | ||
412 | |||
413 | q.dev=pci; | ||
414 | q.ops->vb_map_sg=(vb_map_sg_t *)pci_unmap_sg; | ||
415 | |||
416 | return (videobuf_dma_unmap(&q,dma)); | ||
417 | } | ||
418 | |||
369 | void videobuf_queue_init(struct videobuf_queue* q, | 419 | void videobuf_queue_init(struct videobuf_queue* q, |
370 | struct videobuf_queue_ops *ops, | 420 | struct videobuf_queue_ops *ops, |
371 | struct pci_dev *pci, | 421 | void *dev, |
372 | spinlock_t *irqlock, | 422 | spinlock_t *irqlock, |
373 | enum v4l2_buf_type type, | 423 | enum v4l2_buf_type type, |
374 | enum v4l2_field field, | 424 | enum v4l2_field field, |
@@ -377,13 +427,15 @@ void videobuf_queue_init(struct videobuf_queue* q, | |||
377 | { | 427 | { |
378 | memset(q,0,sizeof(*q)); | 428 | memset(q,0,sizeof(*q)); |
379 | q->irqlock = irqlock; | 429 | q->irqlock = irqlock; |
380 | q->pci = pci; | 430 | q->dev = dev; |
381 | q->type = type; | 431 | q->type = type; |
382 | q->field = field; | 432 | q->field = field; |
383 | q->msize = msize; | 433 | q->msize = msize; |
384 | q->ops = ops; | 434 | q->ops = ops; |
385 | q->priv_data = priv; | 435 | q->priv_data = priv; |
386 | 436 | ||
437 | videobuf_queue_pci(q); | ||
438 | |||
387 | mutex_init(&q->lock); | 439 | mutex_init(&q->lock); |
388 | INIT_LIST_HEAD(&q->stream); | 440 | INIT_LIST_HEAD(&q->stream); |
389 | } | 441 | } |
@@ -431,7 +483,8 @@ videobuf_queue_cancel(struct videobuf_queue *q) | |||
431 | int i; | 483 | int i; |
432 | 484 | ||
433 | /* remove queued buffers from list */ | 485 | /* remove queued buffers from list */ |
434 | spin_lock_irqsave(q->irqlock,flags); | 486 | if (q->irqlock) |
487 | spin_lock_irqsave(q->irqlock,flags); | ||
435 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | 488 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { |
436 | if (NULL == q->bufs[i]) | 489 | if (NULL == q->bufs[i]) |
437 | continue; | 490 | continue; |
@@ -440,7 +493,8 @@ videobuf_queue_cancel(struct videobuf_queue *q) | |||
440 | q->bufs[i]->state = STATE_ERROR; | 493 | q->bufs[i]->state = STATE_ERROR; |
441 | } | 494 | } |
442 | } | 495 | } |
443 | spin_unlock_irqrestore(q->irqlock,flags); | 496 | if (q->irqlock) |
497 | spin_unlock_irqrestore(q->irqlock,flags); | ||
444 | 498 | ||
445 | /* free all buffers + clear queue */ | 499 | /* free all buffers + clear queue */ |
446 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { | 500 | for (i = 0; i < VIDEO_MAX_FRAME; i++) { |
@@ -534,19 +588,29 @@ videobuf_reqbufs(struct videobuf_queue *q, | |||
534 | unsigned int size,count; | 588 | unsigned int size,count; |
535 | int retval; | 589 | int retval; |
536 | 590 | ||
537 | if (req->type != q->type) | 591 | if (req->type != q->type) { |
592 | dprintk(1,"reqbufs: queue type invalid\n"); | ||
538 | return -EINVAL; | 593 | return -EINVAL; |
539 | if (req->count < 1) | 594 | } |
595 | if (req->count < 1) { | ||
596 | dprintk(1,"reqbufs: count invalid (%d)\n",req->count); | ||
540 | return -EINVAL; | 597 | return -EINVAL; |
598 | } | ||
541 | if (req->memory != V4L2_MEMORY_MMAP && | 599 | if (req->memory != V4L2_MEMORY_MMAP && |
542 | req->memory != V4L2_MEMORY_USERPTR && | 600 | req->memory != V4L2_MEMORY_USERPTR && |
543 | req->memory != V4L2_MEMORY_OVERLAY) | 601 | req->memory != V4L2_MEMORY_OVERLAY) { |
602 | dprintk(1,"reqbufs: memory type invalid\n"); | ||
544 | return -EINVAL; | 603 | return -EINVAL; |
604 | } | ||
545 | 605 | ||
546 | if (q->streaming) | 606 | if (q->streaming) { |
607 | dprintk(1,"reqbufs: streaming already exists\n"); | ||
547 | return -EBUSY; | 608 | return -EBUSY; |
548 | if (!list_empty(&q->stream)) | 609 | } |
610 | if (!list_empty(&q->stream)) { | ||
611 | dprintk(1,"reqbufs: stream running\n"); | ||
549 | return -EBUSY; | 612 | return -EBUSY; |
613 | } | ||
550 | 614 | ||
551 | mutex_lock(&q->lock); | 615 | mutex_lock(&q->lock); |
552 | count = req->count; | 616 | count = req->count; |
@@ -559,8 +623,10 @@ videobuf_reqbufs(struct videobuf_queue *q, | |||
559 | count, size, (count*size)>>PAGE_SHIFT); | 623 | count, size, (count*size)>>PAGE_SHIFT); |
560 | 624 | ||
561 | retval = videobuf_mmap_setup(q,count,size,req->memory); | 625 | retval = videobuf_mmap_setup(q,count,size,req->memory); |
562 | if (retval < 0) | 626 | if (retval < 0) { |
627 | dprintk(1,"reqbufs: mmap setup returned %d\n",retval); | ||
563 | goto done; | 628 | goto done; |
629 | } | ||
564 | 630 | ||
565 | req->count = count; | 631 | req->count = count; |
566 | 632 | ||
@@ -572,12 +638,18 @@ videobuf_reqbufs(struct videobuf_queue *q, | |||
572 | int | 638 | int |
573 | videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) | 639 | videobuf_querybuf(struct videobuf_queue *q, struct v4l2_buffer *b) |
574 | { | 640 | { |
575 | if (unlikely(b->type != q->type)) | 641 | if (unlikely(b->type != q->type)) { |
642 | dprintk(1,"querybuf: Wrong type.\n"); | ||
576 | return -EINVAL; | 643 | return -EINVAL; |
577 | if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) | 644 | } |
645 | if (unlikely(b->index < 0 || b->index >= VIDEO_MAX_FRAME)) { | ||
646 | dprintk(1,"querybuf: index out of range.\n"); | ||
578 | return -EINVAL; | 647 | return -EINVAL; |
579 | if (unlikely(NULL == q->bufs[b->index])) | 648 | } |
649 | if (unlikely(NULL == q->bufs[b->index])) { | ||
650 | dprintk(1,"querybuf: buffer is null.\n"); | ||
580 | return -EINVAL; | 651 | return -EINVAL; |
652 | } | ||
581 | videobuf_status(b,q->bufs[b->index],q->type); | 653 | videobuf_status(b,q->bufs[b->index],q->type); |
582 | return 0; | 654 | return 0; |
583 | } | 655 | } |
@@ -593,26 +665,40 @@ videobuf_qbuf(struct videobuf_queue *q, | |||
593 | 665 | ||
594 | mutex_lock(&q->lock); | 666 | mutex_lock(&q->lock); |
595 | retval = -EBUSY; | 667 | retval = -EBUSY; |
596 | if (q->reading) | 668 | if (q->reading) { |
669 | dprintk(1,"qbuf: Reading running...\n"); | ||
597 | goto done; | 670 | goto done; |
671 | } | ||
598 | retval = -EINVAL; | 672 | retval = -EINVAL; |
599 | if (b->type != q->type) | 673 | if (b->type != q->type) { |
674 | dprintk(1,"qbuf: Wrong type.\n"); | ||
600 | goto done; | 675 | goto done; |
601 | if (b->index < 0 || b->index >= VIDEO_MAX_FRAME) | 676 | } |
677 | if (b->index < 0 || b->index >= VIDEO_MAX_FRAME) { | ||
678 | dprintk(1,"qbuf: index out of range.\n"); | ||
602 | goto done; | 679 | goto done; |
680 | } | ||
603 | buf = q->bufs[b->index]; | 681 | buf = q->bufs[b->index]; |
604 | if (NULL == buf) | 682 | if (NULL == buf) { |
683 | dprintk(1,"qbuf: buffer is null.\n"); | ||
605 | goto done; | 684 | goto done; |
685 | } | ||
606 | MAGIC_CHECK(buf->magic,MAGIC_BUFFER); | 686 | MAGIC_CHECK(buf->magic,MAGIC_BUFFER); |
607 | if (buf->memory != b->memory) | 687 | if (buf->memory != b->memory) { |
688 | dprintk(1,"qbuf: memory type is wrong.\n"); | ||
608 | goto done; | 689 | goto done; |
690 | } | ||
609 | if (buf->state == STATE_QUEUED || | 691 | if (buf->state == STATE_QUEUED || |
610 | buf->state == STATE_ACTIVE) | 692 | buf->state == STATE_ACTIVE) { |
693 | dprintk(1,"qbuf: buffer is already queued or active.\n"); | ||
611 | goto done; | 694 | goto done; |
695 | } | ||
612 | 696 | ||
613 | if (b->flags & V4L2_BUF_FLAG_INPUT) { | 697 | if (b->flags & V4L2_BUF_FLAG_INPUT) { |
614 | if (b->input >= q->inputs) | 698 | if (b->input >= q->inputs) { |
699 | dprintk(1,"qbuf: wrong input.\n"); | ||
615 | goto done; | 700 | goto done; |
701 | } | ||
616 | buf->input = b->input; | 702 | buf->input = b->input; |
617 | } else { | 703 | } else { |
618 | buf->input = UNSET; | 704 | buf->input = UNSET; |
@@ -620,12 +706,16 @@ videobuf_qbuf(struct videobuf_queue *q, | |||
620 | 706 | ||
621 | switch (b->memory) { | 707 | switch (b->memory) { |
622 | case V4L2_MEMORY_MMAP: | 708 | case V4L2_MEMORY_MMAP: |
623 | if (0 == buf->baddr) | 709 | if (0 == buf->baddr) { |
710 | dprintk(1,"qbuf: mmap requested but buffer addr is zero!\n"); | ||
624 | goto done; | 711 | goto done; |
712 | } | ||
625 | break; | 713 | break; |
626 | case V4L2_MEMORY_USERPTR: | 714 | case V4L2_MEMORY_USERPTR: |
627 | if (b->length < buf->bsize) | 715 | if (b->length < buf->bsize) { |
716 | dprintk(1,"qbuf: buffer length is not enough\n"); | ||
628 | goto done; | 717 | goto done; |
718 | } | ||
629 | if (STATE_NEEDS_INIT != buf->state && buf->baddr != b->m.userptr) | 719 | if (STATE_NEEDS_INIT != buf->state && buf->baddr != b->m.userptr) |
630 | q->ops->buf_release(q,buf); | 720 | q->ops->buf_release(q,buf); |
631 | buf->baddr = b->m.userptr; | 721 | buf->baddr = b->m.userptr; |
@@ -634,20 +724,27 @@ videobuf_qbuf(struct videobuf_queue *q, | |||
634 | buf->boff = b->m.offset; | 724 | buf->boff = b->m.offset; |
635 | break; | 725 | break; |
636 | default: | 726 | default: |
727 | dprintk(1,"qbuf: wrong memory type\n"); | ||
637 | goto done; | 728 | goto done; |
638 | } | 729 | } |
639 | 730 | ||
731 | dprintk(1,"qbuf: requesting next field\n"); | ||
640 | field = videobuf_next_field(q); | 732 | field = videobuf_next_field(q); |
641 | retval = q->ops->buf_prepare(q,buf,field); | 733 | retval = q->ops->buf_prepare(q,buf,field); |
642 | if (0 != retval) | 734 | if (0 != retval) { |
735 | dprintk(1,"qbuf: buffer_prepare returned %d\n",retval); | ||
643 | goto done; | 736 | goto done; |
737 | } | ||
644 | 738 | ||
645 | list_add_tail(&buf->stream,&q->stream); | 739 | list_add_tail(&buf->stream,&q->stream); |
646 | if (q->streaming) { | 740 | if (q->streaming) { |
647 | spin_lock_irqsave(q->irqlock,flags); | 741 | if (q->irqlock) |
742 | spin_lock_irqsave(q->irqlock,flags); | ||
648 | q->ops->buf_queue(q,buf); | 743 | q->ops->buf_queue(q,buf); |
649 | spin_unlock_irqrestore(q->irqlock,flags); | 744 | if (q->irqlock) |
745 | spin_unlock_irqrestore(q->irqlock,flags); | ||
650 | } | 746 | } |
747 | dprintk(1,"qbuf: succeded\n"); | ||
651 | retval = 0; | 748 | retval = 0; |
652 | 749 | ||
653 | done: | 750 | done: |
@@ -664,26 +761,39 @@ videobuf_dqbuf(struct videobuf_queue *q, | |||
664 | 761 | ||
665 | mutex_lock(&q->lock); | 762 | mutex_lock(&q->lock); |
666 | retval = -EBUSY; | 763 | retval = -EBUSY; |
667 | if (q->reading) | 764 | if (q->reading) { |
765 | dprintk(1,"dqbuf: Reading running...\n"); | ||
668 | goto done; | 766 | goto done; |
767 | } | ||
669 | retval = -EINVAL; | 768 | retval = -EINVAL; |
670 | if (b->type != q->type) | 769 | if (b->type != q->type) { |
770 | dprintk(1,"dqbuf: Wrong type.\n"); | ||
671 | goto done; | 771 | goto done; |
672 | if (list_empty(&q->stream)) | 772 | } |
773 | if (list_empty(&q->stream)) { | ||
774 | dprintk(1,"dqbuf: stream running\n"); | ||
673 | goto done; | 775 | goto done; |
776 | } | ||
674 | buf = list_entry(q->stream.next, struct videobuf_buffer, stream); | 777 | buf = list_entry(q->stream.next, struct videobuf_buffer, stream); |
675 | retval = videobuf_waiton(buf, nonblocking, 1); | 778 | retval = videobuf_waiton(buf, nonblocking, 1); |
676 | if (retval < 0) | 779 | if (retval < 0) { |
780 | dprintk(1,"dqbuf: waiton returned %d\n",retval); | ||
677 | goto done; | 781 | goto done; |
782 | } | ||
678 | switch (buf->state) { | 783 | switch (buf->state) { |
679 | case STATE_ERROR: | 784 | case STATE_ERROR: |
785 | dprintk(1,"dqbuf: state is error\n"); | ||
680 | retval = -EIO; | 786 | retval = -EIO; |
681 | /* fall through */ | 787 | videobuf_dma_sync(q,&buf->dma); |
788 | buf->state = STATE_IDLE; | ||
789 | break; | ||
682 | case STATE_DONE: | 790 | case STATE_DONE: |
683 | videobuf_dma_pci_sync(q->pci,&buf->dma); | 791 | dprintk(1,"dqbuf: state is done\n"); |
792 | videobuf_dma_sync(q,&buf->dma); | ||
684 | buf->state = STATE_IDLE; | 793 | buf->state = STATE_IDLE; |
685 | break; | 794 | break; |
686 | default: | 795 | default: |
796 | dprintk(1,"dqbuf: state invalid\n"); | ||
687 | retval = -EINVAL; | 797 | retval = -EINVAL; |
688 | goto done; | 798 | goto done; |
689 | } | 799 | } |
@@ -711,13 +821,15 @@ int videobuf_streamon(struct videobuf_queue *q) | |||
711 | if (q->streaming) | 821 | if (q->streaming) |
712 | goto done; | 822 | goto done; |
713 | q->streaming = 1; | 823 | q->streaming = 1; |
714 | spin_lock_irqsave(q->irqlock,flags); | 824 | if (q->irqlock) |
825 | spin_lock_irqsave(q->irqlock,flags); | ||
715 | list_for_each(list,&q->stream) { | 826 | list_for_each(list,&q->stream) { |
716 | buf = list_entry(list, struct videobuf_buffer, stream); | 827 | buf = list_entry(list, struct videobuf_buffer, stream); |
717 | if (buf->state == STATE_PREPARED) | 828 | if (buf->state == STATE_PREPARED) |
718 | q->ops->buf_queue(q,buf); | 829 | q->ops->buf_queue(q,buf); |
719 | } | 830 | } |
720 | spin_unlock_irqrestore(q->irqlock,flags); | 831 | if (q->irqlock) |
832 | spin_unlock_irqrestore(q->irqlock,flags); | ||
721 | 833 | ||
722 | done: | 834 | done: |
723 | mutex_unlock(&q->lock); | 835 | mutex_unlock(&q->lock); |
@@ -762,12 +874,14 @@ videobuf_read_zerocopy(struct videobuf_queue *q, char __user *data, | |||
762 | goto done; | 874 | goto done; |
763 | 875 | ||
764 | /* start capture & wait */ | 876 | /* start capture & wait */ |
765 | spin_lock_irqsave(q->irqlock,flags); | 877 | if (q->irqlock) |
878 | spin_lock_irqsave(q->irqlock,flags); | ||
766 | q->ops->buf_queue(q,q->read_buf); | 879 | q->ops->buf_queue(q,q->read_buf); |
767 | spin_unlock_irqrestore(q->irqlock,flags); | 880 | if (q->irqlock) |
881 | spin_unlock_irqrestore(q->irqlock,flags); | ||
768 | retval = videobuf_waiton(q->read_buf,0,0); | 882 | retval = videobuf_waiton(q->read_buf,0,0); |
769 | if (0 == retval) { | 883 | if (0 == retval) { |
770 | videobuf_dma_pci_sync(q->pci,&q->read_buf->dma); | 884 | videobuf_dma_sync(q,&q->read_buf->dma); |
771 | if (STATE_ERROR == q->read_buf->state) | 885 | if (STATE_ERROR == q->read_buf->state) |
772 | retval = -EIO; | 886 | retval = -EIO; |
773 | else | 887 | else |
@@ -809,6 +923,7 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
809 | /* need to capture a new frame */ | 923 | /* need to capture a new frame */ |
810 | retval = -ENOMEM; | 924 | retval = -ENOMEM; |
811 | q->read_buf = videobuf_alloc(q->msize); | 925 | q->read_buf = videobuf_alloc(q->msize); |
926 | dprintk(1,"video alloc=0x%08x\n",(unsigned int) q->read_buf); | ||
812 | if (NULL == q->read_buf) | 927 | if (NULL == q->read_buf) |
813 | goto done; | 928 | goto done; |
814 | q->read_buf->memory = V4L2_MEMORY_USERPTR; | 929 | q->read_buf->memory = V4L2_MEMORY_USERPTR; |
@@ -820,9 +935,11 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
820 | q->read_buf = NULL; | 935 | q->read_buf = NULL; |
821 | goto done; | 936 | goto done; |
822 | } | 937 | } |
823 | spin_lock_irqsave(q->irqlock,flags); | 938 | if (q->irqlock) |
939 | spin_lock_irqsave(q->irqlock,flags); | ||
824 | q->ops->buf_queue(q,q->read_buf); | 940 | q->ops->buf_queue(q,q->read_buf); |
825 | spin_unlock_irqrestore(q->irqlock,flags); | 941 | if (q->irqlock) |
942 | spin_unlock_irqrestore(q->irqlock,flags); | ||
826 | q->read_off = 0; | 943 | q->read_off = 0; |
827 | } | 944 | } |
828 | 945 | ||
@@ -830,7 +947,7 @@ ssize_t videobuf_read_one(struct videobuf_queue *q, | |||
830 | retval = videobuf_waiton(q->read_buf, nonblocking, 1); | 947 | retval = videobuf_waiton(q->read_buf, nonblocking, 1); |
831 | if (0 != retval) | 948 | if (0 != retval) |
832 | goto done; | 949 | goto done; |
833 | videobuf_dma_pci_sync(q->pci,&q->read_buf->dma); | 950 | videobuf_dma_sync(q,&q->read_buf->dma); |
834 | 951 | ||
835 | if (STATE_ERROR == q->read_buf->state) { | 952 | if (STATE_ERROR == q->read_buf->state) { |
836 | /* catch I/O errors */ | 953 | /* catch I/O errors */ |
@@ -887,10 +1004,12 @@ int videobuf_read_start(struct videobuf_queue *q) | |||
887 | return err; | 1004 | return err; |
888 | list_add_tail(&q->bufs[i]->stream, &q->stream); | 1005 | list_add_tail(&q->bufs[i]->stream, &q->stream); |
889 | } | 1006 | } |
890 | spin_lock_irqsave(q->irqlock,flags); | 1007 | if (q->irqlock) |
1008 | spin_lock_irqsave(q->irqlock,flags); | ||
891 | for (i = 0; i < count; i++) | 1009 | for (i = 0; i < count; i++) |
892 | q->ops->buf_queue(q,q->bufs[i]); | 1010 | q->ops->buf_queue(q,q->bufs[i]); |
893 | spin_unlock_irqrestore(q->irqlock,flags); | 1011 | if (q->irqlock) |
1012 | spin_unlock_irqrestore(q->irqlock,flags); | ||
894 | q->reading = 1; | 1013 | q->reading = 1; |
895 | return 0; | 1014 | return 0; |
896 | } | 1015 | } |
@@ -985,9 +1104,11 @@ ssize_t videobuf_read_stream(struct videobuf_queue *q, | |||
985 | if (q->read_off == q->read_buf->size) { | 1104 | if (q->read_off == q->read_buf->size) { |
986 | list_add_tail(&q->read_buf->stream, | 1105 | list_add_tail(&q->read_buf->stream, |
987 | &q->stream); | 1106 | &q->stream); |
988 | spin_lock_irqsave(q->irqlock,flags); | 1107 | if (q->irqlock) |
1108 | spin_lock_irqsave(q->irqlock,flags); | ||
989 | q->ops->buf_queue(q,q->read_buf); | 1109 | q->ops->buf_queue(q,q->read_buf); |
990 | spin_unlock_irqrestore(q->irqlock,flags); | 1110 | if (q->irqlock) |
1111 | spin_unlock_irqrestore(q->irqlock,flags); | ||
991 | q->read_buf = NULL; | 1112 | q->read_buf = NULL; |
992 | } | 1113 | } |
993 | if (retval < 0) | 1114 | if (retval < 0) |
@@ -1249,11 +1370,14 @@ EXPORT_SYMBOL_GPL(videobuf_dma_init); | |||
1249 | EXPORT_SYMBOL_GPL(videobuf_dma_init_user); | 1370 | EXPORT_SYMBOL_GPL(videobuf_dma_init_user); |
1250 | EXPORT_SYMBOL_GPL(videobuf_dma_init_kernel); | 1371 | EXPORT_SYMBOL_GPL(videobuf_dma_init_kernel); |
1251 | EXPORT_SYMBOL_GPL(videobuf_dma_init_overlay); | 1372 | EXPORT_SYMBOL_GPL(videobuf_dma_init_overlay); |
1252 | EXPORT_SYMBOL_GPL(videobuf_dma_pci_map); | 1373 | EXPORT_SYMBOL_GPL(videobuf_dma_map); |
1253 | EXPORT_SYMBOL_GPL(videobuf_dma_pci_sync); | 1374 | EXPORT_SYMBOL_GPL(videobuf_dma_sync); |
1254 | EXPORT_SYMBOL_GPL(videobuf_dma_pci_unmap); | 1375 | EXPORT_SYMBOL_GPL(videobuf_dma_unmap); |
1255 | EXPORT_SYMBOL_GPL(videobuf_dma_free); | 1376 | EXPORT_SYMBOL_GPL(videobuf_dma_free); |
1256 | 1377 | ||
1378 | EXPORT_SYMBOL_GPL(videobuf_pci_dma_map); | ||
1379 | EXPORT_SYMBOL_GPL(videobuf_pci_dma_unmap); | ||
1380 | |||
1257 | EXPORT_SYMBOL_GPL(videobuf_alloc); | 1381 | EXPORT_SYMBOL_GPL(videobuf_alloc); |
1258 | EXPORT_SYMBOL_GPL(videobuf_waiton); | 1382 | EXPORT_SYMBOL_GPL(videobuf_waiton); |
1259 | EXPORT_SYMBOL_GPL(videobuf_iolock); | 1383 | EXPORT_SYMBOL_GPL(videobuf_iolock); |
diff --git a/drivers/media/video/videocodec.h b/drivers/media/video/videocodec.h index b1239ac7f371..8c233720b6a5 100644 --- a/drivers/media/video/videocodec.h +++ b/drivers/media/video/videocodec.h | |||
@@ -57,7 +57,7 @@ | |||
57 | therfor they may not be initialized. | 57 | therfor they may not be initialized. |
58 | 58 | ||
59 | The other fuctions are just for convenience, as they are for sure used by | 59 | The other fuctions are just for convenience, as they are for sure used by |
60 | most/all of the codecs. The last ones may be ommited, too. | 60 | most/all of the codecs. The last ones may be ommited, too. |
61 | 61 | ||
62 | See the structure declaration below for more information and which data has | 62 | See the structure declaration below for more information and which data has |
63 | to be set up for the master and the slave. | 63 | to be set up for the master and the slave. |
@@ -75,52 +75,52 @@ | |||
75 | /* ========================================== */ | 75 | /* ========================================== */ |
76 | 76 | ||
77 | /* | 77 | /* |
78 | ==== master setup ==== | 78 | ==== master setup ==== |
79 | name -> name of the device structure for reference and debugging | 79 | name -> name of the device structure for reference and debugging |
80 | master_data -> data ref. for the master (e.g. the zr36055,57,67) | 80 | master_data -> data ref. for the master (e.g. the zr36055,57,67) |
81 | readreg -> ref. to read-fn from register (setup by master, used by slave) | 81 | readreg -> ref. to read-fn from register (setup by master, used by slave) |
82 | writereg -> ref. to write-fn to register (setup by master, used by slave) | 82 | writereg -> ref. to write-fn to register (setup by master, used by slave) |
83 | this two functions do the lowlevel I/O job | 83 | this two functions do the lowlevel I/O job |
84 | 84 | ||
85 | ==== slave functionality setup ==== | 85 | ==== slave functionality setup ==== |
86 | slave_data -> data ref. for the slave (e.g. the zr36050,60) | 86 | slave_data -> data ref. for the slave (e.g. the zr36050,60) |
87 | check -> fn-ref. checks availability of an device, returns -EIO on failure or | 87 | check -> fn-ref. checks availability of an device, returns -EIO on failure or |
88 | the type on success | 88 | the type on success |
89 | this makes espcecially sense if a driver module supports more than | 89 | this makes espcecially sense if a driver module supports more than |
90 | one codec which may be quite similar to access, nevertheless it | 90 | one codec which may be quite similar to access, nevertheless it |
91 | is good for a first functionality check | 91 | is good for a first functionality check |
92 | 92 | ||
93 | -- main functions you always need for compression/decompression -- | 93 | -- main functions you always need for compression/decompression -- |
94 | 94 | ||
95 | set_mode -> this fn-ref. resets the entire codec, and sets up the mode | 95 | set_mode -> this fn-ref. resets the entire codec, and sets up the mode |
96 | with the last defined norm/size (or device default if not | 96 | with the last defined norm/size (or device default if not |
97 | available) - it returns 0 if the mode is possible | 97 | available) - it returns 0 if the mode is possible |
98 | set_size -> this fn-ref. sets the norm and image size for | 98 | set_size -> this fn-ref. sets the norm and image size for |
99 | compression/decompression (returns 0 on success) | 99 | compression/decompression (returns 0 on success) |
100 | the norm param is defined in videodev.h (VIDEO_MODE_*) | 100 | the norm param is defined in videodev.h (VIDEO_MODE_*) |
101 | 101 | ||
102 | additional setup may be available, too - but the codec should work with | 102 | additional setup may be available, too - but the codec should work with |
103 | some default values even without this | 103 | some default values even without this |
104 | 104 | ||
105 | set_data -> sets device-specific data (tables, quality etc.) | 105 | set_data -> sets device-specific data (tables, quality etc.) |
106 | get_data -> query device-specific data (tables, quality etc.) | 106 | get_data -> query device-specific data (tables, quality etc.) |
107 | 107 | ||
108 | if the device delivers interrupts, they may be setup/handled here | 108 | if the device delivers interrupts, they may be setup/handled here |
109 | setup_interrupt -> codec irq setup (not needed for 36050/60) | 109 | setup_interrupt -> codec irq setup (not needed for 36050/60) |
110 | handle_interrupt -> codec irq handling (not needed for 36050/60) | 110 | handle_interrupt -> codec irq handling (not needed for 36050/60) |
111 | 111 | ||
112 | if the device delivers pictures, they may be handled here | 112 | if the device delivers pictures, they may be handled here |
113 | put_image -> puts image data to the codec (not needed for 36050/60) | 113 | put_image -> puts image data to the codec (not needed for 36050/60) |
114 | get_image -> gets image data from the codec (not needed for 36050/60) | 114 | get_image -> gets image data from the codec (not needed for 36050/60) |
115 | the calls include frame numbers and flags (even/odd/...) | 115 | the calls include frame numbers and flags (even/odd/...) |
116 | if needed and a flag which allows blocking until its ready | 116 | if needed and a flag which allows blocking until its ready |
117 | */ | 117 | */ |
118 | 118 | ||
119 | /* ============== */ | 119 | /* ============== */ |
120 | /* user interface */ | 120 | /* user interface */ |
121 | /* ============== */ | 121 | /* ============== */ |
122 | 122 | ||
123 | /* | 123 | /* |
124 | Currently there is only a information display planned, as the layer | 124 | Currently there is only a information display planned, as the layer |
125 | is not visible for the user space at all. | 125 | is not visible for the user space at all. |
126 | 126 | ||
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index 0229819d0aac..a8c101494cf5 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c | |||
@@ -1555,12 +1555,12 @@ static void vino_update_line_size(struct vino_channel_settings *vcs) | |||
1555 | unsigned int w = vcs->clipping.right - vcs->clipping.left; | 1555 | unsigned int w = vcs->clipping.right - vcs->clipping.left; |
1556 | unsigned int d = vcs->decimation; | 1556 | unsigned int d = vcs->decimation; |
1557 | unsigned int bpp = vino_data_formats[vcs->data_format].bpp; | 1557 | unsigned int bpp = vino_data_formats[vcs->data_format].bpp; |
1558 | unsigned int lsize; | 1558 | unsigned int lsize; |
1559 | 1559 | ||
1560 | dprintk("update_line_size(): before: w = %d, d = %d, " | 1560 | dprintk("update_line_size(): before: w = %d, d = %d, " |
1561 | "line_size = %d\n", w, d, vcs->line_size); | 1561 | "line_size = %d\n", w, d, vcs->line_size); |
1562 | 1562 | ||
1563 | /* line size must be multiple of 8 bytes */ | 1563 | /* line size must be multiple of 8 bytes */ |
1564 | lsize = (bpp * (w / d)) & ~7; | 1564 | lsize = (bpp * (w / d)) & ~7; |
1565 | w = (lsize / bpp) * d; | 1565 | w = (lsize / bpp) * d; |
1566 | 1566 | ||
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c new file mode 100644 index 000000000000..5e813404d068 --- /dev/null +++ b/drivers/media/video/vivi.c | |||
@@ -0,0 +1,1454 @@ | |||
1 | /* | ||
2 | * Virtual Video driver - This code emulates a real video device with v4l2 api | ||
3 | * | ||
4 | * Copyright (c) 2006 by: | ||
5 | * Mauro Carvalho Chehab <mchehab--a.t--infradead.org> | ||
6 | * Ted Walther <ted--a.t--enumera.com> | ||
7 | * John Sokol <sokol--a.t--videotechnology.com> | ||
8 | * http://v4l.videotechnology.com/ | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or modify | ||
11 | * it under the terms of the BSD Licence, GNU General Public License | ||
12 | * as published by the Free Software Foundation; either version 2 of the | ||
13 | * License, or (at your option) any later version | ||
14 | */ | ||
15 | #include <linux/module.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/errno.h> | ||
18 | #include <linux/fs.h> | ||
19 | #include <linux/kernel.h> | ||
20 | #include <linux/slab.h> | ||
21 | #include <linux/mm.h> | ||
22 | #include <linux/ioport.h> | ||
23 | #include <linux/init.h> | ||
24 | #include <linux/sched.h> | ||
25 | #include <linux/pci.h> | ||
26 | #include <linux/random.h> | ||
27 | #include <linux/version.h> | ||
28 | #include <linux/videodev2.h> | ||
29 | #include <linux/interrupt.h> | ||
30 | #include <media/video-buf.h> | ||
31 | #include <media/v4l2-common.h> | ||
32 | #include <linux/kthread.h> | ||
33 | #include <linux/highmem.h> | ||
34 | |||
35 | /* Wake up at about 30 fps */ | ||
36 | #define WAKE_NUMERATOR 30 | ||
37 | #define WAKE_DENOMINATOR 1001 | ||
38 | #define BUFFER_TIMEOUT msecs_to_jiffies(500) /* 0.5 seconds */ | ||
39 | |||
40 | /* These timers are for 1 fps - used only for testing */ | ||
41 | //#define WAKE_DENOMINATOR 30 /* hack for testing purposes */ | ||
42 | //#define BUFFER_TIMEOUT msecs_to_jiffies(5000) /* 5 seconds */ | ||
43 | |||
44 | #include "font.h" | ||
45 | |||
46 | #ifndef kzalloc | ||
47 | #define kzalloc(size, flags) \ | ||
48 | ({ \ | ||
49 | void *__ret = kmalloc(size, flags); \ | ||
50 | if (__ret) \ | ||
51 | memset(__ret, 0, size); \ | ||
52 | __ret; \ | ||
53 | }) | ||
54 | #endif | ||
55 | |||
56 | MODULE_DESCRIPTION("Video Technology Magazine Virtual Video Capture Board"); | ||
57 | MODULE_AUTHOR("Mauro Carvalho Chehab, Ted Walther and John Sokol"); | ||
58 | MODULE_LICENSE("Dual BSD/GPL"); | ||
59 | |||
60 | #define VIVI_MAJOR_VERSION 0 | ||
61 | #define VIVI_MINOR_VERSION 4 | ||
62 | #define VIVI_RELEASE 0 | ||
63 | #define VIVI_VERSION KERNEL_VERSION(VIVI_MAJOR_VERSION, VIVI_MINOR_VERSION, VIVI_RELEASE) | ||
64 | |||
65 | static int video_nr = -1; /* /dev/videoN, -1 for autodetect */ | ||
66 | module_param(video_nr, int, 0); | ||
67 | |||
68 | static int debug = 0; | ||
69 | module_param(debug, int, 0); | ||
70 | |||
71 | static unsigned int vid_limit = 16; | ||
72 | module_param(vid_limit,int,0644); | ||
73 | MODULE_PARM_DESC(vid_limit,"capture memory limit in megabytes"); | ||
74 | |||
75 | /* supported controls */ | ||
76 | static struct v4l2_queryctrl vivi_qctrl[] = { | ||
77 | { | ||
78 | .id = V4L2_CID_AUDIO_VOLUME, | ||
79 | .name = "Volume", | ||
80 | .minimum = 0, | ||
81 | .maximum = 65535, | ||
82 | .step = 65535/100, | ||
83 | .default_value = 65535, | ||
84 | .flags = 0, | ||
85 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
86 | },{ | ||
87 | .id = V4L2_CID_BRIGHTNESS, | ||
88 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
89 | .name = "Brightness", | ||
90 | .minimum = 0, | ||
91 | .maximum = 255, | ||
92 | .step = 1, | ||
93 | .default_value = 127, | ||
94 | .flags = 0, | ||
95 | }, { | ||
96 | .id = V4L2_CID_CONTRAST, | ||
97 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
98 | .name = "Contrast", | ||
99 | .minimum = 0, | ||
100 | .maximum = 255, | ||
101 | .step = 0x1, | ||
102 | .default_value = 0x10, | ||
103 | .flags = 0, | ||
104 | }, { | ||
105 | .id = V4L2_CID_SATURATION, | ||
106 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
107 | .name = "Saturation", | ||
108 | .minimum = 0, | ||
109 | .maximum = 255, | ||
110 | .step = 0x1, | ||
111 | .default_value = 127, | ||
112 | .flags = 0, | ||
113 | }, { | ||
114 | .id = V4L2_CID_HUE, | ||
115 | .type = V4L2_CTRL_TYPE_INTEGER, | ||
116 | .name = "Hue", | ||
117 | .minimum = -128, | ||
118 | .maximum = 127, | ||
119 | .step = 0x1, | ||
120 | .default_value = 0, | ||
121 | .flags = 0, | ||
122 | } | ||
123 | }; | ||
124 | |||
125 | static int qctl_regs[ARRAY_SIZE(vivi_qctrl)]; | ||
126 | |||
127 | #define dprintk(level,fmt, arg...) \ | ||
128 | do { \ | ||
129 | if (debug >= (level)) \ | ||
130 | printk(KERN_DEBUG "vivi: " fmt , ## arg); \ | ||
131 | } while (0) | ||
132 | |||
133 | /* ------------------------------------------------------------------ | ||
134 | Basic structures | ||
135 | ------------------------------------------------------------------*/ | ||
136 | |||
137 | struct vivi_fmt { | ||
138 | char *name; | ||
139 | u32 fourcc; /* v4l2 format id */ | ||
140 | int depth; | ||
141 | }; | ||
142 | |||
143 | static struct vivi_fmt format = { | ||
144 | .name = "4:2:2, packed, YUYV", | ||
145 | .fourcc = V4L2_PIX_FMT_YUYV, | ||
146 | .depth = 16, | ||
147 | }; | ||
148 | |||
149 | struct sg_to_addr { | ||
150 | int pos; | ||
151 | struct scatterlist *sg; | ||
152 | }; | ||
153 | |||
154 | /* buffer for one video frame */ | ||
155 | struct vivi_buffer { | ||
156 | /* common v4l buffer stuff -- must be first */ | ||
157 | struct videobuf_buffer vb; | ||
158 | |||
159 | struct vivi_fmt *fmt; | ||
160 | |||
161 | struct sg_to_addr *to_addr; | ||
162 | }; | ||
163 | |||
164 | struct vivi_dmaqueue { | ||
165 | struct list_head active; | ||
166 | struct list_head queued; | ||
167 | struct timer_list timeout; | ||
168 | |||
169 | /* thread for generating video stream*/ | ||
170 | struct task_struct *kthread; | ||
171 | wait_queue_head_t wq; | ||
172 | /* Counters to control fps rate */ | ||
173 | int frame; | ||
174 | int ini_jiffies; | ||
175 | }; | ||
176 | |||
177 | static LIST_HEAD(vivi_devlist); | ||
178 | |||
179 | struct vivi_dev { | ||
180 | struct list_head vivi_devlist; | ||
181 | |||
182 | struct semaphore lock; | ||
183 | |||
184 | int users; | ||
185 | |||
186 | /* various device info */ | ||
187 | unsigned int resources; | ||
188 | struct video_device video_dev; | ||
189 | |||
190 | struct vivi_dmaqueue vidq; | ||
191 | |||
192 | /* Several counters */ | ||
193 | int h,m,s,us,jiffies; | ||
194 | char timestr[13]; | ||
195 | }; | ||
196 | |||
197 | struct vivi_fh { | ||
198 | struct vivi_dev *dev; | ||
199 | |||
200 | /* video capture */ | ||
201 | struct vivi_fmt *fmt; | ||
202 | unsigned int width,height; | ||
203 | struct videobuf_queue vb_vidq; | ||
204 | |||
205 | enum v4l2_buf_type type; | ||
206 | }; | ||
207 | |||
208 | /* ------------------------------------------------------------------ | ||
209 | DMA and thread functions | ||
210 | ------------------------------------------------------------------*/ | ||
211 | |||
212 | /* Bars and Colors should match positions */ | ||
213 | |||
214 | enum colors { | ||
215 | WHITE, | ||
216 | AMBAR, | ||
217 | CYAN, | ||
218 | GREEN, | ||
219 | MAGENTA, | ||
220 | RED, | ||
221 | BLUE | ||
222 | }; | ||
223 | |||
224 | static u8 bars[8][3] = { | ||
225 | /* R G B */ | ||
226 | {204,204,204}, /* white */ | ||
227 | {208,208, 0}, /* ambar */ | ||
228 | { 0,206,206}, /* cyan */ | ||
229 | { 0,239, 0}, /* green */ | ||
230 | {239, 0,239}, /* magenta */ | ||
231 | {205, 0, 0}, /* red */ | ||
232 | { 0, 0,255}, /* blue */ | ||
233 | { 0, 0, 0} | ||
234 | }; | ||
235 | |||
236 | #define TO_Y(r,g,b) (((16829*r +33039*g +6416*b + 32768)>>16)+16) | ||
237 | /* RGB to V(Cr) Color transform */ | ||
238 | #define TO_V(r,g,b) (((28784*r -24103*g -4681*b + 32768)>>16)+128) | ||
239 | /* RGB to U(Cb) Color transform */ | ||
240 | #define TO_U(r,g,b) (((-9714*r -19070*g +28784*b + 32768)>>16)+128) | ||
241 | |||
242 | #define TSTAMP_MIN_Y 24 | ||
243 | #define TSTAMP_MAX_Y TSTAMP_MIN_Y+15 | ||
244 | #define TSTAMP_MIN_X 64 | ||
245 | |||
246 | void prep_to_addr(struct sg_to_addr to_addr[],struct videobuf_buffer *vb) | ||
247 | { | ||
248 | int i, pos=0; | ||
249 | |||
250 | for (i=0;i<vb->dma.nr_pages;i++) { | ||
251 | to_addr[i].sg=&vb->dma.sglist[i]; | ||
252 | to_addr[i].pos=pos; | ||
253 | pos += vb->dma.sglist[i].length; | ||
254 | } | ||
255 | } | ||
256 | |||
257 | inline int get_addr_pos(int pos, int pages, struct sg_to_addr to_addr[]) | ||
258 | { | ||
259 | int p1=0,p2=pages-1,p3=pages/2; | ||
260 | |||
261 | /* Sanity test */ | ||
262 | BUG_ON (pos>=to_addr[p2].pos+to_addr[p2].sg->length); | ||
263 | |||
264 | while (p1+1<p2) { | ||
265 | if (pos < to_addr[p3].pos) { | ||
266 | p2=p3; | ||
267 | } else { | ||
268 | p1=p3; | ||
269 | } | ||
270 | p3=(p1+p2)/2; | ||
271 | } | ||
272 | if (pos >= to_addr[p2].pos) | ||
273 | p1=p2; | ||
274 | |||
275 | return (p1); | ||
276 | } | ||
277 | |||
278 | void gen_line(struct sg_to_addr to_addr[],int inipos,int pages,int wmax, | ||
279 | int hmax, int line, char *timestr) | ||
280 | { | ||
281 | int w,i,j,pos=inipos,pgpos,oldpg,y; | ||
282 | char *p,*s,*basep; | ||
283 | struct page *pg; | ||
284 | u8 chr,r,g,b,color; | ||
285 | |||
286 | /* Get first addr pointed to pixel position */ | ||
287 | oldpg=get_addr_pos(pos,pages,to_addr); | ||
288 | pg=pfn_to_page(to_addr[oldpg].sg->dma_address >> PAGE_SHIFT); | ||
289 | basep = kmap_atomic(pg, KM_BOUNCE_READ)+to_addr[oldpg].sg->offset; | ||
290 | |||
291 | /* We will just duplicate the second pixel at the packet */ | ||
292 | wmax/=2; | ||
293 | |||
294 | /* Generate a standard color bar pattern */ | ||
295 | for (w=0;w<wmax;w++) { | ||
296 | r=bars[w*7/wmax][0]; | ||
297 | g=bars[w*7/wmax][1]; | ||
298 | b=bars[w*7/wmax][2]; | ||
299 | |||
300 | for (color=0;color<4;color++) { | ||
301 | pgpos=get_addr_pos(pos,pages,to_addr); | ||
302 | if (pgpos!=oldpg) { | ||
303 | pg=pfn_to_page(to_addr[pgpos].sg->dma_address >> PAGE_SHIFT); | ||
304 | kunmap_atomic(basep, KM_BOUNCE_READ); | ||
305 | basep= kmap_atomic(pg, KM_BOUNCE_READ)+to_addr[pgpos].sg->offset; | ||
306 | oldpg=pgpos; | ||
307 | } | ||
308 | p=basep+pos-to_addr[pgpos].pos; | ||
309 | |||
310 | switch (color) { | ||
311 | case 0: | ||
312 | case 2: | ||
313 | *p=TO_Y(r,g,b); /* Luminance */ | ||
314 | break; | ||
315 | case 1: | ||
316 | *p=TO_U(r,g,b); /* Cb */ | ||
317 | break; | ||
318 | case 3: | ||
319 | *p=TO_V(r,g,b); /* Cr */ | ||
320 | break; | ||
321 | } | ||
322 | pos++; | ||
323 | } | ||
324 | } | ||
325 | |||
326 | /* Checks if it is possible to show timestamp */ | ||
327 | if (TSTAMP_MAX_Y>=hmax) | ||
328 | goto end; | ||
329 | if (TSTAMP_MIN_X+strlen(timestr)>=wmax) | ||
330 | goto end; | ||
331 | |||
332 | /* Print stream time */ | ||
333 | if (line>=TSTAMP_MIN_Y && line<=TSTAMP_MAX_Y) { | ||
334 | j=TSTAMP_MIN_X; | ||
335 | for (s=timestr;*s;s++) { | ||
336 | chr=rom8x16_bits[(*s-0x30)*16+line-TSTAMP_MIN_Y]; | ||
337 | for (i=0;i<7;i++) { | ||
338 | if (chr&1<<(7-i)) { /* Font color*/ | ||
339 | r=bars[BLUE][0]; | ||
340 | g=bars[BLUE][1]; | ||
341 | b=bars[BLUE][2]; | ||
342 | r=g=b=0; | ||
343 | g=198; | ||
344 | } else { /* Background color */ | ||
345 | r=bars[WHITE][0]; | ||
346 | g=bars[WHITE][1]; | ||
347 | b=bars[WHITE][2]; | ||
348 | r=g=b=0; | ||
349 | } | ||
350 | |||
351 | pos=inipos+j*2; | ||
352 | for (color=0;color<4;color++) { | ||
353 | pgpos=get_addr_pos(pos,pages,to_addr); | ||
354 | if (pgpos!=oldpg) { | ||
355 | pg=pfn_to_page(to_addr[pgpos]. | ||
356 | sg->dma_address | ||
357 | >> PAGE_SHIFT); | ||
358 | kunmap_atomic(basep, | ||
359 | KM_BOUNCE_READ); | ||
360 | basep= kmap_atomic(pg, | ||
361 | KM_BOUNCE_READ)+ | ||
362 | to_addr[pgpos].sg->offset; | ||
363 | oldpg=pgpos; | ||
364 | } | ||
365 | p=basep+pos-to_addr[pgpos].pos; | ||
366 | |||
367 | y=TO_Y(r,g,b); | ||
368 | |||
369 | switch (color) { | ||
370 | case 0: | ||
371 | case 2: | ||
372 | *p=TO_Y(r,g,b); /* Luminance */ | ||
373 | break; | ||
374 | case 1: | ||
375 | *p=TO_U(r,g,b); /* Cb */ | ||
376 | break; | ||
377 | case 3: | ||
378 | *p=TO_V(r,g,b); /* Cr */ | ||
379 | break; | ||
380 | } | ||
381 | pos++; | ||
382 | } | ||
383 | j++; | ||
384 | } | ||
385 | } | ||
386 | } | ||
387 | |||
388 | |||
389 | end: | ||
390 | kunmap_atomic(basep, KM_BOUNCE_READ); | ||
391 | } | ||
392 | static void vivi_fillbuff(struct vivi_dev *dev,struct vivi_buffer *buf) | ||
393 | { | ||
394 | int h,pos=0; | ||
395 | int hmax = buf->vb.height; | ||
396 | int wmax = buf->vb.width; | ||
397 | struct videobuf_buffer *vb=&buf->vb; | ||
398 | struct sg_to_addr *to_addr=buf->to_addr; | ||
399 | struct timeval ts; | ||
400 | |||
401 | /* Test if DMA mapping is ready */ | ||
402 | if (!vb->dma.sglist[0].dma_address) | ||
403 | return; | ||
404 | |||
405 | prep_to_addr(to_addr,vb); | ||
406 | |||
407 | /* Check if there is enough memory */ | ||
408 | BUG_ON(buf->vb.dma.nr_pages << PAGE_SHIFT < (buf->vb.width*buf->vb.height)*2); | ||
409 | |||
410 | for (h=0;h<hmax;h++) { | ||
411 | gen_line(to_addr,pos,vb->dma.nr_pages,wmax,hmax,h,dev->timestr); | ||
412 | pos += wmax*2; | ||
413 | } | ||
414 | |||
415 | /* Updates stream time */ | ||
416 | |||
417 | dev->us+=jiffies_to_usecs(jiffies-dev->jiffies); | ||
418 | dev->jiffies=jiffies; | ||
419 | if (dev->us>=1000000) { | ||
420 | dev->us-=1000000; | ||
421 | dev->s++; | ||
422 | if (dev->s>=60) { | ||
423 | dev->s-=60; | ||
424 | dev->m++; | ||
425 | if (dev->m>60) { | ||
426 | dev->m-=60; | ||
427 | dev->h++; | ||
428 | if (dev->h>24) | ||
429 | dev->h-=24; | ||
430 | } | ||
431 | } | ||
432 | } | ||
433 | sprintf(dev->timestr,"%02d:%02d:%02d:%03d", | ||
434 | dev->h,dev->m,dev->s,(dev->us+500)/1000); | ||
435 | |||
436 | dprintk(2,"vivifill at %s: Buffer 0x%08lx size= %d\n",dev->timestr, | ||
437 | (unsigned long)buf->vb.dma.vmalloc,pos); | ||
438 | |||
439 | /* Advice that buffer was filled */ | ||
440 | buf->vb.state = STATE_DONE; | ||
441 | buf->vb.field_count++; | ||
442 | do_gettimeofday(&ts); | ||
443 | buf->vb.ts = ts; | ||
444 | |||
445 | list_del(&buf->vb.queue); | ||
446 | wake_up(&buf->vb.done); | ||
447 | } | ||
448 | |||
449 | static int restart_video_queue(struct vivi_dmaqueue *dma_q); | ||
450 | |||
451 | static void vivi_thread_tick(struct vivi_dmaqueue *dma_q) | ||
452 | { | ||
453 | struct vivi_buffer *buf; | ||
454 | struct vivi_dev *dev= container_of(dma_q,struct vivi_dev,vidq); | ||
455 | |||
456 | int bc; | ||
457 | |||
458 | /* Announces videobuf that all went ok */ | ||
459 | for (bc = 0;; bc++) { | ||
460 | if (list_empty(&dma_q->active)) { | ||
461 | dprintk(1,"No active queue to serve\n"); | ||
462 | break; | ||
463 | } | ||
464 | |||
465 | buf = list_entry(dma_q->active.next, | ||
466 | struct vivi_buffer, vb.queue); | ||
467 | |||
468 | /* Nobody is waiting something to be done, just return */ | ||
469 | if (!waitqueue_active(&buf->vb.done)) { | ||
470 | mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); | ||
471 | return; | ||
472 | } | ||
473 | |||
474 | do_gettimeofday(&buf->vb.ts); | ||
475 | dprintk(2,"[%p/%d] wakeup\n",buf,buf->vb.i); | ||
476 | |||
477 | /* Fill buffer */ | ||
478 | vivi_fillbuff(dev,buf); | ||
479 | } | ||
480 | if (list_empty(&dma_q->active)) { | ||
481 | del_timer(&dma_q->timeout); | ||
482 | } else { | ||
483 | mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); | ||
484 | } | ||
485 | if (bc != 1) | ||
486 | dprintk(1,"%s: %d buffers handled (should be 1)\n",__FUNCTION__,bc); | ||
487 | } | ||
488 | |||
489 | void vivi_sleep(struct vivi_dmaqueue *dma_q) | ||
490 | { | ||
491 | int timeout; | ||
492 | DECLARE_WAITQUEUE(wait, current); | ||
493 | |||
494 | dprintk(1,"%s dma_q=0x%08lx\n",__FUNCTION__,(unsigned long)dma_q); | ||
495 | |||
496 | add_wait_queue(&dma_q->wq, &wait); | ||
497 | if (!kthread_should_stop()) { | ||
498 | dma_q->frame++; | ||
499 | |||
500 | /* Calculate time to wake up */ | ||
501 | timeout=dma_q->ini_jiffies+msecs_to_jiffies((dma_q->frame*WAKE_NUMERATOR*1000)/WAKE_DENOMINATOR)-jiffies; | ||
502 | |||
503 | if (timeout <= 0) { | ||
504 | int old=dma_q->frame; | ||
505 | dma_q->frame=(jiffies_to_msecs(jiffies-dma_q->ini_jiffies)*WAKE_DENOMINATOR)/(WAKE_NUMERATOR*1000)+1; | ||
506 | |||
507 | timeout=dma_q->ini_jiffies+msecs_to_jiffies((dma_q->frame*WAKE_NUMERATOR*1000)/WAKE_DENOMINATOR)-jiffies; | ||
508 | |||
509 | dprintk(1,"underrun, losed %d frames. " | ||
510 | "Now, frame is %d. Waking on %d jiffies\n", | ||
511 | dma_q->frame-old,dma_q->frame,timeout); | ||
512 | } else | ||
513 | dprintk(1,"will sleep for %i jiffies\n",timeout); | ||
514 | |||
515 | vivi_thread_tick(dma_q); | ||
516 | |||
517 | schedule_timeout_interruptible (timeout); | ||
518 | } | ||
519 | |||
520 | remove_wait_queue(&dma_q->wq, &wait); | ||
521 | try_to_freeze(); | ||
522 | } | ||
523 | |||
524 | int vivi_thread(void *data) | ||
525 | { | ||
526 | struct vivi_dmaqueue *dma_q=data; | ||
527 | |||
528 | dprintk(1,"thread started\n"); | ||
529 | |||
530 | for (;;) { | ||
531 | vivi_sleep(dma_q); | ||
532 | |||
533 | if (kthread_should_stop()) | ||
534 | break; | ||
535 | } | ||
536 | dprintk(1, "thread: exit\n"); | ||
537 | return 0; | ||
538 | } | ||
539 | |||
540 | int vivi_start_thread(struct vivi_dmaqueue *dma_q) | ||
541 | { | ||
542 | dma_q->frame=0; | ||
543 | dma_q->ini_jiffies=jiffies; | ||
544 | |||
545 | dprintk(1,"%s\n",__FUNCTION__); | ||
546 | init_waitqueue_head(&dma_q->wq); | ||
547 | |||
548 | dma_q->kthread = kthread_run(vivi_thread, dma_q, "vivi"); | ||
549 | |||
550 | if (dma_q->kthread == NULL) { | ||
551 | printk(KERN_ERR "vivi: kernel_thread() failed\n"); | ||
552 | return -EINVAL; | ||
553 | } | ||
554 | dprintk(1,"returning from %s\n",__FUNCTION__); | ||
555 | return 0; | ||
556 | } | ||
557 | |||
558 | void vivi_stop_thread(struct vivi_dmaqueue *dma_q) | ||
559 | { | ||
560 | dprintk(1,"%s\n",__FUNCTION__); | ||
561 | /* shutdown control thread */ | ||
562 | if (dma_q->kthread) { | ||
563 | kthread_stop(dma_q->kthread); | ||
564 | dma_q->kthread=NULL; | ||
565 | } | ||
566 | } | ||
567 | |||
568 | static int restart_video_queue(struct vivi_dmaqueue *dma_q) | ||
569 | { | ||
570 | struct vivi_buffer *buf, *prev; | ||
571 | struct list_head *item; | ||
572 | |||
573 | dprintk(1,"%s dma_q=0x%08lx\n",__FUNCTION__,(unsigned long)dma_q); | ||
574 | |||
575 | if (!list_empty(&dma_q->active)) { | ||
576 | buf = list_entry(dma_q->active.next, struct vivi_buffer, vb.queue); | ||
577 | dprintk(2,"restart_queue [%p/%d]: restart dma\n", | ||
578 | buf, buf->vb.i); | ||
579 | |||
580 | dprintk(1,"Restarting video dma\n"); | ||
581 | vivi_stop_thread(dma_q); | ||
582 | // vivi_start_thread(dma_q); | ||
583 | |||
584 | /* cancel all outstanding capture / vbi requests */ | ||
585 | list_for_each(item,&dma_q->active) { | ||
586 | buf = list_entry(item, struct vivi_buffer, vb.queue); | ||
587 | |||
588 | list_del(&buf->vb.queue); | ||
589 | buf->vb.state = STATE_ERROR; | ||
590 | wake_up(&buf->vb.done); | ||
591 | } | ||
592 | mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); | ||
593 | |||
594 | return 0; | ||
595 | } | ||
596 | |||
597 | prev = NULL; | ||
598 | for (;;) { | ||
599 | if (list_empty(&dma_q->queued)) | ||
600 | return 0; | ||
601 | buf = list_entry(dma_q->queued.next, struct vivi_buffer, vb.queue); | ||
602 | if (NULL == prev) { | ||
603 | list_del(&buf->vb.queue); | ||
604 | list_add_tail(&buf->vb.queue,&dma_q->active); | ||
605 | |||
606 | dprintk(1,"Restarting video dma\n"); | ||
607 | vivi_stop_thread(dma_q); | ||
608 | vivi_start_thread(dma_q); | ||
609 | |||
610 | buf->vb.state = STATE_ACTIVE; | ||
611 | mod_timer(&dma_q->timeout, jiffies+BUFFER_TIMEOUT); | ||
612 | dprintk(2,"[%p/%d] restart_queue - first active\n", | ||
613 | buf,buf->vb.i); | ||
614 | |||
615 | } else if (prev->vb.width == buf->vb.width && | ||
616 | prev->vb.height == buf->vb.height && | ||
617 | prev->fmt == buf->fmt) { | ||
618 | list_del(&buf->vb.queue); | ||
619 | list_add_tail(&buf->vb.queue,&dma_q->active); | ||
620 | buf->vb.state = STATE_ACTIVE; | ||
621 | dprintk(2,"[%p/%d] restart_queue - move to active\n", | ||
622 | buf,buf->vb.i); | ||
623 | } else { | ||
624 | return 0; | ||
625 | } | ||
626 | prev = buf; | ||
627 | } | ||
628 | } | ||
629 | |||
630 | static void vivi_vid_timeout(unsigned long data) | ||
631 | { | ||
632 | struct vivi_dev *dev = (struct vivi_dev*)data; | ||
633 | struct vivi_dmaqueue *vidq = &dev->vidq; | ||
634 | struct vivi_buffer *buf; | ||
635 | |||
636 | while (!list_empty(&vidq->active)) { | ||
637 | buf = list_entry(vidq->active.next, struct vivi_buffer, vb.queue); | ||
638 | list_del(&buf->vb.queue); | ||
639 | buf->vb.state = STATE_ERROR; | ||
640 | wake_up(&buf->vb.done); | ||
641 | printk("vivi/0: [%p/%d] timeout\n", buf, buf->vb.i); | ||
642 | } | ||
643 | |||
644 | restart_video_queue(vidq); | ||
645 | } | ||
646 | |||
647 | /* ------------------------------------------------------------------ | ||
648 | Videobuf operations | ||
649 | ------------------------------------------------------------------*/ | ||
650 | static int | ||
651 | buffer_setup(struct videobuf_queue *vq, unsigned int *count, unsigned int *size) | ||
652 | { | ||
653 | struct vivi_fh *fh = vq->priv_data; | ||
654 | |||
655 | *size = fh->width*fh->height*2; | ||
656 | |||
657 | if (0 == *count) | ||
658 | *count = 32; | ||
659 | while (*size * *count > vid_limit * 1024 * 1024) | ||
660 | (*count)--; | ||
661 | return 0; | ||
662 | } | ||
663 | |||
664 | void | ||
665 | free_buffer(struct videobuf_queue *vq, struct vivi_buffer *buf) | ||
666 | { | ||
667 | dprintk(1,"%s\n",__FUNCTION__); | ||
668 | |||
669 | if (in_interrupt()) | ||
670 | BUG(); | ||
671 | |||
672 | /*FIXME: Maybe a spinlock is required here */ | ||
673 | kfree(buf->to_addr); | ||
674 | buf->to_addr=NULL; | ||
675 | |||
676 | videobuf_waiton(&buf->vb,0,0); | ||
677 | videobuf_dma_unmap(vq, &buf->vb.dma); | ||
678 | videobuf_dma_free(&buf->vb.dma); | ||
679 | buf->vb.state = STATE_NEEDS_INIT; | ||
680 | } | ||
681 | |||
682 | #define norm_maxw() 1024 | ||
683 | #define norm_maxh() 768 | ||
684 | static int | ||
685 | buffer_prepare(struct videobuf_queue *vq, struct videobuf_buffer *vb, | ||
686 | enum v4l2_field field) | ||
687 | { | ||
688 | struct vivi_fh *fh = vq->priv_data; | ||
689 | struct vivi_buffer *buf = container_of(vb,struct vivi_buffer,vb); | ||
690 | int rc, init_buffer = 0; | ||
691 | |||
692 | // dprintk(1,"%s, field=%d\n",__FUNCTION__,field); | ||
693 | |||
694 | BUG_ON(NULL == fh->fmt); | ||
695 | if (fh->width < 48 || fh->width > norm_maxw() || | ||
696 | fh->height < 32 || fh->height > norm_maxh()) | ||
697 | return -EINVAL; | ||
698 | buf->vb.size = fh->width*fh->height*2; | ||
699 | if (0 != buf->vb.baddr && buf->vb.bsize < buf->vb.size) | ||
700 | return -EINVAL; | ||
701 | |||
702 | if (buf->fmt != fh->fmt || | ||
703 | buf->vb.width != fh->width || | ||
704 | buf->vb.height != fh->height || | ||
705 | buf->vb.field != field) { | ||
706 | buf->fmt = fh->fmt; | ||
707 | buf->vb.width = fh->width; | ||
708 | buf->vb.height = fh->height; | ||
709 | buf->vb.field = field; | ||
710 | init_buffer = 1; | ||
711 | } | ||
712 | |||
713 | if (STATE_NEEDS_INIT == buf->vb.state) { | ||
714 | if (0 != (rc = videobuf_iolock(vq,&buf->vb,NULL))) | ||
715 | goto fail; | ||
716 | } | ||
717 | |||
718 | buf->vb.state = STATE_PREPARED; | ||
719 | |||
720 | if (NULL == (buf->to_addr = kmalloc(sizeof(*buf->to_addr) * vb->dma.nr_pages,GFP_KERNEL))) { | ||
721 | rc=-ENOMEM; | ||
722 | goto fail; | ||
723 | } | ||
724 | |||
725 | return 0; | ||
726 | |||
727 | fail: | ||
728 | free_buffer(vq,buf); | ||
729 | return rc; | ||
730 | } | ||
731 | |||
732 | static void | ||
733 | buffer_queue(struct videobuf_queue *vq, struct videobuf_buffer *vb) | ||
734 | { | ||
735 | struct vivi_buffer *buf = container_of(vb,struct vivi_buffer,vb); | ||
736 | struct vivi_fh *fh = vq->priv_data; | ||
737 | struct vivi_dev *dev = fh->dev; | ||
738 | struct vivi_dmaqueue *vidq = &dev->vidq; | ||
739 | struct vivi_buffer *prev; | ||
740 | |||
741 | if (!list_empty(&vidq->queued)) { | ||
742 | dprintk(1,"adding vb queue=0x%08lx\n",(unsigned long)&buf->vb.queue); | ||
743 | list_add_tail(&buf->vb.queue,&vidq->queued); | ||
744 | buf->vb.state = STATE_QUEUED; | ||
745 | dprintk(2,"[%p/%d] buffer_queue - append to queued\n", | ||
746 | buf, buf->vb.i); | ||
747 | } else if (list_empty(&vidq->active)) { | ||
748 | list_add_tail(&buf->vb.queue,&vidq->active); | ||
749 | |||
750 | buf->vb.state = STATE_ACTIVE; | ||
751 | mod_timer(&vidq->timeout, jiffies+BUFFER_TIMEOUT); | ||
752 | dprintk(2,"[%p/%d] buffer_queue - first active\n", | ||
753 | buf, buf->vb.i); | ||
754 | |||
755 | vivi_start_thread(vidq); | ||
756 | } else { | ||
757 | prev = list_entry(vidq->active.prev, struct vivi_buffer, vb.queue); | ||
758 | if (prev->vb.width == buf->vb.width && | ||
759 | prev->vb.height == buf->vb.height && | ||
760 | prev->fmt == buf->fmt) { | ||
761 | list_add_tail(&buf->vb.queue,&vidq->active); | ||
762 | buf->vb.state = STATE_ACTIVE; | ||
763 | dprintk(2,"[%p/%d] buffer_queue - append to active\n", | ||
764 | buf, buf->vb.i); | ||
765 | |||
766 | } else { | ||
767 | list_add_tail(&buf->vb.queue,&vidq->queued); | ||
768 | buf->vb.state = STATE_QUEUED; | ||
769 | dprintk(2,"[%p/%d] buffer_queue - first queued\n", | ||
770 | buf, buf->vb.i); | ||
771 | } | ||
772 | } | ||
773 | } | ||
774 | |||
775 | static void buffer_release(struct videobuf_queue *vq, struct videobuf_buffer *vb) | ||
776 | { | ||
777 | struct vivi_buffer *buf = container_of(vb,struct vivi_buffer,vb); | ||
778 | struct vivi_fh *fh = vq->priv_data; | ||
779 | struct vivi_dev *dev = (struct vivi_dev*)fh->dev; | ||
780 | struct vivi_dmaqueue *vidq = &dev->vidq; | ||
781 | |||
782 | dprintk(1,"%s\n",__FUNCTION__); | ||
783 | |||
784 | vivi_stop_thread(vidq); | ||
785 | |||
786 | free_buffer(vq,buf); | ||
787 | } | ||
788 | |||
789 | int vivi_map_sg (void *dev, struct scatterlist *sg, int nents, | ||
790 | int direction) | ||
791 | { | ||
792 | int i; | ||
793 | |||
794 | dprintk(1,"%s, number of pages=%d\n",__FUNCTION__,nents); | ||
795 | BUG_ON(direction == DMA_NONE); | ||
796 | |||
797 | for (i = 0; i < nents; i++ ) { | ||
798 | BUG_ON(!sg[i].page); | ||
799 | |||
800 | sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset; | ||
801 | } | ||
802 | |||
803 | return nents; | ||
804 | } | ||
805 | |||
806 | int vivi_unmap_sg(void *dev,struct scatterlist *sglist,int nr_pages, | ||
807 | int direction) | ||
808 | { | ||
809 | dprintk(1,"%s\n",__FUNCTION__); | ||
810 | return 0; | ||
811 | } | ||
812 | |||
813 | int vivi_dma_sync_sg(void *dev,struct scatterlist *sglist,int nr_pages, | ||
814 | int direction) | ||
815 | { | ||
816 | // dprintk(1,"%s\n",__FUNCTION__); | ||
817 | |||
818 | // flush_write_buffers(); | ||
819 | return 0; | ||
820 | } | ||
821 | |||
822 | static struct videobuf_queue_ops vivi_video_qops = { | ||
823 | .buf_setup = buffer_setup, | ||
824 | .buf_prepare = buffer_prepare, | ||
825 | .buf_queue = buffer_queue, | ||
826 | .buf_release = buffer_release, | ||
827 | |||
828 | /* Non-pci handling routines */ | ||
829 | .vb_map_sg = vivi_map_sg, | ||
830 | .vb_dma_sync_sg = vivi_dma_sync_sg, | ||
831 | .vb_unmap_sg = vivi_unmap_sg, | ||
832 | }; | ||
833 | |||
834 | /* ------------------------------------------------------------------ | ||
835 | IOCTL handling | ||
836 | ------------------------------------------------------------------*/ | ||
837 | |||
838 | static int vivi_try_fmt(struct vivi_dev *dev, struct vivi_fh *fh, | ||
839 | struct v4l2_format *f) | ||
840 | { | ||
841 | struct vivi_fmt *fmt; | ||
842 | enum v4l2_field field; | ||
843 | unsigned int maxw, maxh; | ||
844 | |||
845 | if (format.fourcc != f->fmt.pix.pixelformat) { | ||
846 | dprintk(1,"Fourcc format invalid.\n"); | ||
847 | return -EINVAL; | ||
848 | } | ||
849 | fmt=&format; | ||
850 | |||
851 | field = f->fmt.pix.field; | ||
852 | |||
853 | if (field == V4L2_FIELD_ANY) { | ||
854 | // field=V4L2_FIELD_INTERLACED; | ||
855 | field=V4L2_FIELD_SEQ_TB; | ||
856 | } else if (V4L2_FIELD_INTERLACED != field) { | ||
857 | dprintk(1,"Field type invalid.\n"); | ||
858 | return -EINVAL; | ||
859 | } | ||
860 | |||
861 | maxw = norm_maxw(); | ||
862 | maxh = norm_maxh(); | ||
863 | |||
864 | f->fmt.pix.field = field; | ||
865 | if (f->fmt.pix.height < 32) | ||
866 | f->fmt.pix.height = 32; | ||
867 | if (f->fmt.pix.height > maxh) | ||
868 | f->fmt.pix.height = maxh; | ||
869 | if (f->fmt.pix.width < 48) | ||
870 | f->fmt.pix.width = 48; | ||
871 | if (f->fmt.pix.width > maxw) | ||
872 | f->fmt.pix.width = maxw; | ||
873 | f->fmt.pix.width &= ~0x03; | ||
874 | f->fmt.pix.bytesperline = | ||
875 | (f->fmt.pix.width * fmt->depth) >> 3; | ||
876 | f->fmt.pix.sizeimage = | ||
877 | f->fmt.pix.height * f->fmt.pix.bytesperline; | ||
878 | |||
879 | return 0; | ||
880 | } | ||
881 | |||
882 | static int res_get(struct vivi_dev *dev, struct vivi_fh *fh) | ||
883 | { | ||
884 | /* is it free? */ | ||
885 | down(&dev->lock); | ||
886 | if (dev->resources) { | ||
887 | /* no, someone else uses it */ | ||
888 | up(&dev->lock); | ||
889 | return 0; | ||
890 | } | ||
891 | /* it's free, grab it */ | ||
892 | dev->resources =1; | ||
893 | dprintk(1,"res: get\n"); | ||
894 | up(&dev->lock); | ||
895 | return 1; | ||
896 | } | ||
897 | |||
898 | static inline int res_locked(struct vivi_dev *dev) | ||
899 | { | ||
900 | return (dev->resources); | ||
901 | } | ||
902 | |||
903 | static void res_free(struct vivi_dev *dev, struct vivi_fh *fh) | ||
904 | { | ||
905 | down(&dev->lock); | ||
906 | dev->resources = 0; | ||
907 | dprintk(1,"res: put\n"); | ||
908 | up(&dev->lock); | ||
909 | } | ||
910 | |||
911 | static int vivi_do_ioctl(struct inode *inode, struct file *file, unsigned int cmd, void *arg) | ||
912 | { | ||
913 | struct vivi_fh *fh = file->private_data; | ||
914 | struct vivi_dev *dev = fh->dev; | ||
915 | int ret=0; | ||
916 | |||
917 | if (debug) { | ||
918 | if (_IOC_DIR(cmd) & _IOC_WRITE) | ||
919 | v4l_printk_ioctl_arg("vivi(w)",cmd, arg); | ||
920 | else if (!_IOC_DIR(cmd) & _IOC_READ) { | ||
921 | v4l_print_ioctl("vivi", cmd); | ||
922 | } | ||
923 | } | ||
924 | |||
925 | switch(cmd) { | ||
926 | /* --- capabilities ------------------------------------------ */ | ||
927 | case VIDIOC_QUERYCAP: | ||
928 | { | ||
929 | struct v4l2_capability *cap = (struct v4l2_capability*)arg; | ||
930 | |||
931 | memset(cap, 0, sizeof(*cap)); | ||
932 | |||
933 | strcpy(cap->driver, "vivi"); | ||
934 | strcpy(cap->card, "vivi"); | ||
935 | cap->version = VIVI_VERSION; | ||
936 | cap->capabilities = | ||
937 | V4L2_CAP_VIDEO_CAPTURE | | ||
938 | V4L2_CAP_STREAMING | | ||
939 | V4L2_CAP_READWRITE; | ||
940 | break; | ||
941 | } | ||
942 | /* --- capture ioctls ---------------------------------------- */ | ||
943 | case VIDIOC_ENUM_FMT: | ||
944 | { | ||
945 | struct v4l2_fmtdesc *f = arg; | ||
946 | enum v4l2_buf_type type; | ||
947 | unsigned int index; | ||
948 | |||
949 | index = f->index; | ||
950 | type = f->type; | ||
951 | |||
952 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
953 | ret=-EINVAL; | ||
954 | break; | ||
955 | } | ||
956 | |||
957 | switch (type) { | ||
958 | case V4L2_BUF_TYPE_VIDEO_CAPTURE: | ||
959 | if (index > 0){ | ||
960 | ret=-EINVAL; | ||
961 | break; | ||
962 | } | ||
963 | memset(f,0,sizeof(*f)); | ||
964 | |||
965 | f->index = index; | ||
966 | f->type = type; | ||
967 | strlcpy(f->description,format.name,sizeof(f->description)); | ||
968 | f->pixelformat = format.fourcc; | ||
969 | break; | ||
970 | default: | ||
971 | ret=-EINVAL; | ||
972 | } | ||
973 | break; | ||
974 | } | ||
975 | case VIDIOC_G_FMT: | ||
976 | { | ||
977 | struct v4l2_format *f = (struct v4l2_format *)arg; | ||
978 | |||
979 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
980 | ret=-EINVAL; | ||
981 | break; | ||
982 | } | ||
983 | |||
984 | memset(&f->fmt.pix,0,sizeof(f->fmt.pix)); | ||
985 | f->fmt.pix.width = fh->width; | ||
986 | f->fmt.pix.height = fh->height; | ||
987 | f->fmt.pix.field = fh->vb_vidq.field; | ||
988 | f->fmt.pix.pixelformat = fh->fmt->fourcc; | ||
989 | f->fmt.pix.bytesperline = | ||
990 | (f->fmt.pix.width * fh->fmt->depth) >> 3; | ||
991 | f->fmt.pix.sizeimage = | ||
992 | f->fmt.pix.height * f->fmt.pix.bytesperline; | ||
993 | break; | ||
994 | } | ||
995 | case VIDIOC_S_FMT: | ||
996 | { | ||
997 | struct v4l2_format *f = arg; | ||
998 | |||
999 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1000 | dprintk(1,"Only capture supported.\n"); | ||
1001 | ret=-EINVAL; | ||
1002 | break; | ||
1003 | } | ||
1004 | |||
1005 | ret = vivi_try_fmt(dev,fh,f); | ||
1006 | if (ret < 0) | ||
1007 | break; | ||
1008 | |||
1009 | fh->fmt = &format; | ||
1010 | fh->width = f->fmt.pix.width; | ||
1011 | fh->height = f->fmt.pix.height; | ||
1012 | fh->vb_vidq.field = f->fmt.pix.field; | ||
1013 | fh->type = f->type; | ||
1014 | |||
1015 | break; | ||
1016 | } | ||
1017 | case VIDIOC_TRY_FMT: | ||
1018 | { | ||
1019 | struct v4l2_format *f = arg; | ||
1020 | if (f->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1021 | ret=-EINVAL; | ||
1022 | break; | ||
1023 | } | ||
1024 | |||
1025 | ret=vivi_try_fmt(dev,fh,f); | ||
1026 | break; | ||
1027 | } | ||
1028 | case VIDIOC_REQBUFS: | ||
1029 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1030 | ret=-EINVAL; | ||
1031 | break; | ||
1032 | } | ||
1033 | ret=videobuf_reqbufs(&fh->vb_vidq, arg); | ||
1034 | break; | ||
1035 | case VIDIOC_QUERYBUF: | ||
1036 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1037 | ret=-EINVAL; | ||
1038 | break; | ||
1039 | } | ||
1040 | ret=videobuf_querybuf(&fh->vb_vidq, arg); | ||
1041 | break; | ||
1042 | case VIDIOC_QBUF: | ||
1043 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1044 | ret=-EINVAL; | ||
1045 | break; | ||
1046 | } | ||
1047 | ret=videobuf_qbuf(&fh->vb_vidq, arg); | ||
1048 | break; | ||
1049 | case VIDIOC_DQBUF: | ||
1050 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1051 | ret=-EINVAL; | ||
1052 | break; | ||
1053 | } | ||
1054 | ret=videobuf_dqbuf(&fh->vb_vidq, arg, | ||
1055 | file->f_flags & O_NONBLOCK); | ||
1056 | break; | ||
1057 | #ifdef HAVE_V4L1 | ||
1058 | /* --- streaming capture ------------------------------------- */ | ||
1059 | case VIDIOCGMBUF: | ||
1060 | { | ||
1061 | struct video_mbuf *mbuf = arg; | ||
1062 | struct videobuf_queue *q=&fh->vb_vidq; | ||
1063 | struct v4l2_requestbuffers req; | ||
1064 | unsigned int i; | ||
1065 | |||
1066 | memset(&req,0,sizeof(req)); | ||
1067 | req.type = q->type; | ||
1068 | req.count = 8; | ||
1069 | req.memory = V4L2_MEMORY_MMAP; | ||
1070 | ret = videobuf_reqbufs(q,&req); | ||
1071 | if (ret < 0) | ||
1072 | break; | ||
1073 | memset(mbuf,0,sizeof(*mbuf)); | ||
1074 | mbuf->frames = req.count; | ||
1075 | mbuf->size = 0; | ||
1076 | for (i = 0; i < mbuf->frames; i++) { | ||
1077 | mbuf->offsets[i] = q->bufs[i]->boff; | ||
1078 | mbuf->size += q->bufs[i]->bsize; | ||
1079 | } | ||
1080 | break; | ||
1081 | } | ||
1082 | #endif | ||
1083 | case VIDIOC_STREAMON: | ||
1084 | { | ||
1085 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) | ||
1086 | return -EINVAL; | ||
1087 | if (!res_get(dev,fh)) | ||
1088 | return -EBUSY; | ||
1089 | ret=videobuf_streamon(&fh->vb_vidq); | ||
1090 | break; | ||
1091 | } | ||
1092 | case VIDIOC_STREAMOFF: | ||
1093 | { | ||
1094 | if (fh->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1095 | ret=-EINVAL; | ||
1096 | break; | ||
1097 | } | ||
1098 | ret = videobuf_streamoff(&fh->vb_vidq); | ||
1099 | if (ret < 0) | ||
1100 | break; | ||
1101 | res_free(dev,fh); | ||
1102 | break; | ||
1103 | } | ||
1104 | /* ---------- tv norms ---------- */ | ||
1105 | case VIDIOC_ENUMSTD: | ||
1106 | { | ||
1107 | struct v4l2_standard *e = arg; | ||
1108 | |||
1109 | if (e->index>0) { | ||
1110 | ret=-EINVAL; | ||
1111 | break; | ||
1112 | } | ||
1113 | ret = v4l2_video_std_construct(e, V4L2_STD_NTSC_M, "NTSC-M"); | ||
1114 | |||
1115 | /* Allows vivi to use different fps from video std */ | ||
1116 | e->frameperiod.numerator = WAKE_NUMERATOR; | ||
1117 | e->frameperiod.denominator = WAKE_DENOMINATOR; | ||
1118 | |||
1119 | break; | ||
1120 | } | ||
1121 | case VIDIOC_G_STD: | ||
1122 | { | ||
1123 | v4l2_std_id *id = arg; | ||
1124 | |||
1125 | *id = V4L2_STD_NTSC_M; | ||
1126 | break; | ||
1127 | } | ||
1128 | case VIDIOC_S_STD: | ||
1129 | { | ||
1130 | break; | ||
1131 | } | ||
1132 | /* ------ input switching ---------- */ | ||
1133 | case VIDIOC_ENUMINPUT: | ||
1134 | { /* only one input in this sample driver */ | ||
1135 | struct v4l2_input *inp = arg; | ||
1136 | |||
1137 | if (inp->index != 0) { | ||
1138 | ret=-EINVAL; | ||
1139 | break; | ||
1140 | } | ||
1141 | memset(inp, 0, sizeof(*inp)); | ||
1142 | |||
1143 | inp->index = 0; | ||
1144 | inp->type = V4L2_INPUT_TYPE_CAMERA; | ||
1145 | inp->std = V4L2_STD_NTSC_M; | ||
1146 | strcpy(inp->name,"Camera"); | ||
1147 | break; | ||
1148 | } | ||
1149 | case VIDIOC_G_INPUT: | ||
1150 | { | ||
1151 | unsigned int *i = arg; | ||
1152 | |||
1153 | *i = 0; | ||
1154 | break; | ||
1155 | } | ||
1156 | case VIDIOC_S_INPUT: | ||
1157 | { | ||
1158 | unsigned int *i = arg; | ||
1159 | |||
1160 | if (*i > 0) | ||
1161 | ret=-EINVAL; | ||
1162 | break; | ||
1163 | } | ||
1164 | |||
1165 | /* --- controls ---------------------------------------------- */ | ||
1166 | case VIDIOC_QUERYCTRL: | ||
1167 | { | ||
1168 | struct v4l2_queryctrl *qc = arg; | ||
1169 | int i; | ||
1170 | |||
1171 | for (i = 0; i < ARRAY_SIZE(vivi_qctrl); i++) | ||
1172 | if (qc->id && qc->id == vivi_qctrl[i].id) { | ||
1173 | memcpy(qc, &(vivi_qctrl[i]), | ||
1174 | sizeof(*qc)); | ||
1175 | break; | ||
1176 | } | ||
1177 | |||
1178 | ret=-EINVAL; | ||
1179 | break; | ||
1180 | } | ||
1181 | case VIDIOC_G_CTRL: | ||
1182 | { | ||
1183 | struct v4l2_control *ctrl = arg; | ||
1184 | int i; | ||
1185 | |||
1186 | for (i = 0; i < ARRAY_SIZE(vivi_qctrl); i++) | ||
1187 | if (ctrl->id == vivi_qctrl[i].id) { | ||
1188 | ctrl->value=qctl_regs[i]; | ||
1189 | break; | ||
1190 | } | ||
1191 | |||
1192 | ret=-EINVAL; | ||
1193 | break; | ||
1194 | } | ||
1195 | case VIDIOC_S_CTRL: | ||
1196 | { | ||
1197 | struct v4l2_control *ctrl = arg; | ||
1198 | int i; | ||
1199 | for (i = 0; i < ARRAY_SIZE(vivi_qctrl); i++) | ||
1200 | if (ctrl->id == vivi_qctrl[i].id) { | ||
1201 | if (ctrl->value < | ||
1202 | vivi_qctrl[i].minimum | ||
1203 | || ctrl->value > | ||
1204 | vivi_qctrl[i].maximum) { | ||
1205 | ret=-ERANGE; | ||
1206 | break; | ||
1207 | } | ||
1208 | qctl_regs[i]=ctrl->value; | ||
1209 | break; | ||
1210 | } | ||
1211 | ret=-EINVAL; | ||
1212 | break; | ||
1213 | } | ||
1214 | default: | ||
1215 | ret=v4l_compat_translate_ioctl(inode,file,cmd,arg,vivi_do_ioctl); | ||
1216 | } | ||
1217 | |||
1218 | if (debug) { | ||
1219 | if (ret<0) { | ||
1220 | v4l_print_ioctl("vivi(err)", cmd); | ||
1221 | dprintk(1,"errcode=%d\n",ret); | ||
1222 | } else if (_IOC_DIR(cmd) & _IOC_READ) | ||
1223 | v4l_printk_ioctl_arg("vivi(r)",cmd, arg); | ||
1224 | } | ||
1225 | |||
1226 | return ret; | ||
1227 | } | ||
1228 | |||
1229 | static int vivi_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | ||
1230 | { | ||
1231 | return video_usercopy(inode, file, cmd, arg, vivi_do_ioctl); | ||
1232 | } | ||
1233 | |||
1234 | /* ------------------------------------------------------------------ | ||
1235 | File operations for the device | ||
1236 | ------------------------------------------------------------------*/ | ||
1237 | |||
1238 | #define line_buf_size(norm) (norm_maxw(norm)*(format.depth+7)/8) | ||
1239 | |||
1240 | static int vivi_open(struct inode *inode, struct file *file) | ||
1241 | { | ||
1242 | int minor = iminor(inode); | ||
1243 | struct vivi_dev *h,*dev = NULL; | ||
1244 | struct vivi_fh *fh; | ||
1245 | struct list_head *list; | ||
1246 | enum v4l2_buf_type type = 0; | ||
1247 | int i; | ||
1248 | |||
1249 | printk(KERN_DEBUG "vivi: open called (minor=%d)\n",minor); | ||
1250 | |||
1251 | list_for_each(list,&vivi_devlist) { | ||
1252 | h = list_entry(list, struct vivi_dev, vivi_devlist); | ||
1253 | if (h->video_dev.minor == minor) { | ||
1254 | dev = h; | ||
1255 | type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1256 | } | ||
1257 | } | ||
1258 | if (NULL == dev) | ||
1259 | return -ENODEV; | ||
1260 | |||
1261 | |||
1262 | /* If more than one user, mutex should be added */ | ||
1263 | dev->users++; | ||
1264 | |||
1265 | dprintk(1,"open minor=%d type=%s users=%d\n", | ||
1266 | minor,v4l2_type_names[type],dev->users); | ||
1267 | |||
1268 | /* allocate + initialize per filehandle data */ | ||
1269 | fh = kzalloc(sizeof(*fh),GFP_KERNEL); | ||
1270 | if (NULL == fh) { | ||
1271 | dev->users--; | ||
1272 | return -ENOMEM; | ||
1273 | } | ||
1274 | |||
1275 | file->private_data = fh; | ||
1276 | fh->dev = dev; | ||
1277 | fh->type = V4L2_BUF_TYPE_VIDEO_CAPTURE; | ||
1278 | fh->fmt = &format; | ||
1279 | fh->width = 640; | ||
1280 | fh->height = 480; | ||
1281 | |||
1282 | /* Put all controls at a sane state */ | ||
1283 | for (i = 0; i < ARRAY_SIZE(vivi_qctrl); i++) | ||
1284 | qctl_regs[i] =vivi_qctrl[i].default_value; | ||
1285 | |||
1286 | dprintk(1,"Open: fh=0x%08lx, dev=0x%08lx, dev->vidq=0x%08lx\n", | ||
1287 | (unsigned long)fh,(unsigned long)dev,(unsigned long)&dev->vidq); | ||
1288 | dprintk(1,"Open: list_empty queued=%d\n",list_empty(&dev->vidq.queued)); | ||
1289 | dprintk(1,"Open: list_empty active=%d\n",list_empty(&dev->vidq.active)); | ||
1290 | |||
1291 | /* Resets frame counters */ | ||
1292 | dev->h=0; | ||
1293 | dev->m=0; | ||
1294 | dev->s=0; | ||
1295 | dev->us=0; | ||
1296 | dev->jiffies=jiffies; | ||
1297 | sprintf(dev->timestr,"%02d:%02d:%02d:%03d", | ||
1298 | dev->h,dev->m,dev->s,(dev->us+500)/1000); | ||
1299 | |||
1300 | videobuf_queue_init(&fh->vb_vidq, &vivi_video_qops, | ||
1301 | NULL, NULL, | ||
1302 | fh->type, | ||
1303 | V4L2_FIELD_INTERLACED, | ||
1304 | sizeof(struct vivi_buffer),fh); | ||
1305 | |||
1306 | return 0; | ||
1307 | } | ||
1308 | |||
1309 | static ssize_t | ||
1310 | vivi_read(struct file *file, char __user *data, size_t count, loff_t *ppos) | ||
1311 | { | ||
1312 | struct vivi_fh *fh = file->private_data; | ||
1313 | |||
1314 | if (fh->type==V4L2_BUF_TYPE_VIDEO_CAPTURE) { | ||
1315 | if (res_locked(fh->dev)) | ||
1316 | return -EBUSY; | ||
1317 | return videobuf_read_one(&fh->vb_vidq, data, count, ppos, | ||
1318 | file->f_flags & O_NONBLOCK); | ||
1319 | } | ||
1320 | return 0; | ||
1321 | } | ||
1322 | |||
1323 | static unsigned int | ||
1324 | vivi_poll(struct file *file, struct poll_table_struct *wait) | ||
1325 | { | ||
1326 | struct vivi_fh *fh = file->private_data; | ||
1327 | struct vivi_buffer *buf; | ||
1328 | |||
1329 | dprintk(1,"%s\n",__FUNCTION__); | ||
1330 | |||
1331 | if (V4L2_BUF_TYPE_VIDEO_CAPTURE != fh->type) | ||
1332 | return POLLERR; | ||
1333 | |||
1334 | if (res_get(fh->dev,fh)) { | ||
1335 | dprintk(1,"poll: mmap interface\n"); | ||
1336 | /* streaming capture */ | ||
1337 | if (list_empty(&fh->vb_vidq.stream)) | ||
1338 | return POLLERR; | ||
1339 | buf = list_entry(fh->vb_vidq.stream.next,struct vivi_buffer,vb.stream); | ||
1340 | } else { | ||
1341 | dprintk(1,"poll: read() interface\n"); | ||
1342 | /* read() capture */ | ||
1343 | buf = (struct vivi_buffer*)fh->vb_vidq.read_buf; | ||
1344 | if (NULL == buf) | ||
1345 | return POLLERR; | ||
1346 | } | ||
1347 | poll_wait(file, &buf->vb.done, wait); | ||
1348 | if (buf->vb.state == STATE_DONE || | ||
1349 | buf->vb.state == STATE_ERROR) | ||
1350 | return POLLIN|POLLRDNORM; | ||
1351 | return 0; | ||
1352 | } | ||
1353 | |||
1354 | static int vivi_release(struct inode *inode, struct file *file) | ||
1355 | { | ||
1356 | struct vivi_fh *fh = file->private_data; | ||
1357 | struct vivi_dev *dev = fh->dev; | ||
1358 | struct vivi_dmaqueue *vidq = &dev->vidq; | ||
1359 | |||
1360 | int minor = iminor(inode); | ||
1361 | |||
1362 | vivi_stop_thread(vidq); | ||
1363 | videobuf_mmap_free(&fh->vb_vidq); | ||
1364 | |||
1365 | kfree (fh); | ||
1366 | |||
1367 | dev->users--; | ||
1368 | |||
1369 | printk(KERN_DEBUG "vivi: close called (minor=%d, users=%d)\n",minor,dev->users); | ||
1370 | |||
1371 | return 0; | ||
1372 | } | ||
1373 | |||
1374 | static int | ||
1375 | vivi_mmap(struct file *file, struct vm_area_struct * vma) | ||
1376 | { | ||
1377 | struct vivi_fh *fh = file->private_data; | ||
1378 | int ret; | ||
1379 | |||
1380 | dprintk (1,"mmap called, vma=0x%08lx\n",(unsigned long)vma); | ||
1381 | |||
1382 | ret=videobuf_mmap_mapper(&fh->vb_vidq, vma); | ||
1383 | |||
1384 | dprintk (1,"vma start=0x%08lx, size=%ld, ret=%d\n", | ||
1385 | (unsigned long)vma->vm_start, | ||
1386 | (unsigned long)vma->vm_end-(unsigned long)vma->vm_start, | ||
1387 | ret); | ||
1388 | |||
1389 | return ret; | ||
1390 | } | ||
1391 | |||
1392 | static struct file_operations vivi_fops = { | ||
1393 | .owner = THIS_MODULE, | ||
1394 | .open = vivi_open, | ||
1395 | .release = vivi_release, | ||
1396 | .read = vivi_read, | ||
1397 | .poll = vivi_poll, | ||
1398 | .ioctl = vivi_ioctl, | ||
1399 | .mmap = vivi_mmap, | ||
1400 | .llseek = no_llseek, | ||
1401 | }; | ||
1402 | |||
1403 | static struct video_device vivi = { | ||
1404 | .name = "VTM Virtual Video Capture Board", | ||
1405 | .type = VID_TYPE_CAPTURE, | ||
1406 | .hardware = 0, | ||
1407 | .fops = &vivi_fops, | ||
1408 | .minor = -1, | ||
1409 | // .release = video_device_release, | ||
1410 | }; | ||
1411 | /* ------------------------------------------------------------------ | ||
1412 | Initialization and module stuff | ||
1413 | ------------------------------------------------------------------*/ | ||
1414 | |||
1415 | static int __init vivi_init(void) | ||
1416 | { | ||
1417 | int ret; | ||
1418 | struct vivi_dev *dev; | ||
1419 | |||
1420 | dev = kzalloc(sizeof(*dev),GFP_KERNEL); | ||
1421 | if (NULL == dev) | ||
1422 | return -ENOMEM; | ||
1423 | list_add_tail(&dev->vivi_devlist,&vivi_devlist); | ||
1424 | |||
1425 | /* init video dma queues */ | ||
1426 | INIT_LIST_HEAD(&dev->vidq.active); | ||
1427 | INIT_LIST_HEAD(&dev->vidq.queued); | ||
1428 | |||
1429 | /* initialize locks */ | ||
1430 | init_MUTEX(&dev->lock); | ||
1431 | |||
1432 | dev->vidq.timeout.function = vivi_vid_timeout; | ||
1433 | dev->vidq.timeout.data = (unsigned long)dev; | ||
1434 | init_timer(&dev->vidq.timeout); | ||
1435 | |||
1436 | ret = video_register_device(&vivi, VFL_TYPE_GRABBER, video_nr); | ||
1437 | printk(KERN_INFO "Video Technology Magazine Virtual Video Capture Board (Load status: %d)\n", ret); | ||
1438 | return ret; | ||
1439 | } | ||
1440 | |||
1441 | static void __exit vivi_exit(void) | ||
1442 | { | ||
1443 | struct vivi_dev *h; | ||
1444 | struct list_head *list; | ||
1445 | |||
1446 | list_for_each(list,&vivi_devlist) { | ||
1447 | h = list_entry(list, struct vivi_dev, vivi_devlist); | ||
1448 | kfree (h); | ||
1449 | } | ||
1450 | video_unregister_device(&vivi); | ||
1451 | } | ||
1452 | |||
1453 | module_init(vivi_init); | ||
1454 | module_exit(vivi_exit); | ||
diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index 4cd579967487..40b205b91481 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * vpx3220a, vpx3216b & vpx3214c video decoder driver version 0.0.1 | 2 | * vpx3220a, vpx3216b & vpx3214c video decoder driver version 0.0.1 |
3 | * | 3 | * |
4 | * Copyright (C) 2001 Laurent Pinchart <lpinchart@freegates.be> | 4 | * Copyright (C) 2001 Laurent Pinchart <lpinchart@freegates.be> |
@@ -176,8 +176,8 @@ vpx3220_write_block (struct i2c_client *client, | |||
176 | 176 | ||
177 | static int | 177 | static int |
178 | vpx3220_write_fp_block (struct i2c_client *client, | 178 | vpx3220_write_fp_block (struct i2c_client *client, |
179 | const u16 *data, | 179 | const u16 *data, |
180 | unsigned int len) | 180 | unsigned int len) |
181 | { | 181 | { |
182 | u8 reg; | 182 | u8 reg; |
183 | int ret = 0; | 183 | int ret = 0; |
@@ -316,7 +316,7 @@ vpx3220_command (struct i2c_client *client, | |||
316 | vpx3220_write_fp_block(client, init_fp, | 316 | vpx3220_write_fp_block(client, init_fp, |
317 | sizeof(init_fp) >> 1); | 317 | sizeof(init_fp) >> 1); |
318 | switch (decoder->norm) { | 318 | switch (decoder->norm) { |
319 | 319 | ||
320 | case VIDEO_MODE_NTSC: | 320 | case VIDEO_MODE_NTSC: |
321 | vpx3220_write_fp_block(client, init_ntsc, | 321 | vpx3220_write_fp_block(client, init_ntsc, |
322 | sizeof(init_ntsc) >> 1); | 322 | sizeof(init_ntsc) >> 1); |
@@ -324,7 +324,7 @@ vpx3220_command (struct i2c_client *client, | |||
324 | 324 | ||
325 | case VIDEO_MODE_PAL: | 325 | case VIDEO_MODE_PAL: |
326 | vpx3220_write_fp_block(client, init_pal, | 326 | vpx3220_write_fp_block(client, init_pal, |
327 | sizeof(init_pal) >> 1); | 327 | sizeof(init_pal) >> 1); |
328 | break; | 328 | break; |
329 | case VIDEO_MODE_SECAM: | 329 | case VIDEO_MODE_SECAM: |
330 | vpx3220_write_fp_block(client, init_secam, | 330 | vpx3220_write_fp_block(client, init_secam, |
@@ -332,10 +332,10 @@ vpx3220_command (struct i2c_client *client, | |||
332 | break; | 332 | break; |
333 | default: | 333 | default: |
334 | vpx3220_write_fp_block(client, init_pal, | 334 | vpx3220_write_fp_block(client, init_pal, |
335 | sizeof(init_pal) >> 1); | 335 | sizeof(init_pal) >> 1); |
336 | break; | 336 | break; |
337 | } | 337 | } |
338 | } | 338 | } |
339 | break; | 339 | break; |
340 | 340 | ||
341 | case DECODER_DUMP: | 341 | case DECODER_DUMP: |
@@ -411,7 +411,7 @@ vpx3220_command (struct i2c_client *client, | |||
411 | 411 | ||
412 | /* Here we back up the input selection because it gets | 412 | /* Here we back up the input selection because it gets |
413 | overwritten when we fill the registers with the | 413 | overwritten when we fill the registers with the |
414 | choosen video norm */ | 414 | choosen video norm */ |
415 | temp_input = vpx3220_fp_read(client, 0xf2); | 415 | temp_input = vpx3220_fp_read(client, 0xf2); |
416 | 416 | ||
417 | dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n", | 417 | dprintk(1, KERN_DEBUG "%s: DECODER_SET_NORM %d\n", |
@@ -578,7 +578,7 @@ static unsigned short normal_i2c[] = | |||
578 | }; | 578 | }; |
579 | 579 | ||
580 | static unsigned short ignore = I2C_CLIENT_END; | 580 | static unsigned short ignore = I2C_CLIENT_END; |
581 | 581 | ||
582 | static struct i2c_client_address_data addr_data = { | 582 | static struct i2c_client_address_data addr_data = { |
583 | .normal_i2c = normal_i2c, | 583 | .normal_i2c = normal_i2c, |
584 | .probe = &ignore, | 584 | .probe = &ignore, |
@@ -661,7 +661,7 @@ vpx3220_detect_client (struct i2c_adapter *adapter, | |||
661 | break; | 661 | break; |
662 | default: | 662 | default: |
663 | dprintk(1, | 663 | dprintk(1, |
664 | KERN_INFO | 664 | KERN_INFO |
665 | "%s: Wrong part number (0x%04x)\n", | 665 | "%s: Wrong part number (0x%04x)\n", |
666 | __func__, pn); | 666 | __func__, pn); |
667 | kfree(client); | 667 | kfree(client); |
diff --git a/drivers/media/video/w9966.c b/drivers/media/video/w9966.c index b7b0afffd214..80ef8a1b8f63 100644 --- a/drivers/media/video/w9966.c +++ b/drivers/media/video/w9966.c | |||
@@ -26,7 +26,7 @@ | |||
26 | Does any other model using the w9966 interface chip exist ? | 26 | Does any other model using the w9966 interface chip exist ? |
27 | 27 | ||
28 | Todo: | 28 | Todo: |
29 | 29 | ||
30 | *Add a working EPP mode, since DMA ECP read isn't implemented | 30 | *Add a working EPP mode, since DMA ECP read isn't implemented |
31 | in the parport drivers. (That's why it's so sloow) | 31 | in the parport drivers. (That's why it's so sloow) |
32 | 32 | ||
@@ -47,9 +47,9 @@ | |||
47 | *Probably some bugs that I don't know of | 47 | *Probably some bugs that I don't know of |
48 | 48 | ||
49 | Please support me by sending feedback! | 49 | Please support me by sending feedback! |
50 | 50 | ||
51 | Changes: | 51 | Changes: |
52 | 52 | ||
53 | Alan Cox: Removed RGB mode for kernel merge, added THIS_MODULE | 53 | Alan Cox: Removed RGB mode for kernel merge, added THIS_MODULE |
54 | and owner support for newer module locks | 54 | and owner support for newer module locks |
55 | */ | 55 | */ |
@@ -204,7 +204,7 @@ static struct video_device w9966_template = { | |||
204 | */ | 204 | */ |
205 | 205 | ||
206 | 206 | ||
207 | // Set camera phase flags, so we know what to uninit when terminating | 207 | // Set camera phase flags, so we know what to uninit when terminating |
208 | static inline void w9966_setState(struct w9966_dev* cam, int mask, int val) | 208 | static inline void w9966_setState(struct w9966_dev* cam, int mask, int val) |
209 | { | 209 | { |
210 | cam->dev_state = (cam->dev_state & ~mask) ^ val; | 210 | cam->dev_state = (cam->dev_state & ~mask) ^ val; |
@@ -233,7 +233,7 @@ static inline void w9966_pdev_release(struct w9966_dev* cam) | |||
233 | parport_release(cam->pdev); | 233 | parport_release(cam->pdev); |
234 | w9966_setState(cam, W9966_STATE_CLAIMED, 0); | 234 | w9966_setState(cam, W9966_STATE_CLAIMED, 0); |
235 | } | 235 | } |
236 | 236 | ||
237 | // Read register from W9966 interface-chip | 237 | // Read register from W9966 interface-chip |
238 | // Expects a claimed pdev | 238 | // Expects a claimed pdev |
239 | // -1 on error, else register data (byte) | 239 | // -1 on error, else register data (byte) |
@@ -242,7 +242,7 @@ static int w9966_rReg(struct w9966_dev* cam, int reg) | |||
242 | // ECP, read, regtransfer, REG, REG, REG, REG, REG | 242 | // ECP, read, regtransfer, REG, REG, REG, REG, REG |
243 | const unsigned char addr = 0x80 | (reg & 0x1f); | 243 | const unsigned char addr = 0x80 | (reg & 0x1f); |
244 | unsigned char val; | 244 | unsigned char val; |
245 | 245 | ||
246 | if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) | 246 | if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) |
247 | return -1; | 247 | return -1; |
248 | if (parport_write(cam->pport, &addr, 1) != 1) | 248 | if (parport_write(cam->pport, &addr, 1) != 1) |
@@ -263,7 +263,7 @@ static int w9966_wReg(struct w9966_dev* cam, int reg, int data) | |||
263 | // ECP, write, regtransfer, REG, REG, REG, REG, REG | 263 | // ECP, write, regtransfer, REG, REG, REG, REG, REG |
264 | const unsigned char addr = 0xc0 | (reg & 0x1f); | 264 | const unsigned char addr = 0xc0 | (reg & 0x1f); |
265 | const unsigned char val = data; | 265 | const unsigned char val = data; |
266 | 266 | ||
267 | if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) | 267 | if (parport_negotiate(cam->pport, cam->ppmode | IEEE1284_ADDR) != 0) |
268 | return -1; | 268 | return -1; |
269 | if (parport_write(cam->pport, &addr, 1) != 1) | 269 | if (parport_write(cam->pport, &addr, 1) != 1) |
@@ -284,7 +284,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
284 | { | 284 | { |
285 | if (cam->dev_state != 0) | 285 | if (cam->dev_state != 0) |
286 | return -1; | 286 | return -1; |
287 | 287 | ||
288 | cam->pport = port; | 288 | cam->pport = port; |
289 | cam->brightness = 128; | 289 | cam->brightness = 128; |
290 | cam->contrast = 64; | 290 | cam->contrast = 64; |
@@ -302,7 +302,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
302 | cam->ppmode = IEEE1284_MODE_EPP; | 302 | cam->ppmode = IEEE1284_MODE_EPP; |
303 | else | 303 | else |
304 | cam->ppmode = IEEE1284_MODE_ECP; | 304 | cam->ppmode = IEEE1284_MODE_ECP; |
305 | break; | 305 | break; |
306 | case 1: // hw- or sw-ecp | 306 | case 1: // hw- or sw-ecp |
307 | cam->ppmode = IEEE1284_MODE_ECP; | 307 | cam->ppmode = IEEE1284_MODE_ECP; |
308 | break; | 308 | break; |
@@ -310,7 +310,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
310 | cam->ppmode = IEEE1284_MODE_EPP; | 310 | cam->ppmode = IEEE1284_MODE_EPP; |
311 | break; | 311 | break; |
312 | } | 312 | } |
313 | 313 | ||
314 | // Tell the parport driver that we exists | 314 | // Tell the parport driver that we exists |
315 | cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL); | 315 | cam->pdev = parport_register_device(port, "w9966", NULL, NULL, NULL, 0, NULL); |
316 | if (cam->pdev == NULL) { | 316 | if (cam->pdev == NULL) { |
@@ -320,7 +320,7 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
320 | w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV); | 320 | w9966_setState(cam, W9966_STATE_PDEV, W9966_STATE_PDEV); |
321 | 321 | ||
322 | w9966_pdev_claim(cam); | 322 | w9966_pdev_claim(cam); |
323 | 323 | ||
324 | // Setup a default capture mode | 324 | // Setup a default capture mode |
325 | if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) { | 325 | if (w9966_setup(cam, 0, 0, 1023, 1023, 200, 160) != 0) { |
326 | DPRINTF("w9966_setup() failed.\n"); | 326 | DPRINTF("w9966_setup() failed.\n"); |
@@ -333,11 +333,11 @@ static int w9966_init(struct w9966_dev* cam, struct parport* port) | |||
333 | memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); | 333 | memcpy(&cam->vdev, &w9966_template, sizeof(struct video_device)); |
334 | cam->vdev.priv = cam; | 334 | cam->vdev.priv = cam; |
335 | 335 | ||
336 | if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1) | 336 | if (video_register_device(&cam->vdev, VFL_TYPE_GRABBER, video_nr) == -1) |
337 | return -1; | 337 | return -1; |
338 | 338 | ||
339 | w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); | 339 | w9966_setState(cam, W9966_STATE_VDEV, W9966_STATE_VDEV); |
340 | 340 | ||
341 | // All ok | 341 | // All ok |
342 | printk( | 342 | printk( |
343 | "w9966cf: Found and initialized a webcam on %s.\n", | 343 | "w9966cf: Found and initialized a webcam on %s.\n", |
@@ -391,7 +391,7 @@ static int w9966_findlen(int near, int size, int maxlen) | |||
391 | // Only continue as long as we keep getting better values | 391 | // Only continue as long as we keep getting better values |
392 | if (err > besterr) | 392 | if (err > besterr) |
393 | break; | 393 | break; |
394 | 394 | ||
395 | besterr = err; | 395 | besterr = err; |
396 | bestlen = len; | 396 | bestlen = len; |
397 | } | 397 | } |
@@ -399,7 +399,7 @@ static int w9966_findlen(int near, int size, int maxlen) | |||
399 | return bestlen; | 399 | return bestlen; |
400 | } | 400 | } |
401 | 401 | ||
402 | // Modify capture window (if necessary) | 402 | // Modify capture window (if necessary) |
403 | // and calculate downscaling | 403 | // and calculate downscaling |
404 | // Return -1 on error | 404 | // Return -1 on error |
405 | static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsigned char* factor) | 405 | static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsigned char* factor) |
@@ -407,7 +407,7 @@ static int w9966_calcscale(int size, int min, int max, int* beg, int* end, unsig | |||
407 | int maxlen = max - min; | 407 | int maxlen = max - min; |
408 | int len = *end - *beg + 1; | 408 | int len = *end - *beg + 1; |
409 | int newlen = w9966_findlen(len, size, maxlen); | 409 | int newlen = w9966_findlen(len, size, maxlen); |
410 | int err = newlen - len; | 410 | int err = newlen - len; |
411 | 411 | ||
412 | // Check for bad format | 412 | // Check for bad format |
413 | if (newlen > maxlen || newlen < size) | 413 | if (newlen > maxlen || newlen < size) |
@@ -452,8 +452,8 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
452 | 0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, | 452 | 0x48, 0x0c, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, |
453 | 0x00, 0x00, 0x00, 0x71, 0xe7, 0x00, 0x00, 0xc0 | 453 | 0x00, 0x00, 0x00, 0x71, 0xe7, 0x00, 0x00, 0xc0 |
454 | }; | 454 | }; |
455 | 455 | ||
456 | 456 | ||
457 | if (w*h*2 > W9966_SRAMSIZE) | 457 | if (w*h*2 > W9966_SRAMSIZE) |
458 | { | 458 | { |
459 | DPRINTF("capture window exceeds SRAM size!.\n"); | 459 | DPRINTF("capture window exceeds SRAM size!.\n"); |
@@ -469,9 +469,9 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
469 | cam->width = w; | 469 | cam->width = w; |
470 | cam->height = h; | 470 | cam->height = h; |
471 | 471 | ||
472 | enh_s = 0; | 472 | enh_s = 0; |
473 | enh_e = w*h*2; | 473 | enh_e = w*h*2; |
474 | 474 | ||
475 | // Modify capture window if necessary and calculate downscaling | 475 | // Modify capture window if necessary and calculate downscaling |
476 | if ( | 476 | if ( |
477 | w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 || | 477 | w9966_calcscale(w, W9966_WND_MIN_X, W9966_WND_MAX_X, &x1, &x2, &scale_x) != 0 || |
@@ -482,14 +482,14 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
482 | "%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n", | 482 | "%dx%d, x: %d<->%d, y: %d<->%d, sx: %d/64, sy: %d/64.\n", |
483 | w, h, x1, x2, y1, y2, scale_x&~0x80, scale_y&~0x80 | 483 | w, h, x1, x2, y1, y2, scale_x&~0x80, scale_y&~0x80 |
484 | ); | 484 | ); |
485 | 485 | ||
486 | // Setup registers | 486 | // Setup registers |
487 | regs[0x00] = 0x00; // Set normal operation | 487 | regs[0x00] = 0x00; // Set normal operation |
488 | regs[0x01] = 0x18; // Capture mode | 488 | regs[0x01] = 0x18; // Capture mode |
489 | regs[0x02] = scale_y; // V-scaling | 489 | regs[0x02] = scale_y; // V-scaling |
490 | regs[0x03] = scale_x; // H-scaling | 490 | regs[0x03] = scale_x; // H-scaling |
491 | 491 | ||
492 | // Capture window | 492 | // Capture window |
493 | regs[0x04] = (x1 & 0x0ff); // X-start (8 low bits) | 493 | regs[0x04] = (x1 & 0x0ff); // X-start (8 low bits) |
494 | regs[0x05] = (x1 & 0x300)>>8; // X-start (2 high bits) | 494 | regs[0x05] = (x1 & 0x300)>>8; // X-start (2 high bits) |
495 | regs[0x06] = (y1 & 0x0ff); // Y-start (8 low bits) | 495 | regs[0x06] = (y1 & 0x0ff); // Y-start (8 low bits) |
@@ -499,7 +499,7 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
499 | regs[0x0a] = (y2 & 0x0ff); // Y-end (8 low bits) | 499 | regs[0x0a] = (y2 & 0x0ff); // Y-end (8 low bits) |
500 | 500 | ||
501 | regs[0x0c] = W9966_SRAMID; // SRAM-banks (1x 128kb) | 501 | regs[0x0c] = W9966_SRAMID; // SRAM-banks (1x 128kb) |
502 | 502 | ||
503 | // Enhancement layer | 503 | // Enhancement layer |
504 | regs[0x0d] = (enh_s& 0x000ff); // Enh. start (0-7) | 504 | regs[0x0d] = (enh_s& 0x000ff); // Enh. start (0-7) |
505 | regs[0x0e] = (enh_s& 0x0ff00)>>8; // Enh. start (8-15) | 505 | regs[0x0e] = (enh_s& 0x0ff00)>>8; // Enh. start (8-15) |
@@ -515,7 +515,7 @@ static int w9966_setup(struct w9966_dev* cam, int x1, int y1, int x2, int y2, in | |||
515 | regs[0x19] = 0xff; // I/O port direction control | 515 | regs[0x19] = 0xff; // I/O port direction control |
516 | regs[0x1a] = 0xff; // I/O port data register | 516 | regs[0x1a] = 0xff; // I/O port data register |
517 | regs[0x1b] = 0x10; // ??? | 517 | regs[0x1b] = 0x10; // ??? |
518 | 518 | ||
519 | // SAA7111 chip settings | 519 | // SAA7111 chip settings |
520 | saa7111_regs[0x0a] = cam->brightness; | 520 | saa7111_regs[0x0a] = cam->brightness; |
521 | saa7111_regs[0x0b] = cam->contrast; | 521 | saa7111_regs[0x0b] = cam->contrast; |
@@ -551,7 +551,7 @@ static inline void w9966_i2c_setsda(struct w9966_dev* cam, int state) | |||
551 | cam->i2c_state |= W9966_I2C_W_DATA; | 551 | cam->i2c_state |= W9966_I2C_W_DATA; |
552 | else | 552 | else |
553 | cam->i2c_state &= ~W9966_I2C_W_DATA; | 553 | cam->i2c_state &= ~W9966_I2C_W_DATA; |
554 | 554 | ||
555 | w9966_wReg(cam, 0x18, cam->i2c_state); | 555 | w9966_wReg(cam, 0x18, cam->i2c_state); |
556 | udelay(5); | 556 | udelay(5); |
557 | } | 557 | } |
@@ -577,7 +577,7 @@ static inline int w9966_i2c_setscl(struct w9966_dev* cam, int state) | |||
577 | 577 | ||
578 | w9966_wReg(cam, 0x18, cam->i2c_state); | 578 | w9966_wReg(cam, 0x18, cam->i2c_state); |
579 | udelay(5); | 579 | udelay(5); |
580 | 580 | ||
581 | // we go to high, we also expect the peripheral to ack. | 581 | // we go to high, we also expect the peripheral to ack. |
582 | if (state) { | 582 | if (state) { |
583 | timeout = jiffies + 100; | 583 | timeout = jiffies + 100; |
@@ -607,16 +607,16 @@ static int w9966_i2c_wbyte(struct w9966_dev* cam, int data) | |||
607 | w9966_i2c_setsda(cam, (data >> i) & 0x01); | 607 | w9966_i2c_setsda(cam, (data >> i) & 0x01); |
608 | 608 | ||
609 | if (w9966_i2c_setscl(cam, 1) == -1) | 609 | if (w9966_i2c_setscl(cam, 1) == -1) |
610 | return -1; | 610 | return -1; |
611 | w9966_i2c_setscl(cam, 0); | 611 | w9966_i2c_setscl(cam, 0); |
612 | } | 612 | } |
613 | 613 | ||
614 | w9966_i2c_setsda(cam, 1); | 614 | w9966_i2c_setsda(cam, 1); |
615 | 615 | ||
616 | if (w9966_i2c_setscl(cam, 1) == -1) | 616 | if (w9966_i2c_setscl(cam, 1) == -1) |
617 | return -1; | 617 | return -1; |
618 | w9966_i2c_setscl(cam, 0); | 618 | w9966_i2c_setscl(cam, 0); |
619 | 619 | ||
620 | return 0; | 620 | return 0; |
621 | } | 621 | } |
622 | 622 | ||
@@ -626,8 +626,8 @@ static int w9966_i2c_wbyte(struct w9966_dev* cam, int data) | |||
626 | static int w9966_i2c_rbyte(struct w9966_dev* cam) | 626 | static int w9966_i2c_rbyte(struct w9966_dev* cam) |
627 | { | 627 | { |
628 | unsigned char data = 0x00; | 628 | unsigned char data = 0x00; |
629 | int i; | 629 | int i; |
630 | 630 | ||
631 | w9966_i2c_setsda(cam, 1); | 631 | w9966_i2c_setsda(cam, 1); |
632 | 632 | ||
633 | for (i = 0; i < 8; i++) | 633 | for (i = 0; i < 8; i++) |
@@ -637,7 +637,7 @@ static int w9966_i2c_rbyte(struct w9966_dev* cam) | |||
637 | data = data << 1; | 637 | data = data << 1; |
638 | if (w9966_i2c_getsda(cam)) | 638 | if (w9966_i2c_getsda(cam)) |
639 | data |= 0x01; | 639 | data |= 0x01; |
640 | 640 | ||
641 | w9966_i2c_setscl(cam, 0); | 641 | w9966_i2c_setscl(cam, 0); |
642 | } | 642 | } |
643 | return data; | 643 | return data; |
@@ -673,11 +673,11 @@ static int w9966_rReg_i2c(struct w9966_dev* cam, int reg) | |||
673 | return -1; | 673 | return -1; |
674 | 674 | ||
675 | w9966_i2c_setsda(cam, 0); | 675 | w9966_i2c_setsda(cam, 0); |
676 | 676 | ||
677 | if (w9966_i2c_setscl(cam, 1) == -1) | 677 | if (w9966_i2c_setscl(cam, 1) == -1) |
678 | return -1; | 678 | return -1; |
679 | w9966_i2c_setsda(cam, 1); | 679 | w9966_i2c_setsda(cam, 1); |
680 | 680 | ||
681 | return data; | 681 | return data; |
682 | } | 682 | } |
683 | #endif | 683 | #endif |
@@ -699,7 +699,7 @@ static int w9966_wReg_i2c(struct w9966_dev* cam, int reg, int data) | |||
699 | w9966_i2c_setsda(cam, 0); | 699 | w9966_i2c_setsda(cam, 0); |
700 | if (w9966_i2c_setscl(cam, 1) == -1) | 700 | if (w9966_i2c_setscl(cam, 1) == -1) |
701 | return -1; | 701 | return -1; |
702 | 702 | ||
703 | w9966_i2c_setsda(cam, 1); | 703 | w9966_i2c_setsda(cam, 1); |
704 | 704 | ||
705 | return 0; | 705 | return 0; |
@@ -714,7 +714,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
714 | { | 714 | { |
715 | struct video_device *vdev = video_devdata(file); | 715 | struct video_device *vdev = video_devdata(file); |
716 | struct w9966_dev *cam = vdev->priv; | 716 | struct w9966_dev *cam = vdev->priv; |
717 | 717 | ||
718 | switch(cmd) | 718 | switch(cmd) |
719 | { | 719 | { |
720 | case VIDIOCGCAP: | 720 | case VIDIOCGCAP: |
@@ -790,14 +790,14 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
790 | struct video_picture *vpic = arg; | 790 | struct video_picture *vpic = arg; |
791 | if (vpic->depth != 16 || vpic->palette != VIDEO_PALETTE_YUV422) | 791 | if (vpic->depth != 16 || vpic->palette != VIDEO_PALETTE_YUV422) |
792 | return -EINVAL; | 792 | return -EINVAL; |
793 | 793 | ||
794 | cam->brightness = vpic->brightness >> 8; | 794 | cam->brightness = vpic->brightness >> 8; |
795 | cam->hue = (vpic->hue >> 8) - 128; | 795 | cam->hue = (vpic->hue >> 8) - 128; |
796 | cam->color = vpic->colour >> 9; | 796 | cam->color = vpic->colour >> 9; |
797 | cam->contrast = vpic->contrast >> 9; | 797 | cam->contrast = vpic->contrast >> 9; |
798 | 798 | ||
799 | w9966_pdev_claim(cam); | 799 | w9966_pdev_claim(cam); |
800 | 800 | ||
801 | if ( | 801 | if ( |
802 | w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 || | 802 | w9966_wReg_i2c(cam, 0x0a, cam->brightness) == -1 || |
803 | w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 || | 803 | w9966_wReg_i2c(cam, 0x0b, cam->contrast) == -1 || |
@@ -807,7 +807,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
807 | w9966_pdev_release(cam); | 807 | w9966_pdev_release(cam); |
808 | return -EIO; | 808 | return -EIO; |
809 | } | 809 | } |
810 | 810 | ||
811 | w9966_pdev_release(cam); | 811 | w9966_pdev_release(cam); |
812 | return 0; | 812 | return 0; |
813 | } | 813 | } |
@@ -815,13 +815,13 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
815 | { | 815 | { |
816 | int ret; | 816 | int ret; |
817 | struct video_window *vwin = arg; | 817 | struct video_window *vwin = arg; |
818 | 818 | ||
819 | if (vwin->flags != 0) | 819 | if (vwin->flags != 0) |
820 | return -EINVAL; | 820 | return -EINVAL; |
821 | if (vwin->clipcount != 0) | 821 | if (vwin->clipcount != 0) |
822 | return -EINVAL; | 822 | return -EINVAL; |
823 | if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W) | 823 | if (vwin->width < 2 || vwin->width > W9966_WND_MAX_W) |
824 | return -EINVAL; | 824 | return -EINVAL; |
825 | if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H) | 825 | if (vwin->height < 1 || vwin->height > W9966_WND_MAX_H) |
826 | return -EINVAL; | 826 | return -EINVAL; |
827 | 827 | ||
@@ -829,12 +829,12 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
829 | w9966_pdev_claim(cam); | 829 | w9966_pdev_claim(cam); |
830 | ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height); | 830 | ret = w9966_setup(cam, 0, 0, 1023, 1023, vwin->width, vwin->height); |
831 | w9966_pdev_release(cam); | 831 | w9966_pdev_release(cam); |
832 | 832 | ||
833 | if (ret != 0) { | 833 | if (ret != 0) { |
834 | DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n"); | 834 | DPRINTF("VIDIOCSWIN: w9966_setup() failed.\n"); |
835 | return -EIO; | 835 | return -EIO; |
836 | } | 836 | } |
837 | 837 | ||
838 | return 0; | 838 | return 0; |
839 | } | 839 | } |
840 | case VIDIOCGWIN: | 840 | case VIDIOCGWIN: |
@@ -846,7 +846,7 @@ static int w9966_v4l_do_ioctl(struct inode *inode, struct file *file, | |||
846 | return 0; | 846 | return 0; |
847 | } | 847 | } |
848 | // Unimplemented | 848 | // Unimplemented |
849 | case VIDIOCCAPTURE: | 849 | case VIDIOCCAPTURE: |
850 | case VIDIOCGFBUF: | 850 | case VIDIOCGFBUF: |
851 | case VIDIOCSFBUF: | 851 | case VIDIOCSFBUF: |
852 | case VIDIOCKEY: | 852 | case VIDIOCKEY: |
@@ -877,17 +877,17 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, | |||
877 | unsigned char __user *dest = (unsigned char __user *)buf; | 877 | unsigned char __user *dest = (unsigned char __user *)buf; |
878 | unsigned long dleft = count; | 878 | unsigned long dleft = count; |
879 | unsigned char *tbuf; | 879 | unsigned char *tbuf; |
880 | 880 | ||
881 | // Why would anyone want more than this?? | 881 | // Why would anyone want more than this?? |
882 | if (count > cam->width * cam->height * 2) | 882 | if (count > cam->width * cam->height * 2) |
883 | return -EINVAL; | 883 | return -EINVAL; |
884 | 884 | ||
885 | w9966_pdev_claim(cam); | 885 | w9966_pdev_claim(cam); |
886 | w9966_wReg(cam, 0x00, 0x02); // Reset ECP-FIFO buffer | 886 | w9966_wReg(cam, 0x00, 0x02); // Reset ECP-FIFO buffer |
887 | w9966_wReg(cam, 0x00, 0x00); // Return to normal operation | 887 | w9966_wReg(cam, 0x00, 0x00); // Return to normal operation |
888 | w9966_wReg(cam, 0x01, 0x98); // Enable capture | 888 | w9966_wReg(cam, 0x01, 0x98); // Enable capture |
889 | 889 | ||
890 | // write special capture-addr and negotiate into data transfer | 890 | // write special capture-addr and negotiate into data transfer |
891 | if ( | 891 | if ( |
892 | (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0 )|| | 892 | (parport_negotiate(cam->pport, cam->ppmode|IEEE1284_ADDR) != 0 )|| |
893 | (parport_write(cam->pport, &addr, 1) != 1 )|| | 893 | (parport_write(cam->pport, &addr, 1) != 1 )|| |
@@ -906,7 +906,7 @@ static ssize_t w9966_v4l_read(struct file *file, char __user *buf, | |||
906 | while(dleft > 0) | 906 | while(dleft > 0) |
907 | { | 907 | { |
908 | unsigned long tsize = (dleft > W9966_RBUFFER) ? W9966_RBUFFER : dleft; | 908 | unsigned long tsize = (dleft > W9966_RBUFFER) ? W9966_RBUFFER : dleft; |
909 | 909 | ||
910 | if (parport_read(cam->pport, tbuf, tsize) < tsize) { | 910 | if (parport_read(cam->pport, tbuf, tsize) < tsize) { |
911 | count = -EFAULT; | 911 | count = -EFAULT; |
912 | goto out; | 912 | goto out; |
@@ -933,7 +933,7 @@ out: | |||
933 | static void w9966_attach(struct parport *port) | 933 | static void w9966_attach(struct parport *port) |
934 | { | 934 | { |
935 | int i; | 935 | int i; |
936 | 936 | ||
937 | for (i = 0; i < W9966_MAXCAMS; i++) | 937 | for (i = 0; i < W9966_MAXCAMS; i++) |
938 | { | 938 | { |
939 | if (w9966_cams[i].dev_state != 0) // Cam is already assigned | 939 | if (w9966_cams[i].dev_state != 0) // Cam is already assigned |
diff --git a/drivers/usb/media/w9968cf.c b/drivers/media/video/w9968cf.c index b57dec3782e0..20f211b55ad4 100644 --- a/drivers/usb/media/w9968cf.c +++ b/drivers/media/video/w9968cf.c | |||
@@ -71,39 +71,39 @@ MODULE_SUPPORTED_DEVICE("Video"); | |||
71 | static int ovmod_load = W9968CF_OVMOD_LOAD; | 71 | static int ovmod_load = W9968CF_OVMOD_LOAD; |
72 | static unsigned short simcams = W9968CF_SIMCAMS; | 72 | static unsigned short simcams = W9968CF_SIMCAMS; |
73 | static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ | 73 | static short video_nr[]={[0 ... W9968CF_MAX_DEVICES-1] = -1}; /*-1=first free*/ |
74 | static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 74 | static unsigned int packet_size[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
75 | W9968CF_PACKET_SIZE}; | 75 | W9968CF_PACKET_SIZE}; |
76 | static unsigned short max_buffers[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 76 | static unsigned short max_buffers[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
77 | W9968CF_BUFFERS}; | 77 | W9968CF_BUFFERS}; |
78 | static int double_buffer[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 78 | static int double_buffer[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
79 | W9968CF_DOUBLE_BUFFER}; | 79 | W9968CF_DOUBLE_BUFFER}; |
80 | static int clamping[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_CLAMPING}; | 80 | static int clamping[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_CLAMPING}; |
81 | static unsigned short filter_type[]= {[0 ... W9968CF_MAX_DEVICES-1] = | 81 | static unsigned short filter_type[]= {[0 ... W9968CF_MAX_DEVICES-1] = |
82 | W9968CF_FILTER_TYPE}; | 82 | W9968CF_FILTER_TYPE}; |
83 | static int largeview[]= {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_LARGEVIEW}; | 83 | static int largeview[]= {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_LARGEVIEW}; |
84 | static unsigned short decompression[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 84 | static unsigned short decompression[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
85 | W9968CF_DECOMPRESSION}; | 85 | W9968CF_DECOMPRESSION}; |
86 | static int upscaling[]= {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_UPSCALING}; | 86 | static int upscaling[]= {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_UPSCALING}; |
87 | static unsigned short force_palette[] = {[0 ... W9968CF_MAX_DEVICES-1] = 0}; | 87 | static unsigned short force_palette[] = {[0 ... W9968CF_MAX_DEVICES-1] = 0}; |
88 | static int force_rgb[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_FORCE_RGB}; | 88 | static int force_rgb[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_FORCE_RGB}; |
89 | static int autobright[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_AUTOBRIGHT}; | 89 | static int autobright[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_AUTOBRIGHT}; |
90 | static int autoexp[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_AUTOEXP}; | 90 | static int autoexp[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_AUTOEXP}; |
91 | static unsigned short lightfreq[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 91 | static unsigned short lightfreq[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
92 | W9968CF_LIGHTFREQ}; | 92 | W9968CF_LIGHTFREQ}; |
93 | static int bandingfilter[] = {[0 ... W9968CF_MAX_DEVICES-1]= | 93 | static int bandingfilter[] = {[0 ... W9968CF_MAX_DEVICES-1]= |
94 | W9968CF_BANDINGFILTER}; | 94 | W9968CF_BANDINGFILTER}; |
95 | static short clockdiv[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_CLOCKDIV}; | 95 | static short clockdiv[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_CLOCKDIV}; |
96 | static int backlight[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_BACKLIGHT}; | 96 | static int backlight[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_BACKLIGHT}; |
97 | static int mirror[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_MIRROR}; | 97 | static int mirror[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_MIRROR}; |
98 | static int monochrome[] = {[0 ... W9968CF_MAX_DEVICES-1]=W9968CF_MONOCHROME}; | 98 | static int monochrome[] = {[0 ... W9968CF_MAX_DEVICES-1]=W9968CF_MONOCHROME}; |
99 | static unsigned int brightness[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 99 | static unsigned int brightness[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
100 | W9968CF_BRIGHTNESS}; | 100 | W9968CF_BRIGHTNESS}; |
101 | static unsigned int hue[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_HUE}; | 101 | static unsigned int hue[] = {[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_HUE}; |
102 | static unsigned int colour[]={[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_COLOUR}; | 102 | static unsigned int colour[]={[0 ... W9968CF_MAX_DEVICES-1] = W9968CF_COLOUR}; |
103 | static unsigned int contrast[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 103 | static unsigned int contrast[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
104 | W9968CF_CONTRAST}; | 104 | W9968CF_CONTRAST}; |
105 | static unsigned int whiteness[] = {[0 ... W9968CF_MAX_DEVICES-1] = | 105 | static unsigned int whiteness[] = {[0 ... W9968CF_MAX_DEVICES-1] = |
106 | W9968CF_WHITENESS}; | 106 | W9968CF_WHITENESS}; |
107 | #ifdef W9968CF_DEBUG | 107 | #ifdef W9968CF_DEBUG |
108 | static unsigned short debug = W9968CF_DEBUG_LEVEL; | 108 | static unsigned short debug = W9968CF_DEBUG_LEVEL; |
109 | static int specific_debug = W9968CF_SPECIFIC_DEBUG; | 109 | static int specific_debug = W9968CF_SPECIFIC_DEBUG; |
@@ -145,251 +145,251 @@ module_param(specific_debug, bool, 0644); | |||
145 | #endif | 145 | #endif |
146 | 146 | ||
147 | #ifdef CONFIG_KMOD | 147 | #ifdef CONFIG_KMOD |
148 | MODULE_PARM_DESC(ovmod_load, | 148 | MODULE_PARM_DESC(ovmod_load, |
149 | "\n<0|1> Automatic 'ovcamchip' module loading." | 149 | "\n<0|1> Automatic 'ovcamchip' module loading." |
150 | "\n0 disabled, 1 enabled." | 150 | "\n0 disabled, 1 enabled." |
151 | "\nIf enabled,'insmod' searches for the required 'ovcamchip'" | 151 | "\nIf enabled,'insmod' searches for the required 'ovcamchip'" |
152 | "\nmodule in the system, according to its configuration, and" | 152 | "\nmodule in the system, according to its configuration, and" |
153 | "\nattempts to load that module automatically. This action is" | 153 | "\nattempts to load that module automatically. This action is" |
154 | "\nperformed once as soon as the 'w9968cf' module is loaded" | 154 | "\nperformed once as soon as the 'w9968cf' module is loaded" |
155 | "\ninto memory." | 155 | "\ninto memory." |
156 | "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"." | 156 | "\nDefault value is "__MODULE_STRING(W9968CF_OVMOD_LOAD)"." |
157 | "\n"); | 157 | "\n"); |
158 | #endif | 158 | #endif |
159 | MODULE_PARM_DESC(simcams, | 159 | MODULE_PARM_DESC(simcams, |
160 | "\n<n> Number of cameras allowed to stream simultaneously." | 160 | "\n<n> Number of cameras allowed to stream simultaneously." |
161 | "\nn may vary from 0 to " | 161 | "\nn may vary from 0 to " |
162 | __MODULE_STRING(W9968CF_MAX_DEVICES)"." | 162 | __MODULE_STRING(W9968CF_MAX_DEVICES)"." |
163 | "\nDefault value is "__MODULE_STRING(W9968CF_SIMCAMS)"." | 163 | "\nDefault value is "__MODULE_STRING(W9968CF_SIMCAMS)"." |
164 | "\n"); | 164 | "\n"); |
165 | MODULE_PARM_DESC(video_nr, | 165 | MODULE_PARM_DESC(video_nr, |
166 | "\n<-1|n[,...]> Specify V4L minor mode number." | 166 | "\n<-1|n[,...]> Specify V4L minor mode number." |
167 | "\n -1 = use next available (default)" | 167 | "\n -1 = use next available (default)" |
168 | "\n n = use minor number n (integer >= 0)" | 168 | "\n n = use minor number n (integer >= 0)" |
169 | "\nYou can specify up to "__MODULE_STRING(W9968CF_MAX_DEVICES) | 169 | "\nYou can specify up to "__MODULE_STRING(W9968CF_MAX_DEVICES) |
170 | " cameras this way." | 170 | " cameras this way." |
171 | "\nFor example:" | 171 | "\nFor example:" |
172 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" | 172 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" |
173 | "\nthe second camera and use auto for the first" | 173 | "\nthe second camera and use auto for the first" |
174 | "\none and for every other camera." | 174 | "\none and for every other camera." |
175 | "\n"); | 175 | "\n"); |
176 | MODULE_PARM_DESC(packet_size, | 176 | MODULE_PARM_DESC(packet_size, |
177 | "\n<n[,...]> Specify the maximum data payload" | 177 | "\n<n[,...]> Specify the maximum data payload" |
178 | "\nsize in bytes for alternate settings, for each device." | 178 | "\nsize in bytes for alternate settings, for each device." |
179 | "\nn is scaled between 63 and 1023 " | 179 | "\nn is scaled between 63 and 1023 " |
180 | "(default is "__MODULE_STRING(W9968CF_PACKET_SIZE)")." | 180 | "(default is "__MODULE_STRING(W9968CF_PACKET_SIZE)")." |
181 | "\n"); | 181 | "\n"); |
182 | MODULE_PARM_DESC(max_buffers, | 182 | MODULE_PARM_DESC(max_buffers, |
183 | "\n<n[,...]> For advanced users." | 183 | "\n<n[,...]> For advanced users." |
184 | "\nSpecify the maximum number of video frame buffers" | 184 | "\nSpecify the maximum number of video frame buffers" |
185 | "\nto allocate for each device, from 2 to " | 185 | "\nto allocate for each device, from 2 to " |
186 | __MODULE_STRING(W9968CF_MAX_BUFFERS) | 186 | __MODULE_STRING(W9968CF_MAX_BUFFERS) |
187 | ". (default is "__MODULE_STRING(W9968CF_BUFFERS)")." | 187 | ". (default is "__MODULE_STRING(W9968CF_BUFFERS)")." |
188 | "\n"); | 188 | "\n"); |
189 | MODULE_PARM_DESC(double_buffer, | 189 | MODULE_PARM_DESC(double_buffer, |
190 | "\n<0|1[,...]> " | 190 | "\n<0|1[,...]> " |
191 | "Hardware double buffering: 0 disabled, 1 enabled." | 191 | "Hardware double buffering: 0 disabled, 1 enabled." |
192 | "\nIt should be enabled if you want smooth video output: if" | 192 | "\nIt should be enabled if you want smooth video output: if" |
193 | "\nyou obtain out of sync. video, disable it, or try to" | 193 | "\nyou obtain out of sync. video, disable it, or try to" |
194 | "\ndecrease the 'clockdiv' module parameter value." | 194 | "\ndecrease the 'clockdiv' module parameter value." |
195 | "\nDefault value is "__MODULE_STRING(W9968CF_DOUBLE_BUFFER) | 195 | "\nDefault value is "__MODULE_STRING(W9968CF_DOUBLE_BUFFER) |
196 | " for every device." | 196 | " for every device." |
197 | "\n"); | 197 | "\n"); |
198 | MODULE_PARM_DESC(clamping, | 198 | MODULE_PARM_DESC(clamping, |
199 | "\n<0|1[,...]> Video data clamping: 0 disabled, 1 enabled." | 199 | "\n<0|1[,...]> Video data clamping: 0 disabled, 1 enabled." |
200 | "\nDefault value is "__MODULE_STRING(W9968CF_CLAMPING) | 200 | "\nDefault value is "__MODULE_STRING(W9968CF_CLAMPING) |
201 | " for every device." | 201 | " for every device." |
202 | "\n"); | 202 | "\n"); |
203 | MODULE_PARM_DESC(filter_type, | 203 | MODULE_PARM_DESC(filter_type, |
204 | "\n<0|1|2[,...]> Video filter type." | 204 | "\n<0|1|2[,...]> Video filter type." |
205 | "\n0 none, 1 (1-2-1) 3-tap filter, " | 205 | "\n0 none, 1 (1-2-1) 3-tap filter, " |
206 | "2 (2-3-6-3-2) 5-tap filter." | 206 | "2 (2-3-6-3-2) 5-tap filter." |
207 | "\nDefault value is "__MODULE_STRING(W9968CF_FILTER_TYPE) | 207 | "\nDefault value is "__MODULE_STRING(W9968CF_FILTER_TYPE) |
208 | " for every device." | 208 | " for every device." |
209 | "\nThe filter is used to reduce noise and aliasing artifacts" | 209 | "\nThe filter is used to reduce noise and aliasing artifacts" |
210 | "\nproduced by the CCD or CMOS image sensor, and the scaling" | 210 | "\nproduced by the CCD or CMOS image sensor, and the scaling" |
211 | " process." | 211 | " process." |
212 | "\n"); | 212 | "\n"); |
213 | MODULE_PARM_DESC(largeview, | 213 | MODULE_PARM_DESC(largeview, |
214 | "\n<0|1[,...]> Large view: 0 disabled, 1 enabled." | 214 | "\n<0|1[,...]> Large view: 0 disabled, 1 enabled." |
215 | "\nDefault value is "__MODULE_STRING(W9968CF_LARGEVIEW) | 215 | "\nDefault value is "__MODULE_STRING(W9968CF_LARGEVIEW) |
216 | " for every device." | 216 | " for every device." |
217 | "\n"); | 217 | "\n"); |
218 | MODULE_PARM_DESC(upscaling, | 218 | MODULE_PARM_DESC(upscaling, |
219 | "\n<0|1[,...]> Software scaling (for non-compressed video):" | 219 | "\n<0|1[,...]> Software scaling (for non-compressed video):" |
220 | "\n0 disabled, 1 enabled." | 220 | "\n0 disabled, 1 enabled." |
221 | "\nDisable it if you have a slow CPU or you don't have" | 221 | "\nDisable it if you have a slow CPU or you don't have" |
222 | " enough memory." | 222 | " enough memory." |
223 | "\nDefault value is "__MODULE_STRING(W9968CF_UPSCALING) | 223 | "\nDefault value is "__MODULE_STRING(W9968CF_UPSCALING) |
224 | " for every device." | 224 | " for every device." |
225 | "\nIf 'w9968cf-vpp' is not present, this parameter is" | 225 | "\nIf 'w9968cf-vpp' is not present, this parameter is" |
226 | " set to 0." | 226 | " set to 0." |
227 | "\n"); | 227 | "\n"); |
228 | MODULE_PARM_DESC(decompression, | 228 | MODULE_PARM_DESC(decompression, |
229 | "\n<0|1|2[,...]> Software video decompression:" | 229 | "\n<0|1|2[,...]> Software video decompression:" |
230 | "\n- 0 disables decompression (doesn't allow formats needing" | 230 | "\n- 0 disables decompression (doesn't allow formats needing" |
231 | " decompression)" | 231 | " decompression)" |
232 | "\n- 1 forces decompression (allows formats needing" | 232 | "\n- 1 forces decompression (allows formats needing" |
233 | " decompression only);" | 233 | " decompression only);" |
234 | "\n- 2 allows any permitted formats." | 234 | "\n- 2 allows any permitted formats." |
235 | "\nFormats supporting compressed video are YUV422P and" | 235 | "\nFormats supporting compressed video are YUV422P and" |
236 | " YUV420P/YUV420 " | 236 | " YUV420P/YUV420 " |
237 | "\nin any resolutions where both width and height are " | 237 | "\nin any resolutions where both width and height are " |
238 | "a multiple of 16." | 238 | "a multiple of 16." |
239 | "\nDefault value is "__MODULE_STRING(W9968CF_DECOMPRESSION) | 239 | "\nDefault value is "__MODULE_STRING(W9968CF_DECOMPRESSION) |
240 | " for every device." | 240 | " for every device." |
241 | "\nIf 'w9968cf-vpp' is not present, forcing decompression is " | 241 | "\nIf 'w9968cf-vpp' is not present, forcing decompression is " |
242 | "\nnot allowed; in this case this parameter is set to 2." | 242 | "\nnot allowed; in this case this parameter is set to 2." |
243 | "\n"); | 243 | "\n"); |
244 | MODULE_PARM_DESC(force_palette, | 244 | MODULE_PARM_DESC(force_palette, |
245 | "\n<0" | 245 | "\n<0" |
246 | "|" __MODULE_STRING(VIDEO_PALETTE_UYVY) | 246 | "|" __MODULE_STRING(VIDEO_PALETTE_UYVY) |
247 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV420) | 247 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV420) |
248 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV422P) | 248 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV422P) |
249 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV420P) | 249 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV420P) |
250 | "|" __MODULE_STRING(VIDEO_PALETTE_YUYV) | 250 | "|" __MODULE_STRING(VIDEO_PALETTE_YUYV) |
251 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV422) | 251 | "|" __MODULE_STRING(VIDEO_PALETTE_YUV422) |
252 | "|" __MODULE_STRING(VIDEO_PALETTE_GREY) | 252 | "|" __MODULE_STRING(VIDEO_PALETTE_GREY) |
253 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB555) | 253 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB555) |
254 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB565) | 254 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB565) |
255 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB24) | 255 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB24) |
256 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB32) | 256 | "|" __MODULE_STRING(VIDEO_PALETTE_RGB32) |
257 | "[,...]>" | 257 | "[,...]>" |
258 | " Force picture palette." | 258 | " Force picture palette." |
259 | "\nIn order:" | 259 | "\nIn order:" |
260 | "\n- 0 allows any of the following formats:" | 260 | "\n- 0 allows any of the following formats:" |
261 | "\n- UYVY 16 bpp - Original video, compression disabled" | 261 | "\n- UYVY 16 bpp - Original video, compression disabled" |
262 | "\n- YUV420 12 bpp - Original video, compression enabled" | 262 | "\n- YUV420 12 bpp - Original video, compression enabled" |
263 | "\n- YUV422P 16 bpp - Original video, compression enabled" | 263 | "\n- YUV422P 16 bpp - Original video, compression enabled" |
264 | "\n- YUV420P 12 bpp - Original video, compression enabled" | 264 | "\n- YUV420P 12 bpp - Original video, compression enabled" |
265 | "\n- YUVY 16 bpp - Software conversion from UYVY" | 265 | "\n- YUVY 16 bpp - Software conversion from UYVY" |
266 | "\n- YUV422 16 bpp - Software conversion from UYVY" | 266 | "\n- YUV422 16 bpp - Software conversion from UYVY" |
267 | "\n- GREY 8 bpp - Software conversion from UYVY" | 267 | "\n- GREY 8 bpp - Software conversion from UYVY" |
268 | "\n- RGB555 16 bpp - Software conversion from UYVY" | 268 | "\n- RGB555 16 bpp - Software conversion from UYVY" |
269 | "\n- RGB565 16 bpp - Software conversion from UYVY" | 269 | "\n- RGB565 16 bpp - Software conversion from UYVY" |
270 | "\n- RGB24 24 bpp - Software conversion from UYVY" | 270 | "\n- RGB24 24 bpp - Software conversion from UYVY" |
271 | "\n- RGB32 32 bpp - Software conversion from UYVY" | 271 | "\n- RGB32 32 bpp - Software conversion from UYVY" |
272 | "\nWhen not 0, this parameter will override 'decompression'." | 272 | "\nWhen not 0, this parameter will override 'decompression'." |
273 | "\nDefault value is 0 for every device." | 273 | "\nDefault value is 0 for every device." |
274 | "\nInitial palette is " | 274 | "\nInitial palette is " |
275 | __MODULE_STRING(W9968CF_PALETTE_DECOMP_ON)"." | 275 | __MODULE_STRING(W9968CF_PALETTE_DECOMP_ON)"." |
276 | "\nIf 'w9968cf-vpp' is not present, this parameter is" | 276 | "\nIf 'w9968cf-vpp' is not present, this parameter is" |
277 | " set to 9 (UYVY)." | 277 | " set to 9 (UYVY)." |
278 | "\n"); | 278 | "\n"); |
279 | MODULE_PARM_DESC(force_rgb, | 279 | MODULE_PARM_DESC(force_rgb, |
280 | "\n<0|1[,...]> Read RGB video data instead of BGR:" | 280 | "\n<0|1[,...]> Read RGB video data instead of BGR:" |
281 | "\n 1 = use RGB component ordering." | 281 | "\n 1 = use RGB component ordering." |
282 | "\n 0 = use BGR component ordering." | 282 | "\n 0 = use BGR component ordering." |
283 | "\nThis parameter has effect when using RGBX palettes only." | 283 | "\nThis parameter has effect when using RGBX palettes only." |
284 | "\nDefault value is "__MODULE_STRING(W9968CF_FORCE_RGB) | 284 | "\nDefault value is "__MODULE_STRING(W9968CF_FORCE_RGB) |
285 | " for every device." | 285 | " for every device." |
286 | "\n"); | 286 | "\n"); |
287 | MODULE_PARM_DESC(autobright, | 287 | MODULE_PARM_DESC(autobright, |
288 | "\n<0|1[,...]> Image sensor automatically changes brightness:" | 288 | "\n<0|1[,...]> Image sensor automatically changes brightness:" |
289 | "\n 0 = no, 1 = yes" | 289 | "\n 0 = no, 1 = yes" |
290 | "\nDefault value is "__MODULE_STRING(W9968CF_AUTOBRIGHT) | 290 | "\nDefault value is "__MODULE_STRING(W9968CF_AUTOBRIGHT) |
291 | " for every device." | 291 | " for every device." |
292 | "\n"); | 292 | "\n"); |
293 | MODULE_PARM_DESC(autoexp, | 293 | MODULE_PARM_DESC(autoexp, |
294 | "\n<0|1[,...]> Image sensor automatically changes exposure:" | 294 | "\n<0|1[,...]> Image sensor automatically changes exposure:" |
295 | "\n 0 = no, 1 = yes" | 295 | "\n 0 = no, 1 = yes" |
296 | "\nDefault value is "__MODULE_STRING(W9968CF_AUTOEXP) | 296 | "\nDefault value is "__MODULE_STRING(W9968CF_AUTOEXP) |
297 | " for every device." | 297 | " for every device." |
298 | "\n"); | 298 | "\n"); |
299 | MODULE_PARM_DESC(lightfreq, | 299 | MODULE_PARM_DESC(lightfreq, |
300 | "\n<50|60[,...]> Light frequency in Hz:" | 300 | "\n<50|60[,...]> Light frequency in Hz:" |
301 | "\n 50 for European and Asian lighting," | 301 | "\n 50 for European and Asian lighting," |
302 | " 60 for American lighting." | 302 | " 60 for American lighting." |
303 | "\nDefault value is "__MODULE_STRING(W9968CF_LIGHTFREQ) | 303 | "\nDefault value is "__MODULE_STRING(W9968CF_LIGHTFREQ) |
304 | " for every device." | 304 | " for every device." |
305 | "\n"); | 305 | "\n"); |
306 | MODULE_PARM_DESC(bandingfilter, | 306 | MODULE_PARM_DESC(bandingfilter, |
307 | "\n<0|1[,...]> Banding filter to reduce effects of" | 307 | "\n<0|1[,...]> Banding filter to reduce effects of" |
308 | " fluorescent lighting:" | 308 | " fluorescent lighting:" |
309 | "\n 0 disabled, 1 enabled." | 309 | "\n 0 disabled, 1 enabled." |
310 | "\nThis filter tries to reduce the pattern of horizontal" | 310 | "\nThis filter tries to reduce the pattern of horizontal" |
311 | "\nlight/dark bands caused by some (usually fluorescent)" | 311 | "\nlight/dark bands caused by some (usually fluorescent)" |
312 | " lighting." | 312 | " lighting." |
313 | "\nDefault value is "__MODULE_STRING(W9968CF_BANDINGFILTER) | 313 | "\nDefault value is "__MODULE_STRING(W9968CF_BANDINGFILTER) |
314 | " for every device." | 314 | " for every device." |
315 | "\n"); | 315 | "\n"); |
316 | MODULE_PARM_DESC(clockdiv, | 316 | MODULE_PARM_DESC(clockdiv, |
317 | "\n<-1|n[,...]> " | 317 | "\n<-1|n[,...]> " |
318 | "Force pixel clock divisor to a specific value (for experts):" | 318 | "Force pixel clock divisor to a specific value (for experts):" |
319 | "\n n may vary from 0 to 127." | 319 | "\n n may vary from 0 to 127." |
320 | "\n -1 for automatic value." | 320 | "\n -1 for automatic value." |
321 | "\nSee also the 'double_buffer' module parameter." | 321 | "\nSee also the 'double_buffer' module parameter." |
322 | "\nDefault value is "__MODULE_STRING(W9968CF_CLOCKDIV) | 322 | "\nDefault value is "__MODULE_STRING(W9968CF_CLOCKDIV) |
323 | " for every device." | 323 | " for every device." |
324 | "\n"); | 324 | "\n"); |
325 | MODULE_PARM_DESC(backlight, | 325 | MODULE_PARM_DESC(backlight, |
326 | "\n<0|1[,...]> Objects are lit from behind:" | 326 | "\n<0|1[,...]> Objects are lit from behind:" |
327 | "\n 0 = no, 1 = yes" | 327 | "\n 0 = no, 1 = yes" |
328 | "\nDefault value is "__MODULE_STRING(W9968CF_BACKLIGHT) | 328 | "\nDefault value is "__MODULE_STRING(W9968CF_BACKLIGHT) |
329 | " for every device." | 329 | " for every device." |
330 | "\n"); | 330 | "\n"); |
331 | MODULE_PARM_DESC(mirror, | 331 | MODULE_PARM_DESC(mirror, |
332 | "\n<0|1[,...]> Reverse image horizontally:" | 332 | "\n<0|1[,...]> Reverse image horizontally:" |
333 | "\n 0 = no, 1 = yes" | 333 | "\n 0 = no, 1 = yes" |
334 | "\nDefault value is "__MODULE_STRING(W9968CF_MIRROR) | 334 | "\nDefault value is "__MODULE_STRING(W9968CF_MIRROR) |
335 | " for every device." | 335 | " for every device." |
336 | "\n"); | 336 | "\n"); |
337 | MODULE_PARM_DESC(monochrome, | 337 | MODULE_PARM_DESC(monochrome, |
338 | "\n<0|1[,...]> Use image sensor as monochrome sensor:" | 338 | "\n<0|1[,...]> Use image sensor as monochrome sensor:" |
339 | "\n 0 = no, 1 = yes" | 339 | "\n 0 = no, 1 = yes" |
340 | "\nNot all the sensors support monochrome color." | 340 | "\nNot all the sensors support monochrome color." |
341 | "\nDefault value is "__MODULE_STRING(W9968CF_MONOCHROME) | 341 | "\nDefault value is "__MODULE_STRING(W9968CF_MONOCHROME) |
342 | " for every device." | 342 | " for every device." |
343 | "\n"); | 343 | "\n"); |
344 | MODULE_PARM_DESC(brightness, | 344 | MODULE_PARM_DESC(brightness, |
345 | "\n<n[,...]> Set picture brightness (0-65535)." | 345 | "\n<n[,...]> Set picture brightness (0-65535)." |
346 | "\nDefault value is "__MODULE_STRING(W9968CF_BRIGHTNESS) | 346 | "\nDefault value is "__MODULE_STRING(W9968CF_BRIGHTNESS) |
347 | " for every device." | 347 | " for every device." |
348 | "\nThis parameter has no effect if 'autobright' is enabled." | 348 | "\nThis parameter has no effect if 'autobright' is enabled." |
349 | "\n"); | 349 | "\n"); |
350 | MODULE_PARM_DESC(hue, | 350 | MODULE_PARM_DESC(hue, |
351 | "\n<n[,...]> Set picture hue (0-65535)." | 351 | "\n<n[,...]> Set picture hue (0-65535)." |
352 | "\nDefault value is "__MODULE_STRING(W9968CF_HUE) | 352 | "\nDefault value is "__MODULE_STRING(W9968CF_HUE) |
353 | " for every device." | 353 | " for every device." |
354 | "\n"); | 354 | "\n"); |
355 | MODULE_PARM_DESC(colour, | 355 | MODULE_PARM_DESC(colour, |
356 | "\n<n[,...]> Set picture saturation (0-65535)." | 356 | "\n<n[,...]> Set picture saturation (0-65535)." |
357 | "\nDefault value is "__MODULE_STRING(W9968CF_COLOUR) | 357 | "\nDefault value is "__MODULE_STRING(W9968CF_COLOUR) |
358 | " for every device." | 358 | " for every device." |
359 | "\n"); | 359 | "\n"); |
360 | MODULE_PARM_DESC(contrast, | 360 | MODULE_PARM_DESC(contrast, |
361 | "\n<n[,...]> Set picture contrast (0-65535)." | 361 | "\n<n[,...]> Set picture contrast (0-65535)." |
362 | "\nDefault value is "__MODULE_STRING(W9968CF_CONTRAST) | 362 | "\nDefault value is "__MODULE_STRING(W9968CF_CONTRAST) |
363 | " for every device." | 363 | " for every device." |
364 | "\n"); | 364 | "\n"); |
365 | MODULE_PARM_DESC(whiteness, | 365 | MODULE_PARM_DESC(whiteness, |
366 | "\n<n[,...]> Set picture whiteness (0-65535)." | 366 | "\n<n[,...]> Set picture whiteness (0-65535)." |
367 | "\nDefault value is "__MODULE_STRING(W9968CF_WHITENESS) | 367 | "\nDefault value is "__MODULE_STRING(W9968CF_WHITENESS) |
368 | " for every device." | 368 | " for every device." |
369 | "\n"); | 369 | "\n"); |
370 | #ifdef W9968CF_DEBUG | 370 | #ifdef W9968CF_DEBUG |
371 | MODULE_PARM_DESC(debug, | 371 | MODULE_PARM_DESC(debug, |
372 | "\n<n> Debugging information level, from 0 to 6:" | 372 | "\n<n> Debugging information level, from 0 to 6:" |
373 | "\n0 = none (use carefully)" | 373 | "\n0 = none (use carefully)" |
374 | "\n1 = critical errors" | 374 | "\n1 = critical errors" |
375 | "\n2 = significant informations" | 375 | "\n2 = significant informations" |
376 | "\n3 = configuration or general messages" | 376 | "\n3 = configuration or general messages" |
377 | "\n4 = warnings" | 377 | "\n4 = warnings" |
378 | "\n5 = called functions" | 378 | "\n5 = called functions" |
379 | "\n6 = function internals" | 379 | "\n6 = function internals" |
380 | "\nLevel 5 and 6 are useful for testing only, when only " | 380 | "\nLevel 5 and 6 are useful for testing only, when only " |
381 | "one device is used." | 381 | "one device is used." |
382 | "\nDefault value is "__MODULE_STRING(W9968CF_DEBUG_LEVEL)"." | 382 | "\nDefault value is "__MODULE_STRING(W9968CF_DEBUG_LEVEL)"." |
383 | "\n"); | 383 | "\n"); |
384 | MODULE_PARM_DESC(specific_debug, | 384 | MODULE_PARM_DESC(specific_debug, |
385 | "\n<0|1> Enable or disable specific debugging messages:" | 385 | "\n<0|1> Enable or disable specific debugging messages:" |
386 | "\n0 = print messages concerning every level" | 386 | "\n0 = print messages concerning every level" |
387 | " <= 'debug' level." | 387 | " <= 'debug' level." |
388 | "\n1 = print messages concerning the level" | 388 | "\n1 = print messages concerning the level" |
389 | " indicated by 'debug'." | 389 | " indicated by 'debug'." |
390 | "\nDefault value is " | 390 | "\nDefault value is " |
391 | __MODULE_STRING(W9968CF_SPECIFIC_DEBUG)"." | 391 | __MODULE_STRING(W9968CF_SPECIFIC_DEBUG)"." |
392 | "\n"); | 392 | "\n"); |
393 | #endif /* W9968CF_DEBUG */ | 393 | #endif /* W9968CF_DEBUG */ |
394 | 394 | ||
395 | 395 | ||
@@ -406,7 +406,7 @@ static int w9968cf_mmap(struct file*, struct vm_area_struct*); | |||
406 | static int w9968cf_ioctl(struct inode*, struct file*, unsigned, unsigned long); | 406 | static int w9968cf_ioctl(struct inode*, struct file*, unsigned, unsigned long); |
407 | static ssize_t w9968cf_read(struct file*, char __user *, size_t, loff_t*); | 407 | static ssize_t w9968cf_read(struct file*, char __user *, size_t, loff_t*); |
408 | static int w9968cf_v4l_ioctl(struct inode*, struct file*, unsigned int, | 408 | static int w9968cf_v4l_ioctl(struct inode*, struct file*, unsigned int, |
409 | void __user *); | 409 | void __user *); |
410 | 410 | ||
411 | /* USB-specific */ | 411 | /* USB-specific */ |
412 | static int w9968cf_start_transfer(struct w9968cf_device*); | 412 | static int w9968cf_start_transfer(struct w9968cf_device*); |
@@ -428,25 +428,25 @@ static int w9968cf_smbus_write_ack(struct w9968cf_device*); | |||
428 | static int w9968cf_smbus_read_ack(struct w9968cf_device*); | 428 | static int w9968cf_smbus_read_ack(struct w9968cf_device*); |
429 | static int w9968cf_smbus_refresh_bus(struct w9968cf_device*); | 429 | static int w9968cf_smbus_refresh_bus(struct w9968cf_device*); |
430 | static int w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, | 430 | static int w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, |
431 | u16 address, u8* value); | 431 | u16 address, u8* value); |
432 | static int w9968cf_i2c_adap_read_byte_data(struct w9968cf_device*, u16 address, | 432 | static int w9968cf_i2c_adap_read_byte_data(struct w9968cf_device*, u16 address, |
433 | u8 subaddress, u8* value); | 433 | u8 subaddress, u8* value); |
434 | static int w9968cf_i2c_adap_write_byte(struct w9968cf_device*, | 434 | static int w9968cf_i2c_adap_write_byte(struct w9968cf_device*, |
435 | u16 address, u8 subaddress); | 435 | u16 address, u8 subaddress); |
436 | static int w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device*, | 436 | static int w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device*, |
437 | u16 address, u8 subaddress, | 437 | u16 address, u8 subaddress, |
438 | u8 value); | 438 | u8 value); |
439 | 439 | ||
440 | /* I2C interface to kernel */ | 440 | /* I2C interface to kernel */ |
441 | static int w9968cf_i2c_init(struct w9968cf_device*); | 441 | static int w9968cf_i2c_init(struct w9968cf_device*); |
442 | static int w9968cf_i2c_smbus_xfer(struct i2c_adapter*, u16 addr, | 442 | static int w9968cf_i2c_smbus_xfer(struct i2c_adapter*, u16 addr, |
443 | unsigned short flags, char read_write, | 443 | unsigned short flags, char read_write, |
444 | u8 command, int size, union i2c_smbus_data*); | 444 | u8 command, int size, union i2c_smbus_data*); |
445 | static u32 w9968cf_i2c_func(struct i2c_adapter*); | 445 | static u32 w9968cf_i2c_func(struct i2c_adapter*); |
446 | static int w9968cf_i2c_attach_inform(struct i2c_client*); | 446 | static int w9968cf_i2c_attach_inform(struct i2c_client*); |
447 | static int w9968cf_i2c_detach_inform(struct i2c_client*); | 447 | static int w9968cf_i2c_detach_inform(struct i2c_client*); |
448 | static int w9968cf_i2c_control(struct i2c_adapter*, unsigned int cmd, | 448 | static int w9968cf_i2c_control(struct i2c_adapter*, unsigned int cmd, |
449 | unsigned long arg); | 449 | unsigned long arg); |
450 | 450 | ||
451 | /* Memory management */ | 451 | /* Memory management */ |
452 | static void* rvmalloc(unsigned long size); | 452 | static void* rvmalloc(unsigned long size); |
@@ -458,17 +458,17 @@ static int w9968cf_allocate_memory(struct w9968cf_device*); | |||
458 | static int w9968cf_sensor_set_control(struct w9968cf_device*,int cid,int val); | 458 | static int w9968cf_sensor_set_control(struct w9968cf_device*,int cid,int val); |
459 | static int w9968cf_sensor_get_control(struct w9968cf_device*,int cid,int *val); | 459 | static int w9968cf_sensor_get_control(struct w9968cf_device*,int cid,int *val); |
460 | static int w9968cf_sensor_cmd(struct w9968cf_device*, | 460 | static int w9968cf_sensor_cmd(struct w9968cf_device*, |
461 | unsigned int cmd, void *arg); | 461 | unsigned int cmd, void *arg); |
462 | static int w9968cf_sensor_init(struct w9968cf_device*); | 462 | static int w9968cf_sensor_init(struct w9968cf_device*); |
463 | static int w9968cf_sensor_update_settings(struct w9968cf_device*); | 463 | static int w9968cf_sensor_update_settings(struct w9968cf_device*); |
464 | static int w9968cf_sensor_get_picture(struct w9968cf_device*); | 464 | static int w9968cf_sensor_get_picture(struct w9968cf_device*); |
465 | static int w9968cf_sensor_update_picture(struct w9968cf_device*, | 465 | static int w9968cf_sensor_update_picture(struct w9968cf_device*, |
466 | struct video_picture pict); | 466 | struct video_picture pict); |
467 | 467 | ||
468 | /* Other helper functions */ | 468 | /* Other helper functions */ |
469 | static void w9968cf_configure_camera(struct w9968cf_device*,struct usb_device*, | 469 | static void w9968cf_configure_camera(struct w9968cf_device*,struct usb_device*, |
470 | enum w9968cf_model_id, | 470 | enum w9968cf_model_id, |
471 | const unsigned short dev_nr); | 471 | const unsigned short dev_nr); |
472 | static void w9968cf_adjust_configuration(struct w9968cf_device*); | 472 | static void w9968cf_adjust_configuration(struct w9968cf_device*); |
473 | static int w9968cf_turn_on_led(struct w9968cf_device*); | 473 | static int w9968cf_turn_on_led(struct w9968cf_device*); |
474 | static int w9968cf_init_chip(struct w9968cf_device*); | 474 | static int w9968cf_init_chip(struct w9968cf_device*); |
@@ -477,8 +477,8 @@ static inline u16 w9968cf_valid_depth(u16 palette); | |||
477 | static inline u8 w9968cf_need_decompression(u16 palette); | 477 | static inline u8 w9968cf_need_decompression(u16 palette); |
478 | static int w9968cf_set_picture(struct w9968cf_device*, struct video_picture); | 478 | static int w9968cf_set_picture(struct w9968cf_device*, struct video_picture); |
479 | static int w9968cf_set_window(struct w9968cf_device*, struct video_window); | 479 | static int w9968cf_set_window(struct w9968cf_device*, struct video_window); |
480 | static int w9968cf_postprocess_frame(struct w9968cf_device*, | 480 | static int w9968cf_postprocess_frame(struct w9968cf_device*, |
481 | struct w9968cf_frame_t*); | 481 | struct w9968cf_frame_t*); |
482 | static int w9968cf_adjust_window_size(struct w9968cf_device*, u16* w, u16* h); | 482 | static int w9968cf_adjust_window_size(struct w9968cf_device*, u16* w, u16* h); |
483 | static void w9968cf_init_framelist(struct w9968cf_device*); | 483 | static void w9968cf_init_framelist(struct w9968cf_device*); |
484 | static void w9968cf_push_frame(struct w9968cf_device*, u8 f_num); | 484 | static void w9968cf_push_frame(struct w9968cf_device*, u8 f_num); |
@@ -497,11 +497,11 @@ struct w9968cf_symbolic_list { | |||
497 | const char *name; | 497 | const char *name; |
498 | }; | 498 | }; |
499 | 499 | ||
500 | /*-------------------------------------------------------------------------- | 500 | /*-------------------------------------------------------------------------- |
501 | Returns the name of the matching element in the symbolic_list array. The | 501 | Returns the name of the matching element in the symbolic_list array. The |
502 | end of the list must be marked with an element that has a NULL name. | 502 | end of the list must be marked with an element that has a NULL name. |
503 | --------------------------------------------------------------------------*/ | 503 | --------------------------------------------------------------------------*/ |
504 | static inline const char * | 504 | static inline const char * |
505 | symbolic(struct w9968cf_symbolic_list list[], const int num) | 505 | symbolic(struct w9968cf_symbolic_list list[], const int num) |
506 | { | 506 | { |
507 | int i; | 507 | int i; |
@@ -568,7 +568,7 @@ static struct w9968cf_symbolic_list v4l1_plist[] = { | |||
568 | static struct w9968cf_symbolic_list decoder_errlist[] = { | 568 | static struct w9968cf_symbolic_list decoder_errlist[] = { |
569 | { W9968CF_DEC_ERR_CORRUPTED_DATA, "Corrupted data" }, | 569 | { W9968CF_DEC_ERR_CORRUPTED_DATA, "Corrupted data" }, |
570 | { W9968CF_DEC_ERR_BUF_OVERFLOW, "Buffer overflow" }, | 570 | { W9968CF_DEC_ERR_BUF_OVERFLOW, "Buffer overflow" }, |
571 | { W9968CF_DEC_ERR_NO_SOI, "SOI marker not found" }, | 571 | { W9968CF_DEC_ERR_NO_SOI, "SOI marker not found" }, |
572 | { W9968CF_DEC_ERR_NO_SOF0, "SOF0 marker not found" }, | 572 | { W9968CF_DEC_ERR_NO_SOF0, "SOF0 marker not found" }, |
573 | { W9968CF_DEC_ERR_NO_SOS, "SOS marker not found" }, | 573 | { W9968CF_DEC_ERR_NO_SOS, "SOS marker not found" }, |
574 | { W9968CF_DEC_ERR_NO_EOI, "EOI marker not found" }, | 574 | { W9968CF_DEC_ERR_NO_EOI, "EOI marker not found" }, |
@@ -695,7 +695,7 @@ static int w9968cf_allocate_memory(struct w9968cf_device* cam) | |||
695 | bpp = (w9968cf_vpp) ? 4 : 2; | 695 | bpp = (w9968cf_vpp) ? 4 : 2; |
696 | if (cam->upscaling) | 696 | if (cam->upscaling) |
697 | vpp_bufsize = max(W9968CF_MAX_WIDTH*W9968CF_MAX_HEIGHT*bpp, | 697 | vpp_bufsize = max(W9968CF_MAX_WIDTH*W9968CF_MAX_HEIGHT*bpp, |
698 | cam->maxwidth*cam->maxheight*bpp); | 698 | cam->maxwidth*cam->maxheight*bpp); |
699 | else | 699 | else |
700 | vpp_bufsize = cam->maxwidth*cam->maxheight*bpp; | 700 | vpp_bufsize = cam->maxwidth*cam->maxheight*bpp; |
701 | 701 | ||
@@ -704,7 +704,7 @@ static int w9968cf_allocate_memory(struct w9968cf_device* cam) | |||
704 | if (!(cam->transfer_buffer[i] = | 704 | if (!(cam->transfer_buffer[i] = |
705 | kzalloc(W9968CF_ISO_PACKETS*p_size, GFP_KERNEL))) { | 705 | kzalloc(W9968CF_ISO_PACKETS*p_size, GFP_KERNEL))) { |
706 | DBG(1, "Couldn't allocate memory for the isochronous " | 706 | DBG(1, "Couldn't allocate memory for the isochronous " |
707 | "transfer buffers (%u bytes)", | 707 | "transfer buffers (%u bytes)", |
708 | p_size * W9968CF_ISO_PACKETS) | 708 | p_size * W9968CF_ISO_PACKETS) |
709 | return -ENOMEM; | 709 | return -ENOMEM; |
710 | } | 710 | } |
@@ -780,7 +780,7 @@ static int w9968cf_allocate_memory(struct w9968cf_device* cam) | |||
780 | of the next video frame; if an error is encountered in a packet, the entire | 780 | of the next video frame; if an error is encountered in a packet, the entire |
781 | video frame is discarded and grabbed again. | 781 | video frame is discarded and grabbed again. |
782 | If there are no requested frames in the FIFO list, packets are collected into | 782 | If there are no requested frames in the FIFO list, packets are collected into |
783 | a temporary buffer. | 783 | a temporary buffer. |
784 | --------------------------------------------------------------------------*/ | 784 | --------------------------------------------------------------------------*/ |
785 | static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) | 785 | static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) |
786 | { | 786 | { |
@@ -799,7 +799,7 @@ static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) | |||
799 | /* "(*f)" will be used instead of "cam->frame_current" */ | 799 | /* "(*f)" will be used instead of "cam->frame_current" */ |
800 | f = &cam->frame_current; | 800 | f = &cam->frame_current; |
801 | 801 | ||
802 | /* If a frame has been requested and we are grabbing into | 802 | /* If a frame has been requested and we are grabbing into |
803 | the temporary frame, we'll switch to that requested frame */ | 803 | the temporary frame, we'll switch to that requested frame */ |
804 | if ((*f) == &cam->frame_tmp && *cam->requested_frame) { | 804 | if ((*f) == &cam->frame_tmp && *cam->requested_frame) { |
805 | if (cam->frame_tmp.status == F_GRABBING) { | 805 | if (cam->frame_tmp.status == F_GRABBING) { |
@@ -808,7 +808,7 @@ static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) | |||
808 | (*f)->length = cam->frame_tmp.length; | 808 | (*f)->length = cam->frame_tmp.length; |
809 | memcpy((*f)->buffer, cam->frame_tmp.buffer, | 809 | memcpy((*f)->buffer, cam->frame_tmp.buffer, |
810 | (*f)->length); | 810 | (*f)->length); |
811 | DBG(6, "Switched from temp. frame to frame #%d", | 811 | DBG(6, "Switched from temp. frame to frame #%d", |
812 | (*f)->number) | 812 | (*f)->number) |
813 | } | 813 | } |
814 | } | 814 | } |
@@ -850,7 +850,7 @@ static void w9968cf_urb_complete(struct urb *urb, struct pt_regs *regs) | |||
850 | 850 | ||
851 | if (cam->vpp_flag & VPP_DECOMPRESSION) { | 851 | if (cam->vpp_flag & VPP_DECOMPRESSION) { |
852 | err = w9968cf_vpp->check_headers((*f)->buffer, | 852 | err = w9968cf_vpp->check_headers((*f)->buffer, |
853 | (*f)->length); | 853 | (*f)->length); |
854 | if (err) { | 854 | if (err) { |
855 | DBG(4, "Skip corrupted frame: %s", | 855 | DBG(4, "Skip corrupted frame: %s", |
856 | symbolic(decoder_errlist, err)) | 856 | symbolic(decoder_errlist, err)) |
@@ -975,7 +975,7 @@ static int w9968cf_start_transfer(struct w9968cf_device* cam) | |||
975 | cam->frame_current = &cam->frame_tmp; | 975 | cam->frame_current = &cam->frame_tmp; |
976 | 976 | ||
977 | if (!(cam->vpp_flag & VPP_DECOMPRESSION)) | 977 | if (!(cam->vpp_flag & VPP_DECOMPRESSION)) |
978 | DBG(5, "Isochronous transfer size: %lu bytes/frame", | 978 | DBG(5, "Isochronous transfer size: %lu bytes/frame", |
979 | (unsigned long)t_size*2) | 979 | (unsigned long)t_size*2) |
980 | 980 | ||
981 | DBG(5, "Starting the isochronous transfer...") | 981 | DBG(5, "Starting the isochronous transfer...") |
@@ -992,7 +992,7 @@ static int w9968cf_start_transfer(struct w9968cf_device* cam) | |||
992 | usb_free_urb(cam->urb[j]); | 992 | usb_free_urb(cam->urb[j]); |
993 | } | 993 | } |
994 | DBG(1, "Couldn't send a transfer request to the " | 994 | DBG(1, "Couldn't send a transfer request to the " |
995 | "USB core (error #%d, %s)", err, | 995 | "USB core (error #%d, %s)", err, |
996 | symbolic(urb_errlist, err)) | 996 | symbolic(urb_errlist, err)) |
997 | return err; | 997 | return err; |
998 | } | 998 | } |
@@ -1016,7 +1016,7 @@ static int w9968cf_stop_transfer(struct w9968cf_device* cam) | |||
1016 | if (!cam->streaming) | 1016 | if (!cam->streaming) |
1017 | return 0; | 1017 | return 0; |
1018 | 1018 | ||
1019 | /* This avoids race conditions with usb_submit_urb() | 1019 | /* This avoids race conditions with usb_submit_urb() |
1020 | in the URB completition handler */ | 1020 | in the URB completition handler */ |
1021 | spin_lock_irqsave(&cam->urb_lock, lock_flags); | 1021 | spin_lock_irqsave(&cam->urb_lock, lock_flags); |
1022 | cam->streaming = 0; | 1022 | cam->streaming = 0; |
@@ -1050,7 +1050,7 @@ exit: | |||
1050 | 1050 | ||
1051 | 1051 | ||
1052 | /*-------------------------------------------------------------------------- | 1052 | /*-------------------------------------------------------------------------- |
1053 | Write a W9968CF register. | 1053 | Write a W9968CF register. |
1054 | Return 0 on success, -1 otherwise. | 1054 | Return 0 on success, -1 otherwise. |
1055 | --------------------------------------------------------------------------*/ | 1055 | --------------------------------------------------------------------------*/ |
1056 | static int w9968cf_write_reg(struct w9968cf_device* cam, u16 value, u16 index) | 1056 | static int w9968cf_write_reg(struct w9968cf_device* cam, u16 value, u16 index) |
@@ -1059,8 +1059,8 @@ static int w9968cf_write_reg(struct w9968cf_device* cam, u16 value, u16 index) | |||
1059 | int res; | 1059 | int res; |
1060 | 1060 | ||
1061 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0, | 1061 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0, |
1062 | USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, | 1062 | USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, |
1063 | value, index, NULL, 0, W9968CF_USB_CTRL_TIMEOUT); | 1063 | value, index, NULL, 0, W9968CF_USB_CTRL_TIMEOUT); |
1064 | 1064 | ||
1065 | if (res < 0) | 1065 | if (res < 0) |
1066 | DBG(4, "Failed to write a register " | 1066 | DBG(4, "Failed to write a register " |
@@ -1072,7 +1072,7 @@ static int w9968cf_write_reg(struct w9968cf_device* cam, u16 value, u16 index) | |||
1072 | 1072 | ||
1073 | 1073 | ||
1074 | /*-------------------------------------------------------------------------- | 1074 | /*-------------------------------------------------------------------------- |
1075 | Read a W9968CF register. | 1075 | Read a W9968CF register. |
1076 | Return the register value on success, -1 otherwise. | 1076 | Return the register value on success, -1 otherwise. |
1077 | --------------------------------------------------------------------------*/ | 1077 | --------------------------------------------------------------------------*/ |
1078 | static int w9968cf_read_reg(struct w9968cf_device* cam, u16 index) | 1078 | static int w9968cf_read_reg(struct w9968cf_device* cam, u16 index) |
@@ -1082,8 +1082,8 @@ static int w9968cf_read_reg(struct w9968cf_device* cam, u16 index) | |||
1082 | int res; | 1082 | int res; |
1083 | 1083 | ||
1084 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 1, | 1084 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 1, |
1085 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, | 1085 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, |
1086 | 0, index, buff, 2, W9968CF_USB_CTRL_TIMEOUT); | 1086 | 0, index, buff, 2, W9968CF_USB_CTRL_TIMEOUT); |
1087 | 1087 | ||
1088 | if (res < 0) | 1088 | if (res < 0) |
1089 | DBG(4, "Failed to read a register " | 1089 | DBG(4, "Failed to read a register " |
@@ -1107,8 +1107,8 @@ static int w9968cf_write_fsb(struct w9968cf_device* cam, u16* data) | |||
1107 | value = *data++; | 1107 | value = *data++; |
1108 | 1108 | ||
1109 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0, | 1109 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0, |
1110 | USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, | 1110 | USB_TYPE_VENDOR | USB_DIR_OUT | USB_RECIP_DEVICE, |
1111 | value, 0x06, data, 6, W9968CF_USB_CTRL_TIMEOUT); | 1111 | value, 0x06, data, 6, W9968CF_USB_CTRL_TIMEOUT); |
1112 | 1112 | ||
1113 | if (res < 0) | 1113 | if (res < 0) |
1114 | DBG(4, "Failed to write the FSB registers " | 1114 | DBG(4, "Failed to write the FSB registers " |
@@ -1287,9 +1287,9 @@ static int w9968cf_smbus_refresh_bus(struct w9968cf_device* cam) | |||
1287 | 1287 | ||
1288 | 1288 | ||
1289 | /* SMBus protocol: S Addr Wr [A] Subaddr [A] Value [A] P */ | 1289 | /* SMBus protocol: S Addr Wr [A] Subaddr [A] Value [A] P */ |
1290 | static int | 1290 | static int |
1291 | w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, | 1291 | w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, |
1292 | u16 address, u8 subaddress,u8 value) | 1292 | u16 address, u8 subaddress,u8 value) |
1293 | { | 1293 | { |
1294 | u16* data = cam->data_buffer; | 1294 | u16* data = cam->data_buffer; |
1295 | int err = 0; | 1295 | int err = 0; |
@@ -1348,7 +1348,7 @@ w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, | |||
1348 | "value 0x%02X", address, subaddress, value) | 1348 | "value 0x%02X", address, subaddress, value) |
1349 | else | 1349 | else |
1350 | DBG(5, "I2C write byte data failed, addr.0x%04X, " | 1350 | DBG(5, "I2C write byte data failed, addr.0x%04X, " |
1351 | "subaddr.0x%02X, value 0x%02X", | 1351 | "subaddr.0x%02X, value 0x%02X", |
1352 | address, subaddress, value) | 1352 | address, subaddress, value) |
1353 | 1353 | ||
1354 | return err; | 1354 | return err; |
@@ -1356,10 +1356,10 @@ w9968cf_i2c_adap_fastwrite_byte_data(struct w9968cf_device* cam, | |||
1356 | 1356 | ||
1357 | 1357 | ||
1358 | /* SMBus protocol: S Addr Wr [A] Subaddr [A] P S Addr+1 Rd [A] [Value] NA P */ | 1358 | /* SMBus protocol: S Addr Wr [A] Subaddr [A] P S Addr+1 Rd [A] [Value] NA P */ |
1359 | static int | 1359 | static int |
1360 | w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, | 1360 | w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, |
1361 | u16 address, u8 subaddress, | 1361 | u16 address, u8 subaddress, |
1362 | u8* value) | 1362 | u8* value) |
1363 | { | 1363 | { |
1364 | int err = 0; | 1364 | int err = 0; |
1365 | 1365 | ||
@@ -1384,7 +1384,7 @@ w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, | |||
1384 | 1384 | ||
1385 | if (!err) | 1385 | if (!err) |
1386 | DBG(5, "I2C read byte data done, addr.0x%04X, " | 1386 | DBG(5, "I2C read byte data done, addr.0x%04X, " |
1387 | "subaddr.0x%02X, value 0x%02X", | 1387 | "subaddr.0x%02X, value 0x%02X", |
1388 | address, subaddress, *value) | 1388 | address, subaddress, *value) |
1389 | else | 1389 | else |
1390 | DBG(5, "I2C read byte data failed, addr.0x%04X, " | 1390 | DBG(5, "I2C read byte data failed, addr.0x%04X, " |
@@ -1396,9 +1396,9 @@ w9968cf_i2c_adap_read_byte_data(struct w9968cf_device* cam, | |||
1396 | 1396 | ||
1397 | 1397 | ||
1398 | /* SMBus protocol: S Addr+1 Rd [A] [Value] NA P */ | 1398 | /* SMBus protocol: S Addr+1 Rd [A] [Value] NA P */ |
1399 | static int | 1399 | static int |
1400 | w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, | 1400 | w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, |
1401 | u16 address, u8* value) | 1401 | u16 address, u8* value) |
1402 | { | 1402 | { |
1403 | int err = 0; | 1403 | int err = 0; |
1404 | 1404 | ||
@@ -1411,7 +1411,7 @@ w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, | |||
1411 | err += w9968cf_smbus_read_byte(cam, value); | 1411 | err += w9968cf_smbus_read_byte(cam, value); |
1412 | err += w9968cf_smbus_write_ack(cam); | 1412 | err += w9968cf_smbus_write_ack(cam); |
1413 | err += w9968cf_smbus_stop(cam); | 1413 | err += w9968cf_smbus_stop(cam); |
1414 | 1414 | ||
1415 | /* Serial data disable */ | 1415 | /* Serial data disable */ |
1416 | err += w9968cf_write_sb(cam, 0x0000); | 1416 | err += w9968cf_write_sb(cam, 0x0000); |
1417 | 1417 | ||
@@ -1427,9 +1427,9 @@ w9968cf_i2c_adap_read_byte(struct w9968cf_device* cam, | |||
1427 | 1427 | ||
1428 | 1428 | ||
1429 | /* SMBus protocol: S Addr Wr [A] Value [A] P */ | 1429 | /* SMBus protocol: S Addr Wr [A] Value [A] P */ |
1430 | static int | 1430 | static int |
1431 | w9968cf_i2c_adap_write_byte(struct w9968cf_device* cam, | 1431 | w9968cf_i2c_adap_write_byte(struct w9968cf_device* cam, |
1432 | u16 address, u8 value) | 1432 | u16 address, u8 value) |
1433 | { | 1433 | { |
1434 | DBG(4, "i2c_write_byte() is an unsupported transfer mode") | 1434 | DBG(4, "i2c_write_byte() is an unsupported transfer mode") |
1435 | return -EINVAL; | 1435 | return -EINVAL; |
@@ -1442,13 +1442,13 @@ w9968cf_i2c_adap_write_byte(struct w9968cf_device* cam, | |||
1442 | ****************************************************************************/ | 1442 | ****************************************************************************/ |
1443 | 1443 | ||
1444 | static int | 1444 | static int |
1445 | w9968cf_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, | 1445 | w9968cf_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, |
1446 | unsigned short flags, char read_write, u8 command, | 1446 | unsigned short flags, char read_write, u8 command, |
1447 | int size, union i2c_smbus_data *data) | 1447 | int size, union i2c_smbus_data *data) |
1448 | { | 1448 | { |
1449 | struct w9968cf_device* cam = i2c_get_adapdata(adapter); | 1449 | struct w9968cf_device* cam = i2c_get_adapdata(adapter); |
1450 | u8 i; | 1450 | u8 i; |
1451 | int err = 0; | 1451 | int err = 0; |
1452 | 1452 | ||
1453 | switch (addr) { | 1453 | switch (addr) { |
1454 | case OV6xx0_SID: | 1454 | case OV6xx0_SID: |
@@ -1464,20 +1464,20 @@ w9968cf_i2c_smbus_xfer(struct i2c_adapter *adapter, u16 addr, | |||
1464 | addr <<= 1; | 1464 | addr <<= 1; |
1465 | 1465 | ||
1466 | if (read_write == I2C_SMBUS_WRITE) | 1466 | if (read_write == I2C_SMBUS_WRITE) |
1467 | err = w9968cf_i2c_adap_write_byte(cam, addr, command); | 1467 | err = w9968cf_i2c_adap_write_byte(cam, addr, command); |
1468 | else if (read_write == I2C_SMBUS_READ) | 1468 | else if (read_write == I2C_SMBUS_READ) |
1469 | err = w9968cf_i2c_adap_read_byte(cam,addr,&data->byte); | 1469 | err = w9968cf_i2c_adap_read_byte(cam,addr,&data->byte); |
1470 | 1470 | ||
1471 | } else if (size == I2C_SMBUS_BYTE_DATA) { | 1471 | } else if (size == I2C_SMBUS_BYTE_DATA) { |
1472 | addr <<= 1; | 1472 | addr <<= 1; |
1473 | 1473 | ||
1474 | if (read_write == I2C_SMBUS_WRITE) | 1474 | if (read_write == I2C_SMBUS_WRITE) |
1475 | err = w9968cf_i2c_adap_fastwrite_byte_data(cam, addr, | 1475 | err = w9968cf_i2c_adap_fastwrite_byte_data(cam, addr, |
1476 | command, data->byte); | 1476 | command, data->byte); |
1477 | else if (read_write == I2C_SMBUS_READ) { | 1477 | else if (read_write == I2C_SMBUS_READ) { |
1478 | for (i = 1; i <= W9968CF_I2C_RW_RETRIES; i++) { | 1478 | for (i = 1; i <= W9968CF_I2C_RW_RETRIES; i++) { |
1479 | err = w9968cf_i2c_adap_read_byte_data(cam,addr, | 1479 | err = w9968cf_i2c_adap_read_byte_data(cam,addr, |
1480 | command, &data->byte); | 1480 | command, &data->byte); |
1481 | if (err) { | 1481 | if (err) { |
1482 | if (w9968cf_smbus_refresh_bus(cam)) { | 1482 | if (w9968cf_smbus_refresh_bus(cam)) { |
1483 | err = -EIO; | 1483 | err = -EIO; |
@@ -1520,7 +1520,7 @@ static int w9968cf_i2c_attach_inform(struct i2c_client* client) | |||
1520 | return err; | 1520 | return err; |
1521 | } | 1521 | } |
1522 | } else { | 1522 | } else { |
1523 | DBG(4, "Rejected client [%s] with driver [%s]", | 1523 | DBG(4, "Rejected client [%s] with driver [%s]", |
1524 | client->name, client->driver->driver.name) | 1524 | client->name, client->driver->driver.name) |
1525 | return -EINVAL; | 1525 | return -EINVAL; |
1526 | } | 1526 | } |
@@ -1545,9 +1545,9 @@ static int w9968cf_i2c_detach_inform(struct i2c_client* client) | |||
1545 | } | 1545 | } |
1546 | 1546 | ||
1547 | 1547 | ||
1548 | static int | 1548 | static int |
1549 | w9968cf_i2c_control(struct i2c_adapter* adapter, unsigned int cmd, | 1549 | w9968cf_i2c_control(struct i2c_adapter* adapter, unsigned int cmd, |
1550 | unsigned long arg) | 1550 | unsigned long arg) |
1551 | { | 1551 | { |
1552 | return 0; | 1552 | return 0; |
1553 | } | 1553 | } |
@@ -1625,12 +1625,12 @@ static int w9968cf_turn_on_led(struct w9968cf_device* cam) | |||
1625 | static int w9968cf_init_chip(struct w9968cf_device* cam) | 1625 | static int w9968cf_init_chip(struct w9968cf_device* cam) |
1626 | { | 1626 | { |
1627 | unsigned long hw_bufsize = cam->maxwidth*cam->maxheight*2, | 1627 | unsigned long hw_bufsize = cam->maxwidth*cam->maxheight*2, |
1628 | y0 = 0x0000, | 1628 | y0 = 0x0000, |
1629 | u0 = y0 + hw_bufsize/2, | 1629 | u0 = y0 + hw_bufsize/2, |
1630 | v0 = u0 + hw_bufsize/4, | 1630 | v0 = u0 + hw_bufsize/4, |
1631 | y1 = v0 + hw_bufsize/4, | 1631 | y1 = v0 + hw_bufsize/4, |
1632 | u1 = y1 + hw_bufsize/2, | 1632 | u1 = y1 + hw_bufsize/2, |
1633 | v1 = u1 + hw_bufsize/4; | 1633 | v1 = u1 + hw_bufsize/4; |
1634 | int err = 0; | 1634 | int err = 0; |
1635 | 1635 | ||
1636 | err += w9968cf_write_reg(cam, 0xff00, 0x00); /* power off */ | 1636 | err += w9968cf_write_reg(cam, 0xff00, 0x00); /* power off */ |
@@ -1762,7 +1762,7 @@ w9968cf_set_picture(struct w9968cf_device* cam, struct video_picture pict) | |||
1762 | cam->vpp_flag = VPP_SWAP_YUV_BYTES; | 1762 | cam->vpp_flag = VPP_SWAP_YUV_BYTES; |
1763 | hw_palette = VIDEO_PALETTE_UYVY; | 1763 | hw_palette = VIDEO_PALETTE_UYVY; |
1764 | break; | 1764 | break; |
1765 | /* Original video is used instead of RGBX palettes. | 1765 | /* Original video is used instead of RGBX palettes. |
1766 | Software conversion later. */ | 1766 | Software conversion later. */ |
1767 | case VIDEO_PALETTE_GREY: | 1767 | case VIDEO_PALETTE_GREY: |
1768 | case VIDEO_PALETTE_RGB555: | 1768 | case VIDEO_PALETTE_RGB555: |
@@ -1777,7 +1777,7 @@ w9968cf_set_picture(struct w9968cf_device* cam, struct video_picture pict) | |||
1777 | } | 1777 | } |
1778 | 1778 | ||
1779 | /* NOTE: due to memory issues, it is better to disable the hardware | 1779 | /* NOTE: due to memory issues, it is better to disable the hardware |
1780 | double buffering during compression */ | 1780 | double buffering during compression */ |
1781 | if (cam->double_buffer && !(cam->vpp_flag & VPP_DECOMPRESSION)) | 1781 | if (cam->double_buffer && !(cam->vpp_flag & VPP_DECOMPRESSION)) |
1782 | reg_v |= 0x0080; | 1782 | reg_v |= 0x0080; |
1783 | 1783 | ||
@@ -1832,8 +1832,8 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win) | |||
1832 | #define __UNSC(x) ((x) >> 10) | 1832 | #define __UNSC(x) ((x) >> 10) |
1833 | 1833 | ||
1834 | /* Make sure we are using a supported resolution */ | 1834 | /* Make sure we are using a supported resolution */ |
1835 | if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, | 1835 | if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, |
1836 | (u16*)&win.height))) | 1836 | (u16*)&win.height))) |
1837 | goto error; | 1837 | goto error; |
1838 | 1838 | ||
1839 | /* Scaling factors */ | 1839 | /* Scaling factors */ |
@@ -1962,7 +1962,7 @@ w9968cf_set_window(struct w9968cf_device* cam, struct video_window win) | |||
1962 | /* Settings changed, so we clear the frame buffers */ | 1962 | /* Settings changed, so we clear the frame buffers */ |
1963 | memset(cam->frame[0].buffer, 0, cam->nbuffers*cam->frame[0].size); | 1963 | memset(cam->frame[0].buffer, 0, cam->nbuffers*cam->frame[0].size); |
1964 | 1964 | ||
1965 | DBG(4, "The capture area is %dx%d, Offset (x,y)=(%u,%u)", | 1965 | DBG(4, "The capture area is %dx%d, Offset (x,y)=(%u,%u)", |
1966 | win.width, win.height, win.x, win.y) | 1966 | win.width, win.height, win.x, win.y) |
1967 | 1967 | ||
1968 | PDBGG("x=%u ,y=%u, w=%u, h=%u, ax=%u, ay=%u, s_win.x=%u, s_win.y=%u, " | 1968 | PDBGG("x=%u ,y=%u, w=%u, h=%u, ax=%u, ay=%u, s_win.x=%u, s_win.y=%u, " |
@@ -1978,11 +1978,11 @@ error: | |||
1978 | } | 1978 | } |
1979 | 1979 | ||
1980 | 1980 | ||
1981 | /*-------------------------------------------------------------------------- | 1981 | /*-------------------------------------------------------------------------- |
1982 | Adjust the asked values for window width and height. | 1982 | Adjust the asked values for window width and height. |
1983 | Return 0 on success, -1 otherwise. | 1983 | Return 0 on success, -1 otherwise. |
1984 | --------------------------------------------------------------------------*/ | 1984 | --------------------------------------------------------------------------*/ |
1985 | static int | 1985 | static int |
1986 | w9968cf_adjust_window_size(struct w9968cf_device* cam, u16* width, u16* height) | 1986 | w9968cf_adjust_window_size(struct w9968cf_device* cam, u16* width, u16* height) |
1987 | { | 1987 | { |
1988 | u16 maxw, maxh; | 1988 | u16 maxw, maxh; |
@@ -1992,10 +1992,10 @@ w9968cf_adjust_window_size(struct w9968cf_device* cam, u16* width, u16* height) | |||
1992 | 1992 | ||
1993 | maxw = cam->upscaling && !(cam->vpp_flag & VPP_DECOMPRESSION) && | 1993 | maxw = cam->upscaling && !(cam->vpp_flag & VPP_DECOMPRESSION) && |
1994 | w9968cf_vpp ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) | 1994 | w9968cf_vpp ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) |
1995 | : cam->maxwidth; | 1995 | : cam->maxwidth; |
1996 | maxh = cam->upscaling && !(cam->vpp_flag & VPP_DECOMPRESSION) && | 1996 | maxh = cam->upscaling && !(cam->vpp_flag & VPP_DECOMPRESSION) && |
1997 | w9968cf_vpp ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight) | 1997 | w9968cf_vpp ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight) |
1998 | : cam->maxheight; | 1998 | : cam->maxheight; |
1999 | 1999 | ||
2000 | if (*width > maxw) | 2000 | if (*width > maxw) |
2001 | *width = maxw; | 2001 | *width = maxw; |
@@ -2054,7 +2054,7 @@ static void w9968cf_push_frame(struct w9968cf_device* cam, u8 f_num) | |||
2054 | Read, store and remove the first pointer in the FIFO list of requested | 2054 | Read, store and remove the first pointer in the FIFO list of requested |
2055 | frames. This function is called in interrupt context. | 2055 | frames. This function is called in interrupt context. |
2056 | --------------------------------------------------------------------------*/ | 2056 | --------------------------------------------------------------------------*/ |
2057 | static void | 2057 | static void |
2058 | w9968cf_pop_frame(struct w9968cf_device* cam, struct w9968cf_frame_t** framep) | 2058 | w9968cf_pop_frame(struct w9968cf_device* cam, struct w9968cf_frame_t** framep) |
2059 | { | 2059 | { |
2060 | u8 i; | 2060 | u8 i; |
@@ -2078,9 +2078,9 @@ w9968cf_pop_frame(struct w9968cf_device* cam, struct w9968cf_frame_t** framep) | |||
2078 | High-level video post-processing routine on grabbed frames. | 2078 | High-level video post-processing routine on grabbed frames. |
2079 | Return 0 on success, a negative number otherwise. | 2079 | Return 0 on success, a negative number otherwise. |
2080 | --------------------------------------------------------------------------*/ | 2080 | --------------------------------------------------------------------------*/ |
2081 | static int | 2081 | static int |
2082 | w9968cf_postprocess_frame(struct w9968cf_device* cam, | 2082 | w9968cf_postprocess_frame(struct w9968cf_device* cam, |
2083 | struct w9968cf_frame_t* fr) | 2083 | struct w9968cf_frame_t* fr) |
2084 | { | 2084 | { |
2085 | void *pIn = fr->buffer, *pOut = cam->frame_vpp.buffer, *tmp; | 2085 | void *pIn = fr->buffer, *pOut = cam->frame_vpp.buffer, *tmp; |
2086 | u16 w = cam->window.width, | 2086 | u16 w = cam->window.width, |
@@ -2127,7 +2127,7 @@ w9968cf_postprocess_frame(struct w9968cf_device* cam, | |||
2127 | w9968cf_vpp->uyvy_to_rgbx(pIn, fr->length, pOut, fmt, rgb); | 2127 | w9968cf_vpp->uyvy_to_rgbx(pIn, fr->length, pOut, fmt, rgb); |
2128 | fr->length = (w*h*d)/8; | 2128 | fr->length = (w*h*d)/8; |
2129 | _PSWAP(pIn, pOut) | 2129 | _PSWAP(pIn, pOut) |
2130 | DBG(6, "UYVY-16bit to %s conversion done", | 2130 | DBG(6, "UYVY-16bit to %s conversion done", |
2131 | symbolic(v4l1_plist, fmt)) | 2131 | symbolic(v4l1_plist, fmt)) |
2132 | } | 2132 | } |
2133 | 2133 | ||
@@ -2143,7 +2143,7 @@ w9968cf_postprocess_frame(struct w9968cf_device* cam, | |||
2143 | * Image sensor control routines * | 2143 | * Image sensor control routines * |
2144 | ****************************************************************************/ | 2144 | ****************************************************************************/ |
2145 | 2145 | ||
2146 | static int | 2146 | static int |
2147 | w9968cf_sensor_set_control(struct w9968cf_device* cam, int cid, int val) | 2147 | w9968cf_sensor_set_control(struct w9968cf_device* cam, int cid, int val) |
2148 | { | 2148 | { |
2149 | struct ovcamchip_control ctl; | 2149 | struct ovcamchip_control ctl; |
@@ -2158,7 +2158,7 @@ w9968cf_sensor_set_control(struct w9968cf_device* cam, int cid, int val) | |||
2158 | } | 2158 | } |
2159 | 2159 | ||
2160 | 2160 | ||
2161 | static int | 2161 | static int |
2162 | w9968cf_sensor_get_control(struct w9968cf_device* cam, int cid, int* val) | 2162 | w9968cf_sensor_get_control(struct w9968cf_device* cam, int cid, int* val) |
2163 | { | 2163 | { |
2164 | struct ovcamchip_control ctl; | 2164 | struct ovcamchip_control ctl; |
@@ -2198,38 +2198,38 @@ static int w9968cf_sensor_update_settings(struct w9968cf_device* cam) | |||
2198 | int err = 0; | 2198 | int err = 0; |
2199 | 2199 | ||
2200 | /* Auto brightness */ | 2200 | /* Auto brightness */ |
2201 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOBRIGHT, | 2201 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOBRIGHT, |
2202 | cam->auto_brt); | 2202 | cam->auto_brt); |
2203 | if (err) | 2203 | if (err) |
2204 | return err; | 2204 | return err; |
2205 | 2205 | ||
2206 | /* Auto exposure */ | 2206 | /* Auto exposure */ |
2207 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOEXP, | 2207 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_AUTOEXP, |
2208 | cam->auto_exp); | 2208 | cam->auto_exp); |
2209 | if (err) | 2209 | if (err) |
2210 | return err; | 2210 | return err; |
2211 | 2211 | ||
2212 | /* Banding filter */ | 2212 | /* Banding filter */ |
2213 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BANDFILT, | 2213 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BANDFILT, |
2214 | cam->bandfilt); | 2214 | cam->bandfilt); |
2215 | if (err) | 2215 | if (err) |
2216 | return err; | 2216 | return err; |
2217 | 2217 | ||
2218 | /* Light frequency */ | 2218 | /* Light frequency */ |
2219 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_FREQ, | 2219 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_FREQ, |
2220 | cam->lightfreq); | 2220 | cam->lightfreq); |
2221 | if (err) | 2221 | if (err) |
2222 | return err; | 2222 | return err; |
2223 | 2223 | ||
2224 | /* Back light */ | 2224 | /* Back light */ |
2225 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BACKLIGHT, | 2225 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BACKLIGHT, |
2226 | cam->backlight); | 2226 | cam->backlight); |
2227 | if (err) | 2227 | if (err) |
2228 | return err; | 2228 | return err; |
2229 | 2229 | ||
2230 | /* Mirror */ | 2230 | /* Mirror */ |
2231 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_MIRROR, | 2231 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_MIRROR, |
2232 | cam->mirror); | 2232 | cam->mirror); |
2233 | if (err) | 2233 | if (err) |
2234 | return err; | 2234 | return err; |
2235 | 2235 | ||
@@ -2281,15 +2281,15 @@ static int w9968cf_sensor_get_picture(struct w9968cf_device* cam) | |||
2281 | Returns: 0 on success, a negative number otherwise. | 2281 | Returns: 0 on success, a negative number otherwise. |
2282 | --------------------------------------------------------------------------*/ | 2282 | --------------------------------------------------------------------------*/ |
2283 | static int | 2283 | static int |
2284 | w9968cf_sensor_update_picture(struct w9968cf_device* cam, | 2284 | w9968cf_sensor_update_picture(struct w9968cf_device* cam, |
2285 | struct video_picture pict) | 2285 | struct video_picture pict) |
2286 | { | 2286 | { |
2287 | int err = 0; | 2287 | int err = 0; |
2288 | 2288 | ||
2289 | if ((!cam->sensor_initialized) | 2289 | if ((!cam->sensor_initialized) |
2290 | || pict.contrast != cam->picture.contrast) { | 2290 | || pict.contrast != cam->picture.contrast) { |
2291 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_CONT, | 2291 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_CONT, |
2292 | pict.contrast); | 2292 | pict.contrast); |
2293 | if (err) | 2293 | if (err) |
2294 | goto fail; | 2294 | goto fail; |
2295 | DBG(4, "Contrast changed from %u to %u", | 2295 | DBG(4, "Contrast changed from %u to %u", |
@@ -2297,10 +2297,10 @@ w9968cf_sensor_update_picture(struct w9968cf_device* cam, | |||
2297 | cam->picture.contrast = pict.contrast; | 2297 | cam->picture.contrast = pict.contrast; |
2298 | } | 2298 | } |
2299 | 2299 | ||
2300 | if (((!cam->sensor_initialized) || | 2300 | if (((!cam->sensor_initialized) || |
2301 | pict.brightness != cam->picture.brightness) && (!cam->auto_brt)) { | 2301 | pict.brightness != cam->picture.brightness) && (!cam->auto_brt)) { |
2302 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BRIGHT, | 2302 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_BRIGHT, |
2303 | pict.brightness); | 2303 | pict.brightness); |
2304 | if (err) | 2304 | if (err) |
2305 | goto fail; | 2305 | goto fail; |
2306 | DBG(4, "Brightness changed from %u to %u", | 2306 | DBG(4, "Brightness changed from %u to %u", |
@@ -2309,8 +2309,8 @@ w9968cf_sensor_update_picture(struct w9968cf_device* cam, | |||
2309 | } | 2309 | } |
2310 | 2310 | ||
2311 | if ((!cam->sensor_initialized) || pict.colour != cam->picture.colour) { | 2311 | if ((!cam->sensor_initialized) || pict.colour != cam->picture.colour) { |
2312 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_SAT, | 2312 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_SAT, |
2313 | pict.colour); | 2313 | pict.colour); |
2314 | if (err) | 2314 | if (err) |
2315 | goto fail; | 2315 | goto fail; |
2316 | DBG(4, "Colour changed from %u to %u", | 2316 | DBG(4, "Colour changed from %u to %u", |
@@ -2319,8 +2319,8 @@ w9968cf_sensor_update_picture(struct w9968cf_device* cam, | |||
2319 | } | 2319 | } |
2320 | 2320 | ||
2321 | if ((!cam->sensor_initialized) || pict.hue != cam->picture.hue) { | 2321 | if ((!cam->sensor_initialized) || pict.hue != cam->picture.hue) { |
2322 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_HUE, | 2322 | err = w9968cf_sensor_set_control(cam, OVCAMCHIP_CID_HUE, |
2323 | pict.hue); | 2323 | pict.hue); |
2324 | if (err) | 2324 | if (err) |
2325 | goto fail; | 2325 | goto fail; |
2326 | DBG(4, "Hue changed from %u to %u", | 2326 | DBG(4, "Hue changed from %u to %u", |
@@ -2349,12 +2349,12 @@ static int w9968cf_sensor_init(struct w9968cf_device* cam) | |||
2349 | { | 2349 | { |
2350 | int err = 0; | 2350 | int err = 0; |
2351 | 2351 | ||
2352 | if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_INITIALIZE, | 2352 | if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_INITIALIZE, |
2353 | &cam->monochrome))) | 2353 | &cam->monochrome))) |
2354 | goto error; | 2354 | goto error; |
2355 | 2355 | ||
2356 | if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_Q_SUBTYPE, | 2356 | if ((err = w9968cf_sensor_cmd(cam, OVCAMCHIP_CMD_Q_SUBTYPE, |
2357 | &cam->sensor))) | 2357 | &cam->sensor))) |
2358 | goto error; | 2358 | goto error; |
2359 | 2359 | ||
2360 | /* NOTE: Make sure width and height are a multiple of 16 */ | 2360 | /* NOTE: Make sure width and height are a multiple of 16 */ |
@@ -2416,14 +2416,14 @@ error: | |||
2416 | 2416 | ||
2417 | /*-------------------------------------------------------------------------- | 2417 | /*-------------------------------------------------------------------------- |
2418 | Fill some basic fields in the main device data structure. | 2418 | Fill some basic fields in the main device data structure. |
2419 | This function is called once on w9968cf_usb_probe() for each recognized | 2419 | This function is called once on w9968cf_usb_probe() for each recognized |
2420 | camera. | 2420 | camera. |
2421 | --------------------------------------------------------------------------*/ | 2421 | --------------------------------------------------------------------------*/ |
2422 | static void | 2422 | static void |
2423 | w9968cf_configure_camera(struct w9968cf_device* cam, | 2423 | w9968cf_configure_camera(struct w9968cf_device* cam, |
2424 | struct usb_device* udev, | 2424 | struct usb_device* udev, |
2425 | enum w9968cf_model_id mod_id, | 2425 | enum w9968cf_model_id mod_id, |
2426 | const unsigned short dev_nr) | 2426 | const unsigned short dev_nr) |
2427 | { | 2427 | { |
2428 | mutex_init(&cam->fileop_mutex); | 2428 | mutex_init(&cam->fileop_mutex); |
2429 | init_waitqueue_head(&cam->open); | 2429 | init_waitqueue_head(&cam->open); |
@@ -2444,60 +2444,60 @@ w9968cf_configure_camera(struct w9968cf_device* cam, | |||
2444 | packet_size[dev_nr] < wMaxPacketSize[cam->altsetting-1]; | 2444 | packet_size[dev_nr] < wMaxPacketSize[cam->altsetting-1]; |
2445 | cam->altsetting++); | 2445 | cam->altsetting++); |
2446 | 2446 | ||
2447 | cam->max_buffers = (max_buffers[dev_nr] < 2 || | 2447 | cam->max_buffers = (max_buffers[dev_nr] < 2 || |
2448 | max_buffers[dev_nr] > W9968CF_MAX_BUFFERS) | 2448 | max_buffers[dev_nr] > W9968CF_MAX_BUFFERS) |
2449 | ? W9968CF_BUFFERS : (u8)max_buffers[dev_nr]; | 2449 | ? W9968CF_BUFFERS : (u8)max_buffers[dev_nr]; |
2450 | 2450 | ||
2451 | cam->double_buffer = (double_buffer[dev_nr] == 0 || | 2451 | cam->double_buffer = (double_buffer[dev_nr] == 0 || |
2452 | double_buffer[dev_nr] == 1) | 2452 | double_buffer[dev_nr] == 1) |
2453 | ? (u8)double_buffer[dev_nr]:W9968CF_DOUBLE_BUFFER; | 2453 | ? (u8)double_buffer[dev_nr]:W9968CF_DOUBLE_BUFFER; |
2454 | 2454 | ||
2455 | cam->clamping = (clamping[dev_nr] == 0 || clamping[dev_nr] == 1) | 2455 | cam->clamping = (clamping[dev_nr] == 0 || clamping[dev_nr] == 1) |
2456 | ? (u8)clamping[dev_nr] : W9968CF_CLAMPING; | 2456 | ? (u8)clamping[dev_nr] : W9968CF_CLAMPING; |
2457 | 2457 | ||
2458 | cam->filter_type = (filter_type[dev_nr] == 0 || | 2458 | cam->filter_type = (filter_type[dev_nr] == 0 || |
2459 | filter_type[dev_nr] == 1 || | 2459 | filter_type[dev_nr] == 1 || |
2460 | filter_type[dev_nr] == 2) | 2460 | filter_type[dev_nr] == 2) |
2461 | ? (u8)filter_type[dev_nr] : W9968CF_FILTER_TYPE; | 2461 | ? (u8)filter_type[dev_nr] : W9968CF_FILTER_TYPE; |
2462 | 2462 | ||
2463 | cam->capture = 1; | 2463 | cam->capture = 1; |
2464 | 2464 | ||
2465 | cam->largeview = (largeview[dev_nr] == 0 || largeview[dev_nr] == 1) | 2465 | cam->largeview = (largeview[dev_nr] == 0 || largeview[dev_nr] == 1) |
2466 | ? (u8)largeview[dev_nr] : W9968CF_LARGEVIEW; | 2466 | ? (u8)largeview[dev_nr] : W9968CF_LARGEVIEW; |
2467 | 2467 | ||
2468 | cam->decompression = (decompression[dev_nr] == 0 || | 2468 | cam->decompression = (decompression[dev_nr] == 0 || |
2469 | decompression[dev_nr] == 1 || | 2469 | decompression[dev_nr] == 1 || |
2470 | decompression[dev_nr] == 2) | 2470 | decompression[dev_nr] == 2) |
2471 | ? (u8)decompression[dev_nr]:W9968CF_DECOMPRESSION; | 2471 | ? (u8)decompression[dev_nr]:W9968CF_DECOMPRESSION; |
2472 | 2472 | ||
2473 | cam->upscaling = (upscaling[dev_nr] == 0 || | 2473 | cam->upscaling = (upscaling[dev_nr] == 0 || |
2474 | upscaling[dev_nr] == 1) | 2474 | upscaling[dev_nr] == 1) |
2475 | ? (u8)upscaling[dev_nr] : W9968CF_UPSCALING; | 2475 | ? (u8)upscaling[dev_nr] : W9968CF_UPSCALING; |
2476 | 2476 | ||
2477 | cam->auto_brt = (autobright[dev_nr] == 0 || autobright[dev_nr] == 1) | 2477 | cam->auto_brt = (autobright[dev_nr] == 0 || autobright[dev_nr] == 1) |
2478 | ? (u8)autobright[dev_nr] : W9968CF_AUTOBRIGHT; | 2478 | ? (u8)autobright[dev_nr] : W9968CF_AUTOBRIGHT; |
2479 | 2479 | ||
2480 | cam->auto_exp = (autoexp[dev_nr] == 0 || autoexp[dev_nr] == 1) | 2480 | cam->auto_exp = (autoexp[dev_nr] == 0 || autoexp[dev_nr] == 1) |
2481 | ? (u8)autoexp[dev_nr] : W9968CF_AUTOEXP; | 2481 | ? (u8)autoexp[dev_nr] : W9968CF_AUTOEXP; |
2482 | 2482 | ||
2483 | cam->lightfreq = (lightfreq[dev_nr] == 50 || lightfreq[dev_nr] == 60) | 2483 | cam->lightfreq = (lightfreq[dev_nr] == 50 || lightfreq[dev_nr] == 60) |
2484 | ? (u8)lightfreq[dev_nr] : W9968CF_LIGHTFREQ; | 2484 | ? (u8)lightfreq[dev_nr] : W9968CF_LIGHTFREQ; |
2485 | 2485 | ||
2486 | cam->bandfilt = (bandingfilter[dev_nr] == 0 || | 2486 | cam->bandfilt = (bandingfilter[dev_nr] == 0 || |
2487 | bandingfilter[dev_nr] == 1) | 2487 | bandingfilter[dev_nr] == 1) |
2488 | ? (u8)bandingfilter[dev_nr] : W9968CF_BANDINGFILTER; | 2488 | ? (u8)bandingfilter[dev_nr] : W9968CF_BANDINGFILTER; |
2489 | 2489 | ||
2490 | cam->backlight = (backlight[dev_nr] == 0 || backlight[dev_nr] == 1) | 2490 | cam->backlight = (backlight[dev_nr] == 0 || backlight[dev_nr] == 1) |
2491 | ? (u8)backlight[dev_nr] : W9968CF_BACKLIGHT; | 2491 | ? (u8)backlight[dev_nr] : W9968CF_BACKLIGHT; |
2492 | 2492 | ||
2493 | cam->clockdiv = (clockdiv[dev_nr] == -1 || clockdiv[dev_nr] >= 0) | 2493 | cam->clockdiv = (clockdiv[dev_nr] == -1 || clockdiv[dev_nr] >= 0) |
2494 | ? (s8)clockdiv[dev_nr] : W9968CF_CLOCKDIV; | 2494 | ? (s8)clockdiv[dev_nr] : W9968CF_CLOCKDIV; |
2495 | 2495 | ||
2496 | cam->mirror = (mirror[dev_nr] == 0 || mirror[dev_nr] == 1) | 2496 | cam->mirror = (mirror[dev_nr] == 0 || mirror[dev_nr] == 1) |
2497 | ? (u8)mirror[dev_nr] : W9968CF_MIRROR; | 2497 | ? (u8)mirror[dev_nr] : W9968CF_MIRROR; |
2498 | 2498 | ||
2499 | cam->monochrome = (monochrome[dev_nr] == 0 || monochrome[dev_nr] == 1) | 2499 | cam->monochrome = (monochrome[dev_nr] == 0 || monochrome[dev_nr] == 1) |
2500 | ? monochrome[dev_nr] : W9968CF_MONOCHROME; | 2500 | ? monochrome[dev_nr] : W9968CF_MONOCHROME; |
2501 | 2501 | ||
2502 | cam->picture.brightness = (u16)brightness[dev_nr]; | 2502 | cam->picture.brightness = (u16)brightness[dev_nr]; |
2503 | cam->picture.hue = (u16)hue[dev_nr]; | 2503 | cam->picture.hue = (u16)hue[dev_nr]; |
@@ -2519,7 +2519,7 @@ w9968cf_configure_camera(struct w9968cf_device* cam, | |||
2519 | cam->picture.depth = w9968cf_valid_depth(cam->picture.palette); | 2519 | cam->picture.depth = w9968cf_valid_depth(cam->picture.palette); |
2520 | 2520 | ||
2521 | cam->force_rgb = (force_rgb[dev_nr] == 0 || force_rgb[dev_nr] == 1) | 2521 | cam->force_rgb = (force_rgb[dev_nr] == 0 || force_rgb[dev_nr] == 1) |
2522 | ? (u8)force_rgb[dev_nr] : W9968CF_FORCE_RGB; | 2522 | ? (u8)force_rgb[dev_nr] : W9968CF_FORCE_RGB; |
2523 | 2523 | ||
2524 | cam->window.x = 0; | 2524 | cam->window.x = 0; |
2525 | cam->window.y = 0; | 2525 | cam->window.y = 0; |
@@ -2531,16 +2531,16 @@ w9968cf_configure_camera(struct w9968cf_device* cam, | |||
2531 | 2531 | ||
2532 | DBG(3, "%s configured with settings #%u:", | 2532 | DBG(3, "%s configured with settings #%u:", |
2533 | symbolic(camlist, cam->id), dev_nr) | 2533 | symbolic(camlist, cam->id), dev_nr) |
2534 | 2534 | ||
2535 | DBG(3, "- Data packet size for USB isochrnous transfer: %u bytes", | 2535 | DBG(3, "- Data packet size for USB isochrnous transfer: %u bytes", |
2536 | wMaxPacketSize[cam->altsetting-1]) | 2536 | wMaxPacketSize[cam->altsetting-1]) |
2537 | 2537 | ||
2538 | DBG(3, "- Number of requested video frame buffers: %u", | 2538 | DBG(3, "- Number of requested video frame buffers: %u", |
2539 | cam->max_buffers) | 2539 | cam->max_buffers) |
2540 | 2540 | ||
2541 | if (cam->double_buffer) | 2541 | if (cam->double_buffer) |
2542 | DBG(3, "- Hardware double buffering enabled") | 2542 | DBG(3, "- Hardware double buffering enabled") |
2543 | else | 2543 | else |
2544 | DBG(3, "- Hardware double buffering disabled") | 2544 | DBG(3, "- Hardware double buffering disabled") |
2545 | 2545 | ||
2546 | if (cam->filter_type == 0) | 2546 | if (cam->filter_type == 0) |
@@ -2648,7 +2648,7 @@ static void w9968cf_adjust_configuration(struct w9968cf_device* cam) | |||
2648 | 2648 | ||
2649 | /*-------------------------------------------------------------------------- | 2649 | /*-------------------------------------------------------------------------- |
2650 | Release the resources used by the driver. | 2650 | Release the resources used by the driver. |
2651 | This function is called on disconnect | 2651 | This function is called on disconnect |
2652 | (or on close if deallocation has been deferred) | 2652 | (or on close if deallocation has been deferred) |
2653 | --------------------------------------------------------------------------*/ | 2653 | --------------------------------------------------------------------------*/ |
2654 | static void w9968cf_release_resources(struct w9968cf_device* cam) | 2654 | static void w9968cf_release_resources(struct w9968cf_device* cam) |
@@ -2706,8 +2706,8 @@ static int w9968cf_open(struct inode* inode, struct file* filp) | |||
2706 | } | 2706 | } |
2707 | mutex_unlock(&cam->dev_mutex); | 2707 | mutex_unlock(&cam->dev_mutex); |
2708 | err = wait_event_interruptible_exclusive(cam->open, | 2708 | err = wait_event_interruptible_exclusive(cam->open, |
2709 | cam->disconnected || | 2709 | cam->disconnected || |
2710 | !cam->users); | 2710 | !cam->users); |
2711 | if (err) { | 2711 | if (err) { |
2712 | up_read(&w9968cf_disconnect); | 2712 | up_read(&w9968cf_disconnect); |
2713 | return err; | 2713 | return err; |
@@ -2820,9 +2820,9 @@ w9968cf_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
2820 | w9968cf_push_frame(cam, 1); | 2820 | w9968cf_push_frame(cam, 1); |
2821 | 2821 | ||
2822 | err = wait_event_interruptible(cam->wait_queue, | 2822 | err = wait_event_interruptible(cam->wait_queue, |
2823 | cam->frame[0].status == F_READY || | 2823 | cam->frame[0].status == F_READY || |
2824 | cam->frame[1].status == F_READY || | 2824 | cam->frame[1].status == F_READY || |
2825 | cam->disconnected); | 2825 | cam->disconnected); |
2826 | if (err) { | 2826 | if (err) { |
2827 | mutex_unlock(&cam->fileop_mutex); | 2827 | mutex_unlock(&cam->fileop_mutex); |
2828 | return err; | 2828 | return err; |
@@ -2859,12 +2859,12 @@ w9968cf_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
2859 | static int w9968cf_mmap(struct file* filp, struct vm_area_struct *vma) | 2859 | static int w9968cf_mmap(struct file* filp, struct vm_area_struct *vma) |
2860 | { | 2860 | { |
2861 | struct w9968cf_device* cam = (struct w9968cf_device*) | 2861 | struct w9968cf_device* cam = (struct w9968cf_device*) |
2862 | video_get_drvdata(video_devdata(filp)); | 2862 | video_get_drvdata(video_devdata(filp)); |
2863 | unsigned long vsize = vma->vm_end - vma->vm_start, | 2863 | unsigned long vsize = vma->vm_end - vma->vm_start, |
2864 | psize = cam->nbuffers * cam->frame[0].size, | 2864 | psize = cam->nbuffers * cam->frame[0].size, |
2865 | start = vma->vm_start, | 2865 | start = vma->vm_start, |
2866 | pos = (unsigned long)cam->frame[0].buffer, | 2866 | pos = (unsigned long)cam->frame[0].buffer, |
2867 | page; | 2867 | page; |
2868 | 2868 | ||
2869 | if (cam->disconnected) { | 2869 | if (cam->disconnected) { |
2870 | DBG(2, "Device not present") | 2870 | DBG(2, "Device not present") |
@@ -2898,7 +2898,7 @@ static int w9968cf_mmap(struct file* filp, struct vm_area_struct *vma) | |||
2898 | 2898 | ||
2899 | static int | 2899 | static int |
2900 | w9968cf_ioctl(struct inode* inode, struct file* filp, | 2900 | w9968cf_ioctl(struct inode* inode, struct file* filp, |
2901 | unsigned int cmd, unsigned long arg) | 2901 | unsigned int cmd, unsigned long arg) |
2902 | { | 2902 | { |
2903 | struct w9968cf_device* cam; | 2903 | struct w9968cf_device* cam; |
2904 | int err; | 2904 | int err; |
@@ -2928,21 +2928,21 @@ w9968cf_ioctl(struct inode* inode, struct file* filp, | |||
2928 | 2928 | ||
2929 | 2929 | ||
2930 | static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | 2930 | static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, |
2931 | unsigned int cmd, void __user * arg) | 2931 | unsigned int cmd, void __user * arg) |
2932 | { | 2932 | { |
2933 | struct w9968cf_device* cam; | 2933 | struct w9968cf_device* cam; |
2934 | const char* v4l1_ioctls[] = { | 2934 | const char* v4l1_ioctls[] = { |
2935 | "?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", | 2935 | "?", "CGAP", "GCHAN", "SCHAN", "GTUNER", "STUNER", |
2936 | "GPICT", "SPICT", "CCAPTURE", "GWIN", "SWIN", "GFBUF", | 2936 | "GPICT", "SPICT", "CCAPTURE", "GWIN", "SWIN", "GFBUF", |
2937 | "SFBUF", "KEY", "GFREQ", "SFREQ", "GAUDIO", "SAUDIO", | 2937 | "SFBUF", "KEY", "GFREQ", "SFREQ", "GAUDIO", "SAUDIO", |
2938 | "SYNC", "MCAPTURE", "GMBUF", "GUNIT", "GCAPTURE", "SCAPTURE", | 2938 | "SYNC", "MCAPTURE", "GMBUF", "GUNIT", "GCAPTURE", "SCAPTURE", |
2939 | "SPLAYMODE", "SWRITEMODE", "GPLAYINFO", "SMICROCODE", | 2939 | "SPLAYMODE", "SWRITEMODE", "GPLAYINFO", "SMICROCODE", |
2940 | "GVBIFMT", "SVBIFMT" | 2940 | "GVBIFMT", "SVBIFMT" |
2941 | }; | 2941 | }; |
2942 | 2942 | ||
2943 | #define V4L1_IOCTL(cmd) \ | 2943 | #define V4L1_IOCTL(cmd) \ |
2944 | ((_IOC_NR((cmd)) < ARRAY_SIZE(v4l1_ioctls)) ? \ | 2944 | ((_IOC_NR((cmd)) < ARRAY_SIZE(v4l1_ioctls)) ? \ |
2945 | v4l1_ioctls[_IOC_NR((cmd))] : "?") | 2945 | v4l1_ioctls[_IOC_NR((cmd))] : "?") |
2946 | 2946 | ||
2947 | cam = (struct w9968cf_device*)video_get_drvdata(video_devdata(filp)); | 2947 | cam = (struct w9968cf_device*)video_get_drvdata(video_devdata(filp)); |
2948 | 2948 | ||
@@ -2957,14 +2957,14 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
2957 | .minwidth = cam->minwidth, | 2957 | .minwidth = cam->minwidth, |
2958 | .minheight = cam->minheight, | 2958 | .minheight = cam->minheight, |
2959 | }; | 2959 | }; |
2960 | sprintf(cap.name, "W996[87]CF USB Camera #%d", | 2960 | sprintf(cap.name, "W996[87]CF USB Camera #%d", |
2961 | cam->v4ldev->minor); | 2961 | cam->v4ldev->minor); |
2962 | cap.maxwidth = (cam->upscaling && w9968cf_vpp) | 2962 | cap.maxwidth = (cam->upscaling && w9968cf_vpp) |
2963 | ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) | 2963 | ? max((u16)W9968CF_MAX_WIDTH, cam->maxwidth) |
2964 | : cam->maxwidth; | 2964 | : cam->maxwidth; |
2965 | cap.maxheight = (cam->upscaling && w9968cf_vpp) | 2965 | cap.maxheight = (cam->upscaling && w9968cf_vpp) |
2966 | ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight) | 2966 | ? max((u16)W9968CF_MAX_HEIGHT, cam->maxheight) |
2967 | : cam->maxheight; | 2967 | : cam->maxheight; |
2968 | 2968 | ||
2969 | if (copy_to_user(arg, &cap, sizeof(cap))) | 2969 | if (copy_to_user(arg, &cap, sizeof(cap))) |
2970 | return -EFAULT; | 2970 | return -EFAULT; |
@@ -3029,7 +3029,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3029 | if (copy_from_user(&pict, arg, sizeof(pict))) | 3029 | if (copy_from_user(&pict, arg, sizeof(pict))) |
3030 | return -EFAULT; | 3030 | return -EFAULT; |
3031 | 3031 | ||
3032 | if ( (cam->force_palette || !w9968cf_vpp) | 3032 | if ( (cam->force_palette || !w9968cf_vpp) |
3033 | && pict.palette != cam->picture.palette ) { | 3033 | && pict.palette != cam->picture.palette ) { |
3034 | DBG(4, "Palette %s rejected: only %s is allowed", | 3034 | DBG(4, "Palette %s rejected: only %s is allowed", |
3035 | symbolic(v4l1_plist, pict.palette), | 3035 | symbolic(v4l1_plist, pict.palette), |
@@ -3046,24 +3046,24 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3046 | if (!cam->force_palette) { | 3046 | if (!cam->force_palette) { |
3047 | if (cam->decompression == 0) { | 3047 | if (cam->decompression == 0) { |
3048 | if (w9968cf_need_decompression(pict.palette)) { | 3048 | if (w9968cf_need_decompression(pict.palette)) { |
3049 | DBG(4, "Decompression disabled: palette %s is not " | 3049 | DBG(4, "Decompression disabled: palette %s is not " |
3050 | "allowed. VIDIOCSPICT failed", | 3050 | "allowed. VIDIOCSPICT failed", |
3051 | symbolic(v4l1_plist, pict.palette)) | 3051 | symbolic(v4l1_plist, pict.palette)) |
3052 | return -EINVAL; | 3052 | return -EINVAL; |
3053 | } | 3053 | } |
3054 | } else if (cam->decompression == 1) { | 3054 | } else if (cam->decompression == 1) { |
3055 | if (!w9968cf_need_decompression(pict.palette)) { | 3055 | if (!w9968cf_need_decompression(pict.palette)) { |
3056 | DBG(4, "Decompression forced: palette %s is not " | 3056 | DBG(4, "Decompression forced: palette %s is not " |
3057 | "allowed. VIDIOCSPICT failed", | 3057 | "allowed. VIDIOCSPICT failed", |
3058 | symbolic(v4l1_plist, pict.palette)) | 3058 | symbolic(v4l1_plist, pict.palette)) |
3059 | return -EINVAL; | 3059 | return -EINVAL; |
3060 | } | 3060 | } |
3061 | } | 3061 | } |
3062 | } | 3062 | } |
3063 | 3063 | ||
3064 | if (pict.depth != w9968cf_valid_depth(pict.palette)) { | 3064 | if (pict.depth != w9968cf_valid_depth(pict.palette)) { |
3065 | DBG(4, "Requested depth %u bpp is not valid for %s " | 3065 | DBG(4, "Requested depth %u bpp is not valid for %s " |
3066 | "palette: ignored and changed to %u bpp", | 3066 | "palette: ignored and changed to %u bpp", |
3067 | pict.depth, symbolic(v4l1_plist, pict.palette), | 3067 | pict.depth, symbolic(v4l1_plist, pict.palette), |
3068 | w9968cf_valid_depth(pict.palette)) | 3068 | w9968cf_valid_depth(pict.palette)) |
3069 | pict.depth = w9968cf_valid_depth(pict.palette); | 3069 | pict.depth = w9968cf_valid_depth(pict.palette); |
@@ -3074,9 +3074,9 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3074 | || cam->frame_current->queued) { | 3074 | || cam->frame_current->queued) { |
3075 | err = wait_event_interruptible | 3075 | err = wait_event_interruptible |
3076 | ( cam->wait_queue, | 3076 | ( cam->wait_queue, |
3077 | cam->disconnected || | 3077 | cam->disconnected || |
3078 | (!*cam->requested_frame && | 3078 | (!*cam->requested_frame && |
3079 | !cam->frame_current->queued) ); | 3079 | !cam->frame_current->queued) ); |
3080 | if (err) | 3080 | if (err) |
3081 | return err; | 3081 | return err; |
3082 | if (cam->disconnected) | 3082 | if (cam->disconnected) |
@@ -3116,7 +3116,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3116 | return -EINVAL; | 3116 | return -EINVAL; |
3117 | 3117 | ||
3118 | if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, | 3118 | if ((err = w9968cf_adjust_window_size(cam, (u16*)&win.width, |
3119 | (u16*)&win.height))) { | 3119 | (u16*)&win.height))) { |
3120 | DBG(4, "Resolution not supported (%ux%u). " | 3120 | DBG(4, "Resolution not supported (%ux%u). " |
3121 | "VIDIOCSWIN failed", win.width, win.height) | 3121 | "VIDIOCSWIN failed", win.width, win.height) |
3122 | return err; | 3122 | return err; |
@@ -3130,9 +3130,9 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3130 | || cam->frame_current->queued) { | 3130 | || cam->frame_current->queued) { |
3131 | err = wait_event_interruptible | 3131 | err = wait_event_interruptible |
3132 | ( cam->wait_queue, | 3132 | ( cam->wait_queue, |
3133 | cam->disconnected || | 3133 | cam->disconnected || |
3134 | (!*cam->requested_frame && | 3134 | (!*cam->requested_frame && |
3135 | !cam->frame_current->queued) ); | 3135 | !cam->frame_current->queued) ); |
3136 | if (err) | 3136 | if (err) |
3137 | return err; | 3137 | return err; |
3138 | if (cam->disconnected) | 3138 | if (cam->disconnected) |
@@ -3175,7 +3175,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3175 | mbuf.frames = cam->nbuffers; | 3175 | mbuf.frames = cam->nbuffers; |
3176 | for (i = 0; i < cam->nbuffers; i++) | 3176 | for (i = 0; i < cam->nbuffers; i++) |
3177 | mbuf.offsets[i] = (unsigned long)cam->frame[i].buffer - | 3177 | mbuf.offsets[i] = (unsigned long)cam->frame[i].buffer - |
3178 | (unsigned long)cam->frame[0].buffer; | 3178 | (unsigned long)cam->frame[0].buffer; |
3179 | 3179 | ||
3180 | if (copy_to_user(arg, &mbuf, sizeof(mbuf))) | 3180 | if (copy_to_user(arg, &mbuf, sizeof(mbuf))) |
3181 | return -EFAULT; | 3181 | return -EFAULT; |
@@ -3194,7 +3194,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3194 | return -EFAULT; | 3194 | return -EFAULT; |
3195 | 3195 | ||
3196 | DBG(6, "VIDIOCMCAPTURE called: frame #%u, format=%s, %dx%d", | 3196 | DBG(6, "VIDIOCMCAPTURE called: frame #%u, format=%s, %dx%d", |
3197 | mmap.frame, symbolic(v4l1_plist, mmap.format), | 3197 | mmap.frame, symbolic(v4l1_plist, mmap.format), |
3198 | mmap.width, mmap.height) | 3198 | mmap.width, mmap.height) |
3199 | 3199 | ||
3200 | if (mmap.frame >= cam->nbuffers) { | 3200 | if (mmap.frame >= cam->nbuffers) { |
@@ -3203,7 +3203,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3203 | return -EINVAL; | 3203 | return -EINVAL; |
3204 | } | 3204 | } |
3205 | 3205 | ||
3206 | if (mmap.format!=cam->picture.palette && | 3206 | if (mmap.format!=cam->picture.palette && |
3207 | (cam->force_palette || !w9968cf_vpp)) { | 3207 | (cam->force_palette || !w9968cf_vpp)) { |
3208 | DBG(4, "Palette %s rejected: only %s is allowed", | 3208 | DBG(4, "Palette %s rejected: only %s is allowed", |
3209 | symbolic(v4l1_plist, mmap.format), | 3209 | symbolic(v4l1_plist, mmap.format), |
@@ -3213,7 +3213,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3213 | 3213 | ||
3214 | if (!w9968cf_valid_palette(mmap.format)) { | 3214 | if (!w9968cf_valid_palette(mmap.format)) { |
3215 | DBG(4, "Palette %s not supported. " | 3215 | DBG(4, "Palette %s not supported. " |
3216 | "VIDIOCMCAPTURE failed", | 3216 | "VIDIOCMCAPTURE failed", |
3217 | symbolic(v4l1_plist, mmap.format)) | 3217 | symbolic(v4l1_plist, mmap.format)) |
3218 | return -EINVAL; | 3218 | return -EINVAL; |
3219 | } | 3219 | } |
@@ -3221,23 +3221,23 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3221 | if (!cam->force_palette) { | 3221 | if (!cam->force_palette) { |
3222 | if (cam->decompression == 0) { | 3222 | if (cam->decompression == 0) { |
3223 | if (w9968cf_need_decompression(mmap.format)) { | 3223 | if (w9968cf_need_decompression(mmap.format)) { |
3224 | DBG(4, "Decompression disabled: palette %s is not " | 3224 | DBG(4, "Decompression disabled: palette %s is not " |
3225 | "allowed. VIDIOCSPICT failed", | 3225 | "allowed. VIDIOCSPICT failed", |
3226 | symbolic(v4l1_plist, mmap.format)) | 3226 | symbolic(v4l1_plist, mmap.format)) |
3227 | return -EINVAL; | 3227 | return -EINVAL; |
3228 | } | 3228 | } |
3229 | } else if (cam->decompression == 1) { | 3229 | } else if (cam->decompression == 1) { |
3230 | if (!w9968cf_need_decompression(mmap.format)) { | 3230 | if (!w9968cf_need_decompression(mmap.format)) { |
3231 | DBG(4, "Decompression forced: palette %s is not " | 3231 | DBG(4, "Decompression forced: palette %s is not " |
3232 | "allowed. VIDIOCSPICT failed", | 3232 | "allowed. VIDIOCSPICT failed", |
3233 | symbolic(v4l1_plist, mmap.format)) | 3233 | symbolic(v4l1_plist, mmap.format)) |
3234 | return -EINVAL; | 3234 | return -EINVAL; |
3235 | } | 3235 | } |
3236 | } | 3236 | } |
3237 | } | 3237 | } |
3238 | 3238 | ||
3239 | if ((err = w9968cf_adjust_window_size(cam, (u16*)&mmap.width, | 3239 | if ((err = w9968cf_adjust_window_size(cam, (u16*)&mmap.width, |
3240 | (u16*)&mmap.height))) { | 3240 | (u16*)&mmap.height))) { |
3241 | DBG(4, "Resolution not supported (%dx%d). " | 3241 | DBG(4, "Resolution not supported (%dx%d). " |
3242 | "VIDIOCMCAPTURE failed", | 3242 | "VIDIOCMCAPTURE failed", |
3243 | mmap.width, mmap.height) | 3243 | mmap.width, mmap.height) |
@@ -3258,12 +3258,12 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3258 | DBG(6, "VIDIOCMCAPTURE. Change settings for " | 3258 | DBG(6, "VIDIOCMCAPTURE. Change settings for " |
3259 | "frame #%u: %dx%d, format %s. Wait...", | 3259 | "frame #%u: %dx%d, format %s. Wait...", |
3260 | mmap.frame, mmap.width, mmap.height, | 3260 | mmap.frame, mmap.width, mmap.height, |
3261 | symbolic(v4l1_plist, mmap.format)) | 3261 | symbolic(v4l1_plist, mmap.format)) |
3262 | err = wait_event_interruptible | 3262 | err = wait_event_interruptible |
3263 | ( cam->wait_queue, | 3263 | ( cam->wait_queue, |
3264 | cam->disconnected || | 3264 | cam->disconnected || |
3265 | (!*cam->requested_frame && | 3265 | (!*cam->requested_frame && |
3266 | !cam->frame_current->queued) ); | 3266 | !cam->frame_current->queued) ); |
3267 | if (err) | 3267 | if (err) |
3268 | return err; | 3268 | return err; |
3269 | if (cam->disconnected) | 3269 | if (cam->disconnected) |
@@ -3280,7 +3280,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3280 | goto ioctl_fail; | 3280 | goto ioctl_fail; |
3281 | 3281 | ||
3282 | /* This before set_window */ | 3282 | /* This before set_window */ |
3283 | if (w9968cf_set_picture(cam, pict)) | 3283 | if (w9968cf_set_picture(cam, pict)) |
3284 | goto ioctl_fail; | 3284 | goto ioctl_fail; |
3285 | 3285 | ||
3286 | if (w9968cf_set_window(cam, win)) | 3286 | if (w9968cf_set_window(cam, win)) |
@@ -3292,10 +3292,10 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3292 | } else if (fr->queued) { | 3292 | } else if (fr->queued) { |
3293 | 3293 | ||
3294 | DBG(6, "Wait until frame #%u is free", mmap.frame) | 3294 | DBG(6, "Wait until frame #%u is free", mmap.frame) |
3295 | 3295 | ||
3296 | err = wait_event_interruptible(cam->wait_queue, | 3296 | err = wait_event_interruptible(cam->wait_queue, |
3297 | cam->disconnected || | 3297 | cam->disconnected || |
3298 | (!fr->queued)); | 3298 | (!fr->queued)); |
3299 | if (err) | 3299 | if (err) |
3300 | return err; | 3300 | return err; |
3301 | if (cam->disconnected) | 3301 | if (cam->disconnected) |
@@ -3335,9 +3335,9 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3335 | } | 3335 | } |
3336 | case F_ERROR: | 3336 | case F_ERROR: |
3337 | case F_GRABBING: | 3337 | case F_GRABBING: |
3338 | err = wait_event_interruptible(cam->wait_queue, | 3338 | err = wait_event_interruptible(cam->wait_queue, |
3339 | (fr->status == F_READY) | 3339 | (fr->status == F_READY) |
3340 | || cam->disconnected); | 3340 | || cam->disconnected); |
3341 | if (err) | 3341 | if (err) |
3342 | return err; | 3342 | return err; |
3343 | if (cam->disconnected) | 3343 | if (cam->disconnected) |
@@ -3439,7 +3439,7 @@ static int w9968cf_v4l_ioctl(struct inode* inode, struct file* filp, | |||
3439 | DBG(4, "Unsupported V4L1 IOCtl: VIDIOC%s " | 3439 | DBG(4, "Unsupported V4L1 IOCtl: VIDIOC%s " |
3440 | "(type 0x%01X, " | 3440 | "(type 0x%01X, " |
3441 | "n. 0x%01X, " | 3441 | "n. 0x%01X, " |
3442 | "dir. 0x%01X, " | 3442 | "dir. 0x%01X, " |
3443 | "size 0x%02X)", | 3443 | "size 0x%02X)", |
3444 | V4L1_IOCTL(cmd), | 3444 | V4L1_IOCTL(cmd), |
3445 | _IOC_TYPE(cmd),_IOC_NR(cmd),_IOC_DIR(cmd),_IOC_SIZE(cmd)) | 3445 | _IOC_TYPE(cmd),_IOC_NR(cmd),_IOC_DIR(cmd),_IOC_SIZE(cmd)) |
@@ -3499,13 +3499,13 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3499 | le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[0].idProduct) | 3499 | le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[0].idProduct) |
3500 | mod_id = W9968CF_MOD_CLVBWGP; /* see camlist[] table */ | 3500 | mod_id = W9968CF_MOD_CLVBWGP; /* see camlist[] table */ |
3501 | else if (le16_to_cpu(udev->descriptor.idVendor) == winbond_id_table[1].idVendor && | 3501 | else if (le16_to_cpu(udev->descriptor.idVendor) == winbond_id_table[1].idVendor && |
3502 | le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[1].idProduct) | 3502 | le16_to_cpu(udev->descriptor.idProduct) == winbond_id_table[1].idProduct) |
3503 | mod_id = W9968CF_MOD_GENERIC; /* see camlist[] table */ | 3503 | mod_id = W9968CF_MOD_GENERIC; /* see camlist[] table */ |
3504 | else | 3504 | else |
3505 | return -ENODEV; | 3505 | return -ENODEV; |
3506 | 3506 | ||
3507 | cam = (struct w9968cf_device*) | 3507 | cam = (struct w9968cf_device*) |
3508 | kzalloc(sizeof(struct w9968cf_device), GFP_KERNEL); | 3508 | kzalloc(sizeof(struct w9968cf_device), GFP_KERNEL); |
3509 | if (!cam) | 3509 | if (!cam) |
3510 | return -ENOMEM; | 3510 | return -ENOMEM; |
3511 | 3511 | ||
@@ -3569,7 +3569,7 @@ w9968cf_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
3569 | cam->v4ldev->dev = &cam->dev; | 3569 | cam->v4ldev->dev = &cam->dev; |
3570 | 3570 | ||
3571 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | 3571 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, |
3572 | video_nr[dev_nr]); | 3572 | video_nr[dev_nr]); |
3573 | if (err) { | 3573 | if (err) { |
3574 | DBG(1, "V4L device registration failed") | 3574 | DBG(1, "V4L device registration failed") |
3575 | if (err == -ENFILE && video_nr[dev_nr] == -1) | 3575 | if (err == -ENFILE && video_nr[dev_nr] == -1) |
@@ -3611,7 +3611,7 @@ fail: /* Free unused memory */ | |||
3611 | 3611 | ||
3612 | static void w9968cf_usb_disconnect(struct usb_interface* intf) | 3612 | static void w9968cf_usb_disconnect(struct usb_interface* intf) |
3613 | { | 3613 | { |
3614 | struct w9968cf_device* cam = | 3614 | struct w9968cf_device* cam = |
3615 | (struct w9968cf_device*)usb_get_intfdata(intf); | 3615 | (struct w9968cf_device*)usb_get_intfdata(intf); |
3616 | 3616 | ||
3617 | down_write(&w9968cf_disconnect); | 3617 | down_write(&w9968cf_disconnect); |
diff --git a/drivers/usb/media/w9968cf.h b/drivers/media/video/w9968cf.h index a87be719a281..2836b45ec206 100644 --- a/drivers/usb/media/w9968cf.h +++ b/drivers/media/video/w9968cf.h | |||
@@ -61,7 +61,7 @@ | |||
61 | 61 | ||
62 | /* Maximum data payload sizes in bytes for alternate settings */ | 62 | /* Maximum data payload sizes in bytes for alternate settings */ |
63 | static const u16 wMaxPacketSize[] = {1023, 959, 895, 831, 767, 703, 639, 575, | 63 | static const u16 wMaxPacketSize[] = {1023, 959, 895, 831, 767, 703, 639, 575, |
64 | 511, 447, 383, 319, 255, 191, 127, 63}; | 64 | 511, 447, 383, 319, 255, 191, 127, 63}; |
65 | #define W9968CF_PACKET_SIZE 1023 /* according to wMaxPacketSizes[] */ | 65 | #define W9968CF_PACKET_SIZE 1023 /* according to wMaxPacketSizes[] */ |
66 | #define W9968CF_MIN_PACKET_SIZE 63 /* minimum value */ | 66 | #define W9968CF_MIN_PACKET_SIZE 63 /* minimum value */ |
67 | #define W9968CF_ISO_PACKETS 5 /* n.of packets for isochronous transfers */ | 67 | #define W9968CF_ISO_PACKETS 5 /* n.of packets for isochronous transfers */ |
@@ -134,7 +134,7 @@ static const struct w9968cf_format w9968cf_formatlist[] = { | |||
134 | ****************************************************************************/ | 134 | ****************************************************************************/ |
135 | 135 | ||
136 | #define W9968CF_MODULE_NAME "V4L driver for W996[87]CF JPEG USB " \ | 136 | #define W9968CF_MODULE_NAME "V4L driver for W996[87]CF JPEG USB " \ |
137 | "Dual Mode Camera Chip" | 137 | "Dual Mode Camera Chip" |
138 | #define W9968CF_MODULE_VERSION "1:1.33-basic" | 138 | #define W9968CF_MODULE_VERSION "1:1.33-basic" |
139 | #define W9968CF_MODULE_AUTHOR "(C) 2002-2004 Luca Risolia" | 139 | #define W9968CF_MODULE_AUTHOR "(C) 2002-2004 Luca Risolia" |
140 | #define W9968CF_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | 140 | #define W9968CF_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" |
@@ -270,9 +270,9 @@ struct w9968cf_device { | |||
270 | 270 | ||
271 | /* Locks */ | 271 | /* Locks */ |
272 | struct mutex dev_mutex, /* for probe, disconnect,open and close */ | 272 | struct mutex dev_mutex, /* for probe, disconnect,open and close */ |
273 | fileop_mutex; /* for read and ioctl */ | 273 | fileop_mutex; /* for read and ioctl */ |
274 | spinlock_t urb_lock, /* for submit_urb() and unlink_urb() */ | 274 | spinlock_t urb_lock, /* for submit_urb() and unlink_urb() */ |
275 | flist_lock; /* for requested frame list accesses */ | 275 | flist_lock; /* for requested frame list accesses */ |
276 | wait_queue_head_t open, wait_queue; | 276 | wait_queue_head_t open, wait_queue; |
277 | 277 | ||
278 | char command[16]; /* name of the program holding the device */ | 278 | char command[16]; /* name of the program holding the device */ |
@@ -299,7 +299,7 @@ struct w9968cf_device { | |||
299 | dev_warn(&cam->dev, fmt "\n", ## args); \ | 299 | dev_warn(&cam->dev, fmt "\n", ## args); \ |
300 | else if ((level) >= 5) \ | 300 | else if ((level) >= 5) \ |
301 | dev_info(&cam->dev, "[%s:%d] " fmt "\n", \ | 301 | dev_info(&cam->dev, "[%s:%d] " fmt "\n", \ |
302 | __FUNCTION__, __LINE__ , ## args); \ | 302 | __FUNCTION__, __LINE__ , ## args); \ |
303 | } \ | 303 | } \ |
304 | } | 304 | } |
305 | /* For generic kernel (not device specific) messages */ | 305 | /* For generic kernel (not device specific) messages */ |
@@ -311,7 +311,7 @@ struct w9968cf_device { | |||
311 | pr_info("w9968cf: " fmt "\n", ## args); \ | 311 | pr_info("w9968cf: " fmt "\n", ## args); \ |
312 | else if ((level) >= 5) \ | 312 | else if ((level) >= 5) \ |
313 | pr_debug("w9968cf: [%s:%d] " fmt "\n", __FUNCTION__, \ | 313 | pr_debug("w9968cf: [%s:%d] " fmt "\n", __FUNCTION__, \ |
314 | __LINE__ , ## args); \ | 314 | __LINE__ , ## args); \ |
315 | } \ | 315 | } \ |
316 | } | 316 | } |
317 | #else | 317 | #else |
diff --git a/drivers/usb/media/w9968cf_decoder.h b/drivers/media/video/w9968cf_decoder.h index 31faccbe8f03..59decbfc540a 100644 --- a/drivers/usb/media/w9968cf_decoder.h +++ b/drivers/media/video/w9968cf_decoder.h | |||
@@ -78,9 +78,9 @@ static const unsigned char UV_QUANTABLE[64] = { | |||
78 | #define W9968CF_DEC_ERR_NO_EOI -6 | 78 | #define W9968CF_DEC_ERR_NO_EOI -6 |
79 | 79 | ||
80 | extern void w9968cf_init_decoder(void); | 80 | extern void w9968cf_init_decoder(void); |
81 | extern int w9968cf_check_headers(const unsigned char* Pin, | 81 | extern int w9968cf_check_headers(const unsigned char* Pin, |
82 | const unsigned long BUF_SIZE); | 82 | const unsigned long BUF_SIZE); |
83 | extern int w9968cf_decode(const char* Pin, const unsigned long BUF_SIZE, | 83 | extern int w9968cf_decode(const char* Pin, const unsigned long BUF_SIZE, |
84 | const unsigned W, const unsigned H, char* Pout); | 84 | const unsigned W, const unsigned H, char* Pout); |
85 | 85 | ||
86 | #endif /* _W9968CF_DECODER_H_ */ | 86 | #endif /* _W9968CF_DECODER_H_ */ |
diff --git a/drivers/usb/media/w9968cf_vpp.h b/drivers/media/video/w9968cf_vpp.h index f3b91b782671..88c9b6c0cc36 100644 --- a/drivers/usb/media/w9968cf_vpp.h +++ b/drivers/media/video/w9968cf_vpp.h | |||
@@ -29,7 +29,7 @@ struct w9968cf_vpp_t { | |||
29 | struct module* owner; | 29 | struct module* owner; |
30 | int (*check_headers)(const unsigned char*, const unsigned long); | 30 | int (*check_headers)(const unsigned char*, const unsigned long); |
31 | int (*decode)(const char*, const unsigned long, const unsigned, | 31 | int (*decode)(const char*, const unsigned long, const unsigned, |
32 | const unsigned, char*); | 32 | const unsigned, char*); |
33 | void (*swap_yuvbytes)(void*, unsigned long); | 33 | void (*swap_yuvbytes)(void*, unsigned long); |
34 | void (*uyvy_to_rgbx)(u8*, unsigned long, u8*, u16, u8); | 34 | void (*uyvy_to_rgbx)(u8*, unsigned long, u8*, u16, u8); |
35 | void (*scale_up)(u8*, u8*, u16, u16, u16, u16, u16); | 35 | void (*scale_up)(u8*, u8*, u16, u16, u16, u16, u16); |
diff --git a/drivers/media/video/wm8775.c b/drivers/media/video/wm8775.c index 8cb64f8a8a91..d81a88bbe43d 100644 --- a/drivers/media/video/wm8775.c +++ b/drivers/media/video/wm8775.c | |||
@@ -79,21 +79,26 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd, | |||
79 | void *arg) | 79 | void *arg) |
80 | { | 80 | { |
81 | struct wm8775_state *state = i2c_get_clientdata(client); | 81 | struct wm8775_state *state = i2c_get_clientdata(client); |
82 | struct v4l2_audio *input = arg; | 82 | struct v4l2_routing *route = arg; |
83 | struct v4l2_control *ctrl = arg; | 83 | struct v4l2_control *ctrl = arg; |
84 | 84 | ||
85 | switch (cmd) { | 85 | switch (cmd) { |
86 | case VIDIOC_S_AUDIO: | 86 | case VIDIOC_INT_G_AUDIO_ROUTING: |
87 | route->input = state->input; | ||
88 | route->output = 0; | ||
89 | break; | ||
90 | |||
91 | case VIDIOC_INT_S_AUDIO_ROUTING: | ||
87 | /* There are 4 inputs and one output. Zero or more inputs | 92 | /* There are 4 inputs and one output. Zero or more inputs |
88 | are multiplexed together to the output. Hence there are | 93 | are multiplexed together to the output. Hence there are |
89 | 16 combinations. | 94 | 16 combinations. |
90 | If only one input is active (the normal case) then the | 95 | If only one input is active (the normal case) then the |
91 | input values 1, 2, 4 or 8 should be used. */ | 96 | input values 1, 2, 4 or 8 should be used. */ |
92 | if (input->index > 15) { | 97 | if (route->input > 15) { |
93 | v4l_err(client, "Invalid input %d.\n", input->index); | 98 | v4l_err(client, "Invalid input %d.\n", route->input); |
94 | return -EINVAL; | 99 | return -EINVAL; |
95 | } | 100 | } |
96 | state->input = input->index; | 101 | state->input = route->input; |
97 | if (state->muted) | 102 | if (state->muted) |
98 | break; | 103 | break; |
99 | wm8775_write(client, R21, 0x0c0); | 104 | wm8775_write(client, R21, 0x0c0); |
@@ -102,11 +107,6 @@ static int wm8775_command(struct i2c_client *client, unsigned int cmd, | |||
102 | wm8775_write(client, R21, 0x100 + state->input); | 107 | wm8775_write(client, R21, 0x100 + state->input); |
103 | break; | 108 | break; |
104 | 109 | ||
105 | case VIDIOC_G_AUDIO: | ||
106 | memset(input, 0, sizeof(*input)); | ||
107 | input->index = state->input; | ||
108 | break; | ||
109 | |||
110 | case VIDIOC_G_CTRL: | 110 | case VIDIOC_G_CTRL: |
111 | if (ctrl->id != V4L2_CID_AUDIO_MUTE) | 111 | if (ctrl->id != V4L2_CID_AUDIO_MUTE) |
112 | return -EINVAL; | 112 | return -EINVAL; |
diff --git a/drivers/media/video/zc0301/Makefile b/drivers/media/video/zc0301/Makefile new file mode 100644 index 000000000000..d749199d8f06 --- /dev/null +++ b/drivers/media/video/zc0301/Makefile | |||
@@ -0,0 +1,3 @@ | |||
1 | zc0301-objs := zc0301_core.o zc0301_pas202bcb.o | ||
2 | |||
3 | obj-$(CONFIG_USB_ZC0301) += zc0301.o | ||
diff --git a/drivers/usb/media/zc0301.h b/drivers/media/video/zc0301/zc0301.h index 8e0655140e60..b9c93b8c16f7 100644 --- a/drivers/usb/media/zc0301.h +++ b/drivers/media/video/zc0301/zc0301.h | |||
@@ -157,7 +157,7 @@ do { \ | |||
157 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ | 157 | dev_info(&cam->usbdev->dev, fmt "\n", ## args); \ |
158 | else if ((level) >= 3) \ | 158 | else if ((level) >= 3) \ |
159 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 159 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
160 | __FUNCTION__, __LINE__ , ## args); \ | 160 | __FUNCTION__, __LINE__ , ## args); \ |
161 | } \ | 161 | } \ |
162 | } while (0) | 162 | } while (0) |
163 | # define KDBG(level, fmt, args...) \ | 163 | # define KDBG(level, fmt, args...) \ |
@@ -167,7 +167,7 @@ do { \ | |||
167 | pr_info("zc0301: " fmt "\n", ## args); \ | 167 | pr_info("zc0301: " fmt "\n", ## args); \ |
168 | else if ((level) == 3) \ | 168 | else if ((level) == 3) \ |
169 | pr_debug("zc0301: [%s:%d] " fmt "\n", __FUNCTION__, \ | 169 | pr_debug("zc0301: [%s:%d] " fmt "\n", __FUNCTION__, \ |
170 | __LINE__ , ## args); \ | 170 | __LINE__ , ## args); \ |
171 | } \ | 171 | } \ |
172 | } while (0) | 172 | } while (0) |
173 | # define V4LDBG(level, name, cmd) \ | 173 | # define V4LDBG(level, name, cmd) \ |
@@ -184,7 +184,7 @@ do { \ | |||
184 | #undef PDBG | 184 | #undef PDBG |
185 | #define PDBG(fmt, args...) \ | 185 | #define PDBG(fmt, args...) \ |
186 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ | 186 | dev_info(&cam->usbdev->dev, "[%s:%d] " fmt "\n", \ |
187 | __FUNCTION__, __LINE__ , ## args) | 187 | __FUNCTION__, __LINE__ , ## args) |
188 | 188 | ||
189 | #undef PDBGG | 189 | #undef PDBGG |
190 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ | 190 | #define PDBGG(fmt, args...) do {;} while(0) /* placeholder */ |
diff --git a/drivers/usb/media/zc0301_core.c b/drivers/media/video/zc0301/zc0301_core.c index 4036c6268bff..0fad39754f7a 100644 --- a/drivers/usb/media/zc0301_core.c +++ b/drivers/media/video/zc0301/zc0301_core.c | |||
@@ -48,7 +48,7 @@ | |||
48 | /*****************************************************************************/ | 48 | /*****************************************************************************/ |
49 | 49 | ||
50 | #define ZC0301_MODULE_NAME "V4L2 driver for ZC0301 " \ | 50 | #define ZC0301_MODULE_NAME "V4L2 driver for ZC0301 " \ |
51 | "Image Processor and Control Chip" | 51 | "Image Processor and Control Chip" |
52 | #define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia" | 52 | #define ZC0301_MODULE_AUTHOR "(C) 2006 Luca Risolia" |
53 | #define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" | 53 | #define ZC0301_AUTHOR_EMAIL "<luca.risolia@studio.unibo.it>" |
54 | #define ZC0301_MODULE_LICENSE "GPL" | 54 | #define ZC0301_MODULE_LICENSE "GPL" |
@@ -67,67 +67,67 @@ MODULE_LICENSE(ZC0301_MODULE_LICENSE); | |||
67 | static short video_nr[] = {[0 ... ZC0301_MAX_DEVICES-1] = -1}; | 67 | static short video_nr[] = {[0 ... ZC0301_MAX_DEVICES-1] = -1}; |
68 | module_param_array(video_nr, short, NULL, 0444); | 68 | module_param_array(video_nr, short, NULL, 0444); |
69 | MODULE_PARM_DESC(video_nr, | 69 | MODULE_PARM_DESC(video_nr, |
70 | "\n<-1|n[,...]> Specify V4L2 minor mode number." | 70 | "\n<-1|n[,...]> Specify V4L2 minor mode number." |
71 | "\n -1 = use next available (default)" | 71 | "\n -1 = use next available (default)" |
72 | "\n n = use minor number n (integer >= 0)" | 72 | "\n n = use minor number n (integer >= 0)" |
73 | "\nYou can specify up to " | 73 | "\nYou can specify up to " |
74 | __MODULE_STRING(ZC0301_MAX_DEVICES) " cameras this way." | 74 | __MODULE_STRING(ZC0301_MAX_DEVICES) " cameras this way." |
75 | "\nFor example:" | 75 | "\nFor example:" |
76 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" | 76 | "\nvideo_nr=-1,2,-1 would assign minor number 2 to" |
77 | "\nthe second registered camera and use auto for the first" | 77 | "\nthe second registered camera and use auto for the first" |
78 | "\none and for every other camera." | 78 | "\none and for every other camera." |
79 | "\n"); | 79 | "\n"); |
80 | 80 | ||
81 | static short force_munmap[] = {[0 ... ZC0301_MAX_DEVICES-1] = | 81 | static short force_munmap[] = {[0 ... ZC0301_MAX_DEVICES-1] = |
82 | ZC0301_FORCE_MUNMAP}; | 82 | ZC0301_FORCE_MUNMAP}; |
83 | module_param_array(force_munmap, bool, NULL, 0444); | 83 | module_param_array(force_munmap, bool, NULL, 0444); |
84 | MODULE_PARM_DESC(force_munmap, | 84 | MODULE_PARM_DESC(force_munmap, |
85 | "\n<0|1[,...]> Force the application to unmap previously" | 85 | "\n<0|1[,...]> Force the application to unmap previously" |
86 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" | 86 | "\nmapped buffer memory before calling any VIDIOC_S_CROP or" |
87 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" | 87 | "\nVIDIOC_S_FMT ioctl's. Not all the applications support" |
88 | "\nthis feature. This parameter is specific for each" | 88 | "\nthis feature. This parameter is specific for each" |
89 | "\ndetected camera." | 89 | "\ndetected camera." |
90 | "\n 0 = do not force memory unmapping" | 90 | "\n 0 = do not force memory unmapping" |
91 | "\n 1 = force memory unmapping (save memory)" | 91 | "\n 1 = force memory unmapping (save memory)" |
92 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." | 92 | "\nDefault value is "__MODULE_STRING(SN9C102_FORCE_MUNMAP)"." |
93 | "\n"); | 93 | "\n"); |
94 | 94 | ||
95 | static unsigned int frame_timeout[] = {[0 ... ZC0301_MAX_DEVICES-1] = | 95 | static unsigned int frame_timeout[] = {[0 ... ZC0301_MAX_DEVICES-1] = |
96 | ZC0301_FRAME_TIMEOUT}; | 96 | ZC0301_FRAME_TIMEOUT}; |
97 | module_param_array(frame_timeout, uint, NULL, 0644); | 97 | module_param_array(frame_timeout, uint, NULL, 0644); |
98 | MODULE_PARM_DESC(frame_timeout, | 98 | MODULE_PARM_DESC(frame_timeout, |
99 | "\n<n[,...]> Timeout for a video frame in seconds." | 99 | "\n<n[,...]> Timeout for a video frame in seconds." |
100 | "\nThis parameter is specific for each detected camera." | 100 | "\nThis parameter is specific for each detected camera." |
101 | "\nDefault value is "__MODULE_STRING(ZC0301_FRAME_TIMEOUT)"." | 101 | "\nDefault value is "__MODULE_STRING(ZC0301_FRAME_TIMEOUT)"." |
102 | "\n"); | 102 | "\n"); |
103 | 103 | ||
104 | #ifdef ZC0301_DEBUG | 104 | #ifdef ZC0301_DEBUG |
105 | static unsigned short debug = ZC0301_DEBUG_LEVEL; | 105 | static unsigned short debug = ZC0301_DEBUG_LEVEL; |
106 | module_param(debug, ushort, 0644); | 106 | module_param(debug, ushort, 0644); |
107 | MODULE_PARM_DESC(debug, | 107 | MODULE_PARM_DESC(debug, |
108 | "\n<n> Debugging information level, from 0 to 3:" | 108 | "\n<n> Debugging information level, from 0 to 3:" |
109 | "\n0 = none (use carefully)" | 109 | "\n0 = none (use carefully)" |
110 | "\n1 = critical errors" | 110 | "\n1 = critical errors" |
111 | "\n2 = significant informations" | 111 | "\n2 = significant informations" |
112 | "\n3 = more verbose messages" | 112 | "\n3 = more verbose messages" |
113 | "\nLevel 3 is useful for testing only, when only " | 113 | "\nLevel 3 is useful for testing only, when only " |
114 | "one device is used." | 114 | "one device is used." |
115 | "\nDefault value is "__MODULE_STRING(ZC0301_DEBUG_LEVEL)"." | 115 | "\nDefault value is "__MODULE_STRING(ZC0301_DEBUG_LEVEL)"." |
116 | "\n"); | 116 | "\n"); |
117 | #endif | 117 | #endif |
118 | 118 | ||
119 | /*****************************************************************************/ | 119 | /*****************************************************************************/ |
120 | 120 | ||
121 | static u32 | 121 | static u32 |
122 | zc0301_request_buffers(struct zc0301_device* cam, u32 count, | 122 | zc0301_request_buffers(struct zc0301_device* cam, u32 count, |
123 | enum zc0301_io_method io) | 123 | enum zc0301_io_method io) |
124 | { | 124 | { |
125 | struct v4l2_pix_format* p = &(cam->sensor.pix_format); | 125 | struct v4l2_pix_format* p = &(cam->sensor.pix_format); |
126 | struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); | 126 | struct v4l2_rect* r = &(cam->sensor.cropcap.bounds); |
127 | const size_t imagesize = cam->module_param.force_munmap || | 127 | const size_t imagesize = cam->module_param.force_munmap || |
128 | io == IO_READ ? | 128 | io == IO_READ ? |
129 | (p->width * p->height * p->priv) / 8 : | 129 | (p->width * p->height * p->priv) / 8 : |
130 | (r->width * r->height * p->priv) / 8; | 130 | (r->width * r->height * p->priv) / 8; |
131 | void* buff = NULL; | 131 | void* buff = NULL; |
132 | u32 i; | 132 | u32 i; |
133 | 133 | ||
@@ -216,7 +216,7 @@ int zc0301_write_reg(struct zc0301_device* cam, u16 index, u16 value) | |||
216 | int res; | 216 | int res; |
217 | 217 | ||
218 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0xa0, 0x40, | 218 | res = usb_control_msg(udev, usb_sndctrlpipe(udev, 0), 0xa0, 0x40, |
219 | value, index, NULL, 0, ZC0301_CTRL_TIMEOUT); | 219 | value, index, NULL, 0, ZC0301_CTRL_TIMEOUT); |
220 | if (res < 0) { | 220 | if (res < 0) { |
221 | DBG(3, "Failed to write a register (index 0x%04X, " | 221 | DBG(3, "Failed to write a register (index 0x%04X, " |
222 | "value 0x%02X, error %d)",index, value, res); | 222 | "value 0x%02X, error %d)",index, value, res); |
@@ -234,7 +234,7 @@ int zc0301_read_reg(struct zc0301_device* cam, u16 index) | |||
234 | int res; | 234 | int res; |
235 | 235 | ||
236 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0xa1, 0xc0, | 236 | res = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0), 0xa1, 0xc0, |
237 | 0x0001, index, buff, 1, ZC0301_CTRL_TIMEOUT); | 237 | 0x0001, index, buff, 1, ZC0301_CTRL_TIMEOUT); |
238 | if (res < 0) | 238 | if (res < 0) |
239 | DBG(3, "Failed to read a register (index 0x%04X, error %d)", | 239 | DBG(3, "Failed to read a register (index 0x%04X, error %d)", |
240 | index, res); | 240 | index, res); |
@@ -337,11 +337,11 @@ static void zc0301_urb_complete(struct urb *urb, struct pt_regs* regs) | |||
337 | 337 | ||
338 | if (!(*f)) | 338 | if (!(*f)) |
339 | (*f) = list_entry(cam->inqueue.next, struct zc0301_frame_t, | 339 | (*f) = list_entry(cam->inqueue.next, struct zc0301_frame_t, |
340 | frame); | 340 | frame); |
341 | 341 | ||
342 | imagesize = (cam->sensor.pix_format.width * | 342 | imagesize = (cam->sensor.pix_format.width * |
343 | cam->sensor.pix_format.height * | 343 | cam->sensor.pix_format.height * |
344 | cam->sensor.pix_format.priv) / 8; | 344 | cam->sensor.pix_format.priv) / 8; |
345 | 345 | ||
346 | for (i = 0; i < urb->number_of_packets; i++) { | 346 | for (i = 0; i < urb->number_of_packets; i++) { |
347 | unsigned int len, status; | 347 | unsigned int len, status; |
@@ -395,8 +395,8 @@ end_of_frame: | |||
395 | list_move_tail(&(*f)->frame, &cam->outqueue); | 395 | list_move_tail(&(*f)->frame, &cam->outqueue); |
396 | if (!list_empty(&cam->inqueue)) | 396 | if (!list_empty(&cam->inqueue)) |
397 | (*f) = list_entry(cam->inqueue.next, | 397 | (*f) = list_entry(cam->inqueue.next, |
398 | struct zc0301_frame_t, | 398 | struct zc0301_frame_t, |
399 | frame); | 399 | frame); |
400 | else | 400 | else |
401 | (*f) = NULL; | 401 | (*f) = NULL; |
402 | spin_unlock(&cam->queue_lock); | 402 | spin_unlock(&cam->queue_lock); |
@@ -429,14 +429,14 @@ static int zc0301_start_transfer(struct zc0301_device* cam) | |||
429 | struct usb_device *udev = cam->usbdev; | 429 | struct usb_device *udev = cam->usbdev; |
430 | struct urb* urb; | 430 | struct urb* urb; |
431 | const unsigned int wMaxPacketSize[] = {0, 128, 192, 256, 384, | 431 | const unsigned int wMaxPacketSize[] = {0, 128, 192, 256, 384, |
432 | 512, 768, 1023}; | 432 | 512, 768, 1023}; |
433 | const unsigned int psz = wMaxPacketSize[ZC0301_ALTERNATE_SETTING]; | 433 | const unsigned int psz = wMaxPacketSize[ZC0301_ALTERNATE_SETTING]; |
434 | s8 i, j; | 434 | s8 i, j; |
435 | int err = 0; | 435 | int err = 0; |
436 | 436 | ||
437 | for (i = 0; i < ZC0301_URBS; i++) { | 437 | for (i = 0; i < ZC0301_URBS; i++) { |
438 | cam->transfer_buffer[i] = kzalloc(ZC0301_ISO_PACKETS * psz, | 438 | cam->transfer_buffer[i] = kzalloc(ZC0301_ISO_PACKETS * psz, |
439 | GFP_KERNEL); | 439 | GFP_KERNEL); |
440 | if (!cam->transfer_buffer[i]) { | 440 | if (!cam->transfer_buffer[i]) { |
441 | err = -ENOMEM; | 441 | err = -ENOMEM; |
442 | DBG(1, "Not enough memory"); | 442 | DBG(1, "Not enough memory"); |
@@ -528,9 +528,9 @@ static int zc0301_stream_interrupt(struct zc0301_device* cam) | |||
528 | 528 | ||
529 | cam->stream = STREAM_INTERRUPT; | 529 | cam->stream = STREAM_INTERRUPT; |
530 | timeout = wait_event_timeout(cam->wait_stream, | 530 | timeout = wait_event_timeout(cam->wait_stream, |
531 | (cam->stream == STREAM_OFF) || | 531 | (cam->stream == STREAM_OFF) || |
532 | (cam->state & DEV_DISCONNECTED), | 532 | (cam->state & DEV_DISCONNECTED), |
533 | ZC0301_URB_TIMEOUT); | 533 | ZC0301_URB_TIMEOUT); |
534 | if (cam->state & DEV_DISCONNECTED) | 534 | if (cam->state & DEV_DISCONNECTED) |
535 | return -ENODEV; | 535 | return -ENODEV; |
536 | else if (cam->stream != STREAM_OFF) { | 536 | else if (cam->stream != STREAM_OFF) { |
@@ -548,7 +548,7 @@ static int zc0301_stream_interrupt(struct zc0301_device* cam) | |||
548 | 548 | ||
549 | static int | 549 | static int |
550 | zc0301_set_compression(struct zc0301_device* cam, | 550 | zc0301_set_compression(struct zc0301_device* cam, |
551 | struct v4l2_jpegcompression* compression) | 551 | struct v4l2_jpegcompression* compression) |
552 | { | 552 | { |
553 | int r, err = 0; | 553 | int r, err = 0; |
554 | 554 | ||
@@ -670,8 +670,8 @@ static int zc0301_open(struct inode* inode, struct file* filp) | |||
670 | } | 670 | } |
671 | mutex_unlock(&cam->dev_mutex); | 671 | mutex_unlock(&cam->dev_mutex); |
672 | err = wait_event_interruptible_exclusive(cam->open, | 672 | err = wait_event_interruptible_exclusive(cam->open, |
673 | cam->state & DEV_DISCONNECTED | 673 | cam->state & DEV_DISCONNECTED |
674 | || !cam->users); | 674 | || !cam->users); |
675 | if (err) { | 675 | if (err) { |
676 | up_read(&zc0301_disconnect); | 676 | up_read(&zc0301_disconnect); |
677 | return err; | 677 | return err; |
@@ -802,12 +802,12 @@ zc0301_read(struct file* filp, char __user * buf, size_t count, loff_t* f_pos) | |||
802 | return -EAGAIN; | 802 | return -EAGAIN; |
803 | } | 803 | } |
804 | timeout = wait_event_interruptible_timeout | 804 | timeout = wait_event_interruptible_timeout |
805 | ( cam->wait_frame, | 805 | ( cam->wait_frame, |
806 | (!list_empty(&cam->outqueue)) || | 806 | (!list_empty(&cam->outqueue)) || |
807 | (cam->state & DEV_DISCONNECTED) || | 807 | (cam->state & DEV_DISCONNECTED) || |
808 | (cam->state & DEV_MISCONFIGURED), | 808 | (cam->state & DEV_MISCONFIGURED), |
809 | cam->module_param.frame_timeout * | 809 | cam->module_param.frame_timeout * |
810 | 1000 * msecs_to_jiffies(1) ); | 810 | 1000 * msecs_to_jiffies(1) ); |
811 | if (timeout < 0) { | 811 | if (timeout < 0) { |
812 | mutex_unlock(&cam->fileop_mutex); | 812 | mutex_unlock(&cam->fileop_mutex); |
813 | return timeout; | 813 | return timeout; |
@@ -930,7 +930,7 @@ static int zc0301_mmap(struct file* filp, struct vm_area_struct *vma) | |||
930 | { | 930 | { |
931 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); | 931 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); |
932 | unsigned long size = vma->vm_end - vma->vm_start, | 932 | unsigned long size = vma->vm_end - vma->vm_start, |
933 | start = vma->vm_start; | 933 | start = vma->vm_start; |
934 | void *pos; | 934 | void *pos; |
935 | u32 i; | 935 | u32 i; |
936 | 936 | ||
@@ -998,13 +998,13 @@ zc0301_vidioc_querycap(struct zc0301_device* cam, void __user * arg) | |||
998 | .driver = "zc0301", | 998 | .driver = "zc0301", |
999 | .version = ZC0301_MODULE_VERSION_CODE, | 999 | .version = ZC0301_MODULE_VERSION_CODE, |
1000 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | | 1000 | .capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_READWRITE | |
1001 | V4L2_CAP_STREAMING, | 1001 | V4L2_CAP_STREAMING, |
1002 | }; | 1002 | }; |
1003 | 1003 | ||
1004 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); | 1004 | strlcpy(cap.card, cam->v4ldev->name, sizeof(cap.card)); |
1005 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) | 1005 | if (usb_make_path(cam->usbdev, cap.bus_info, sizeof(cap.bus_info)) < 0) |
1006 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, | 1006 | strlcpy(cap.bus_info, cam->usbdev->dev.bus_id, |
1007 | sizeof(cap.bus_info)); | 1007 | sizeof(cap.bus_info)); |
1008 | 1008 | ||
1009 | if (copy_to_user(arg, &cap, sizeof(cap))) | 1009 | if (copy_to_user(arg, &cap, sizeof(cap))) |
1010 | return -EFAULT; | 1010 | return -EFAULT; |
@@ -1337,7 +1337,7 @@ zc0301_vidioc_g_fmt(struct zc0301_device* cam, void __user * arg) | |||
1337 | 1337 | ||
1338 | static int | 1338 | static int |
1339 | zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd, | 1339 | zc0301_vidioc_try_s_fmt(struct zc0301_device* cam, unsigned int cmd, |
1340 | void __user * arg) | 1340 | void __user * arg) |
1341 | { | 1341 | { |
1342 | struct zc0301_sensor* s = &cam->sensor; | 1342 | struct zc0301_sensor* s = &cam->sensor; |
1343 | struct v4l2_format format; | 1343 | struct v4l2_format format; |
@@ -1600,7 +1600,7 @@ zc0301_vidioc_qbuf(struct zc0301_device* cam, void __user * arg) | |||
1600 | 1600 | ||
1601 | static int | 1601 | static int |
1602 | zc0301_vidioc_dqbuf(struct zc0301_device* cam, struct file* filp, | 1602 | zc0301_vidioc_dqbuf(struct zc0301_device* cam, struct file* filp, |
1603 | void __user * arg) | 1603 | void __user * arg) |
1604 | { | 1604 | { |
1605 | struct v4l2_buffer b; | 1605 | struct v4l2_buffer b; |
1606 | struct zc0301_frame_t *f; | 1606 | struct zc0301_frame_t *f; |
@@ -1619,12 +1619,12 @@ zc0301_vidioc_dqbuf(struct zc0301_device* cam, struct file* filp, | |||
1619 | if (filp->f_flags & O_NONBLOCK) | 1619 | if (filp->f_flags & O_NONBLOCK) |
1620 | return -EAGAIN; | 1620 | return -EAGAIN; |
1621 | timeout = wait_event_interruptible_timeout | 1621 | timeout = wait_event_interruptible_timeout |
1622 | ( cam->wait_frame, | 1622 | ( cam->wait_frame, |
1623 | (!list_empty(&cam->outqueue)) || | 1623 | (!list_empty(&cam->outqueue)) || |
1624 | (cam->state & DEV_DISCONNECTED) || | 1624 | (cam->state & DEV_DISCONNECTED) || |
1625 | (cam->state & DEV_MISCONFIGURED), | 1625 | (cam->state & DEV_MISCONFIGURED), |
1626 | cam->module_param.frame_timeout * | 1626 | cam->module_param.frame_timeout * |
1627 | 1000 * msecs_to_jiffies(1) ); | 1627 | 1000 * msecs_to_jiffies(1) ); |
1628 | if (timeout < 0) | 1628 | if (timeout < 0) |
1629 | return timeout; | 1629 | return timeout; |
1630 | if (cam->state & DEV_DISCONNECTED) | 1630 | if (cam->state & DEV_DISCONNECTED) |
@@ -1748,7 +1748,7 @@ zc0301_vidioc_s_parm(struct zc0301_device* cam, void __user * arg) | |||
1748 | 1748 | ||
1749 | 1749 | ||
1750 | static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp, | 1750 | static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp, |
1751 | unsigned int cmd, void __user * arg) | 1751 | unsigned int cmd, void __user * arg) |
1752 | { | 1752 | { |
1753 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); | 1753 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); |
1754 | 1754 | ||
@@ -1842,7 +1842,7 @@ static int zc0301_ioctl_v4l2(struct inode* inode, struct file* filp, | |||
1842 | 1842 | ||
1843 | 1843 | ||
1844 | static int zc0301_ioctl(struct inode* inode, struct file* filp, | 1844 | static int zc0301_ioctl(struct inode* inode, struct file* filp, |
1845 | unsigned int cmd, unsigned long arg) | 1845 | unsigned int cmd, unsigned long arg) |
1846 | { | 1846 | { |
1847 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); | 1847 | struct zc0301_device* cam = video_get_drvdata(video_devdata(filp)); |
1848 | int err = 0; | 1848 | int err = 0; |
@@ -1948,7 +1948,7 @@ zc0301_usb_probe(struct usb_interface* intf, const struct usb_device_id* id) | |||
1948 | mutex_lock(&cam->dev_mutex); | 1948 | mutex_lock(&cam->dev_mutex); |
1949 | 1949 | ||
1950 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, | 1950 | err = video_register_device(cam->v4ldev, VFL_TYPE_GRABBER, |
1951 | video_nr[dev_nr]); | 1951 | video_nr[dev_nr]); |
1952 | if (err) { | 1952 | if (err) { |
1953 | DBG(1, "V4L2 device registration failed"); | 1953 | DBG(1, "V4L2 device registration failed"); |
1954 | if (err == -ENFILE && video_nr[dev_nr] == -1) | 1954 | if (err == -ENFILE && video_nr[dev_nr] == -1) |
diff --git a/drivers/usb/media/zc0301_pas202bcb.c b/drivers/media/video/zc0301/zc0301_pas202bcb.c index 9d282a22c15f..eaadf0252049 100644 --- a/drivers/usb/media/zc0301_pas202bcb.c +++ b/drivers/media/video/zc0301/zc0301_pas202bcb.c | |||
@@ -24,10 +24,10 @@ | |||
24 | 24 | ||
25 | /* | 25 | /* |
26 | NOTE: Sensor controls are disabled for now, becouse changing them while | 26 | NOTE: Sensor controls are disabled for now, becouse changing them while |
27 | streaming sometimes results in out-of-sync video frames. We'll use | 27 | streaming sometimes results in out-of-sync video frames. We'll use |
28 | the default initialization, until we know how to stop and start video | 28 | the default initialization, until we know how to stop and start video |
29 | in the chip. However, the image quality still looks good under various | 29 | in the chip. However, the image quality still looks good under various |
30 | light conditions. | 30 | light conditions. |
31 | */ | 31 | */ |
32 | 32 | ||
33 | #include <linux/delay.h> | 33 | #include <linux/delay.h> |
@@ -165,7 +165,7 @@ static int pas202bcb_init(struct zc0301_device* cam) | |||
165 | 165 | ||
166 | 166 | ||
167 | static int pas202bcb_get_ctrl(struct zc0301_device* cam, | 167 | static int pas202bcb_get_ctrl(struct zc0301_device* cam, |
168 | struct v4l2_control* ctrl) | 168 | struct v4l2_control* ctrl) |
169 | { | 169 | { |
170 | switch (ctrl->id) { | 170 | switch (ctrl->id) { |
171 | case V4L2_CID_EXPOSURE: | 171 | case V4L2_CID_EXPOSURE: |
@@ -208,7 +208,7 @@ static int pas202bcb_get_ctrl(struct zc0301_device* cam, | |||
208 | 208 | ||
209 | 209 | ||
210 | static int pas202bcb_set_ctrl(struct zc0301_device* cam, | 210 | static int pas202bcb_set_ctrl(struct zc0301_device* cam, |
211 | const struct v4l2_control* ctrl) | 211 | const struct v4l2_control* ctrl) |
212 | { | 212 | { |
213 | int err = 0; | 213 | int err = 0; |
214 | 214 | ||
diff --git a/drivers/usb/media/zc0301_sensor.h b/drivers/media/video/zc0301/zc0301_sensor.h index cf0965a81d01..1f95c28b1015 100644 --- a/drivers/usb/media/zc0301_sensor.h +++ b/drivers/media/video/zc0301/zc0301_sensor.h | |||
@@ -51,7 +51,7 @@ zc0301_attach_sensor(struct zc0301_device* cam, struct zc0301_sensor* sensor); | |||
51 | 51 | ||
52 | #define ZC0301_USB_DEVICE(vend, prod, intclass) \ | 52 | #define ZC0301_USB_DEVICE(vend, prod, intclass) \ |
53 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ | 53 | .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \ |
54 | USB_DEVICE_ID_MATCH_INT_CLASS, \ | 54 | USB_DEVICE_ID_MATCH_INT_CLASS, \ |
55 | .idVendor = (vend), \ | 55 | .idVendor = (vend), \ |
56 | .idProduct = (prod), \ | 56 | .idProduct = (prod), \ |
57 | .bInterfaceClass = (intclass) | 57 | .bInterfaceClass = (intclass) |
@@ -92,7 +92,7 @@ struct zc0301_sensor { | |||
92 | int (*init)(struct zc0301_device*); | 92 | int (*init)(struct zc0301_device*); |
93 | int (*get_ctrl)(struct zc0301_device*, struct v4l2_control* ctrl); | 93 | int (*get_ctrl)(struct zc0301_device*, struct v4l2_control* ctrl); |
94 | int (*set_ctrl)(struct zc0301_device*, | 94 | int (*set_ctrl)(struct zc0301_device*, |
95 | const struct v4l2_control* ctrl); | 95 | const struct v4l2_control* ctrl); |
96 | int (*set_crop)(struct zc0301_device*, const struct v4l2_rect* rect); | 96 | int (*set_crop)(struct zc0301_device*, const struct v4l2_rect* rect); |
97 | 97 | ||
98 | /* Private */ | 98 | /* Private */ |
diff --git a/drivers/media/video/zoran.h b/drivers/media/video/zoran.h index ad04a129499d..0166f555a5ca 100644 --- a/drivers/media/video/zoran.h +++ b/drivers/media/video/zoran.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * zoran - Iomega Buz driver | 2 | * zoran - Iomega Buz driver |
3 | * | 3 | * |
4 | * Copyright (C) 1999 Rainer Johanni <Rainer@Johanni.de> | 4 | * Copyright (C) 1999 Rainer Johanni <Rainer@Johanni.de> |
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index b22dbb6d18f6..0a85c9e7fb48 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Media Labs LML33/LML33R10. | 4 | * Media Labs LML33/LML33R10. |
5 | * | 5 | * |
6 | * This part handles card-specific data and detection | 6 | * This part handles card-specific data and detection |
7 | * | 7 | * |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Currently maintained by: | 10 | * Currently maintained by: |
diff --git a/drivers/media/video/zoran_card.h b/drivers/media/video/zoran_card.h index e5b6acd3eedc..ad997c30bee5 100644 --- a/drivers/media/video/zoran_card.h +++ b/drivers/media/video/zoran_card.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Media Labs LML33/LML33R10. | 4 | * Media Labs LML33/LML33R10. |
5 | * | 5 | * |
6 | * This part handles card-specific data and detection | 6 | * This part handles card-specific data and detection |
7 | * | 7 | * |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Currently maintained by: | 10 | * Currently maintained by: |
diff --git a/drivers/media/video/zoran_device.c b/drivers/media/video/zoran_device.c index 4e15afdec4c9..c690b2ee880a 100644 --- a/drivers/media/video/zoran_device.c +++ b/drivers/media/video/zoran_device.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Media Labs LML33/LML33R10. | 4 | * Media Labs LML33/LML33R10. |
5 | * | 5 | * |
6 | * This part handles device access (PCI/I2C/codec/...) | 6 | * This part handles device access (PCI/I2C/codec/...) |
7 | * | 7 | * |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Currently maintained by: | 10 | * Currently maintained by: |
@@ -492,7 +492,7 @@ zr36057_set_vfe (struct zoran *zr, | |||
492 | /* (Ronald) don't write this if overlay_mask = NULL */ | 492 | /* (Ronald) don't write this if overlay_mask = NULL */ |
493 | if (zr->overlay_mask) { | 493 | if (zr->overlay_mask) { |
494 | /* Write overlay clipping mask data, but don't enable overlay clipping */ | 494 | /* Write overlay clipping mask data, but don't enable overlay clipping */ |
495 | /* RJ: since this makes only sense on the screen, we use | 495 | /* RJ: since this makes only sense on the screen, we use |
496 | * zr->overlay_settings.width instead of video_width */ | 496 | * zr->overlay_settings.width instead of video_width */ |
497 | 497 | ||
498 | mask_line_size = (BUZ_MAX_WIDTH + 31) / 32; | 498 | mask_line_size = (BUZ_MAX_WIDTH + 31) / 32; |
@@ -819,12 +819,12 @@ zr36057_set_jpg (struct zoran *zr, | |||
819 | if (zr->card.vfe_pol.hsync_pol) | 819 | if (zr->card.vfe_pol.hsync_pol) |
820 | btor(ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR); | 820 | btor(ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR); |
821 | else | 821 | else |
822 | btand(~ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR); | 822 | btand(~ZR36057_VFEHCR_HSPol, ZR36057_VFEHCR); |
823 | reg = ((tvn->HSyncStart) << ZR36057_HSP_HsyncStart) | | 823 | reg = ((tvn->HSyncStart) << ZR36057_HSP_HsyncStart) | |
824 | (tvn->Wt << ZR36057_HSP_LineTot); | 824 | (tvn->Wt << ZR36057_HSP_LineTot); |
825 | btwrite(reg, ZR36057_HSP); | 825 | btwrite(reg, ZR36057_HSP); |
826 | reg = ((zr->jpg_settings.img_x + | 826 | reg = ((zr->jpg_settings.img_x + |
827 | tvn->HStart + 4) << ZR36057_FHAP_NAX) | | 827 | tvn->HStart + 4) << ZR36057_FHAP_NAX) | |
828 | (zr->jpg_settings.img_width << ZR36057_FHAP_PAX); | 828 | (zr->jpg_settings.img_width << ZR36057_FHAP_PAX); |
829 | btwrite(reg, ZR36057_FHAP); | 829 | btwrite(reg, ZR36057_FHAP); |
830 | 830 | ||
@@ -1272,15 +1272,15 @@ error_handler (struct zoran *zr, | |||
1272 | if (zr->JPEG_error != 1) { | 1272 | if (zr->JPEG_error != 1) { |
1273 | /* | 1273 | /* |
1274 | * First entry: error just happened during normal operation | 1274 | * First entry: error just happened during normal operation |
1275 | * | 1275 | * |
1276 | * In BUZ_MODE_MOTION_COMPRESS: | 1276 | * In BUZ_MODE_MOTION_COMPRESS: |
1277 | * | 1277 | * |
1278 | * Possible glitch in TV signal. In this case we should | 1278 | * Possible glitch in TV signal. In this case we should |
1279 | * stop the codec and wait for good quality signal before | 1279 | * stop the codec and wait for good quality signal before |
1280 | * restarting it to avoid further problems | 1280 | * restarting it to avoid further problems |
1281 | * | 1281 | * |
1282 | * In BUZ_MODE_MOTION_DECOMPRESS: | 1282 | * In BUZ_MODE_MOTION_DECOMPRESS: |
1283 | * | 1283 | * |
1284 | * Bad JPEG frame: we have to mark it as processed (codec crashed | 1284 | * Bad JPEG frame: we have to mark it as processed (codec crashed |
1285 | * and was not able to do it itself), and to remove it from queue. | 1285 | * and was not able to do it itself), and to remove it from queue. |
1286 | */ | 1286 | */ |
diff --git a/drivers/media/video/zoran_device.h b/drivers/media/video/zoran_device.h index f315203d7105..f19705cbdb39 100644 --- a/drivers/media/video/zoran_device.h +++ b/drivers/media/video/zoran_device.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Media Labs LML33/LML33R10. | 4 | * Media Labs LML33/LML33R10. |
5 | * | 5 | * |
6 | * This part handles card-specific data and detection | 6 | * This part handles card-specific data and detection |
7 | * | 7 | * |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Currently maintained by: | 10 | * Currently maintained by: |
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index b2c6e01e3923..b5a576a37fd2 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c | |||
@@ -94,7 +94,7 @@ | |||
94 | V4L2_CAP_VIDEO_CAPTURE |\ | 94 | V4L2_CAP_VIDEO_CAPTURE |\ |
95 | V4L2_CAP_VIDEO_OUTPUT |\ | 95 | V4L2_CAP_VIDEO_OUTPUT |\ |
96 | V4L2_CAP_VIDEO_OVERLAY \ | 96 | V4L2_CAP_VIDEO_OVERLAY \ |
97 | ) | 97 | ) |
98 | #endif | 98 | #endif |
99 | 99 | ||
100 | #include <asm/byteorder.h> | 100 | #include <asm/byteorder.h> |
@@ -165,7 +165,7 @@ const struct zoran_format zoran_formats[] = { | |||
165 | #endif | 165 | #endif |
166 | .depth = 16, | 166 | .depth = 16, |
167 | .flags = ZORAN_FORMAT_CAPTURE | | 167 | .flags = ZORAN_FORMAT_CAPTURE | |
168 | ZORAN_FORMAT_OVERLAY, | 168 | ZORAN_FORMAT_OVERLAY, |
169 | }, { | 169 | }, { |
170 | .name = "Hardware-encoded Motion-JPEG", | 170 | .name = "Hardware-encoded Motion-JPEG", |
171 | .palette = -1, | 171 | .palette = -1, |
@@ -670,7 +670,7 @@ jpg_fbuffer_free (struct file *file) | |||
670 | j])))); | 670 | j])))); |
671 | free_page((unsigned long) | 671 | free_page((unsigned long) |
672 | bus_to_virt | 672 | bus_to_virt |
673 | (le32_to_cpu | 673 | (le32_to_cpu |
674 | (fh->jpg_buffers. | 674 | (fh->jpg_buffers. |
675 | buffer[i]. | 675 | buffer[i]. |
676 | frag_tab[2 * j]))); | 676 | frag_tab[2 * j]))); |
@@ -1871,7 +1871,7 @@ zoran_v4l2_buffer_status (struct file *file, | |||
1871 | 1871 | ||
1872 | static int | 1872 | static int |
1873 | zoran_set_norm (struct zoran *zr, | 1873 | zoran_set_norm (struct zoran *zr, |
1874 | int norm) /* VIDEO_MODE_* */ | 1874 | int norm) /* VIDEO_MODE_* */ |
1875 | { | 1875 | { |
1876 | int norm_encoder, on; | 1876 | int norm_encoder, on; |
1877 | 1877 | ||
@@ -2006,9 +2006,9 @@ zoran_set_input (struct zoran *zr, | |||
2006 | 2006 | ||
2007 | static int | 2007 | static int |
2008 | zoran_do_ioctl (struct inode *inode, | 2008 | zoran_do_ioctl (struct inode *inode, |
2009 | struct file *file, | 2009 | struct file *file, |
2010 | unsigned int cmd, | 2010 | unsigned int cmd, |
2011 | void *arg) | 2011 | void *arg) |
2012 | { | 2012 | { |
2013 | struct zoran_fh *fh = file->private_data; | 2013 | struct zoran_fh *fh = file->private_data; |
2014 | struct zoran *zr = fh->zr; | 2014 | struct zoran *zr = fh->zr; |
@@ -2095,7 +2095,7 @@ zoran_do_ioctl (struct inode *inode, | |||
2095 | break; | 2095 | break; |
2096 | 2096 | ||
2097 | /* RJ: the documentation at http://roadrunner.swansea.linux.org.uk/v4lapi.shtml says: | 2097 | /* RJ: the documentation at http://roadrunner.swansea.linux.org.uk/v4lapi.shtml says: |
2098 | * | 2098 | * |
2099 | * * "The VIDIOCSCHAN ioctl takes an integer argument and switches the capture to this input." | 2099 | * * "The VIDIOCSCHAN ioctl takes an integer argument and switches the capture to this input." |
2100 | * * ^^^^^^^ | 2100 | * * ^^^^^^^ |
2101 | * * The famos BTTV driver has it implemented with a struct video_channel argument | 2101 | * * The famos BTTV driver has it implemented with a struct video_channel argument |
diff --git a/drivers/media/video/zoran_procfs.c b/drivers/media/video/zoran_procfs.c index f0d9b13c3c6c..a00fae90229a 100644 --- a/drivers/media/video/zoran_procfs.c +++ b/drivers/media/video/zoran_procfs.c | |||
@@ -4,7 +4,7 @@ | |||
4 | * Media Labs LML33/LML33R10. | 4 | * Media Labs LML33/LML33R10. |
5 | * | 5 | * |
6 | * This part handles the procFS entries (/proc/ZORAN[%d]) | 6 | * This part handles the procFS entries (/proc/ZORAN[%d]) |
7 | * | 7 | * |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Currently maintained by: | 10 | * Currently maintained by: |
diff --git a/drivers/media/video/zoran_procfs.h b/drivers/media/video/zoran_procfs.h index 8904fc959555..f2d5b1ba448f 100644 --- a/drivers/media/video/zoran_procfs.h +++ b/drivers/media/video/zoran_procfs.h | |||
@@ -4,7 +4,7 @@ | |||
4 | * Media Labs LML33/LML33R10. | 4 | * Media Labs LML33/LML33R10. |
5 | * | 5 | * |
6 | * This part handles card-specific data and detection | 6 | * This part handles card-specific data and detection |
7 | * | 7 | * |
8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> | 8 | * Copyright (C) 2000 Serguei Miridonov <mirsev@cicese.mx> |
9 | * | 9 | * |
10 | * Currently maintained by: | 10 | * Currently maintained by: |
diff --git a/drivers/media/video/zr36016.c b/drivers/media/video/zr36016.c index 10130ef67ea7..62f77584fb85 100644 --- a/drivers/media/video/zr36016.c +++ b/drivers/media/video/zr36016.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/wait.h> | 35 | #include <linux/wait.h> |
36 | 36 | ||
37 | /* includes for structures and defines regarding video | 37 | /* includes for structures and defines regarding video |
38 | #include<linux/videodev.h> */ | 38 | #include<linux/videodev.h> */ |
39 | 39 | ||
40 | /* I/O commands, error codes */ | 40 | /* I/O commands, error codes */ |
@@ -143,8 +143,8 @@ zr36016_readi (struct zr36016 *ptr, | |||
143 | 143 | ||
144 | static void | 144 | static void |
145 | zr36016_writei (struct zr36016 *ptr, | 145 | zr36016_writei (struct zr36016 *ptr, |
146 | u16 reg, | 146 | u16 reg, |
147 | u8 value) | 147 | u8 value) |
148 | { | 148 | { |
149 | dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, | 149 | dprintk(4, "%s: writing indirect 0x%02x to 0x%04x\n", ptr->name, |
150 | value, reg); | 150 | value, reg); |
@@ -192,7 +192,7 @@ zr36016_basic_test (struct zr36016 *ptr) | |||
192 | dprintk(1, "\n"); | 192 | dprintk(1, "\n"); |
193 | } | 193 | } |
194 | // for testing just write 0, then the default value to a register and read | 194 | // for testing just write 0, then the default value to a register and read |
195 | // it back in both cases | 195 | // it back in both cases |
196 | zr36016_writei(ptr, ZR016I_PAX_LO, 0x00); | 196 | zr36016_writei(ptr, ZR016I_PAX_LO, 0x00); |
197 | if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0) { | 197 | if (zr36016_readi(ptr, ZR016I_PAX_LO) != 0x0) { |
198 | dprintk(1, | 198 | dprintk(1, |
@@ -232,17 +232,17 @@ zr36016_basic_test (struct zr36016 *ptr) | |||
232 | static int zr36016_pushit (struct zr36016 *ptr, | 232 | static int zr36016_pushit (struct zr36016 *ptr, |
233 | u16 startreg, | 233 | u16 startreg, |
234 | u16 len, | 234 | u16 len, |
235 | const char *data) | 235 | const char *data) |
236 | { | 236 | { |
237 | int i=0; | 237 | int i=0; |
238 | 238 | ||
239 | dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", | 239 | dprintk(4, "%s: write data block to 0x%04x (len=%d)\n", |
240 | ptr->name, startreg,len); | 240 | ptr->name, startreg,len); |
241 | while (i<len) { | 241 | while (i<len) { |
242 | zr36016_writei(ptr, startreg++, data[i++]); | 242 | zr36016_writei(ptr, startreg++, data[i++]); |
243 | } | 243 | } |
244 | 244 | ||
245 | return i; | 245 | return i; |
246 | } | 246 | } |
247 | #endif | 247 | #endif |
248 | 248 | ||
diff --git a/drivers/media/video/zr36050.c b/drivers/media/video/zr36050.c index 6699725be605..a6bbd125631c 100644 --- a/drivers/media/video/zr36050.c +++ b/drivers/media/video/zr36050.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/wait.h> | 35 | #include <linux/wait.h> |
36 | 36 | ||
37 | /* includes for structures and defines regarding video | 37 | /* includes for structures and defines regarding video |
38 | #include<linux/videodev.h> */ | 38 | #include<linux/videodev.h> */ |
39 | 39 | ||
40 | /* I/O commands, error codes */ | 40 | /* I/O commands, error codes */ |
@@ -171,7 +171,7 @@ zr36050_wait_end (struct zr36050 *ptr) | |||
171 | /* ========================================================================= | 171 | /* ========================================================================= |
172 | Local helper function: | 172 | Local helper function: |
173 | 173 | ||
174 | basic test of "connectivity", writes/reads to/from memory the SOF marker | 174 | basic test of "connectivity", writes/reads to/from memory the SOF marker |
175 | ========================================================================= */ | 175 | ========================================================================= */ |
176 | 176 | ||
177 | static int | 177 | static int |
@@ -218,9 +218,9 @@ zr36050_basic_test (struct zr36050 *ptr) | |||
218 | 218 | ||
219 | static int | 219 | static int |
220 | zr36050_pushit (struct zr36050 *ptr, | 220 | zr36050_pushit (struct zr36050 *ptr, |
221 | u16 startreg, | 221 | u16 startreg, |
222 | u16 len, | 222 | u16 len, |
223 | const char *data) | 223 | const char *data) |
224 | { | 224 | { |
225 | int i = 0; | 225 | int i = 0; |
226 | 226 | ||
@@ -345,7 +345,7 @@ static const char zr36050_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 }; | |||
345 | /* ------------------------------------------------------------------------- */ | 345 | /* ------------------------------------------------------------------------- */ |
346 | 346 | ||
347 | /* SOF (start of frame) segment depends on width, height and sampling ratio | 347 | /* SOF (start of frame) segment depends on width, height and sampling ratio |
348 | of each color component */ | 348 | of each color component */ |
349 | 349 | ||
350 | static int | 350 | static int |
351 | zr36050_set_sof (struct zr36050 *ptr) | 351 | zr36050_set_sof (struct zr36050 *ptr) |
@@ -376,8 +376,8 @@ zr36050_set_sof (struct zr36050 *ptr) | |||
376 | 376 | ||
377 | /* ------------------------------------------------------------------------- */ | 377 | /* ------------------------------------------------------------------------- */ |
378 | 378 | ||
379 | /* SOS (start of scan) segment depends on the used scan components | 379 | /* SOS (start of scan) segment depends on the used scan components |
380 | of each color component */ | 380 | of each color component */ |
381 | 381 | ||
382 | static int | 382 | static int |
383 | zr36050_set_sos (struct zr36050 *ptr) | 383 | zr36050_set_sos (struct zr36050 *ptr) |
diff --git a/drivers/media/video/zr36057.h b/drivers/media/video/zr36057.h index 159abfa034d9..54c9362aa980 100644 --- a/drivers/media/video/zr36057.h +++ b/drivers/media/video/zr36057.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * zr36057.h - zr36057 register offsets | 2 | * zr36057.h - zr36057 register offsets |
3 | * | 3 | * |
4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> | 4 | * Copyright (C) 1998 Dave Perks <dperks@ibm.net> |
@@ -27,14 +27,14 @@ | |||
27 | #define ZR36057_VFEHCR 0x000 /* Video Front End, Horizontal Configuration Register */ | 27 | #define ZR36057_VFEHCR 0x000 /* Video Front End, Horizontal Configuration Register */ |
28 | #define ZR36057_VFEHCR_HSPol (1<<30) | 28 | #define ZR36057_VFEHCR_HSPol (1<<30) |
29 | #define ZR36057_VFEHCR_HStart 10 | 29 | #define ZR36057_VFEHCR_HStart 10 |
30 | #define ZR36057_VFEHCR_HEnd 0 | 30 | #define ZR36057_VFEHCR_HEnd 0 |
31 | #define ZR36057_VFEHCR_Hmask 0x3ff | 31 | #define ZR36057_VFEHCR_Hmask 0x3ff |
32 | 32 | ||
33 | #define ZR36057_VFEVCR 0x004 /* Video Front End, Vertical Configuration Register */ | 33 | #define ZR36057_VFEVCR 0x004 /* Video Front End, Vertical Configuration Register */ |
34 | #define ZR36057_VFEVCR_VSPol (1<<30) | 34 | #define ZR36057_VFEVCR_VSPol (1<<30) |
35 | #define ZR36057_VFEVCR_VStart 10 | 35 | #define ZR36057_VFEVCR_VStart 10 |
36 | #define ZR36057_VFEVCR_VEnd 0 | 36 | #define ZR36057_VFEVCR_VEnd 0 |
37 | #define ZR36057_VFEVCR_Vmask 0x3ff | 37 | #define ZR36057_VFEVCR_Vmask 0x3ff |
38 | 38 | ||
39 | #define ZR36057_VFESPFR 0x008 /* Video Front End, Scaler and Pixel Format Register */ | 39 | #define ZR36057_VFESPFR 0x008 /* Video Front End, Scaler and Pixel Format Register */ |
40 | #define ZR36057_VFESPFR_ExtFl (1<<26) | 40 | #define ZR36057_VFESPFR_ExtFl (1<<26) |
diff --git a/drivers/media/video/zr36060.c b/drivers/media/video/zr36060.c index d8dd003a7aad..97c8f9b9dc12 100644 --- a/drivers/media/video/zr36060.c +++ b/drivers/media/video/zr36060.c | |||
@@ -34,7 +34,7 @@ | |||
34 | #include <linux/types.h> | 34 | #include <linux/types.h> |
35 | #include <linux/wait.h> | 35 | #include <linux/wait.h> |
36 | 36 | ||
37 | /* includes for structures and defines regarding video | 37 | /* includes for structures and defines regarding video |
38 | #include<linux/videodev.h> */ | 38 | #include<linux/videodev.h> */ |
39 | 39 | ||
40 | /* I/O commands, error codes */ | 40 | /* I/O commands, error codes */ |
@@ -173,7 +173,7 @@ zr36060_wait_end (struct zr36060 *ptr) | |||
173 | /* ========================================================================= | 173 | /* ========================================================================= |
174 | Local helper function: | 174 | Local helper function: |
175 | 175 | ||
176 | basic test of "connectivity", writes/reads to/from memory the SOF marker | 176 | basic test of "connectivity", writes/reads to/from memory the SOF marker |
177 | ========================================================================= */ | 177 | ========================================================================= */ |
178 | 178 | ||
179 | static int | 179 | static int |
@@ -208,9 +208,9 @@ zr36060_basic_test (struct zr36060 *ptr) | |||
208 | 208 | ||
209 | static int | 209 | static int |
210 | zr36060_pushit (struct zr36060 *ptr, | 210 | zr36060_pushit (struct zr36060 *ptr, |
211 | u16 startreg, | 211 | u16 startreg, |
212 | u16 len, | 212 | u16 len, |
213 | const char *data) | 213 | const char *data) |
214 | { | 214 | { |
215 | int i = 0; | 215 | int i = 0; |
216 | 216 | ||
@@ -335,7 +335,7 @@ static const char zr36060_decimation_v[8] = { 1, 1, 1, 0, 0, 0, 0, 0 }; | |||
335 | /* ------------------------------------------------------------------------- */ | 335 | /* ------------------------------------------------------------------------- */ |
336 | 336 | ||
337 | /* SOF (start of frame) segment depends on width, height and sampling ratio | 337 | /* SOF (start of frame) segment depends on width, height and sampling ratio |
338 | of each color component */ | 338 | of each color component */ |
339 | 339 | ||
340 | static int | 340 | static int |
341 | zr36060_set_sof (struct zr36060 *ptr) | 341 | zr36060_set_sof (struct zr36060 *ptr) |
@@ -367,8 +367,8 @@ zr36060_set_sof (struct zr36060 *ptr) | |||
367 | 367 | ||
368 | /* ------------------------------------------------------------------------- */ | 368 | /* ------------------------------------------------------------------------- */ |
369 | 369 | ||
370 | /* SOS (start of scan) segment depends on the used scan components | 370 | /* SOS (start of scan) segment depends on the used scan components |
371 | of each color component */ | 371 | of each color component */ |
372 | 372 | ||
373 | static int | 373 | static int |
374 | zr36060_set_sos (struct zr36060 *ptr) | 374 | zr36060_set_sos (struct zr36060 *ptr) |
@@ -385,7 +385,7 @@ zr36060_set_sos (struct zr36060 *ptr) | |||
385 | for (i = 0; i < NO_OF_COMPONENTS; i++) { | 385 | for (i = 0; i < NO_OF_COMPONENTS; i++) { |
386 | sos_data[5 + (i * 2)] = i; // index | 386 | sos_data[5 + (i * 2)] = i; // index |
387 | sos_data[6 + (i * 2)] = (zr36060_td[i] << 4) | | 387 | sos_data[6 + (i * 2)] = (zr36060_td[i] << 4) | |
388 | zr36060_ta[i]; // AC/DC tbl.sel. | 388 | zr36060_ta[i]; // AC/DC tbl.sel. |
389 | } | 389 | } |
390 | sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 2] = 00; // scan start | 390 | sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 2] = 00; // scan start |
391 | sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 3] = 0x3f; | 391 | sos_data[2 + 1 + (2 * NO_OF_COMPONENTS) + 3] = 0x3f; |
@@ -999,7 +999,7 @@ zr36060_cleanup_module (void) | |||
999 | dprintk(1, | 999 | dprintk(1, |
1000 | "zr36060: something's wrong - %d codecs left somehow.\n", | 1000 | "zr36060: something's wrong - %d codecs left somehow.\n", |
1001 | zr36060_codecs); | 1001 | zr36060_codecs); |
1002 | } | 1002 | } |
1003 | 1003 | ||
1004 | /* however, we can't just stay alive */ | 1004 | /* however, we can't just stay alive */ |
1005 | videocodec_unregister(&zr36060_codec); | 1005 | videocodec_unregister(&zr36060_codec); |
diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c index d4c633b8a7f5..6ac3b6740089 100644 --- a/drivers/media/video/zr36120.c +++ b/drivers/media/video/zr36120.c | |||
@@ -70,10 +70,10 @@ MODULE_AUTHOR("Pauline Middelink <middelin@polyware.nl>"); | |||
70 | MODULE_DESCRIPTION("Zoran ZR36120 based framegrabber"); | 70 | MODULE_DESCRIPTION("Zoran ZR36120 based framegrabber"); |
71 | MODULE_LICENSE("GPL"); | 71 | MODULE_LICENSE("GPL"); |
72 | 72 | ||
73 | MODULE_PARM(triton1,"i"); | 73 | module_param(triton1, uint, 0); |
74 | MODULE_PARM(cardtype,"1-" __MODULE_STRING(ZORAN_MAX) "i"); | 74 | module_param_array(cardtype, uint, NULL, 0); |
75 | MODULE_PARM(video_nr,"i"); | 75 | module_param(video_nr, int, 0); |
76 | MODULE_PARM(vbi_nr,"i"); | 76 | module_param(vbi_nr, int, 0); |
77 | 77 | ||
78 | static int zoran_cards; | 78 | static int zoran_cards; |
79 | static struct zoran zorans[ZORAN_MAX]; | 79 | static struct zoran zorans[ZORAN_MAX]; |
@@ -316,7 +316,7 @@ DEBUG(printk(CARD_DEBUG "%p added to queue\n",CARD,item)); | |||
316 | item->status = FBUFFER_BUSY; | 316 | item->status = FBUFFER_BUSY; |
317 | if (!lastitem) | 317 | if (!lastitem) |
318 | ztv->workqueue = item; | 318 | ztv->workqueue = item; |
319 | else | 319 | else |
320 | lastitem->next = item; | 320 | lastitem->next = item; |
321 | lastitem = item; | 321 | lastitem = item; |
322 | } | 322 | } |
@@ -516,7 +516,7 @@ DEBUG(printk(KERN_DEBUG " %d: clip(%d,%d,%d,%d)\n", i,vp->x,vp->y,vp->widt | |||
516 | zraor((ztv->vidInterlace*ystep)<<0,~ZORAN_OCR_MASKSTRIDE,ZORAN_OCR); | 516 | zraor((ztv->vidInterlace*ystep)<<0,~ZORAN_OCR_MASKSTRIDE,ZORAN_OCR); |
517 | } | 517 | } |
518 | 518 | ||
519 | struct tvnorm | 519 | struct tvnorm |
520 | { | 520 | { |
521 | u16 Wt, Wa, Ht, Ha, HStart, VStart; | 521 | u16 Wt, Wa, Ht, Ha, HStart, VStart; |
522 | }; | 522 | }; |
@@ -660,7 +660,7 @@ DEBUG(printk(KERN_DEBUG " Y: scale=0, start=%d, end=%d\n", Hstart, Hend)); | |||
660 | int HorDcm = 64-X; | 660 | int HorDcm = 64-X; |
661 | int hcrop1 = 2*(Wa-We)/4; | 661 | int hcrop1 = 2*(Wa-We)/4; |
662 | /* | 662 | /* |
663 | * BUGFIX: Juha Nurmela <junki@qn-lpr2-165.quicknet.inet.fi> | 663 | * BUGFIX: Juha Nurmela <junki@qn-lpr2-165.quicknet.inet.fi> |
664 | * found the solution to the color phase shift. | 664 | * found the solution to the color phase shift. |
665 | * See ChangeLog for the full explanation) | 665 | * See ChangeLog for the full explanation) |
666 | */ | 666 | */ |
@@ -812,12 +812,12 @@ void zoran_close(struct video_device* dev) | |||
812 | 812 | ||
813 | zoran_common_close(ztv); | 813 | zoran_common_close(ztv); |
814 | 814 | ||
815 | /* | 815 | /* |
816 | * This is sucky but right now I can't find a good way to | 816 | * This is sucky but right now I can't find a good way to |
817 | * be sure its safe to free the buffer. We wait 5-6 fields | 817 | * be sure its safe to free the buffer. We wait 5-6 fields |
818 | * which is more than sufficient to be sure. | 818 | * which is more than sufficient to be sure. |
819 | */ | 819 | */ |
820 | msleep(100); /* Wait 1/10th of a second */ | 820 | msleep(100); /* Wait 1/10th of a second */ |
821 | 821 | ||
822 | /* free the allocated framebuffer */ | 822 | /* free the allocated framebuffer */ |
823 | bfree(ztv->fbuffer, ZORAN_MAX_FBUFSIZE); | 823 | bfree(ztv->fbuffer, ZORAN_MAX_FBUFSIZE); |
@@ -1436,7 +1436,7 @@ int zoran_ioctl(struct video_device* dev, unsigned int cmd, void *arg) | |||
1436 | 1436 | ||
1437 | /* Why isn't this in the API? | 1437 | /* Why isn't this in the API? |
1438 | * And why doesn't it take a buffer number? | 1438 | * And why doesn't it take a buffer number? |
1439 | case BTTV_FIELDNR: | 1439 | case BTTV_FIELDNR: |
1440 | { | 1440 | { |
1441 | unsigned long v = ztv->lastfieldnr; | 1441 | unsigned long v = ztv->lastfieldnr; |
1442 | if (copy_to_user(arg,&v,sizeof(v))) | 1442 | if (copy_to_user(arg,&v,sizeof(v))) |
@@ -1557,12 +1557,12 @@ void vbi_close(struct video_device *dev) | |||
1557 | 1557 | ||
1558 | zoran_common_close(ztv); | 1558 | zoran_common_close(ztv); |
1559 | 1559 | ||
1560 | /* | 1560 | /* |
1561 | * This is sucky but right now I can't find a good way to | 1561 | * This is sucky but right now I can't find a good way to |
1562 | * be sure its safe to free the buffer. We wait 5-6 fields | 1562 | * be sure its safe to free the buffer. We wait 5-6 fields |
1563 | * which is more than sufficient to be sure. | 1563 | * which is more than sufficient to be sure. |
1564 | */ | 1564 | */ |
1565 | msleep(100); /* Wait 1/10th of a second */ | 1565 | msleep(100); /* Wait 1/10th of a second */ |
1566 | 1566 | ||
1567 | for (item=ztv->readinfo; item!=ztv->readinfo+ZORAN_VBI_BUFFERS; item++) | 1567 | for (item=ztv->readinfo; item!=ztv->readinfo+ZORAN_VBI_BUFFERS; item++) |
1568 | { | 1568 | { |
@@ -1620,7 +1620,7 @@ long vbi_read(struct video_device* dev, char* buf, unsigned long count, int nonb | |||
1620 | write_unlock_irq(&ztv->lock); | 1620 | write_unlock_irq(&ztv->lock); |
1621 | return -EWOULDBLOCK; | 1621 | return -EWOULDBLOCK; |
1622 | } | 1622 | } |
1623 | 1623 | ||
1624 | /* mark the unused buffer as wanted */ | 1624 | /* mark the unused buffer as wanted */ |
1625 | unused->status = FBUFFER_BUSY; | 1625 | unused->status = FBUFFER_BUSY; |
1626 | unused->next = 0; | 1626 | unused->next = 0; |
@@ -1671,7 +1671,7 @@ long vbi_read(struct video_device* dev, char* buf, unsigned long count, int nonb | |||
1671 | if (count == 2*19*2048) { | 1671 | if (count == 2*19*2048) { |
1672 | /* | 1672 | /* |
1673 | * Extreme HACK, old VBI programs expect 2048 points | 1673 | * Extreme HACK, old VBI programs expect 2048 points |
1674 | * of data, and we only got 864 orso. Double each | 1674 | * of data, and we only got 864 orso. Double each |
1675 | * datapoint and clear the rest of the line. | 1675 | * datapoint and clear the rest of the line. |
1676 | * This way we have appear to have a | 1676 | * This way we have appear to have a |
1677 | * sample_frequency of 29.5 Mc. | 1677 | * sample_frequency of 29.5 Mc. |
@@ -1956,7 +1956,7 @@ int __init init_zoran(int card) | |||
1956 | zrand(~ZORAN_VDC_TRICOM, ZORAN_VDC); | 1956 | zrand(~ZORAN_VDC_TRICOM, ZORAN_VDC); |
1957 | 1957 | ||
1958 | /* external FL determines TOP frame */ | 1958 | /* external FL determines TOP frame */ |
1959 | zror(ZORAN_VFEC_EXTFL, ZORAN_VFEC); | 1959 | zror(ZORAN_VFEC_EXTFL, ZORAN_VFEC); |
1960 | 1960 | ||
1961 | /* set HSpol */ | 1961 | /* set HSpol */ |
1962 | if (ztv->card->hsync_pos) | 1962 | if (ztv->card->hsync_pos) |
@@ -2012,7 +2012,7 @@ void release_zoran(int max) | |||
2012 | struct zoran *ztv; | 2012 | struct zoran *ztv; |
2013 | int i; | 2013 | int i; |
2014 | 2014 | ||
2015 | for (i=0;i<max; i++) | 2015 | for (i=0;i<max; i++) |
2016 | { | 2016 | { |
2017 | ztv = &zorans[i]; | 2017 | ztv = &zorans[i]; |
2018 | 2018 | ||
@@ -2029,7 +2029,7 @@ void release_zoran(int max) | |||
2029 | 2029 | ||
2030 | /* free it */ | 2030 | /* free it */ |
2031 | free_irq(ztv->dev->irq,ztv); | 2031 | free_irq(ztv->dev->irq,ztv); |
2032 | 2032 | ||
2033 | /* unregister i2c_bus */ | 2033 | /* unregister i2c_bus */ |
2034 | i2c_unregister_bus((&ztv->i2c)); | 2034 | i2c_unregister_bus((&ztv->i2c)); |
2035 | 2035 | ||
@@ -2050,7 +2050,7 @@ void __exit zr36120_exit(void) | |||
2050 | int __init zr36120_init(void) | 2050 | int __init zr36120_init(void) |
2051 | { | 2051 | { |
2052 | int card; | 2052 | int card; |
2053 | 2053 | ||
2054 | handle_chipset(); | 2054 | handle_chipset(); |
2055 | zoran_cards = find_zoran(); | 2055 | zoran_cards = find_zoran(); |
2056 | if (zoran_cards<0) | 2056 | if (zoran_cards<0) |
@@ -2063,7 +2063,7 @@ int __init zr36120_init(void) | |||
2063 | /* only release the zorans we have registered */ | 2063 | /* only release the zorans we have registered */ |
2064 | release_zoran(card); | 2064 | release_zoran(card); |
2065 | return -EIO; | 2065 | return -EIO; |
2066 | } | 2066 | } |
2067 | } | 2067 | } |
2068 | return 0; | 2068 | return 0; |
2069 | } | 2069 | } |
diff --git a/drivers/media/video/zr36120.h b/drivers/media/video/zr36120.h index 571f8e84b58a..a71e485b0f98 100644 --- a/drivers/media/video/zr36120.h +++ b/drivers/media/video/zr36120.h | |||
@@ -1,4 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | zr36120.h - Zoran 36120/36125 based framegrabbers | 2 | zr36120.h - Zoran 36120/36125 based framegrabbers |
3 | 3 | ||
4 | Copyright (C) 1998-1999 Pauline Middelink (middelin@polyware.nl) | 4 | Copyright (C) 1998-1999 Pauline Middelink (middelin@polyware.nl) |
@@ -89,7 +89,7 @@ struct vidinfo { | |||
89 | ulong* overlay; /* kernel addr of overlay mask */ | 89 | ulong* overlay; /* kernel addr of overlay mask */ |
90 | }; | 90 | }; |
91 | 91 | ||
92 | struct zoran | 92 | struct zoran |
93 | { | 93 | { |
94 | struct video_device video_dev; | 94 | struct video_device video_dev; |
95 | #define CARD_DEBUG KERN_DEBUG "%s(%lu): " | 95 | #define CARD_DEBUG KERN_DEBUG "%s(%lu): " |
@@ -106,7 +106,7 @@ struct zoran | |||
106 | uint norm; /* 0=PAL, 1=NTSC, 2=SECAM */ | 106 | uint norm; /* 0=PAL, 1=NTSC, 2=SECAM */ |
107 | uint tuner_freq; /* Current freq in kHz */ | 107 | uint tuner_freq; /* Current freq in kHz */ |
108 | struct video_picture picture; /* Current picture params */ | 108 | struct video_picture picture; /* Current picture params */ |
109 | 109 | ||
110 | /* videocard details */ | 110 | /* videocard details */ |
111 | uint swidth; /* screen width */ | 111 | uint swidth; /* screen width */ |
112 | uint sheight; /* screen height */ | 112 | uint sheight; /* screen height */ |
diff --git a/drivers/message/i2o/debug.c b/drivers/message/i2o/debug.c index 40d4ea898dbc..5a6cca8e8c45 100644 --- a/drivers/message/i2o/debug.c +++ b/drivers/message/i2o/debug.c | |||
@@ -419,58 +419,53 @@ void i2o_dump_hrt(struct i2o_controller *c) | |||
419 | d = (u8 *) (rows + 2); | 419 | d = (u8 *) (rows + 2); |
420 | state = p[1] << 8 | p[0]; | 420 | state = p[1] << 8 | p[0]; |
421 | 421 | ||
422 | printk(KERN_DEBUG "TID %04X:[", state & 0xFFF); | 422 | printk("TID %04X:[", state & 0xFFF); |
423 | state >>= 12; | 423 | state >>= 12; |
424 | if (state & (1 << 0)) | 424 | if (state & (1 << 0)) |
425 | printk(KERN_DEBUG "H"); /* Hidden */ | 425 | printk("H"); /* Hidden */ |
426 | if (state & (1 << 2)) { | 426 | if (state & (1 << 2)) { |
427 | printk(KERN_DEBUG "P"); /* Present */ | 427 | printk("P"); /* Present */ |
428 | if (state & (1 << 1)) | 428 | if (state & (1 << 1)) |
429 | printk(KERN_DEBUG "C"); /* Controlled */ | 429 | printk("C"); /* Controlled */ |
430 | } | 430 | } |
431 | if (state > 9) | 431 | if (state > 9) |
432 | printk(KERN_DEBUG "*"); /* Hard */ | 432 | printk("*"); /* Hard */ |
433 | 433 | ||
434 | printk(KERN_DEBUG "]:"); | 434 | printk("]:"); |
435 | 435 | ||
436 | switch (p[3] & 0xFFFF) { | 436 | switch (p[3] & 0xFFFF) { |
437 | case 0: | 437 | case 0: |
438 | /* Adapter private bus - easy */ | 438 | /* Adapter private bus - easy */ |
439 | printk(KERN_DEBUG | 439 | printk("Local bus %d: I/O at 0x%04X Mem 0x%08X", p[2], |
440 | "Local bus %d: I/O at 0x%04X Mem 0x%08X", p[2], | ||
441 | d[1] << 8 | d[0], *(u32 *) (d + 4)); | 440 | d[1] << 8 | d[0], *(u32 *) (d + 4)); |
442 | break; | 441 | break; |
443 | case 1: | 442 | case 1: |
444 | /* ISA bus */ | 443 | /* ISA bus */ |
445 | printk(KERN_DEBUG | 444 | printk("ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X", p[2], |
446 | "ISA %d: CSN %d I/O at 0x%04X Mem 0x%08X", p[2], | ||
447 | d[2], d[1] << 8 | d[0], *(u32 *) (d + 4)); | 445 | d[2], d[1] << 8 | d[0], *(u32 *) (d + 4)); |
448 | break; | 446 | break; |
449 | 447 | ||
450 | case 2: /* EISA bus */ | 448 | case 2: /* EISA bus */ |
451 | printk(KERN_DEBUG | 449 | printk("EISA %d: Slot %d I/O at 0x%04X Mem 0x%08X", |
452 | "EISA %d: Slot %d I/O at 0x%04X Mem 0x%08X", | ||
453 | p[2], d[3], d[1] << 8 | d[0], *(u32 *) (d + 4)); | 450 | p[2], d[3], d[1] << 8 | d[0], *(u32 *) (d + 4)); |
454 | break; | 451 | break; |
455 | 452 | ||
456 | case 3: /* MCA bus */ | 453 | case 3: /* MCA bus */ |
457 | printk(KERN_DEBUG | 454 | printk("MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X", p[2], |
458 | "MCA %d: Slot %d I/O at 0x%04X Mem 0x%08X", p[2], | ||
459 | d[3], d[1] << 8 | d[0], *(u32 *) (d + 4)); | 455 | d[3], d[1] << 8 | d[0], *(u32 *) (d + 4)); |
460 | break; | 456 | break; |
461 | 457 | ||
462 | case 4: /* PCI bus */ | 458 | case 4: /* PCI bus */ |
463 | printk(KERN_DEBUG | 459 | printk("PCI %d: Bus %d Device %d Function %d", p[2], |
464 | "PCI %d: Bus %d Device %d Function %d", p[2], | ||
465 | d[2], d[1], d[0]); | 460 | d[2], d[1], d[0]); |
466 | break; | 461 | break; |
467 | 462 | ||
468 | case 0x80: /* Other */ | 463 | case 0x80: /* Other */ |
469 | default: | 464 | default: |
470 | printk(KERN_DEBUG "Unsupported bus type."); | 465 | printk("Unsupported bus type."); |
471 | break; | 466 | break; |
472 | } | 467 | } |
473 | printk(KERN_DEBUG "\n"); | 468 | printk("\n"); |
474 | rows += length; | 469 | rows += length; |
475 | } | 470 | } |
476 | } | 471 | } |
diff --git a/drivers/mmc/au1xmmc.c b/drivers/mmc/au1xmmc.c index 8d84b045bc83..85e89c77bdea 100644 --- a/drivers/mmc/au1xmmc.c +++ b/drivers/mmc/au1xmmc.c | |||
@@ -87,7 +87,7 @@ struct au1xmmc_host *au1xmmc_hosts[AU1XMMC_CONTROLLER_COUNT]; | |||
87 | static int dma = 1; | 87 | static int dma = 1; |
88 | 88 | ||
89 | #ifdef MODULE | 89 | #ifdef MODULE |
90 | MODULE_PARM(dma, "i"); | 90 | module_param(dma, bool, 0); |
91 | MODULE_PARM_DESC(dma, "Use DMA engine for data transfers (0 = disabled)"); | 91 | MODULE_PARM_DESC(dma, "Use DMA engine for data transfers (0 = disabled)"); |
92 | #endif | 92 | #endif |
93 | 93 | ||
diff --git a/drivers/mtd/maps/pcmciamtd.c b/drivers/mtd/maps/pcmciamtd.c index f0f8916da7ad..f988c817e196 100644 --- a/drivers/mtd/maps/pcmciamtd.c +++ b/drivers/mtd/maps/pcmciamtd.c | |||
@@ -28,7 +28,7 @@ | |||
28 | 28 | ||
29 | #ifdef CONFIG_MTD_DEBUG | 29 | #ifdef CONFIG_MTD_DEBUG |
30 | static int debug = CONFIG_MTD_DEBUG_VERBOSE; | 30 | static int debug = CONFIG_MTD_DEBUG_VERBOSE; |
31 | MODULE_PARM(debug, "i"); | 31 | module_param(debug, int, 0); |
32 | MODULE_PARM_DESC(debug, "Set Debug Level 0=quiet, 5=noisy"); | 32 | MODULE_PARM_DESC(debug, "Set Debug Level 0=quiet, 5=noisy"); |
33 | #undef DEBUG | 33 | #undef DEBUG |
34 | #define DEBUG(n, format, arg...) \ | 34 | #define DEBUG(n, format, arg...) \ |
@@ -89,17 +89,17 @@ static int mem_type; | |||
89 | MODULE_LICENSE("GPL"); | 89 | MODULE_LICENSE("GPL"); |
90 | MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>"); | 90 | MODULE_AUTHOR("Simon Evans <spse@secret.org.uk>"); |
91 | MODULE_DESCRIPTION(DRIVER_DESC); | 91 | MODULE_DESCRIPTION(DRIVER_DESC); |
92 | MODULE_PARM(bankwidth, "i"); | 92 | module_param(bankwidth, int, 0); |
93 | MODULE_PARM_DESC(bankwidth, "Set bankwidth (1=8 bit, 2=16 bit, default=2)"); | 93 | MODULE_PARM_DESC(bankwidth, "Set bankwidth (1=8 bit, 2=16 bit, default=2)"); |
94 | MODULE_PARM(mem_speed, "i"); | 94 | module_param(mem_speed, int, 0); |
95 | MODULE_PARM_DESC(mem_speed, "Set memory access speed in ns"); | 95 | MODULE_PARM_DESC(mem_speed, "Set memory access speed in ns"); |
96 | MODULE_PARM(force_size, "i"); | 96 | module_param(force_size, int, 0); |
97 | MODULE_PARM_DESC(force_size, "Force size of card in MiB (1-64)"); | 97 | MODULE_PARM_DESC(force_size, "Force size of card in MiB (1-64)"); |
98 | MODULE_PARM(setvpp, "i"); | 98 | module_param(setvpp, int, 0); |
99 | MODULE_PARM_DESC(setvpp, "Set Vpp (0=Never, 1=On writes, 2=Always on, default=0)"); | 99 | MODULE_PARM_DESC(setvpp, "Set Vpp (0=Never, 1=On writes, 2=Always on, default=0)"); |
100 | MODULE_PARM(vpp, "i"); | 100 | module_param(vpp, int, 0); |
101 | MODULE_PARM_DESC(vpp, "Vpp value in 1/10ths eg 33=3.3V 120=12V (Dangerous)"); | 101 | MODULE_PARM_DESC(vpp, "Vpp value in 1/10ths eg 33=3.3V 120=12V (Dangerous)"); |
102 | MODULE_PARM(mem_type, "i"); | 102 | module_param(mem_type, int, 0); |
103 | MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)"); | 103 | MODULE_PARM_DESC(mem_type, "Set Memory type (0=Flash, 1=RAM, 2=ROM, default=0)"); |
104 | 104 | ||
105 | 105 | ||
diff --git a/drivers/net/3c59x.c b/drivers/net/3c59x.c index 5d11a06ecb2c..d339308539fa 100644 --- a/drivers/net/3c59x.c +++ b/drivers/net/3c59x.c | |||
@@ -1096,14 +1096,18 @@ static int __init vortex_eisa_init (void) | |||
1096 | int orig_cards_found = vortex_cards_found; | 1096 | int orig_cards_found = vortex_cards_found; |
1097 | 1097 | ||
1098 | #ifdef CONFIG_EISA | 1098 | #ifdef CONFIG_EISA |
1099 | if (eisa_driver_register (&vortex_eisa_driver) >= 0) { | 1099 | int err; |
1100 | /* Because of the way EISA bus is probed, we cannot assume | 1100 | |
1101 | * any device have been found when we exit from | 1101 | err = eisa_driver_register (&vortex_eisa_driver); |
1102 | * eisa_driver_register (the bus root driver may not be | 1102 | if (!err) { |
1103 | * initialized yet). So we blindly assume something was | 1103 | /* |
1104 | * found, and let the sysfs magic happend... */ | 1104 | * Because of the way EISA bus is probed, we cannot assume |
1105 | 1105 | * any device have been found when we exit from | |
1106 | eisa_found = 1; | 1106 | * eisa_driver_register (the bus root driver may not be |
1107 | * initialized yet). So we blindly assume something was | ||
1108 | * found, and let the sysfs magic happend... | ||
1109 | */ | ||
1110 | eisa_found = 1; | ||
1107 | } | 1111 | } |
1108 | #endif | 1112 | #endif |
1109 | 1113 | ||
diff --git a/drivers/net/a2065.c b/drivers/net/a2065.c index 8e538a6d7d97..79bb56b8dcef 100644 --- a/drivers/net/a2065.c +++ b/drivers/net/a2065.c | |||
@@ -829,7 +829,7 @@ static void __devexit a2065_remove_one(struct zorro_dev *z) | |||
829 | 829 | ||
830 | static int __init a2065_init_module(void) | 830 | static int __init a2065_init_module(void) |
831 | { | 831 | { |
832 | return zorro_module_init(&a2065_driver); | 832 | return zorro_register_driver(&a2065_driver); |
833 | } | 833 | } |
834 | 834 | ||
835 | static void __exit a2065_cleanup_module(void) | 835 | static void __exit a2065_cleanup_module(void) |
diff --git a/drivers/net/ariadne.c b/drivers/net/ariadne.c index 9fe93acfc8ef..d1b6b1f794e2 100644 --- a/drivers/net/ariadne.c +++ b/drivers/net/ariadne.c | |||
@@ -864,7 +864,7 @@ static void __devexit ariadne_remove_one(struct zorro_dev *z) | |||
864 | 864 | ||
865 | static int __init ariadne_init_module(void) | 865 | static int __init ariadne_init_module(void) |
866 | { | 866 | { |
867 | return zorro_module_init(&ariadne_driver); | 867 | return zorro_register_driver(&ariadne_driver); |
868 | } | 868 | } |
869 | 869 | ||
870 | static void __exit ariadne_cleanup_module(void) | 870 | static void __exit ariadne_cleanup_module(void) |
diff --git a/drivers/net/atari_bionet.c b/drivers/net/atari_bionet.c index 0095384ff454..5e5f80b99b9e 100644 --- a/drivers/net/atari_bionet.c +++ b/drivers/net/atari_bionet.c | |||
@@ -123,7 +123,7 @@ static char version[] = | |||
123 | * Global variable 'bionet_debug'. Can be set at load time by 'insmod' | 123 | * Global variable 'bionet_debug'. Can be set at load time by 'insmod' |
124 | */ | 124 | */ |
125 | unsigned int bionet_debug = NET_DEBUG; | 125 | unsigned int bionet_debug = NET_DEBUG; |
126 | MODULE_PARM(bionet_debug, "i"); | 126 | module_param(bionet_debug, int, 0); |
127 | MODULE_PARM_DESC(bionet_debug, "bionet debug level (0-2)"); | 127 | MODULE_PARM_DESC(bionet_debug, "bionet debug level (0-2)"); |
128 | MODULE_LICENSE("GPL"); | 128 | MODULE_LICENSE("GPL"); |
129 | 129 | ||
diff --git a/drivers/net/atari_pamsnet.c b/drivers/net/atari_pamsnet.c index 8b997809f9de..d6039e62d832 100644 --- a/drivers/net/atari_pamsnet.c +++ b/drivers/net/atari_pamsnet.c | |||
@@ -119,7 +119,7 @@ static char *version = | |||
119 | * Global variable 'pamsnet_debug'. Can be set at load time by 'insmod' | 119 | * Global variable 'pamsnet_debug'. Can be set at load time by 'insmod' |
120 | */ | 120 | */ |
121 | unsigned int pamsnet_debug = NET_DEBUG; | 121 | unsigned int pamsnet_debug = NET_DEBUG; |
122 | MODULE_PARM(pamsnet_debug, "i"); | 122 | module_param(pamsnet_debug, int, 0); |
123 | MODULE_PARM_DESC(pamsnet_debug, "pamsnet debug enable (0-1)"); | 123 | MODULE_PARM_DESC(pamsnet_debug, "pamsnet debug enable (0-1)"); |
124 | MODULE_LICENSE("GPL"); | 124 | MODULE_LICENSE("GPL"); |
125 | 125 | ||
diff --git a/drivers/net/atarilance.c b/drivers/net/atarilance.c index e01b6a78ec63..442b2cbeb58a 100644 --- a/drivers/net/atarilance.c +++ b/drivers/net/atarilance.c | |||
@@ -78,7 +78,7 @@ static int lance_debug = LANCE_DEBUG; | |||
78 | #else | 78 | #else |
79 | static int lance_debug = 1; | 79 | static int lance_debug = 1; |
80 | #endif | 80 | #endif |
81 | MODULE_PARM(lance_debug, "i"); | 81 | module_param(lance_debug, int, 0); |
82 | MODULE_PARM_DESC(lance_debug, "atarilance debug level (0-3)"); | 82 | MODULE_PARM_DESC(lance_debug, "atarilance debug level (0-3)"); |
83 | MODULE_LICENSE("GPL"); | 83 | MODULE_LICENSE("GPL"); |
84 | 84 | ||
diff --git a/drivers/net/cassini.c b/drivers/net/cassini.c index 8f1573e658a5..ac48f7543500 100644 --- a/drivers/net/cassini.c +++ b/drivers/net/cassini.c | |||
@@ -192,12 +192,15 @@ | |||
192 | static char version[] __devinitdata = | 192 | static char version[] __devinitdata = |
193 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; | 193 | DRV_MODULE_NAME ".c:v" DRV_MODULE_VERSION " (" DRV_MODULE_RELDATE ")\n"; |
194 | 194 | ||
195 | static int cassini_debug = -1; /* -1 == use CAS_DEF_MSG_ENABLE as value */ | ||
196 | static int link_mode; | ||
197 | |||
195 | MODULE_AUTHOR("Adrian Sun (asun@darksunrising.com)"); | 198 | MODULE_AUTHOR("Adrian Sun (asun@darksunrising.com)"); |
196 | MODULE_DESCRIPTION("Sun Cassini(+) ethernet driver"); | 199 | MODULE_DESCRIPTION("Sun Cassini(+) ethernet driver"); |
197 | MODULE_LICENSE("GPL"); | 200 | MODULE_LICENSE("GPL"); |
198 | MODULE_PARM(cassini_debug, "i"); | 201 | module_param(cassini_debug, int, 0); |
199 | MODULE_PARM_DESC(cassini_debug, "Cassini bitmapped debugging message enable value"); | 202 | MODULE_PARM_DESC(cassini_debug, "Cassini bitmapped debugging message enable value"); |
200 | MODULE_PARM(link_mode, "i"); | 203 | module_param(link_mode, int, 0); |
201 | MODULE_PARM_DESC(link_mode, "default link mode"); | 204 | MODULE_PARM_DESC(link_mode, "default link mode"); |
202 | 205 | ||
203 | /* | 206 | /* |
@@ -209,7 +212,7 @@ MODULE_PARM_DESC(link_mode, "default link mode"); | |||
209 | * Value in seconds, for user input. | 212 | * Value in seconds, for user input. |
210 | */ | 213 | */ |
211 | static int linkdown_timeout = DEFAULT_LINKDOWN_TIMEOUT; | 214 | static int linkdown_timeout = DEFAULT_LINKDOWN_TIMEOUT; |
212 | MODULE_PARM(linkdown_timeout, "i"); | 215 | module_param(linkdown_timeout, int, 0); |
213 | MODULE_PARM_DESC(linkdown_timeout, | 216 | MODULE_PARM_DESC(linkdown_timeout, |
214 | "min reset interval in sec. for PCS linkdown issue; disabled if not positive"); | 217 | "min reset interval in sec. for PCS linkdown issue; disabled if not positive"); |
215 | 218 | ||
@@ -221,8 +224,6 @@ MODULE_PARM_DESC(linkdown_timeout, | |||
221 | static int link_transition_timeout; | 224 | static int link_transition_timeout; |
222 | 225 | ||
223 | 226 | ||
224 | static int cassini_debug = -1; /* -1 == use CAS_DEF_MSG_ENABLE as value */ | ||
225 | static int link_mode; | ||
226 | 227 | ||
227 | static u16 link_modes[] __devinitdata = { | 228 | static u16 link_modes[] __devinitdata = { |
228 | BMCR_ANENABLE, /* 0 : autoneg */ | 229 | BMCR_ANENABLE, /* 0 : autoneg */ |
diff --git a/drivers/net/chelsio/cxgb2.c b/drivers/net/chelsio/cxgb2.c index 349ebe783ed6..7fe2638ae06d 100644 --- a/drivers/net/chelsio/cxgb2.c +++ b/drivers/net/chelsio/cxgb2.c | |||
@@ -124,7 +124,7 @@ MODULE_LICENSE("GPL"); | |||
124 | 124 | ||
125 | static int dflt_msg_enable = DFLT_MSG_ENABLE; | 125 | static int dflt_msg_enable = DFLT_MSG_ENABLE; |
126 | 126 | ||
127 | MODULE_PARM(dflt_msg_enable, "i"); | 127 | module_param(dflt_msg_enable, int, 0); |
128 | MODULE_PARM_DESC(dflt_msg_enable, "Chelsio T1 message enable bitmap"); | 128 | MODULE_PARM_DESC(dflt_msg_enable, "Chelsio T1 message enable bitmap"); |
129 | 129 | ||
130 | 130 | ||
diff --git a/drivers/net/dgrs.c b/drivers/net/dgrs.c index 32d13166c6e8..e175d4876682 100644 --- a/drivers/net/dgrs.c +++ b/drivers/net/dgrs.c | |||
@@ -1551,7 +1551,7 @@ MODULE_PARM_DESC(nicmode, "Digi RightSwitch operating mode (1: switch, 2: multi- | |||
1551 | static int __init dgrs_init_module (void) | 1551 | static int __init dgrs_init_module (void) |
1552 | { | 1552 | { |
1553 | int i; | 1553 | int i; |
1554 | int cardcount = 0; | 1554 | int err; |
1555 | 1555 | ||
1556 | /* | 1556 | /* |
1557 | * Command line variable overrides | 1557 | * Command line variable overrides |
@@ -1593,13 +1593,13 @@ static int __init dgrs_init_module (void) | |||
1593 | * Find and configure all the cards | 1593 | * Find and configure all the cards |
1594 | */ | 1594 | */ |
1595 | #ifdef CONFIG_EISA | 1595 | #ifdef CONFIG_EISA |
1596 | cardcount = eisa_driver_register(&dgrs_eisa_driver); | 1596 | err = eisa_driver_register(&dgrs_eisa_driver); |
1597 | if (cardcount < 0) | 1597 | if (err) |
1598 | return cardcount; | 1598 | return err; |
1599 | #endif | 1599 | #endif |
1600 | cardcount = pci_register_driver(&dgrs_pci_driver); | 1600 | err = pci_register_driver(&dgrs_pci_driver); |
1601 | if (cardcount) | 1601 | if (err) |
1602 | return cardcount; | 1602 | return err; |
1603 | return 0; | 1603 | return 0; |
1604 | } | 1604 | } |
1605 | 1605 | ||
diff --git a/drivers/net/fec_8xx/fec_main.c b/drivers/net/fec_8xx/fec_main.c index b4f3a9f8a535..7e4338097139 100644 --- a/drivers/net/fec_8xx/fec_main.c +++ b/drivers/net/fec_8xx/fec_main.c | |||
@@ -55,11 +55,11 @@ MODULE_AUTHOR("Pantelis Antoniou <panto@intracom.gr>"); | |||
55 | MODULE_DESCRIPTION("Motorola 8xx FEC ethernet driver"); | 55 | MODULE_DESCRIPTION("Motorola 8xx FEC ethernet driver"); |
56 | MODULE_LICENSE("GPL"); | 56 | MODULE_LICENSE("GPL"); |
57 | 57 | ||
58 | MODULE_PARM(fec_8xx_debug, "i"); | 58 | int fec_8xx_debug = -1; /* -1 == use FEC_8XX_DEF_MSG_ENABLE as value */ |
59 | module_param(fec_8xx_debug, int, 0); | ||
59 | MODULE_PARM_DESC(fec_8xx_debug, | 60 | MODULE_PARM_DESC(fec_8xx_debug, |
60 | "FEC 8xx bitmapped debugging message enable value"); | 61 | "FEC 8xx bitmapped debugging message enable value"); |
61 | 62 | ||
62 | int fec_8xx_debug = -1; /* -1 == use FEC_8XX_DEF_MSG_ENABLE as value */ | ||
63 | 63 | ||
64 | /*************************************************/ | 64 | /*************************************************/ |
65 | 65 | ||
diff --git a/drivers/net/fs_enet/fs_enet-main.c b/drivers/net/fs_enet/fs_enet-main.c index f5d49a110654..196298f33db8 100644 --- a/drivers/net/fs_enet/fs_enet-main.c +++ b/drivers/net/fs_enet/fs_enet-main.c | |||
@@ -58,11 +58,11 @@ MODULE_DESCRIPTION("Freescale Ethernet Driver"); | |||
58 | MODULE_LICENSE("GPL"); | 58 | MODULE_LICENSE("GPL"); |
59 | MODULE_VERSION(DRV_MODULE_VERSION); | 59 | MODULE_VERSION(DRV_MODULE_VERSION); |
60 | 60 | ||
61 | MODULE_PARM(fs_enet_debug, "i"); | 61 | int fs_enet_debug = -1; /* -1 == use FS_ENET_DEF_MSG_ENABLE as value */ |
62 | module_param(fs_enet_debug, int, 0); | ||
62 | MODULE_PARM_DESC(fs_enet_debug, | 63 | MODULE_PARM_DESC(fs_enet_debug, |
63 | "Freescale bitmapped debugging message enable value"); | 64 | "Freescale bitmapped debugging message enable value"); |
64 | 65 | ||
65 | int fs_enet_debug = -1; /* -1 == use FS_ENET_DEF_MSG_ENABLE as value */ | ||
66 | 66 | ||
67 | static void fs_set_multicast_list(struct net_device *dev) | 67 | static void fs_set_multicast_list(struct net_device *dev) |
68 | { | 68 | { |
diff --git a/drivers/net/gt96100eth.c b/drivers/net/gt96100eth.c index 5958a6314723..2d2435404614 100644 --- a/drivers/net/gt96100eth.c +++ b/drivers/net/gt96100eth.c | |||
@@ -114,8 +114,8 @@ static int max_interrupt_work = 32; | |||
114 | 114 | ||
115 | static char mac0[18] = "00.02.03.04.05.06"; | 115 | static char mac0[18] = "00.02.03.04.05.06"; |
116 | static char mac1[18] = "00.01.02.03.04.05"; | 116 | static char mac1[18] = "00.01.02.03.04.05"; |
117 | MODULE_PARM(mac0, "c18"); | 117 | module_param_string(mac0, mac0, 18, 0); |
118 | MODULE_PARM(mac1, "c18"); | 118 | module_param_string(mac1, mac0, 18, 0); |
119 | MODULE_PARM_DESC(mac0, "MAC address for GT96100 ethernet port 0"); | 119 | MODULE_PARM_DESC(mac0, "MAC address for GT96100 ethernet port 0"); |
120 | MODULE_PARM_DESC(mac1, "MAC address for GT96100 ethernet port 1"); | 120 | MODULE_PARM_DESC(mac1, "MAC address for GT96100 ethernet port 1"); |
121 | 121 | ||
diff --git a/drivers/net/hamradio/dmascc.c b/drivers/net/hamradio/dmascc.c index c8dc40214a08..79a8fbcf5f93 100644 --- a/drivers/net/hamradio/dmascc.c +++ b/drivers/net/hamradio/dmascc.c | |||
@@ -280,7 +280,7 @@ static unsigned long rand; | |||
280 | 280 | ||
281 | MODULE_AUTHOR("Klaus Kudielka"); | 281 | MODULE_AUTHOR("Klaus Kudielka"); |
282 | MODULE_DESCRIPTION("Driver for high-speed SCC boards"); | 282 | MODULE_DESCRIPTION("Driver for high-speed SCC boards"); |
283 | MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NUM_DEVS) "i"); | 283 | module_param_array(io, int, NULL, 0); |
284 | MODULE_LICENSE("GPL"); | 284 | MODULE_LICENSE("GPL"); |
285 | 285 | ||
286 | static void __exit dmascc_exit(void) | 286 | static void __exit dmascc_exit(void) |
diff --git a/drivers/net/hamradio/mkiss.c b/drivers/net/hamradio/mkiss.c index dc5e9d59deed..d81a8e1eeb8d 100644 --- a/drivers/net/hamradio/mkiss.c +++ b/drivers/net/hamradio/mkiss.c | |||
@@ -1012,7 +1012,7 @@ static void __exit mkiss_exit_driver(void) | |||
1012 | 1012 | ||
1013 | MODULE_AUTHOR("Ralf Baechle DL5RB <ralf@linux-mips.org>"); | 1013 | MODULE_AUTHOR("Ralf Baechle DL5RB <ralf@linux-mips.org>"); |
1014 | MODULE_DESCRIPTION("KISS driver for AX.25 over TTYs"); | 1014 | MODULE_DESCRIPTION("KISS driver for AX.25 over TTYs"); |
1015 | MODULE_PARM(crc_force, "i"); | 1015 | module_param(crc_force, int, 0); |
1016 | MODULE_PARM_DESC(crc_force, "crc [0 = auto | 1 = none | 2 = flexnet | 3 = smack]"); | 1016 | MODULE_PARM_DESC(crc_force, "crc [0 = auto | 1 = none | 2 = flexnet | 3 = smack]"); |
1017 | MODULE_LICENSE("GPL"); | 1017 | MODULE_LICENSE("GPL"); |
1018 | MODULE_ALIAS_LDISC(N_AX25); | 1018 | MODULE_ALIAS_LDISC(N_AX25); |
diff --git a/drivers/net/hplance.c b/drivers/net/hplance.c index d8410634bcaf..685693464605 100644 --- a/drivers/net/hplance.c +++ b/drivers/net/hplance.c | |||
@@ -217,7 +217,7 @@ static int hplance_close(struct net_device *dev) | |||
217 | 217 | ||
218 | int __init hplance_init_module(void) | 218 | int __init hplance_init_module(void) |
219 | { | 219 | { |
220 | return dio_module_init(&hplance_driver); | 220 | return dio_register_driver(&hplance_driver); |
221 | } | 221 | } |
222 | 222 | ||
223 | void __exit hplance_cleanup_module(void) | 223 | void __exit hplance_cleanup_module(void) |
diff --git a/drivers/net/hydra.c b/drivers/net/hydra.c index 6e0ca7340a8f..d9fb8e74e631 100644 --- a/drivers/net/hydra.c +++ b/drivers/net/hydra.c | |||
@@ -242,7 +242,7 @@ static void __devexit hydra_remove_one(struct zorro_dev *z) | |||
242 | 242 | ||
243 | static int __init hydra_init_module(void) | 243 | static int __init hydra_init_module(void) |
244 | { | 244 | { |
245 | return zorro_module_init(&hydra_driver); | 245 | return zorro_register_driver(&hydra_driver); |
246 | } | 246 | } |
247 | 247 | ||
248 | static void __exit hydra_cleanup_module(void) | 248 | static void __exit hydra_cleanup_module(void) |
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c index 6070195b87bd..98fa5319e5cc 100644 --- a/drivers/net/irda/irport.c +++ b/drivers/net/irda/irport.c | |||
@@ -1118,9 +1118,9 @@ static void __exit irport_cleanup(void) | |||
1118 | } | 1118 | } |
1119 | } | 1119 | } |
1120 | 1120 | ||
1121 | MODULE_PARM(io, "1-4i"); | 1121 | module_param_array(io, int, NULL, 0); |
1122 | MODULE_PARM_DESC(io, "Base I/O addresses"); | 1122 | MODULE_PARM_DESC(io, "Base I/O addresses"); |
1123 | MODULE_PARM(irq, "1-4i"); | 1123 | module_param_array(irq, int, NULL, 0); |
1124 | MODULE_PARM_DESC(irq, "IRQ lines"); | 1124 | MODULE_PARM_DESC(irq, "IRQ lines"); |
1125 | 1125 | ||
1126 | MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); | 1126 | MODULE_AUTHOR("Dag Brattli <dagb@cs.uit.no>"); |
diff --git a/drivers/net/lasi_82596.c b/drivers/net/lasi_82596.c index f7b7238d8352..957888de3d7e 100644 --- a/drivers/net/lasi_82596.c +++ b/drivers/net/lasi_82596.c | |||
@@ -177,7 +177,7 @@ static int i596_debug = (DEB_SERIOUS|DEB_PROBE); | |||
177 | MODULE_AUTHOR("Richard Hirst"); | 177 | MODULE_AUTHOR("Richard Hirst"); |
178 | MODULE_DESCRIPTION("i82596 driver"); | 178 | MODULE_DESCRIPTION("i82596 driver"); |
179 | MODULE_LICENSE("GPL"); | 179 | MODULE_LICENSE("GPL"); |
180 | MODULE_PARM(i596_debug, "i"); | 180 | module_param(i596_debug, int, 0); |
181 | MODULE_PARM_DESC(i596_debug, "lasi_82596 debug mask"); | 181 | MODULE_PARM_DESC(i596_debug, "lasi_82596 debug mask"); |
182 | 182 | ||
183 | /* Copy frames shorter than rx_copybreak, otherwise pass on up in | 183 | /* Copy frames shorter than rx_copybreak, otherwise pass on up in |
@@ -1520,9 +1520,9 @@ static void set_multicast_list(struct net_device *dev) | |||
1520 | } | 1520 | } |
1521 | } | 1521 | } |
1522 | 1522 | ||
1523 | MODULE_PARM(debug, "i"); | ||
1524 | MODULE_PARM_DESC(debug, "lasi_82596 debug mask"); | ||
1525 | static int debug = -1; | 1523 | static int debug = -1; |
1524 | module_param(debug, int, 0); | ||
1525 | MODULE_PARM_DESC(debug, "lasi_82596 debug mask"); | ||
1526 | 1526 | ||
1527 | static int num_drivers; | 1527 | static int num_drivers; |
1528 | static struct net_device *netdevs[MAX_DRIVERS]; | 1528 | static struct net_device *netdevs[MAX_DRIVERS]; |
diff --git a/drivers/net/mac89x0.c b/drivers/net/mac89x0.c index f65b0db111b8..cd3c9a5a98b2 100644 --- a/drivers/net/mac89x0.c +++ b/drivers/net/mac89x0.c | |||
@@ -629,7 +629,7 @@ static int set_mac_address(struct net_device *dev, void *addr) | |||
629 | static struct net_device *dev_cs89x0; | 629 | static struct net_device *dev_cs89x0; |
630 | static int debug; | 630 | static int debug; |
631 | 631 | ||
632 | MODULE_PARM(debug, "i"); | 632 | module_param(debug, int, 0); |
633 | MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); | 633 | MODULE_PARM_DESC(debug, "CS89[02]0 debug level (0-5)"); |
634 | MODULE_LICENSE("GPL"); | 634 | MODULE_LICENSE("GPL"); |
635 | 635 | ||
diff --git a/drivers/net/mace.c b/drivers/net/mace.c index 2a5add257b8f..77792b286027 100644 --- a/drivers/net/mace.c +++ b/drivers/net/mace.c | |||
@@ -1042,7 +1042,7 @@ static void __exit mace_cleanup(void) | |||
1042 | 1042 | ||
1043 | MODULE_AUTHOR("Paul Mackerras"); | 1043 | MODULE_AUTHOR("Paul Mackerras"); |
1044 | MODULE_DESCRIPTION("PowerMac MACE driver."); | 1044 | MODULE_DESCRIPTION("PowerMac MACE driver."); |
1045 | MODULE_PARM(port_aaui, "i"); | 1045 | module_param(port_aaui, int, 0); |
1046 | MODULE_PARM_DESC(port_aaui, "MACE uses AAUI port (0-1)"); | 1046 | MODULE_PARM_DESC(port_aaui, "MACE uses AAUI port (0-1)"); |
1047 | MODULE_LICENSE("GPL"); | 1047 | MODULE_LICENSE("GPL"); |
1048 | 1048 | ||
diff --git a/drivers/net/meth.c b/drivers/net/meth.c index e23655f5049f..d644bf3a933c 100644 --- a/drivers/net/meth.c +++ b/drivers/net/meth.c | |||
@@ -62,7 +62,7 @@ MODULE_DESCRIPTION("SGI O2 Builtin Fast Ethernet driver"); | |||
62 | 62 | ||
63 | #ifdef HAVE_TX_TIMEOUT | 63 | #ifdef HAVE_TX_TIMEOUT |
64 | static int timeout = TX_TIMEOUT; | 64 | static int timeout = TX_TIMEOUT; |
65 | MODULE_PARM(timeout, "i"); | 65 | module_param(timeout, int, 0); |
66 | #endif | 66 | #endif |
67 | 67 | ||
68 | /* | 68 | /* |
diff --git a/drivers/net/ne-h8300.c b/drivers/net/ne-h8300.c index aaebd28a1920..7ea3d596ac3b 100644 --- a/drivers/net/ne-h8300.c +++ b/drivers/net/ne-h8300.c | |||
@@ -601,9 +601,9 @@ static int io[MAX_NE_CARDS]; | |||
601 | static int irq[MAX_NE_CARDS]; | 601 | static int irq[MAX_NE_CARDS]; |
602 | static int bad[MAX_NE_CARDS]; /* 0xbad = bad sig or no reset ack */ | 602 | static int bad[MAX_NE_CARDS]; /* 0xbad = bad sig or no reset ack */ |
603 | 603 | ||
604 | MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); | 604 | module_param_array(io, int, NULL, 0); |
605 | MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); | 605 | module_param_array(irq, int, NULL, 0); |
606 | MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i"); | 606 | module_param_array(bad, int, NULL, 0); |
607 | MODULE_PARM_DESC(io, "I/O base address(es)"); | 607 | MODULE_PARM_DESC(io, "I/O base address(es)"); |
608 | MODULE_PARM_DESC(irq, "IRQ number(s)"); | 608 | MODULE_PARM_DESC(irq, "IRQ number(s)"); |
609 | MODULE_DESCRIPTION("H8/300 NE2000 Ethernet driver"); | 609 | MODULE_DESCRIPTION("H8/300 NE2000 Ethernet driver"); |
diff --git a/drivers/net/ni5010.c b/drivers/net/ni5010.c index 2ab01a5d1d22..a68bf474f6ed 100644 --- a/drivers/net/ni5010.c +++ b/drivers/net/ni5010.c | |||
@@ -766,8 +766,8 @@ static void ni5010_show_registers(struct net_device *dev) | |||
766 | #ifdef MODULE | 766 | #ifdef MODULE |
767 | static struct net_device *dev_ni5010; | 767 | static struct net_device *dev_ni5010; |
768 | 768 | ||
769 | MODULE_PARM(io, "i"); | 769 | module_param(io, int, 0); |
770 | MODULE_PARM(irq, "i"); | 770 | module_param(irq, int, 0); |
771 | MODULE_PARM_DESC(io, "ni5010 I/O base address"); | 771 | MODULE_PARM_DESC(io, "ni5010 I/O base address"); |
772 | MODULE_PARM_DESC(irq, "ni5010 IRQ number"); | 772 | MODULE_PARM_DESC(irq, "ni5010 IRQ number"); |
773 | 773 | ||
diff --git a/drivers/net/sun3lance.c b/drivers/net/sun3lance.c index 01bdb2334058..d4c0002b43db 100644 --- a/drivers/net/sun3lance.c +++ b/drivers/net/sun3lance.c | |||
@@ -71,7 +71,7 @@ static int lance_debug = LANCE_DEBUG; | |||
71 | #else | 71 | #else |
72 | static int lance_debug = 1; | 72 | static int lance_debug = 1; |
73 | #endif | 73 | #endif |
74 | MODULE_PARM(lance_debug, "i"); | 74 | module_param(lance_debug, int, 0); |
75 | MODULE_PARM_DESC(lance_debug, "SUN3 Lance debug level (0-3)"); | 75 | MODULE_PARM_DESC(lance_debug, "SUN3 Lance debug level (0-3)"); |
76 | MODULE_LICENSE("GPL"); | 76 | MODULE_LICENSE("GPL"); |
77 | 77 | ||
diff --git a/drivers/net/zorro8390.c b/drivers/net/zorro8390.c index 761021603597..8037e5806d0a 100644 --- a/drivers/net/zorro8390.c +++ b/drivers/net/zorro8390.c | |||
@@ -426,7 +426,7 @@ static void __devexit zorro8390_remove_one(struct zorro_dev *z) | |||
426 | 426 | ||
427 | static int __init zorro8390_init_module(void) | 427 | static int __init zorro8390_init_module(void) |
428 | { | 428 | { |
429 | return zorro_module_init(&zorro8390_driver); | 429 | return zorro_register_driver(&zorro8390_driver); |
430 | } | 430 | } |
431 | 431 | ||
432 | static void __exit zorro8390_cleanup_module(void) | 432 | static void __exit zorro8390_cleanup_module(void) |
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c index 57fd60314d59..b1b4b683cbdd 100644 --- a/drivers/pnp/isapnp/core.c +++ b/drivers/pnp/isapnp/core.c | |||
@@ -646,8 +646,10 @@ static int __init isapnp_create_device(struct pnp_card *card, | |||
646 | size = 0; | 646 | size = 0; |
647 | skip = 0; | 647 | skip = 0; |
648 | option = pnp_register_independent_option(dev); | 648 | option = pnp_register_independent_option(dev); |
649 | if (!option) | 649 | if (!option) { |
650 | kfree(dev); | ||
650 | return 1; | 651 | return 1; |
652 | } | ||
651 | pnp_add_card_device(card,dev); | 653 | pnp_add_card_device(card,dev); |
652 | } else { | 654 | } else { |
653 | skip = 1; | 655 | skip = 1; |
diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c index dfe542b206cc..7967916bda18 100644 --- a/drivers/s390/block/dasd.c +++ b/drivers/s390/block/dasd.c | |||
@@ -43,7 +43,6 @@ MODULE_AUTHOR("Holger Smolinski <Holger.Smolinski@de.ibm.com>"); | |||
43 | MODULE_DESCRIPTION("Linux on S/390 DASD device driver," | 43 | MODULE_DESCRIPTION("Linux on S/390 DASD device driver," |
44 | " Copyright 2000 IBM Corporation"); | 44 | " Copyright 2000 IBM Corporation"); |
45 | MODULE_SUPPORTED_DEVICE("dasd"); | 45 | MODULE_SUPPORTED_DEVICE("dasd"); |
46 | MODULE_PARM(dasd, "1-" __MODULE_STRING(256) "s"); | ||
47 | MODULE_LICENSE("GPL"); | 46 | MODULE_LICENSE("GPL"); |
48 | 47 | ||
49 | /* | 48 | /* |
diff --git a/drivers/s390/block/dasd_devmap.c b/drivers/s390/block/dasd_devmap.c index f576f243cd93..2f720108a7e0 100644 --- a/drivers/s390/block/dasd_devmap.c +++ b/drivers/s390/block/dasd_devmap.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/config.h> | 16 | #include <linux/config.h> |
17 | #include <linux/ctype.h> | 17 | #include <linux/ctype.h> |
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/module.h> | ||
19 | 20 | ||
20 | #include <asm/debug.h> | 21 | #include <asm/debug.h> |
21 | #include <asm/uaccess.h> | 22 | #include <asm/uaccess.h> |
@@ -69,6 +70,8 @@ int dasd_autodetect = 0; /* is true, when autodetection is active */ | |||
69 | * strings when running as a module. | 70 | * strings when running as a module. |
70 | */ | 71 | */ |
71 | static char *dasd[256]; | 72 | static char *dasd[256]; |
73 | module_param_array(dasd, charp, NULL, 0); | ||
74 | |||
72 | /* | 75 | /* |
73 | * Single spinlock to protect devmap structures and lists. | 76 | * Single spinlock to protect devmap structures and lists. |
74 | */ | 77 | */ |
diff --git a/drivers/scsi/arm/cumana_2.c b/drivers/scsi/arm/cumana_2.c index 583d2d8c8335..fad2109268bb 100644 --- a/drivers/scsi/arm/cumana_2.c +++ b/drivers/scsi/arm/cumana_2.c | |||
@@ -550,6 +550,6 @@ module_exit(cumanascsi2_exit); | |||
550 | 550 | ||
551 | MODULE_AUTHOR("Russell King"); | 551 | MODULE_AUTHOR("Russell King"); |
552 | MODULE_DESCRIPTION("Cumana SCSI-2 driver for Acorn machines"); | 552 | MODULE_DESCRIPTION("Cumana SCSI-2 driver for Acorn machines"); |
553 | MODULE_PARM(term, "1-8i"); | 553 | module_param_array(term, int, NULL, 0); |
554 | MODULE_PARM_DESC(term, "SCSI bus termination"); | 554 | MODULE_PARM_DESC(term, "SCSI bus termination"); |
555 | MODULE_LICENSE("GPL"); | 555 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/arm/eesox.c b/drivers/scsi/arm/eesox.c index 3ffec7efc9d5..dcbb4b2b3fe0 100644 --- a/drivers/scsi/arm/eesox.c +++ b/drivers/scsi/arm/eesox.c | |||
@@ -674,6 +674,6 @@ module_exit(eesox_exit); | |||
674 | 674 | ||
675 | MODULE_AUTHOR("Russell King"); | 675 | MODULE_AUTHOR("Russell King"); |
676 | MODULE_DESCRIPTION("EESOX 'Fast' SCSI driver for Acorn machines"); | 676 | MODULE_DESCRIPTION("EESOX 'Fast' SCSI driver for Acorn machines"); |
677 | MODULE_PARM(term, "1-8i"); | 677 | module_param_array(term, int, NULL, 0); |
678 | MODULE_PARM_DESC(term, "SCSI bus termination"); | 678 | MODULE_PARM_DESC(term, "SCSI bus termination"); |
679 | MODULE_LICENSE("GPL"); | 679 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/arm/powertec.c b/drivers/scsi/arm/powertec.c index 3113bdcedb13..3d69f6c45a6b 100644 --- a/drivers/scsi/arm/powertec.c +++ b/drivers/scsi/arm/powertec.c | |||
@@ -466,6 +466,6 @@ module_exit(powertecscsi_exit); | |||
466 | 466 | ||
467 | MODULE_AUTHOR("Russell King"); | 467 | MODULE_AUTHOR("Russell King"); |
468 | MODULE_DESCRIPTION("Powertec SCSI driver"); | 468 | MODULE_DESCRIPTION("Powertec SCSI driver"); |
469 | MODULE_PARM(term, "1-8i"); | 469 | module_param_array(term, int, NULL, 0); |
470 | MODULE_PARM_DESC(term, "SCSI bus termination"); | 470 | MODULE_PARM_DESC(term, "SCSI bus termination"); |
471 | MODULE_LICENSE("GPL"); | 471 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/scsi/atari_scsi.c b/drivers/scsi/atari_scsi.c index f4c1ca7c1572..f677c5a32a68 100644 --- a/drivers/scsi/atari_scsi.c +++ b/drivers/scsi/atari_scsi.c | |||
@@ -239,17 +239,17 @@ static int atari_read_overruns = 0; | |||
239 | #endif | 239 | #endif |
240 | 240 | ||
241 | static int setup_can_queue = -1; | 241 | static int setup_can_queue = -1; |
242 | MODULE_PARM(setup_can_queue, "i"); | 242 | module_param(setup_can_queue, int, 0); |
243 | static int setup_cmd_per_lun = -1; | 243 | static int setup_cmd_per_lun = -1; |
244 | MODULE_PARM(setup_cmd_per_lun, "i"); | 244 | module_param(setup_cmd_per_lun, int, 0); |
245 | static int setup_sg_tablesize = -1; | 245 | static int setup_sg_tablesize = -1; |
246 | MODULE_PARM(setup_sg_tablesize, "i"); | 246 | module_param(setup_sg_tablesize, int, 0); |
247 | #ifdef SUPPORT_TAGS | 247 | #ifdef SUPPORT_TAGS |
248 | static int setup_use_tagged_queuing = -1; | 248 | static int setup_use_tagged_queuing = -1; |
249 | MODULE_PARM(setup_use_tagged_queuing, "i"); | 249 | module_param(setup_use_tagged_queuing, int, 0); |
250 | #endif | 250 | #endif |
251 | static int setup_hostid = -1; | 251 | static int setup_hostid = -1; |
252 | MODULE_PARM(setup_hostid, "i"); | 252 | module_param(setup_hostid, int, 0); |
253 | 253 | ||
254 | 254 | ||
255 | #if defined(CONFIG_TT_DMA_EMUL) | 255 | #if defined(CONFIG_TT_DMA_EMUL) |
diff --git a/drivers/scsi/sd.c b/drivers/scsi/sd.c index 024ef86c5242..c647d85d97d1 100644 --- a/drivers/scsi/sd.c +++ b/drivers/scsi/sd.c | |||
@@ -190,7 +190,7 @@ static ssize_t sd_store_cache_type(struct class_device *cdev, const char *buf, | |||
190 | if (scsi_mode_sense(sdp, 0x08, 8, buffer, sizeof(buffer), SD_TIMEOUT, | 190 | if (scsi_mode_sense(sdp, 0x08, 8, buffer, sizeof(buffer), SD_TIMEOUT, |
191 | SD_MAX_RETRIES, &data, NULL)) | 191 | SD_MAX_RETRIES, &data, NULL)) |
192 | return -EINVAL; | 192 | return -EINVAL; |
193 | len = min(sizeof(buffer), data.length - data.header_length - | 193 | len = min_t(size_t, sizeof(buffer), data.length - data.header_length - |
194 | data.block_descriptor_length); | 194 | data.block_descriptor_length); |
195 | buffer_data = buffer + data.header_length + | 195 | buffer_data = buffer + data.header_length + |
196 | data.block_descriptor_length; | 196 | data.block_descriptor_length; |
diff --git a/drivers/serial/8250_hp300.c b/drivers/serial/8250_hp300.c index 4315afe9c080..53e81a44c1a3 100644 --- a/drivers/serial/8250_hp300.c +++ b/drivers/serial/8250_hp300.c | |||
@@ -55,6 +55,8 @@ static struct dio_driver hpdca_driver = { | |||
55 | 55 | ||
56 | #endif | 56 | #endif |
57 | 57 | ||
58 | static unsigned int num_ports; | ||
59 | |||
58 | extern int hp300_uart_scode; | 60 | extern int hp300_uart_scode; |
59 | 61 | ||
60 | /* Offset to UART registers from base of DCA */ | 62 | /* Offset to UART registers from base of DCA */ |
@@ -199,6 +201,8 @@ static int __devinit hpdca_init_one(struct dio_dev *d, | |||
199 | out_8(d->resource.start + DIO_VIRADDRBASE + DCA_ID, 0xff); | 201 | out_8(d->resource.start + DIO_VIRADDRBASE + DCA_ID, 0xff); |
200 | udelay(100); | 202 | udelay(100); |
201 | 203 | ||
204 | num_ports++; | ||
205 | |||
202 | return 0; | 206 | return 0; |
203 | } | 207 | } |
204 | #endif | 208 | #endif |
@@ -206,7 +210,6 @@ static int __devinit hpdca_init_one(struct dio_dev *d, | |||
206 | static int __init hp300_8250_init(void) | 210 | static int __init hp300_8250_init(void) |
207 | { | 211 | { |
208 | static int called = 0; | 212 | static int called = 0; |
209 | int num_ports; | ||
210 | #ifdef CONFIG_HPAPCI | 213 | #ifdef CONFIG_HPAPCI |
211 | int line; | 214 | int line; |
212 | unsigned long base; | 215 | unsigned long base; |
@@ -221,11 +224,8 @@ static int __init hp300_8250_init(void) | |||
221 | if (!MACH_IS_HP300) | 224 | if (!MACH_IS_HP300) |
222 | return -ENODEV; | 225 | return -ENODEV; |
223 | 226 | ||
224 | num_ports = 0; | ||
225 | |||
226 | #ifdef CONFIG_HPDCA | 227 | #ifdef CONFIG_HPDCA |
227 | if (dio_module_init(&hpdca_driver) == 0) | 228 | dio_register_driver(&hpdca_driver); |
228 | num_ports++; | ||
229 | #endif | 229 | #endif |
230 | #ifdef CONFIG_HPAPCI | 230 | #ifdef CONFIG_HPAPCI |
231 | if (hp300_model < HP_400) { | 231 | if (hp300_model < HP_400) { |
diff --git a/drivers/serial/ioc4_serial.c b/drivers/serial/ioc4_serial.c index a37579ce6d76..c620209d7b9a 100644 --- a/drivers/serial/ioc4_serial.c +++ b/drivers/serial/ioc4_serial.c | |||
@@ -3,7 +3,7 @@ | |||
3 | * License. See the file "COPYING" in the main directory of this archive | 3 | * License. See the file "COPYING" in the main directory of this archive |
4 | * for more details. | 4 | * for more details. |
5 | * | 5 | * |
6 | * Copyright (C) 2003-2005 Silicon Graphics, Inc. All Rights Reserved. | 6 | * Copyright (C) 2003-2006 Silicon Graphics, Inc. All Rights Reserved. |
7 | */ | 7 | */ |
8 | 8 | ||
9 | 9 | ||
@@ -323,9 +323,12 @@ static unsigned int Num_of_ioc4_cards; | |||
323 | #define IOC4_FIFO_CHARS 255 | 323 | #define IOC4_FIFO_CHARS 255 |
324 | 324 | ||
325 | /* Device name we're using */ | 325 | /* Device name we're using */ |
326 | #define DEVICE_NAME "ttyIOC" | 326 | #define DEVICE_NAME_RS232 "ttyIOC" |
327 | #define DEVICE_MAJOR 204 | 327 | #define DEVICE_NAME_RS422 "ttyAIOC" |
328 | #define DEVICE_MINOR 50 | 328 | #define DEVICE_MAJOR 204 |
329 | #define DEVICE_MINOR_RS232 50 | ||
330 | #define DEVICE_MINOR_RS422 84 | ||
331 | |||
329 | 332 | ||
330 | /* register offsets */ | 333 | /* register offsets */ |
331 | #define IOC4_SERIAL_OFFSET 0x300 | 334 | #define IOC4_SERIAL_OFFSET 0x300 |
@@ -341,10 +344,8 @@ static unsigned int Num_of_ioc4_cards; | |||
341 | #define MAX_BAUD_SUPPORTED 115200 | 344 | #define MAX_BAUD_SUPPORTED 115200 |
342 | 345 | ||
343 | /* protocol types supported */ | 346 | /* protocol types supported */ |
344 | enum sio_proto { | 347 | #define PROTO_RS232 3 |
345 | PROTO_RS232, | 348 | #define PROTO_RS422 7 |
346 | PROTO_RS422 | ||
347 | }; | ||
348 | 349 | ||
349 | /* Notification types */ | 350 | /* Notification types */ |
350 | #define N_DATA_READY 0x01 | 351 | #define N_DATA_READY 0x01 |
@@ -395,11 +396,17 @@ enum sio_proto { | |||
395 | /* | 396 | /* |
396 | * This is the entry saved by the driver - one per card | 397 | * This is the entry saved by the driver - one per card |
397 | */ | 398 | */ |
399 | |||
400 | #define UART_PORT_MIN 0 | ||
401 | #define UART_PORT_RS232 UART_PORT_MIN | ||
402 | #define UART_PORT_RS422 1 | ||
403 | #define UART_PORT_COUNT 2 /* one for each mode */ | ||
404 | |||
398 | struct ioc4_control { | 405 | struct ioc4_control { |
399 | int ic_irq; | 406 | int ic_irq; |
400 | struct { | 407 | struct { |
401 | /* uart ports are allocated here */ | 408 | /* uart ports are allocated here - 1 for rs232, 1 for rs422 */ |
402 | struct uart_port icp_uart_port; | 409 | struct uart_port icp_uart_port[UART_PORT_COUNT]; |
403 | /* Handy reference material */ | 410 | /* Handy reference material */ |
404 | struct ioc4_port *icp_port; | 411 | struct ioc4_port *icp_port; |
405 | } ic_port[IOC4_NUM_SERIAL_PORTS]; | 412 | } ic_port[IOC4_NUM_SERIAL_PORTS]; |
@@ -443,7 +450,9 @@ struct ioc4_soft { | |||
443 | 450 | ||
444 | /* Local port info for each IOC4 serial ports */ | 451 | /* Local port info for each IOC4 serial ports */ |
445 | struct ioc4_port { | 452 | struct ioc4_port { |
446 | struct uart_port *ip_port; | 453 | struct uart_port *ip_port; /* current active port ptr */ |
454 | /* Ptrs for all ports */ | ||
455 | struct uart_port *ip_all_ports[UART_PORT_COUNT]; | ||
447 | /* Back ptrs for this port */ | 456 | /* Back ptrs for this port */ |
448 | struct ioc4_control *ip_control; | 457 | struct ioc4_control *ip_control; |
449 | struct pci_dev *ip_pdev; | 458 | struct pci_dev *ip_pdev; |
@@ -502,6 +511,9 @@ struct ioc4_port { | |||
502 | #define DCD_ON 0x02 | 511 | #define DCD_ON 0x02 |
503 | #define LOWAT_WRITTEN 0x04 | 512 | #define LOWAT_WRITTEN 0x04 |
504 | #define READ_ABORTED 0x08 | 513 | #define READ_ABORTED 0x08 |
514 | #define PORT_ACTIVE 0x10 | ||
515 | #define PORT_INACTIVE 0 /* This is the value when "off" */ | ||
516 | |||
505 | 517 | ||
506 | /* Since each port has different register offsets and bitmasks | 518 | /* Since each port has different register offsets and bitmasks |
507 | * for everything, we'll store those that we need in tables so we | 519 | * for everything, we'll store those that we need in tables so we |
@@ -623,6 +635,23 @@ struct ring_buffer { | |||
623 | static void receive_chars(struct uart_port *); | 635 | static void receive_chars(struct uart_port *); |
624 | static void handle_intr(void *arg, uint32_t sio_ir); | 636 | static void handle_intr(void *arg, uint32_t sio_ir); |
625 | 637 | ||
638 | /* | ||
639 | * port_is_active - determines if this port is currently active | ||
640 | * @port: ptr to soft struct for this port | ||
641 | * @uart_port: uart port to test for | ||
642 | */ | ||
643 | static inline int port_is_active(struct ioc4_port *port, | ||
644 | struct uart_port *uart_port) | ||
645 | { | ||
646 | if (port) { | ||
647 | if ((port->ip_flags & PORT_ACTIVE) | ||
648 | && (port->ip_port == uart_port)) | ||
649 | return 1; | ||
650 | } | ||
651 | return 0; | ||
652 | } | ||
653 | |||
654 | |||
626 | /** | 655 | /** |
627 | * write_ireg - write the interrupt regs | 656 | * write_ireg - write the interrupt regs |
628 | * @ioc4_soft: ptr to soft struct for this port | 657 | * @ioc4_soft: ptr to soft struct for this port |
@@ -708,19 +737,33 @@ static int set_baud(struct ioc4_port *port, int baud) | |||
708 | /** | 737 | /** |
709 | * get_ioc4_port - given a uart port, return the control structure | 738 | * get_ioc4_port - given a uart port, return the control structure |
710 | * @port: uart port | 739 | * @port: uart port |
740 | * @set: set this port as current | ||
711 | */ | 741 | */ |
712 | static struct ioc4_port *get_ioc4_port(struct uart_port *the_port) | 742 | static struct ioc4_port *get_ioc4_port(struct uart_port *the_port, int set) |
713 | { | 743 | { |
714 | struct ioc4_driver_data *idd = dev_get_drvdata(the_port->dev); | 744 | struct ioc4_driver_data *idd = dev_get_drvdata(the_port->dev); |
715 | struct ioc4_control *control = idd->idd_serial_data; | 745 | struct ioc4_control *control = idd->idd_serial_data; |
716 | int ii; | 746 | struct ioc4_port *port; |
747 | int port_num, port_type; | ||
717 | 748 | ||
718 | if (control) { | 749 | if (control) { |
719 | for ( ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++ ) { | 750 | for ( port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS; |
720 | if (!control->ic_port[ii].icp_port) | 751 | port_num++ ) { |
752 | port = control->ic_port[port_num].icp_port; | ||
753 | if (!port) | ||
721 | continue; | 754 | continue; |
722 | if (the_port == control->ic_port[ii].icp_port->ip_port) | 755 | for (port_type = UART_PORT_MIN; |
723 | return control->ic_port[ii].icp_port; | 756 | port_type < UART_PORT_COUNT; |
757 | port_type++) { | ||
758 | if (the_port == port->ip_all_ports | ||
759 | [port_type]) { | ||
760 | /* set local copy */ | ||
761 | if (set) { | ||
762 | port->ip_port = the_port; | ||
763 | } | ||
764 | return port; | ||
765 | } | ||
766 | } | ||
724 | } | 767 | } |
725 | } | 768 | } |
726 | return NULL; | 769 | return NULL; |
@@ -946,6 +989,7 @@ intr_connect(struct ioc4_soft *soft, int type, | |||
946 | * @arg: handler arg | 989 | * @arg: handler arg |
947 | * @regs: registers | 990 | * @regs: registers |
948 | */ | 991 | */ |
992 | |||
949 | static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) | 993 | static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) |
950 | { | 994 | { |
951 | struct ioc4_soft *soft; | 995 | struct ioc4_soft *soft; |
@@ -953,7 +997,7 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) | |||
953 | int xx, num_intrs = 0; | 997 | int xx, num_intrs = 0; |
954 | int intr_type; | 998 | int intr_type; |
955 | int handled = 0; | 999 | int handled = 0; |
956 | struct ioc4_intr_info *ii; | 1000 | struct ioc4_intr_info *intr_info; |
957 | 1001 | ||
958 | soft = arg; | 1002 | soft = arg; |
959 | for (intr_type = 0; intr_type < IOC4_NUM_INTR_TYPES; intr_type++) { | 1003 | for (intr_type = 0; intr_type < IOC4_NUM_INTR_TYPES; intr_type++) { |
@@ -966,13 +1010,13 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) | |||
966 | * which interrupt bits are set. | 1010 | * which interrupt bits are set. |
967 | */ | 1011 | */ |
968 | for (xx = 0; xx < num_intrs; xx++) { | 1012 | for (xx = 0; xx < num_intrs; xx++) { |
969 | ii = &soft->is_intr_type[intr_type].is_intr_info[xx]; | 1013 | intr_info = &soft->is_intr_type[intr_type].is_intr_info[xx]; |
970 | if ((this_mir = this_ir & ii->sd_bits)) { | 1014 | if ((this_mir = this_ir & intr_info->sd_bits)) { |
971 | /* Disable owned interrupts, call handler */ | 1015 | /* Disable owned interrupts, call handler */ |
972 | handled++; | 1016 | handled++; |
973 | write_ireg(soft, ii->sd_bits, IOC4_W_IEC, | 1017 | write_ireg(soft, intr_info->sd_bits, IOC4_W_IEC, |
974 | intr_type); | 1018 | intr_type); |
975 | ii->sd_intr(ii->sd_info, this_mir); | 1019 | intr_info->sd_intr(intr_info->sd_info, this_mir); |
976 | this_ir &= ~this_mir; | 1020 | this_ir &= ~this_mir; |
977 | } | 1021 | } |
978 | } | 1022 | } |
@@ -980,7 +1024,6 @@ static irqreturn_t ioc4_intr(int irq, void *arg, struct pt_regs *regs) | |||
980 | #ifdef DEBUG_INTERRUPTS | 1024 | #ifdef DEBUG_INTERRUPTS |
981 | { | 1025 | { |
982 | struct ioc4_misc_regs __iomem *mem = soft->is_ioc4_misc_addr; | 1026 | struct ioc4_misc_regs __iomem *mem = soft->is_ioc4_misc_addr; |
983 | spinlock_t *lp = &soft->is_ir_lock; | ||
984 | unsigned long flag; | 1027 | unsigned long flag; |
985 | 1028 | ||
986 | spin_lock_irqsave(&soft->is_ir_lock, flag); | 1029 | spin_lock_irqsave(&soft->is_ir_lock, flag); |
@@ -1177,7 +1220,7 @@ static inline int local_open(struct ioc4_port *port) | |||
1177 | { | 1220 | { |
1178 | int spiniter = 0; | 1221 | int spiniter = 0; |
1179 | 1222 | ||
1180 | port->ip_flags = 0; | 1223 | port->ip_flags = PORT_ACTIVE; |
1181 | 1224 | ||
1182 | /* Pause the DMA interface if necessary */ | 1225 | /* Pause the DMA interface if necessary */ |
1183 | if (port->ip_sscr & IOC4_SSCR_DMA_EN) { | 1226 | if (port->ip_sscr & IOC4_SSCR_DMA_EN) { |
@@ -1187,6 +1230,7 @@ static inline int local_open(struct ioc4_port *port) | |||
1187 | & IOC4_SSCR_PAUSE_STATE) == 0) { | 1230 | & IOC4_SSCR_PAUSE_STATE) == 0) { |
1188 | spiniter++; | 1231 | spiniter++; |
1189 | if (spiniter > MAXITER) { | 1232 | if (spiniter > MAXITER) { |
1233 | port->ip_flags = PORT_INACTIVE; | ||
1190 | return -1; | 1234 | return -1; |
1191 | } | 1235 | } |
1192 | } | 1236 | } |
@@ -1506,14 +1550,13 @@ static int set_notification(struct ioc4_port *port, int mask, int set_on) | |||
1506 | /** | 1550 | /** |
1507 | * set_mcr - set the master control reg | 1551 | * set_mcr - set the master control reg |
1508 | * @the_port: port to use | 1552 | * @the_port: port to use |
1509 | * @set: set ? | ||
1510 | * @mask1: mcr mask | 1553 | * @mask1: mcr mask |
1511 | * @mask2: shadow mask | 1554 | * @mask2: shadow mask |
1512 | */ | 1555 | */ |
1513 | static inline int set_mcr(struct uart_port *the_port, int set, | 1556 | static inline int set_mcr(struct uart_port *the_port, |
1514 | int mask1, int mask2) | 1557 | int mask1, int mask2) |
1515 | { | 1558 | { |
1516 | struct ioc4_port *port = get_ioc4_port(the_port); | 1559 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
1517 | uint32_t shadow; | 1560 | uint32_t shadow; |
1518 | int spiniter = 0; | 1561 | int spiniter = 0; |
1519 | char mcr; | 1562 | char mcr; |
@@ -1536,13 +1579,9 @@ static inline int set_mcr(struct uart_port *the_port, int set, | |||
1536 | mcr = (shadow & 0xff000000) >> 24; | 1579 | mcr = (shadow & 0xff000000) >> 24; |
1537 | 1580 | ||
1538 | /* Set new value */ | 1581 | /* Set new value */ |
1539 | if (set) { | 1582 | mcr |= mask1; |
1540 | mcr |= mask1; | 1583 | shadow |= mask2; |
1541 | shadow |= mask2; | 1584 | |
1542 | } else { | ||
1543 | mcr &= ~mask1; | ||
1544 | shadow &= ~mask2; | ||
1545 | } | ||
1546 | writeb(mcr, &port->ip_uart_regs->i4u_mcr); | 1585 | writeb(mcr, &port->ip_uart_regs->i4u_mcr); |
1547 | writel(shadow, &port->ip_serial_regs->shadow); | 1586 | writel(shadow, &port->ip_serial_regs->shadow); |
1548 | 1587 | ||
@@ -1558,7 +1597,7 @@ static inline int set_mcr(struct uart_port *the_port, int set, | |||
1558 | * @port: port to use | 1597 | * @port: port to use |
1559 | * @proto: protocol to use | 1598 | * @proto: protocol to use |
1560 | */ | 1599 | */ |
1561 | static int ioc4_set_proto(struct ioc4_port *port, enum sio_proto proto) | 1600 | static int ioc4_set_proto(struct ioc4_port *port, int proto) |
1562 | { | 1601 | { |
1563 | struct hooks *hooks = port->ip_hooks; | 1602 | struct hooks *hooks = port->ip_hooks; |
1564 | 1603 | ||
@@ -1589,7 +1628,7 @@ static void transmit_chars(struct uart_port *the_port) | |||
1589 | int result; | 1628 | int result; |
1590 | char *start; | 1629 | char *start; |
1591 | struct tty_struct *tty; | 1630 | struct tty_struct *tty; |
1592 | struct ioc4_port *port = get_ioc4_port(the_port); | 1631 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
1593 | struct uart_info *info; | 1632 | struct uart_info *info; |
1594 | 1633 | ||
1595 | if (!the_port) | 1634 | if (!the_port) |
@@ -1645,7 +1684,7 @@ static void | |||
1645 | ioc4_change_speed(struct uart_port *the_port, | 1684 | ioc4_change_speed(struct uart_port *the_port, |
1646 | struct termios *new_termios, struct termios *old_termios) | 1685 | struct termios *new_termios, struct termios *old_termios) |
1647 | { | 1686 | { |
1648 | struct ioc4_port *port = get_ioc4_port(the_port); | 1687 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
1649 | int baud, bits; | 1688 | int baud, bits; |
1650 | unsigned cflag; | 1689 | unsigned cflag; |
1651 | int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8; | 1690 | int new_parity = 0, new_parity_enable = 0, new_stop = 0, new_data = 8; |
@@ -1752,7 +1791,7 @@ static inline int ic4_startup_local(struct uart_port *the_port) | |||
1752 | if (!the_port) | 1791 | if (!the_port) |
1753 | return -1; | 1792 | return -1; |
1754 | 1793 | ||
1755 | port = get_ioc4_port(the_port); | 1794 | port = get_ioc4_port(the_port, 0); |
1756 | if (!port) | 1795 | if (!port) |
1757 | return -1; | 1796 | return -1; |
1758 | 1797 | ||
@@ -1760,6 +1799,9 @@ static inline int ic4_startup_local(struct uart_port *the_port) | |||
1760 | 1799 | ||
1761 | local_open(port); | 1800 | local_open(port); |
1762 | 1801 | ||
1802 | /* set the protocol - mapbase has the port type */ | ||
1803 | ioc4_set_proto(port, the_port->mapbase); | ||
1804 | |||
1763 | /* set the speed of the serial port */ | 1805 | /* set the speed of the serial port */ |
1764 | ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0); | 1806 | ioc4_change_speed(the_port, info->tty->termios, (struct termios *)0); |
1765 | 1807 | ||
@@ -1768,17 +1810,17 @@ static inline int ic4_startup_local(struct uart_port *the_port) | |||
1768 | 1810 | ||
1769 | /* | 1811 | /* |
1770 | * ioc4_cb_output_lowat - called when the output low water mark is hit | 1812 | * ioc4_cb_output_lowat - called when the output low water mark is hit |
1771 | * @port: port to output | 1813 | * @the_port: port to output |
1772 | */ | 1814 | */ |
1773 | static void ioc4_cb_output_lowat(struct ioc4_port *port) | 1815 | static void ioc4_cb_output_lowat(struct uart_port *the_port) |
1774 | { | 1816 | { |
1775 | unsigned long pflags; | 1817 | unsigned long pflags; |
1776 | 1818 | ||
1777 | /* ip_lock is set on the call here */ | 1819 | /* ip_lock is set on the call here */ |
1778 | if (port->ip_port) { | 1820 | if (the_port) { |
1779 | spin_lock_irqsave(&port->ip_port->lock, pflags); | 1821 | spin_lock_irqsave(&the_port->lock, pflags); |
1780 | transmit_chars(port->ip_port); | 1822 | transmit_chars(the_port); |
1781 | spin_unlock_irqrestore(&port->ip_port->lock, pflags); | 1823 | spin_unlock_irqrestore(&the_port->lock, pflags); |
1782 | } | 1824 | } |
1783 | } | 1825 | } |
1784 | 1826 | ||
@@ -1923,7 +1965,7 @@ static void handle_intr(void *arg, uint32_t sio_ir) | |||
1923 | &port->ip_mem->sio_ir.raw); | 1965 | &port->ip_mem->sio_ir.raw); |
1924 | 1966 | ||
1925 | if (port->ip_notify & N_OUTPUT_LOWAT) | 1967 | if (port->ip_notify & N_OUTPUT_LOWAT) |
1926 | ioc4_cb_output_lowat(port); | 1968 | ioc4_cb_output_lowat(port->ip_port); |
1927 | } | 1969 | } |
1928 | 1970 | ||
1929 | /* Handle tx_mt. Must come after tx_explicit. */ | 1971 | /* Handle tx_mt. Must come after tx_explicit. */ |
@@ -1936,7 +1978,7 @@ static void handle_intr(void *arg, uint32_t sio_ir) | |||
1936 | * So send the notification now. | 1978 | * So send the notification now. |
1937 | */ | 1979 | */ |
1938 | if (port->ip_notify & N_OUTPUT_LOWAT) { | 1980 | if (port->ip_notify & N_OUTPUT_LOWAT) { |
1939 | ioc4_cb_output_lowat(port); | 1981 | ioc4_cb_output_lowat(port->ip_port); |
1940 | 1982 | ||
1941 | /* We need to reload the sio_ir since the lowat | 1983 | /* We need to reload the sio_ir since the lowat |
1942 | * call may have caused another write to occur, | 1984 | * call may have caused another write to occur, |
@@ -2023,7 +2065,7 @@ static inline int do_read(struct uart_port *the_port, unsigned char *buf, | |||
2023 | int len) | 2065 | int len) |
2024 | { | 2066 | { |
2025 | int prod_ptr, cons_ptr, total; | 2067 | int prod_ptr, cons_ptr, total; |
2026 | struct ioc4_port *port = get_ioc4_port(the_port); | 2068 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
2027 | struct ring *inring; | 2069 | struct ring *inring; |
2028 | struct ring_entry *entry; | 2070 | struct ring_entry *entry; |
2029 | struct hooks *hooks = port->ip_hooks; | 2071 | struct hooks *hooks = port->ip_hooks; |
@@ -2335,17 +2377,27 @@ static void receive_chars(struct uart_port *the_port) | |||
2335 | */ | 2377 | */ |
2336 | static const char *ic4_type(struct uart_port *the_port) | 2378 | static const char *ic4_type(struct uart_port *the_port) |
2337 | { | 2379 | { |
2338 | return "SGI IOC4 Serial"; | 2380 | if (the_port->mapbase == PROTO_RS232) |
2381 | return "SGI IOC4 Serial [rs232]"; | ||
2382 | else | ||
2383 | return "SGI IOC4 Serial [rs422]"; | ||
2339 | } | 2384 | } |
2340 | 2385 | ||
2341 | /** | 2386 | /** |
2342 | * ic4_tx_empty - Is the transmitter empty? We pretend we're always empty | 2387 | * ic4_tx_empty - Is the transmitter empty? |
2343 | * @port: Port to operate on (we ignore since we always return 1) | 2388 | * @port: Port to operate on |
2344 | * | 2389 | * |
2345 | */ | 2390 | */ |
2346 | static unsigned int ic4_tx_empty(struct uart_port *the_port) | 2391 | static unsigned int ic4_tx_empty(struct uart_port *the_port) |
2347 | { | 2392 | { |
2348 | return 1; | 2393 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
2394 | unsigned int ret = 0; | ||
2395 | |||
2396 | if (port_is_active(port, the_port)) { | ||
2397 | if (readl(&port->ip_serial_regs->shadow) & IOC4_SHADOW_TEMT) | ||
2398 | ret = TIOCSER_TEMT; | ||
2399 | } | ||
2400 | return ret; | ||
2349 | } | 2401 | } |
2350 | 2402 | ||
2351 | /** | 2403 | /** |
@@ -2355,6 +2407,10 @@ static unsigned int ic4_tx_empty(struct uart_port *the_port) | |||
2355 | */ | 2407 | */ |
2356 | static void ic4_stop_tx(struct uart_port *the_port) | 2408 | static void ic4_stop_tx(struct uart_port *the_port) |
2357 | { | 2409 | { |
2410 | struct ioc4_port *port = get_ioc4_port(the_port, 0); | ||
2411 | |||
2412 | if (port_is_active(port, the_port)) | ||
2413 | set_notification(port, N_OUTPUT_LOWAT, 0); | ||
2358 | } | 2414 | } |
2359 | 2415 | ||
2360 | /** | 2416 | /** |
@@ -2377,11 +2433,12 @@ static void ic4_shutdown(struct uart_port *the_port) | |||
2377 | struct ioc4_port *port; | 2433 | struct ioc4_port *port; |
2378 | struct uart_info *info; | 2434 | struct uart_info *info; |
2379 | 2435 | ||
2380 | port = get_ioc4_port(the_port); | 2436 | port = get_ioc4_port(the_port, 0); |
2381 | if (!port) | 2437 | if (!port) |
2382 | return; | 2438 | return; |
2383 | 2439 | ||
2384 | info = the_port->info; | 2440 | info = the_port->info; |
2441 | port->ip_port = NULL; | ||
2385 | 2442 | ||
2386 | wake_up_interruptible(&info->delta_msr_wait); | 2443 | wake_up_interruptible(&info->delta_msr_wait); |
2387 | 2444 | ||
@@ -2390,6 +2447,7 @@ static void ic4_shutdown(struct uart_port *the_port) | |||
2390 | 2447 | ||
2391 | spin_lock_irqsave(&the_port->lock, port_flags); | 2448 | spin_lock_irqsave(&the_port->lock, port_flags); |
2392 | set_notification(port, N_ALL, 0); | 2449 | set_notification(port, N_ALL, 0); |
2450 | port->ip_flags = PORT_INACTIVE; | ||
2393 | spin_unlock_irqrestore(&the_port->lock, port_flags); | 2451 | spin_unlock_irqrestore(&the_port->lock, port_flags); |
2394 | } | 2452 | } |
2395 | 2453 | ||
@@ -2402,6 +2460,11 @@ static void ic4_shutdown(struct uart_port *the_port) | |||
2402 | static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl) | 2460 | static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl) |
2403 | { | 2461 | { |
2404 | unsigned char mcr = 0; | 2462 | unsigned char mcr = 0; |
2463 | struct ioc4_port *port; | ||
2464 | |||
2465 | port = get_ioc4_port(the_port, 0); | ||
2466 | if (!port_is_active(port, the_port)) | ||
2467 | return; | ||
2405 | 2468 | ||
2406 | if (mctrl & TIOCM_RTS) | 2469 | if (mctrl & TIOCM_RTS) |
2407 | mcr |= UART_MCR_RTS; | 2470 | mcr |= UART_MCR_RTS; |
@@ -2414,7 +2477,7 @@ static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl) | |||
2414 | if (mctrl & TIOCM_LOOP) | 2477 | if (mctrl & TIOCM_LOOP) |
2415 | mcr |= UART_MCR_LOOP; | 2478 | mcr |= UART_MCR_LOOP; |
2416 | 2479 | ||
2417 | set_mcr(the_port, 1, mcr, IOC4_SHADOW_DTR); | 2480 | set_mcr(the_port, mcr, IOC4_SHADOW_DTR); |
2418 | } | 2481 | } |
2419 | 2482 | ||
2420 | /** | 2483 | /** |
@@ -2424,11 +2487,11 @@ static void ic4_set_mctrl(struct uart_port *the_port, unsigned int mctrl) | |||
2424 | */ | 2487 | */ |
2425 | static unsigned int ic4_get_mctrl(struct uart_port *the_port) | 2488 | static unsigned int ic4_get_mctrl(struct uart_port *the_port) |
2426 | { | 2489 | { |
2427 | struct ioc4_port *port = get_ioc4_port(the_port); | 2490 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
2428 | uint32_t shadow; | 2491 | uint32_t shadow; |
2429 | unsigned int ret = 0; | 2492 | unsigned int ret = 0; |
2430 | 2493 | ||
2431 | if (!port) | 2494 | if (!port_is_active(port, the_port)) |
2432 | return 0; | 2495 | return 0; |
2433 | 2496 | ||
2434 | shadow = readl(&port->ip_serial_regs->shadow); | 2497 | shadow = readl(&port->ip_serial_regs->shadow); |
@@ -2448,9 +2511,9 @@ static unsigned int ic4_get_mctrl(struct uart_port *the_port) | |||
2448 | */ | 2511 | */ |
2449 | static void ic4_start_tx(struct uart_port *the_port) | 2512 | static void ic4_start_tx(struct uart_port *the_port) |
2450 | { | 2513 | { |
2451 | struct ioc4_port *port = get_ioc4_port(the_port); | 2514 | struct ioc4_port *port = get_ioc4_port(the_port, 0); |
2452 | 2515 | ||
2453 | if (port) { | 2516 | if (port_is_active(port, the_port)) { |
2454 | set_notification(port, N_OUTPUT_LOWAT, 1); | 2517 | set_notification(port, N_OUTPUT_LOWAT, 1); |
2455 | enable_intrs(port, port->ip_hooks->intr_tx_mt); | 2518 | enable_intrs(port, port->ip_hooks->intr_tx_mt); |
2456 | } | 2519 | } |
@@ -2467,7 +2530,7 @@ static void ic4_break_ctl(struct uart_port *the_port, int break_state) | |||
2467 | } | 2530 | } |
2468 | 2531 | ||
2469 | /** | 2532 | /** |
2470 | * ic4_startup - Start up the serial port - always return 0 (We're always on) | 2533 | * ic4_startup - Start up the serial port |
2471 | * @port: Port to operate on | 2534 | * @port: Port to operate on |
2472 | * | 2535 | * |
2473 | */ | 2536 | */ |
@@ -2479,17 +2542,16 @@ static int ic4_startup(struct uart_port *the_port) | |||
2479 | struct uart_info *info; | 2542 | struct uart_info *info; |
2480 | unsigned long port_flags; | 2543 | unsigned long port_flags; |
2481 | 2544 | ||
2482 | if (!the_port) { | 2545 | if (!the_port) |
2483 | return -ENODEV; | 2546 | return -ENODEV; |
2484 | } | 2547 | port = get_ioc4_port(the_port, 1); |
2485 | port = get_ioc4_port(the_port); | 2548 | if (!port) |
2486 | if (!port) { | ||
2487 | return -ENODEV; | 2549 | return -ENODEV; |
2488 | } | ||
2489 | info = the_port->info; | 2550 | info = the_port->info; |
2490 | 2551 | ||
2491 | control = port->ip_control; | 2552 | control = port->ip_control; |
2492 | if (!control) { | 2553 | if (!control) { |
2554 | port->ip_port = NULL; | ||
2493 | return -ENODEV; | 2555 | return -ENODEV; |
2494 | } | 2556 | } |
2495 | 2557 | ||
@@ -2551,28 +2613,104 @@ static struct uart_ops ioc4_ops = { | |||
2551 | * Boot-time initialization code | 2613 | * Boot-time initialization code |
2552 | */ | 2614 | */ |
2553 | 2615 | ||
2554 | static struct uart_driver ioc4_uart = { | 2616 | static struct uart_driver ioc4_uart_rs232 = { |
2555 | .owner = THIS_MODULE, | 2617 | .owner = THIS_MODULE, |
2556 | .driver_name = "ioc4_serial", | 2618 | .driver_name = "ioc4_serial_rs232", |
2557 | .dev_name = DEVICE_NAME, | 2619 | .dev_name = DEVICE_NAME_RS232, |
2558 | .major = DEVICE_MAJOR, | 2620 | .major = DEVICE_MAJOR, |
2559 | .minor = DEVICE_MINOR, | 2621 | .minor = DEVICE_MINOR_RS232, |
2560 | .nr = IOC4_NUM_CARDS * IOC4_NUM_SERIAL_PORTS, | 2622 | .nr = IOC4_NUM_CARDS * IOC4_NUM_SERIAL_PORTS, |
2561 | }; | 2623 | }; |
2562 | 2624 | ||
2625 | static struct uart_driver ioc4_uart_rs422 = { | ||
2626 | .owner = THIS_MODULE, | ||
2627 | .driver_name = "ioc4_serial_rs422", | ||
2628 | .dev_name = DEVICE_NAME_RS422, | ||
2629 | .major = DEVICE_MAJOR, | ||
2630 | .minor = DEVICE_MINOR_RS422, | ||
2631 | .nr = IOC4_NUM_CARDS * IOC4_NUM_SERIAL_PORTS, | ||
2632 | }; | ||
2633 | |||
2634 | |||
2563 | /** | 2635 | /** |
2564 | * ioc4_serial_core_attach - register with serial core | 2636 | * ioc4_serial_remove_one - detach function |
2637 | * | ||
2638 | * @idd: IOC4 master module data for this IOC4 | ||
2639 | */ | ||
2640 | |||
2641 | static int ioc4_serial_remove_one(struct ioc4_driver_data *idd) | ||
2642 | { | ||
2643 | int port_num, port_type; | ||
2644 | struct ioc4_control *control; | ||
2645 | struct uart_port *the_port; | ||
2646 | struct ioc4_port *port; | ||
2647 | struct ioc4_soft *soft; | ||
2648 | |||
2649 | control = idd->idd_serial_data; | ||
2650 | |||
2651 | for (port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS; port_num++) { | ||
2652 | for (port_type = UART_PORT_MIN; | ||
2653 | port_type < UART_PORT_COUNT; | ||
2654 | port_type++) { | ||
2655 | the_port = &control->ic_port[port_num].icp_uart_port | ||
2656 | [port_type]; | ||
2657 | if (the_port) { | ||
2658 | switch (port_type) { | ||
2659 | case UART_PORT_RS422: | ||
2660 | uart_remove_one_port(&ioc4_uart_rs422, | ||
2661 | the_port); | ||
2662 | break; | ||
2663 | default: | ||
2664 | case UART_PORT_RS232: | ||
2665 | uart_remove_one_port(&ioc4_uart_rs232, | ||
2666 | the_port); | ||
2667 | break; | ||
2668 | } | ||
2669 | } | ||
2670 | } | ||
2671 | port = control->ic_port[port_num].icp_port; | ||
2672 | /* we allocate in pairs */ | ||
2673 | if (!(port_num & 1) && port) { | ||
2674 | pci_free_consistent(port->ip_pdev, | ||
2675 | TOTAL_RING_BUF_SIZE, | ||
2676 | port->ip_cpu_ringbuf, | ||
2677 | port->ip_dma_ringbuf); | ||
2678 | kfree(port); | ||
2679 | } | ||
2680 | } | ||
2681 | soft = control->ic_soft; | ||
2682 | if (soft) { | ||
2683 | free_irq(control->ic_irq, soft); | ||
2684 | if (soft->is_ioc4_serial_addr) { | ||
2685 | release_region((unsigned long) | ||
2686 | soft->is_ioc4_serial_addr, | ||
2687 | sizeof(struct ioc4_serial)); | ||
2688 | } | ||
2689 | kfree(soft); | ||
2690 | } | ||
2691 | kfree(control); | ||
2692 | idd->idd_serial_data = NULL; | ||
2693 | |||
2694 | return 0; | ||
2695 | } | ||
2696 | |||
2697 | |||
2698 | /** | ||
2699 | * ioc4_serial_core_attach_rs232 - register with serial core | ||
2565 | * This is done during pci probing | 2700 | * This is done during pci probing |
2566 | * @pdev: handle for this card | 2701 | * @pdev: handle for this card |
2567 | */ | 2702 | */ |
2568 | static inline int | 2703 | static inline int |
2569 | ioc4_serial_core_attach(struct pci_dev *pdev) | 2704 | ioc4_serial_core_attach(struct pci_dev *pdev, int port_type) |
2570 | { | 2705 | { |
2571 | struct ioc4_port *port; | 2706 | struct ioc4_port *port; |
2572 | struct uart_port *the_port; | 2707 | struct uart_port *the_port; |
2573 | struct ioc4_driver_data *idd = pci_get_drvdata(pdev); | 2708 | struct ioc4_driver_data *idd = pci_get_drvdata(pdev); |
2574 | struct ioc4_control *control = idd->idd_serial_data; | 2709 | struct ioc4_control *control = idd->idd_serial_data; |
2575 | int ii; | 2710 | int port_num; |
2711 | int port_type_idx; | ||
2712 | struct uart_driver *u_driver; | ||
2713 | |||
2576 | 2714 | ||
2577 | DPRINT_CONFIG(("%s: attach pdev 0x%p - control 0x%p\n", | 2715 | DPRINT_CONFIG(("%s: attach pdev 0x%p - control 0x%p\n", |
2578 | __FUNCTION__, pdev, (void *)control)); | 2716 | __FUNCTION__, pdev, (void *)control)); |
@@ -2580,28 +2718,36 @@ ioc4_serial_core_attach(struct pci_dev *pdev) | |||
2580 | if (!control) | 2718 | if (!control) |
2581 | return -ENODEV; | 2719 | return -ENODEV; |
2582 | 2720 | ||
2721 | port_type_idx = (port_type == PROTO_RS232) ? UART_PORT_RS232 | ||
2722 | : UART_PORT_RS422; | ||
2723 | |||
2724 | u_driver = (port_type == PROTO_RS232) ? &ioc4_uart_rs232 | ||
2725 | : &ioc4_uart_rs422; | ||
2726 | |||
2583 | /* once around for each port on this card */ | 2727 | /* once around for each port on this card */ |
2584 | for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++) { | 2728 | for (port_num = 0; port_num < IOC4_NUM_SERIAL_PORTS; port_num++) { |
2585 | the_port = &control->ic_port[ii].icp_uart_port; | 2729 | the_port = &control->ic_port[port_num].icp_uart_port |
2586 | port = control->ic_port[ii].icp_port; | 2730 | [port_type_idx]; |
2587 | port->ip_port = the_port; | 2731 | port = control->ic_port[port_num].icp_port; |
2732 | port->ip_all_ports[port_type_idx] = the_port; | ||
2588 | 2733 | ||
2589 | DPRINT_CONFIG(("%s: attach the_port 0x%p / port 0x%p\n", | 2734 | DPRINT_CONFIG(("%s: attach the_port 0x%p / port 0x%p : type %s\n", |
2590 | __FUNCTION__, (void *)the_port, | 2735 | __FUNCTION__, (void *)the_port, |
2591 | (void *)port)); | 2736 | (void *)port, |
2737 | port_type == PROTO_RS232 ? "rs232" : "rs422")); | ||
2592 | 2738 | ||
2593 | /* membase, iobase and mapbase just need to be non-0 */ | 2739 | /* membase, iobase and mapbase just need to be non-0 */ |
2594 | the_port->membase = (unsigned char __iomem *)1; | 2740 | the_port->membase = (unsigned char __iomem *)1; |
2595 | the_port->iobase = (pdev->bus->number << 16) | ii; | 2741 | the_port->iobase = (pdev->bus->number << 16) | port_num; |
2596 | the_port->line = (Num_of_ioc4_cards << 2) | ii; | 2742 | the_port->line = (Num_of_ioc4_cards << 2) | port_num; |
2597 | the_port->mapbase = 1; | 2743 | the_port->mapbase = port_type; |
2598 | the_port->type = PORT_16550A; | 2744 | the_port->type = PORT_16550A; |
2599 | the_port->fifosize = IOC4_FIFO_CHARS; | 2745 | the_port->fifosize = IOC4_FIFO_CHARS; |
2600 | the_port->ops = &ioc4_ops; | 2746 | the_port->ops = &ioc4_ops; |
2601 | the_port->irq = control->ic_irq; | 2747 | the_port->irq = control->ic_irq; |
2602 | the_port->dev = &pdev->dev; | 2748 | the_port->dev = &pdev->dev; |
2603 | spin_lock_init(&the_port->lock); | 2749 | spin_lock_init(&the_port->lock); |
2604 | if (uart_add_one_port(&ioc4_uart, the_port) < 0) { | 2750 | if (uart_add_one_port(u_driver, the_port) < 0) { |
2605 | printk(KERN_WARNING | 2751 | printk(KERN_WARNING |
2606 | "%s: unable to add port %d bus %d\n", | 2752 | "%s: unable to add port %d bus %d\n", |
2607 | __FUNCTION__, the_port->line, pdev->bus->number); | 2753 | __FUNCTION__, the_port->line, pdev->bus->number); |
@@ -2610,8 +2756,6 @@ ioc4_serial_core_attach(struct pci_dev *pdev) | |||
2610 | ("IOC4 serial port %d irq = %d, bus %d\n", | 2756 | ("IOC4 serial port %d irq = %d, bus %d\n", |
2611 | the_port->line, the_port->irq, pdev->bus->number)); | 2757 | the_port->line, the_port->irq, pdev->bus->number)); |
2612 | } | 2758 | } |
2613 | /* all ports are rs232 for now */ | ||
2614 | ioc4_set_proto(port, PROTO_RS232); | ||
2615 | } | 2759 | } |
2616 | return 0; | 2760 | return 0; |
2617 | } | 2761 | } |
@@ -2631,7 +2775,8 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) | |||
2631 | int ret = 0; | 2775 | int ret = 0; |
2632 | 2776 | ||
2633 | 2777 | ||
2634 | DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, idd->idd_pdev, idd->idd_pci_id)); | 2778 | DPRINT_CONFIG(("%s (0x%p, 0x%p)\n", __FUNCTION__, idd->idd_pdev, |
2779 | idd->idd_pci_id)); | ||
2635 | 2780 | ||
2636 | /* request serial registers */ | 2781 | /* request serial registers */ |
2637 | tmp_addr1 = idd->idd_bar0 + IOC4_SERIAL_OFFSET; | 2782 | tmp_addr1 = idd->idd_bar0 + IOC4_SERIAL_OFFSET; |
@@ -2653,11 +2798,11 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) | |||
2653 | goto out2; | 2798 | goto out2; |
2654 | } | 2799 | } |
2655 | DPRINT_CONFIG(("%s : mem 0x%p, serial 0x%p\n", | 2800 | DPRINT_CONFIG(("%s : mem 0x%p, serial 0x%p\n", |
2656 | __FUNCTION__, (void *)idd->idd_misc_regs, (void *)serial)); | 2801 | __FUNCTION__, (void *)idd->idd_misc_regs, |
2802 | (void *)serial)); | ||
2657 | 2803 | ||
2658 | /* Get memory for the new card */ | 2804 | /* Get memory for the new card */ |
2659 | control = kmalloc(sizeof(struct ioc4_control) * IOC4_NUM_SERIAL_PORTS, | 2805 | control = kmalloc(sizeof(struct ioc4_control), GFP_KERNEL); |
2660 | GFP_KERNEL); | ||
2661 | 2806 | ||
2662 | if (!control) { | 2807 | if (!control) { |
2663 | printk(KERN_WARNING "ioc4_attach_one" | 2808 | printk(KERN_WARNING "ioc4_attach_one" |
@@ -2702,7 +2847,7 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) | |||
2702 | 2847 | ||
2703 | /* Hook up interrupt handler */ | 2848 | /* Hook up interrupt handler */ |
2704 | if (!request_irq(idd->idd_pdev->irq, ioc4_intr, SA_SHIRQ, | 2849 | if (!request_irq(idd->idd_pdev->irq, ioc4_intr, SA_SHIRQ, |
2705 | "sgi-ioc4serial", (void *)soft)) { | 2850 | "sgi-ioc4serial", soft)) { |
2706 | control->ic_irq = idd->idd_pdev->irq; | 2851 | control->ic_irq = idd->idd_pdev->irq; |
2707 | } else { | 2852 | } else { |
2708 | printk(KERN_WARNING | 2853 | printk(KERN_WARNING |
@@ -2713,16 +2858,21 @@ ioc4_serial_attach_one(struct ioc4_driver_data *idd) | |||
2713 | if (ret) | 2858 | if (ret) |
2714 | goto out4; | 2859 | goto out4; |
2715 | 2860 | ||
2716 | /* register port with the serial core */ | 2861 | /* register port with the serial core - 1 rs232, 1 rs422 */ |
2717 | 2862 | ||
2718 | if ((ret = ioc4_serial_core_attach(idd->idd_pdev))) | 2863 | if ((ret = ioc4_serial_core_attach(idd->idd_pdev, PROTO_RS232))) |
2719 | goto out4; | 2864 | goto out4; |
2720 | 2865 | ||
2866 | if ((ret = ioc4_serial_core_attach(idd->idd_pdev, PROTO_RS422))) | ||
2867 | goto out5; | ||
2868 | |||
2721 | Num_of_ioc4_cards++; | 2869 | Num_of_ioc4_cards++; |
2722 | 2870 | ||
2723 | return ret; | 2871 | return ret; |
2724 | 2872 | ||
2725 | /* error exits that give back resources */ | 2873 | /* error exits that give back resources */ |
2874 | out5: | ||
2875 | ioc4_serial_remove_one(idd); | ||
2726 | out4: | 2876 | out4: |
2727 | kfree(soft); | 2877 | kfree(soft); |
2728 | out3: | 2878 | out3: |
@@ -2735,52 +2885,6 @@ out1: | |||
2735 | } | 2885 | } |
2736 | 2886 | ||
2737 | 2887 | ||
2738 | /** | ||
2739 | * ioc4_serial_remove_one - detach function | ||
2740 | * | ||
2741 | * @idd: IOC4 master module data for this IOC4 | ||
2742 | */ | ||
2743 | |||
2744 | int ioc4_serial_remove_one(struct ioc4_driver_data *idd) | ||
2745 | { | ||
2746 | int ii; | ||
2747 | struct ioc4_control *control; | ||
2748 | struct uart_port *the_port; | ||
2749 | struct ioc4_port *port; | ||
2750 | struct ioc4_soft *soft; | ||
2751 | |||
2752 | control = idd->idd_serial_data; | ||
2753 | |||
2754 | for (ii = 0; ii < IOC4_NUM_SERIAL_PORTS; ii++) { | ||
2755 | the_port = &control->ic_port[ii].icp_uart_port; | ||
2756 | if (the_port) { | ||
2757 | uart_remove_one_port(&ioc4_uart, the_port); | ||
2758 | } | ||
2759 | port = control->ic_port[ii].icp_port; | ||
2760 | if (!(ii & 1) && port) { | ||
2761 | pci_free_consistent(port->ip_pdev, | ||
2762 | TOTAL_RING_BUF_SIZE, | ||
2763 | (void *)port->ip_cpu_ringbuf, | ||
2764 | port->ip_dma_ringbuf); | ||
2765 | kfree(port); | ||
2766 | } | ||
2767 | } | ||
2768 | soft = control->ic_soft; | ||
2769 | if (soft) { | ||
2770 | free_irq(control->ic_irq, (void *)soft); | ||
2771 | if (soft->is_ioc4_serial_addr) { | ||
2772 | release_region((unsigned long) | ||
2773 | soft->is_ioc4_serial_addr, | ||
2774 | sizeof(struct ioc4_serial)); | ||
2775 | } | ||
2776 | kfree(soft); | ||
2777 | } | ||
2778 | kfree(control); | ||
2779 | idd->idd_serial_data = NULL; | ||
2780 | |||
2781 | return 0; | ||
2782 | } | ||
2783 | |||
2784 | static struct ioc4_submodule ioc4_serial_submodule = { | 2888 | static struct ioc4_submodule ioc4_serial_submodule = { |
2785 | .is_name = "IOC4_serial", | 2889 | .is_name = "IOC4_serial", |
2786 | .is_owner = THIS_MODULE, | 2890 | .is_owner = THIS_MODULE, |
@@ -2796,9 +2900,15 @@ int ioc4_serial_init(void) | |||
2796 | int ret; | 2900 | int ret; |
2797 | 2901 | ||
2798 | /* register with serial core */ | 2902 | /* register with serial core */ |
2799 | if ((ret = uart_register_driver(&ioc4_uart)) < 0) { | 2903 | if ((ret = uart_register_driver(&ioc4_uart_rs232)) < 0) { |
2904 | printk(KERN_WARNING | ||
2905 | "%s: Couldn't register rs232 IOC4 serial driver\n", | ||
2906 | __FUNCTION__); | ||
2907 | return ret; | ||
2908 | } | ||
2909 | if ((ret = uart_register_driver(&ioc4_uart_rs422)) < 0) { | ||
2800 | printk(KERN_WARNING | 2910 | printk(KERN_WARNING |
2801 | "%s: Couldn't register IOC4 serial driver\n", | 2911 | "%s: Couldn't register rs422 IOC4 serial driver\n", |
2802 | __FUNCTION__); | 2912 | __FUNCTION__); |
2803 | return ret; | 2913 | return ret; |
2804 | } | 2914 | } |
@@ -2810,7 +2920,8 @@ int ioc4_serial_init(void) | |||
2810 | static void __devexit ioc4_serial_exit(void) | 2920 | static void __devexit ioc4_serial_exit(void) |
2811 | { | 2921 | { |
2812 | ioc4_unregister_submodule(&ioc4_serial_submodule); | 2922 | ioc4_unregister_submodule(&ioc4_serial_submodule); |
2813 | uart_unregister_driver(&ioc4_uart); | 2923 | uart_unregister_driver(&ioc4_uart_rs232); |
2924 | uart_unregister_driver(&ioc4_uart_rs422); | ||
2814 | } | 2925 | } |
2815 | 2926 | ||
2816 | module_init(ioc4_serial_init); | 2927 | module_init(ioc4_serial_init); |
diff --git a/drivers/serial/mpsc.c b/drivers/serial/mpsc.c index 0ca83ac31d07..94681922ea0a 100644 --- a/drivers/serial/mpsc.c +++ b/drivers/serial/mpsc.c | |||
@@ -1,6 +1,4 @@ | |||
1 | /* | 1 | /* |
2 | * drivers/serial/mpsc.c | ||
3 | * | ||
4 | * Generic driver for the MPSC (UART mode) on Marvell parts (e.g., GT64240, | 2 | * Generic driver for the MPSC (UART mode) on Marvell parts (e.g., GT64240, |
5 | * GT64260, MV64340, MV64360, GT96100, ... ). | 3 | * GT64260, MV64340, MV64360, GT96100, ... ). |
6 | * | 4 | * |
@@ -52,9 +50,263 @@ | |||
52 | * 4) AFAICT, hardware flow control isn't supported by the controller --MAG. | 50 | * 4) AFAICT, hardware flow control isn't supported by the controller --MAG. |
53 | */ | 51 | */ |
54 | 52 | ||
53 | #include <linux/config.h> | ||
54 | |||
55 | #if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | ||
56 | #define SUPPORT_SYSRQ | ||
57 | #endif | ||
58 | |||
59 | #include <linux/module.h> | ||
60 | #include <linux/moduleparam.h> | ||
61 | #include <linux/tty.h> | ||
62 | #include <linux/tty_flip.h> | ||
63 | #include <linux/ioport.h> | ||
64 | #include <linux/init.h> | ||
65 | #include <linux/console.h> | ||
66 | #include <linux/sysrq.h> | ||
67 | #include <linux/serial.h> | ||
68 | #include <linux/serial_core.h> | ||
69 | #include <linux/delay.h> | ||
70 | #include <linux/device.h> | ||
71 | #include <linux/dma-mapping.h> | ||
72 | #include <linux/mv643xx.h> | ||
55 | #include <linux/platform_device.h> | 73 | #include <linux/platform_device.h> |
56 | 74 | ||
57 | #include "mpsc.h" | 75 | #include <asm/io.h> |
76 | #include <asm/irq.h> | ||
77 | |||
78 | #if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | ||
79 | #define SUPPORT_SYSRQ | ||
80 | #endif | ||
81 | |||
82 | #define MPSC_NUM_CTLRS 2 | ||
83 | |||
84 | /* | ||
85 | * Descriptors and buffers must be cache line aligned. | ||
86 | * Buffers lengths must be multiple of cache line size. | ||
87 | * Number of Tx & Rx descriptors must be powers of 2. | ||
88 | */ | ||
89 | #define MPSC_RXR_ENTRIES 32 | ||
90 | #define MPSC_RXRE_SIZE dma_get_cache_alignment() | ||
91 | #define MPSC_RXR_SIZE (MPSC_RXR_ENTRIES * MPSC_RXRE_SIZE) | ||
92 | #define MPSC_RXBE_SIZE dma_get_cache_alignment() | ||
93 | #define MPSC_RXB_SIZE (MPSC_RXR_ENTRIES * MPSC_RXBE_SIZE) | ||
94 | |||
95 | #define MPSC_TXR_ENTRIES 32 | ||
96 | #define MPSC_TXRE_SIZE dma_get_cache_alignment() | ||
97 | #define MPSC_TXR_SIZE (MPSC_TXR_ENTRIES * MPSC_TXRE_SIZE) | ||
98 | #define MPSC_TXBE_SIZE dma_get_cache_alignment() | ||
99 | #define MPSC_TXB_SIZE (MPSC_TXR_ENTRIES * MPSC_TXBE_SIZE) | ||
100 | |||
101 | #define MPSC_DMA_ALLOC_SIZE (MPSC_RXR_SIZE + MPSC_RXB_SIZE + \ | ||
102 | MPSC_TXR_SIZE + MPSC_TXB_SIZE + \ | ||
103 | dma_get_cache_alignment() /* for alignment */) | ||
104 | |||
105 | /* Rx and Tx Ring entry descriptors -- assume entry size is <= cacheline size */ | ||
106 | struct mpsc_rx_desc { | ||
107 | u16 bufsize; | ||
108 | u16 bytecnt; | ||
109 | u32 cmdstat; | ||
110 | u32 link; | ||
111 | u32 buf_ptr; | ||
112 | } __attribute((packed)); | ||
113 | |||
114 | struct mpsc_tx_desc { | ||
115 | u16 bytecnt; | ||
116 | u16 shadow; | ||
117 | u32 cmdstat; | ||
118 | u32 link; | ||
119 | u32 buf_ptr; | ||
120 | } __attribute((packed)); | ||
121 | |||
122 | /* | ||
123 | * Some regs that have the erratum that you can't read them are are shared | ||
124 | * between the two MPSC controllers. This struct contains those shared regs. | ||
125 | */ | ||
126 | struct mpsc_shared_regs { | ||
127 | phys_addr_t mpsc_routing_base_p; | ||
128 | phys_addr_t sdma_intr_base_p; | ||
129 | |||
130 | void __iomem *mpsc_routing_base; | ||
131 | void __iomem *sdma_intr_base; | ||
132 | |||
133 | u32 MPSC_MRR_m; | ||
134 | u32 MPSC_RCRR_m; | ||
135 | u32 MPSC_TCRR_m; | ||
136 | u32 SDMA_INTR_CAUSE_m; | ||
137 | u32 SDMA_INTR_MASK_m; | ||
138 | }; | ||
139 | |||
140 | /* The main driver data structure */ | ||
141 | struct mpsc_port_info { | ||
142 | struct uart_port port; /* Overlay uart_port structure */ | ||
143 | |||
144 | /* Internal driver state for this ctlr */ | ||
145 | u8 ready; | ||
146 | u8 rcv_data; | ||
147 | tcflag_t c_iflag; /* save termios->c_iflag */ | ||
148 | tcflag_t c_cflag; /* save termios->c_cflag */ | ||
149 | |||
150 | /* Info passed in from platform */ | ||
151 | u8 mirror_regs; /* Need to mirror regs? */ | ||
152 | u8 cache_mgmt; /* Need manual cache mgmt? */ | ||
153 | u8 brg_can_tune; /* BRG has baud tuning? */ | ||
154 | u32 brg_clk_src; | ||
155 | u16 mpsc_max_idle; | ||
156 | int default_baud; | ||
157 | int default_bits; | ||
158 | int default_parity; | ||
159 | int default_flow; | ||
160 | |||
161 | /* Physical addresses of various blocks of registers (from platform) */ | ||
162 | phys_addr_t mpsc_base_p; | ||
163 | phys_addr_t sdma_base_p; | ||
164 | phys_addr_t brg_base_p; | ||
165 | |||
166 | /* Virtual addresses of various blocks of registers (from platform) */ | ||
167 | void __iomem *mpsc_base; | ||
168 | void __iomem *sdma_base; | ||
169 | void __iomem *brg_base; | ||
170 | |||
171 | /* Descriptor ring and buffer allocations */ | ||
172 | void *dma_region; | ||
173 | dma_addr_t dma_region_p; | ||
174 | |||
175 | dma_addr_t rxr; /* Rx descriptor ring */ | ||
176 | dma_addr_t rxr_p; /* Phys addr of rxr */ | ||
177 | u8 *rxb; /* Rx Ring I/O buf */ | ||
178 | u8 *rxb_p; /* Phys addr of rxb */ | ||
179 | u32 rxr_posn; /* First desc w/ Rx data */ | ||
180 | |||
181 | dma_addr_t txr; /* Tx descriptor ring */ | ||
182 | dma_addr_t txr_p; /* Phys addr of txr */ | ||
183 | u8 *txb; /* Tx Ring I/O buf */ | ||
184 | u8 *txb_p; /* Phys addr of txb */ | ||
185 | int txr_head; /* Where new data goes */ | ||
186 | int txr_tail; /* Where sent data comes off */ | ||
187 | |||
188 | /* Mirrored values of regs we can't read (if 'mirror_regs' set) */ | ||
189 | u32 MPSC_MPCR_m; | ||
190 | u32 MPSC_CHR_1_m; | ||
191 | u32 MPSC_CHR_2_m; | ||
192 | u32 MPSC_CHR_10_m; | ||
193 | u32 BRG_BCR_m; | ||
194 | struct mpsc_shared_regs *shared_regs; | ||
195 | }; | ||
196 | |||
197 | /* Hooks to platform-specific code */ | ||
198 | int mpsc_platform_register_driver(void); | ||
199 | void mpsc_platform_unregister_driver(void); | ||
200 | |||
201 | /* Hooks back in to mpsc common to be called by platform-specific code */ | ||
202 | struct mpsc_port_info *mpsc_device_probe(int index); | ||
203 | struct mpsc_port_info *mpsc_device_remove(int index); | ||
204 | |||
205 | /* Main MPSC Configuration Register Offsets */ | ||
206 | #define MPSC_MMCRL 0x0000 | ||
207 | #define MPSC_MMCRH 0x0004 | ||
208 | #define MPSC_MPCR 0x0008 | ||
209 | #define MPSC_CHR_1 0x000c | ||
210 | #define MPSC_CHR_2 0x0010 | ||
211 | #define MPSC_CHR_3 0x0014 | ||
212 | #define MPSC_CHR_4 0x0018 | ||
213 | #define MPSC_CHR_5 0x001c | ||
214 | #define MPSC_CHR_6 0x0020 | ||
215 | #define MPSC_CHR_7 0x0024 | ||
216 | #define MPSC_CHR_8 0x0028 | ||
217 | #define MPSC_CHR_9 0x002c | ||
218 | #define MPSC_CHR_10 0x0030 | ||
219 | #define MPSC_CHR_11 0x0034 | ||
220 | |||
221 | #define MPSC_MPCR_FRZ (1 << 9) | ||
222 | #define MPSC_MPCR_CL_5 0 | ||
223 | #define MPSC_MPCR_CL_6 1 | ||
224 | #define MPSC_MPCR_CL_7 2 | ||
225 | #define MPSC_MPCR_CL_8 3 | ||
226 | #define MPSC_MPCR_SBL_1 0 | ||
227 | #define MPSC_MPCR_SBL_2 1 | ||
228 | |||
229 | #define MPSC_CHR_2_TEV (1<<1) | ||
230 | #define MPSC_CHR_2_TA (1<<7) | ||
231 | #define MPSC_CHR_2_TTCS (1<<9) | ||
232 | #define MPSC_CHR_2_REV (1<<17) | ||
233 | #define MPSC_CHR_2_RA (1<<23) | ||
234 | #define MPSC_CHR_2_CRD (1<<25) | ||
235 | #define MPSC_CHR_2_EH (1<<31) | ||
236 | #define MPSC_CHR_2_PAR_ODD 0 | ||
237 | #define MPSC_CHR_2_PAR_SPACE 1 | ||
238 | #define MPSC_CHR_2_PAR_EVEN 2 | ||
239 | #define MPSC_CHR_2_PAR_MARK 3 | ||
240 | |||
241 | /* MPSC Signal Routing */ | ||
242 | #define MPSC_MRR 0x0000 | ||
243 | #define MPSC_RCRR 0x0004 | ||
244 | #define MPSC_TCRR 0x0008 | ||
245 | |||
246 | /* Serial DMA Controller Interface Registers */ | ||
247 | #define SDMA_SDC 0x0000 | ||
248 | #define SDMA_SDCM 0x0008 | ||
249 | #define SDMA_RX_DESC 0x0800 | ||
250 | #define SDMA_RX_BUF_PTR 0x0808 | ||
251 | #define SDMA_SCRDP 0x0810 | ||
252 | #define SDMA_TX_DESC 0x0c00 | ||
253 | #define SDMA_SCTDP 0x0c10 | ||
254 | #define SDMA_SFTDP 0x0c14 | ||
255 | |||
256 | #define SDMA_DESC_CMDSTAT_PE (1<<0) | ||
257 | #define SDMA_DESC_CMDSTAT_CDL (1<<1) | ||
258 | #define SDMA_DESC_CMDSTAT_FR (1<<3) | ||
259 | #define SDMA_DESC_CMDSTAT_OR (1<<6) | ||
260 | #define SDMA_DESC_CMDSTAT_BR (1<<9) | ||
261 | #define SDMA_DESC_CMDSTAT_MI (1<<10) | ||
262 | #define SDMA_DESC_CMDSTAT_A (1<<11) | ||
263 | #define SDMA_DESC_CMDSTAT_AM (1<<12) | ||
264 | #define SDMA_DESC_CMDSTAT_CT (1<<13) | ||
265 | #define SDMA_DESC_CMDSTAT_C (1<<14) | ||
266 | #define SDMA_DESC_CMDSTAT_ES (1<<15) | ||
267 | #define SDMA_DESC_CMDSTAT_L (1<<16) | ||
268 | #define SDMA_DESC_CMDSTAT_F (1<<17) | ||
269 | #define SDMA_DESC_CMDSTAT_P (1<<18) | ||
270 | #define SDMA_DESC_CMDSTAT_EI (1<<23) | ||
271 | #define SDMA_DESC_CMDSTAT_O (1<<31) | ||
272 | |||
273 | #define SDMA_DESC_DFLT (SDMA_DESC_CMDSTAT_O | \ | ||
274 | SDMA_DESC_CMDSTAT_EI) | ||
275 | |||
276 | #define SDMA_SDC_RFT (1<<0) | ||
277 | #define SDMA_SDC_SFM (1<<1) | ||
278 | #define SDMA_SDC_BLMR (1<<6) | ||
279 | #define SDMA_SDC_BLMT (1<<7) | ||
280 | #define SDMA_SDC_POVR (1<<8) | ||
281 | #define SDMA_SDC_RIFB (1<<9) | ||
282 | |||
283 | #define SDMA_SDCM_ERD (1<<7) | ||
284 | #define SDMA_SDCM_AR (1<<15) | ||
285 | #define SDMA_SDCM_STD (1<<16) | ||
286 | #define SDMA_SDCM_TXD (1<<23) | ||
287 | #define SDMA_SDCM_AT (1<<31) | ||
288 | |||
289 | #define SDMA_0_CAUSE_RXBUF (1<<0) | ||
290 | #define SDMA_0_CAUSE_RXERR (1<<1) | ||
291 | #define SDMA_0_CAUSE_TXBUF (1<<2) | ||
292 | #define SDMA_0_CAUSE_TXEND (1<<3) | ||
293 | #define SDMA_1_CAUSE_RXBUF (1<<8) | ||
294 | #define SDMA_1_CAUSE_RXERR (1<<9) | ||
295 | #define SDMA_1_CAUSE_TXBUF (1<<10) | ||
296 | #define SDMA_1_CAUSE_TXEND (1<<11) | ||
297 | |||
298 | #define SDMA_CAUSE_RX_MASK (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR | \ | ||
299 | SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR) | ||
300 | #define SDMA_CAUSE_TX_MASK (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND | \ | ||
301 | SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND) | ||
302 | |||
303 | /* SDMA Interrupt registers */ | ||
304 | #define SDMA_INTR_CAUSE 0x0000 | ||
305 | #define SDMA_INTR_MASK 0x0080 | ||
306 | |||
307 | /* Baud Rate Generator Interface Registers */ | ||
308 | #define BRG_BCR 0x0000 | ||
309 | #define BRG_BTR 0x0004 | ||
58 | 310 | ||
59 | /* | 311 | /* |
60 | * Define how this driver is known to the outside (we've been assigned a | 312 | * Define how this driver is known to the outside (we've been assigned a |
@@ -1165,7 +1417,7 @@ mpsc_startup(struct uart_port *port) | |||
1165 | flag = SA_SHIRQ; | 1417 | flag = SA_SHIRQ; |
1166 | 1418 | ||
1167 | if (request_irq(pi->port.irq, mpsc_sdma_intr, flag, | 1419 | if (request_irq(pi->port.irq, mpsc_sdma_intr, flag, |
1168 | "mpsc/sdma", pi)) | 1420 | "mpsc-sdma", pi)) |
1169 | printk(KERN_ERR "MPSC: Can't get SDMA IRQ %d\n", | 1421 | printk(KERN_ERR "MPSC: Can't get SDMA IRQ %d\n", |
1170 | pi->port.irq); | 1422 | pi->port.irq); |
1171 | 1423 | ||
diff --git a/drivers/serial/mpsc.h b/drivers/serial/mpsc.h deleted file mode 100644 index 678dbcf06c8f..000000000000 --- a/drivers/serial/mpsc.h +++ /dev/null | |||
@@ -1,289 +0,0 @@ | |||
1 | /* | ||
2 | * drivers/serial/mpsc.h | ||
3 | * | ||
4 | * Author: Mark A. Greer <mgreer@mvista.com> | ||
5 | * | ||
6 | * 2004 (c) MontaVista, Software, Inc. This file is licensed under | ||
7 | * the terms of the GNU General Public License version 2. This program | ||
8 | * is licensed "as is" without any warranty of any kind, whether express | ||
9 | * or implied. | ||
10 | */ | ||
11 | |||
12 | #ifndef __MPSC_H__ | ||
13 | #define __MPSC_H__ | ||
14 | |||
15 | #include <linux/config.h> | ||
16 | #include <linux/module.h> | ||
17 | #include <linux/moduleparam.h> | ||
18 | #include <linux/tty.h> | ||
19 | #include <linux/tty_flip.h> | ||
20 | #include <linux/ioport.h> | ||
21 | #include <linux/init.h> | ||
22 | #include <linux/console.h> | ||
23 | #include <linux/sysrq.h> | ||
24 | #include <linux/serial.h> | ||
25 | #include <linux/serial_core.h> | ||
26 | #include <linux/delay.h> | ||
27 | #include <linux/device.h> | ||
28 | #include <linux/dma-mapping.h> | ||
29 | #include <linux/mv643xx.h> | ||
30 | |||
31 | #include <asm/io.h> | ||
32 | #include <asm/irq.h> | ||
33 | |||
34 | #if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ) | ||
35 | #define SUPPORT_SYSRQ | ||
36 | #endif | ||
37 | |||
38 | #define MPSC_NUM_CTLRS 2 | ||
39 | |||
40 | /* | ||
41 | * Descriptors and buffers must be cache line aligned. | ||
42 | * Buffers lengths must be multiple of cache line size. | ||
43 | * Number of Tx & Rx descriptors must be powers of 2. | ||
44 | */ | ||
45 | #define MPSC_RXR_ENTRIES 32 | ||
46 | #define MPSC_RXRE_SIZE dma_get_cache_alignment() | ||
47 | #define MPSC_RXR_SIZE (MPSC_RXR_ENTRIES * MPSC_RXRE_SIZE) | ||
48 | #define MPSC_RXBE_SIZE dma_get_cache_alignment() | ||
49 | #define MPSC_RXB_SIZE (MPSC_RXR_ENTRIES * MPSC_RXBE_SIZE) | ||
50 | |||
51 | #define MPSC_TXR_ENTRIES 32 | ||
52 | #define MPSC_TXRE_SIZE dma_get_cache_alignment() | ||
53 | #define MPSC_TXR_SIZE (MPSC_TXR_ENTRIES * MPSC_TXRE_SIZE) | ||
54 | #define MPSC_TXBE_SIZE dma_get_cache_alignment() | ||
55 | #define MPSC_TXB_SIZE (MPSC_TXR_ENTRIES * MPSC_TXBE_SIZE) | ||
56 | |||
57 | #define MPSC_DMA_ALLOC_SIZE (MPSC_RXR_SIZE + MPSC_RXB_SIZE + \ | ||
58 | MPSC_TXR_SIZE + MPSC_TXB_SIZE + \ | ||
59 | dma_get_cache_alignment() /* for alignment */) | ||
60 | |||
61 | /* Rx and Tx Ring entry descriptors -- assume entry size is <= cacheline size */ | ||
62 | struct mpsc_rx_desc { | ||
63 | u16 bufsize; | ||
64 | u16 bytecnt; | ||
65 | u32 cmdstat; | ||
66 | u32 link; | ||
67 | u32 buf_ptr; | ||
68 | } __attribute((packed)); | ||
69 | |||
70 | struct mpsc_tx_desc { | ||
71 | u16 bytecnt; | ||
72 | u16 shadow; | ||
73 | u32 cmdstat; | ||
74 | u32 link; | ||
75 | u32 buf_ptr; | ||
76 | } __attribute((packed)); | ||
77 | |||
78 | /* | ||
79 | * Some regs that have the erratum that you can't read them are are shared | ||
80 | * between the two MPSC controllers. This struct contains those shared regs. | ||
81 | */ | ||
82 | struct mpsc_shared_regs { | ||
83 | phys_addr_t mpsc_routing_base_p; | ||
84 | phys_addr_t sdma_intr_base_p; | ||
85 | |||
86 | void __iomem *mpsc_routing_base; | ||
87 | void __iomem *sdma_intr_base; | ||
88 | |||
89 | u32 MPSC_MRR_m; | ||
90 | u32 MPSC_RCRR_m; | ||
91 | u32 MPSC_TCRR_m; | ||
92 | u32 SDMA_INTR_CAUSE_m; | ||
93 | u32 SDMA_INTR_MASK_m; | ||
94 | }; | ||
95 | |||
96 | /* The main driver data structure */ | ||
97 | struct mpsc_port_info { | ||
98 | struct uart_port port; /* Overlay uart_port structure */ | ||
99 | |||
100 | /* Internal driver state for this ctlr */ | ||
101 | u8 ready; | ||
102 | u8 rcv_data; | ||
103 | tcflag_t c_iflag; /* save termios->c_iflag */ | ||
104 | tcflag_t c_cflag; /* save termios->c_cflag */ | ||
105 | |||
106 | /* Info passed in from platform */ | ||
107 | u8 mirror_regs; /* Need to mirror regs? */ | ||
108 | u8 cache_mgmt; /* Need manual cache mgmt? */ | ||
109 | u8 brg_can_tune; /* BRG has baud tuning? */ | ||
110 | u32 brg_clk_src; | ||
111 | u16 mpsc_max_idle; | ||
112 | int default_baud; | ||
113 | int default_bits; | ||
114 | int default_parity; | ||
115 | int default_flow; | ||
116 | |||
117 | /* Physical addresses of various blocks of registers (from platform) */ | ||
118 | phys_addr_t mpsc_base_p; | ||
119 | phys_addr_t sdma_base_p; | ||
120 | phys_addr_t brg_base_p; | ||
121 | |||
122 | /* Virtual addresses of various blocks of registers (from platform) */ | ||
123 | void __iomem *mpsc_base; | ||
124 | void __iomem *sdma_base; | ||
125 | void __iomem *brg_base; | ||
126 | |||
127 | /* Descriptor ring and buffer allocations */ | ||
128 | void *dma_region; | ||
129 | dma_addr_t dma_region_p; | ||
130 | |||
131 | dma_addr_t rxr; /* Rx descriptor ring */ | ||
132 | dma_addr_t rxr_p; /* Phys addr of rxr */ | ||
133 | u8 *rxb; /* Rx Ring I/O buf */ | ||
134 | u8 *rxb_p; /* Phys addr of rxb */ | ||
135 | u32 rxr_posn; /* First desc w/ Rx data */ | ||
136 | |||
137 | dma_addr_t txr; /* Tx descriptor ring */ | ||
138 | dma_addr_t txr_p; /* Phys addr of txr */ | ||
139 | u8 *txb; /* Tx Ring I/O buf */ | ||
140 | u8 *txb_p; /* Phys addr of txb */ | ||
141 | int txr_head; /* Where new data goes */ | ||
142 | int txr_tail; /* Where sent data comes off */ | ||
143 | |||
144 | /* Mirrored values of regs we can't read (if 'mirror_regs' set) */ | ||
145 | u32 MPSC_MPCR_m; | ||
146 | u32 MPSC_CHR_1_m; | ||
147 | u32 MPSC_CHR_2_m; | ||
148 | u32 MPSC_CHR_10_m; | ||
149 | u32 BRG_BCR_m; | ||
150 | struct mpsc_shared_regs *shared_regs; | ||
151 | }; | ||
152 | |||
153 | /* Hooks to platform-specific code */ | ||
154 | int mpsc_platform_register_driver(void); | ||
155 | void mpsc_platform_unregister_driver(void); | ||
156 | |||
157 | /* Hooks back in to mpsc common to be called by platform-specific code */ | ||
158 | struct mpsc_port_info *mpsc_device_probe(int index); | ||
159 | struct mpsc_port_info *mpsc_device_remove(int index); | ||
160 | |||
161 | /* | ||
162 | ***************************************************************************** | ||
163 | * | ||
164 | * Multi-Protocol Serial Controller Interface Registers | ||
165 | * | ||
166 | ***************************************************************************** | ||
167 | */ | ||
168 | |||
169 | /* Main Configuratino Register Offsets */ | ||
170 | #define MPSC_MMCRL 0x0000 | ||
171 | #define MPSC_MMCRH 0x0004 | ||
172 | #define MPSC_MPCR 0x0008 | ||
173 | #define MPSC_CHR_1 0x000c | ||
174 | #define MPSC_CHR_2 0x0010 | ||
175 | #define MPSC_CHR_3 0x0014 | ||
176 | #define MPSC_CHR_4 0x0018 | ||
177 | #define MPSC_CHR_5 0x001c | ||
178 | #define MPSC_CHR_6 0x0020 | ||
179 | #define MPSC_CHR_7 0x0024 | ||
180 | #define MPSC_CHR_8 0x0028 | ||
181 | #define MPSC_CHR_9 0x002c | ||
182 | #define MPSC_CHR_10 0x0030 | ||
183 | #define MPSC_CHR_11 0x0034 | ||
184 | |||
185 | #define MPSC_MPCR_FRZ (1 << 9) | ||
186 | #define MPSC_MPCR_CL_5 0 | ||
187 | #define MPSC_MPCR_CL_6 1 | ||
188 | #define MPSC_MPCR_CL_7 2 | ||
189 | #define MPSC_MPCR_CL_8 3 | ||
190 | #define MPSC_MPCR_SBL_1 0 | ||
191 | #define MPSC_MPCR_SBL_2 1 | ||
192 | |||
193 | #define MPSC_CHR_2_TEV (1<<1) | ||
194 | #define MPSC_CHR_2_TA (1<<7) | ||
195 | #define MPSC_CHR_2_TTCS (1<<9) | ||
196 | #define MPSC_CHR_2_REV (1<<17) | ||
197 | #define MPSC_CHR_2_RA (1<<23) | ||
198 | #define MPSC_CHR_2_CRD (1<<25) | ||
199 | #define MPSC_CHR_2_EH (1<<31) | ||
200 | #define MPSC_CHR_2_PAR_ODD 0 | ||
201 | #define MPSC_CHR_2_PAR_SPACE 1 | ||
202 | #define MPSC_CHR_2_PAR_EVEN 2 | ||
203 | #define MPSC_CHR_2_PAR_MARK 3 | ||
204 | |||
205 | /* MPSC Signal Routing */ | ||
206 | #define MPSC_MRR 0x0000 | ||
207 | #define MPSC_RCRR 0x0004 | ||
208 | #define MPSC_TCRR 0x0008 | ||
209 | |||
210 | /* | ||
211 | ***************************************************************************** | ||
212 | * | ||
213 | * Serial DMA Controller Interface Registers | ||
214 | * | ||
215 | ***************************************************************************** | ||
216 | */ | ||
217 | |||
218 | #define SDMA_SDC 0x0000 | ||
219 | #define SDMA_SDCM 0x0008 | ||
220 | #define SDMA_RX_DESC 0x0800 | ||
221 | #define SDMA_RX_BUF_PTR 0x0808 | ||
222 | #define SDMA_SCRDP 0x0810 | ||
223 | #define SDMA_TX_DESC 0x0c00 | ||
224 | #define SDMA_SCTDP 0x0c10 | ||
225 | #define SDMA_SFTDP 0x0c14 | ||
226 | |||
227 | #define SDMA_DESC_CMDSTAT_PE (1<<0) | ||
228 | #define SDMA_DESC_CMDSTAT_CDL (1<<1) | ||
229 | #define SDMA_DESC_CMDSTAT_FR (1<<3) | ||
230 | #define SDMA_DESC_CMDSTAT_OR (1<<6) | ||
231 | #define SDMA_DESC_CMDSTAT_BR (1<<9) | ||
232 | #define SDMA_DESC_CMDSTAT_MI (1<<10) | ||
233 | #define SDMA_DESC_CMDSTAT_A (1<<11) | ||
234 | #define SDMA_DESC_CMDSTAT_AM (1<<12) | ||
235 | #define SDMA_DESC_CMDSTAT_CT (1<<13) | ||
236 | #define SDMA_DESC_CMDSTAT_C (1<<14) | ||
237 | #define SDMA_DESC_CMDSTAT_ES (1<<15) | ||
238 | #define SDMA_DESC_CMDSTAT_L (1<<16) | ||
239 | #define SDMA_DESC_CMDSTAT_F (1<<17) | ||
240 | #define SDMA_DESC_CMDSTAT_P (1<<18) | ||
241 | #define SDMA_DESC_CMDSTAT_EI (1<<23) | ||
242 | #define SDMA_DESC_CMDSTAT_O (1<<31) | ||
243 | |||
244 | #define SDMA_DESC_DFLT (SDMA_DESC_CMDSTAT_O | \ | ||
245 | SDMA_DESC_CMDSTAT_EI) | ||
246 | |||
247 | #define SDMA_SDC_RFT (1<<0) | ||
248 | #define SDMA_SDC_SFM (1<<1) | ||
249 | #define SDMA_SDC_BLMR (1<<6) | ||
250 | #define SDMA_SDC_BLMT (1<<7) | ||
251 | #define SDMA_SDC_POVR (1<<8) | ||
252 | #define SDMA_SDC_RIFB (1<<9) | ||
253 | |||
254 | #define SDMA_SDCM_ERD (1<<7) | ||
255 | #define SDMA_SDCM_AR (1<<15) | ||
256 | #define SDMA_SDCM_STD (1<<16) | ||
257 | #define SDMA_SDCM_TXD (1<<23) | ||
258 | #define SDMA_SDCM_AT (1<<31) | ||
259 | |||
260 | #define SDMA_0_CAUSE_RXBUF (1<<0) | ||
261 | #define SDMA_0_CAUSE_RXERR (1<<1) | ||
262 | #define SDMA_0_CAUSE_TXBUF (1<<2) | ||
263 | #define SDMA_0_CAUSE_TXEND (1<<3) | ||
264 | #define SDMA_1_CAUSE_RXBUF (1<<8) | ||
265 | #define SDMA_1_CAUSE_RXERR (1<<9) | ||
266 | #define SDMA_1_CAUSE_TXBUF (1<<10) | ||
267 | #define SDMA_1_CAUSE_TXEND (1<<11) | ||
268 | |||
269 | #define SDMA_CAUSE_RX_MASK (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR | \ | ||
270 | SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR) | ||
271 | #define SDMA_CAUSE_TX_MASK (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND | \ | ||
272 | SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND) | ||
273 | |||
274 | /* SDMA Interrupt registers */ | ||
275 | #define SDMA_INTR_CAUSE 0x0000 | ||
276 | #define SDMA_INTR_MASK 0x0080 | ||
277 | |||
278 | /* | ||
279 | ***************************************************************************** | ||
280 | * | ||
281 | * Baud Rate Generator Interface Registers | ||
282 | * | ||
283 | ***************************************************************************** | ||
284 | */ | ||
285 | |||
286 | #define BRG_BCR 0x0000 | ||
287 | #define BRG_BTR 0x0004 | ||
288 | |||
289 | #endif /* __MPSC_H__ */ | ||
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index b1222cd4aa46..7fdbc5dad5fd 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -87,8 +87,6 @@ source "drivers/usb/input/Kconfig" | |||
87 | 87 | ||
88 | source "drivers/usb/image/Kconfig" | 88 | source "drivers/usb/image/Kconfig" |
89 | 89 | ||
90 | source "drivers/usb/media/Kconfig" | ||
91 | |||
92 | source "drivers/usb/net/Kconfig" | 90 | source "drivers/usb/net/Kconfig" |
93 | 91 | ||
94 | source "drivers/usb/mon/Kconfig" | 92 | source "drivers/usb/mon/Kconfig" |
diff --git a/drivers/usb/Makefile b/drivers/usb/Makefile index bb36a1c1dbb3..9b7d9769fdcc 100644 --- a/drivers/usb/Makefile +++ b/drivers/usb/Makefile | |||
@@ -35,20 +35,6 @@ obj-$(CONFIG_USB_WACOM) += input/ | |||
35 | obj-$(CONFIG_USB_ACECAD) += input/ | 35 | obj-$(CONFIG_USB_ACECAD) += input/ |
36 | obj-$(CONFIG_USB_XPAD) += input/ | 36 | obj-$(CONFIG_USB_XPAD) += input/ |
37 | 37 | ||
38 | obj-$(CONFIG_USB_DABUSB) += media/ | ||
39 | obj-$(CONFIG_USB_DSBR) += media/ | ||
40 | obj-$(CONFIG_USB_ET61X251) += media/ | ||
41 | obj-$(CONFIG_USB_IBMCAM) += media/ | ||
42 | obj-$(CONFIG_USB_KONICAWC) += media/ | ||
43 | obj-$(CONFIG_USB_OV511) += media/ | ||
44 | obj-$(CONFIG_USB_PWC) += media/ | ||
45 | obj-$(CONFIG_USB_SE401) += media/ | ||
46 | obj-$(CONFIG_USB_SN9C102) += media/ | ||
47 | obj-$(CONFIG_USB_STV680) += media/ | ||
48 | obj-$(CONFIG_USB_VICAM) += media/ | ||
49 | obj-$(CONFIG_USB_W9968CF) += media/ | ||
50 | obj-$(CONFIG_USB_ZC0301) += media/ | ||
51 | |||
52 | obj-$(CONFIG_USB_CATC) += net/ | 38 | obj-$(CONFIG_USB_CATC) += net/ |
53 | obj-$(CONFIG_USB_KAWETH) += net/ | 39 | obj-$(CONFIG_USB_KAWETH) += net/ |
54 | obj-$(CONFIG_USB_PEGASUS) += net/ | 40 | obj-$(CONFIG_USB_PEGASUS) += net/ |
diff --git a/drivers/usb/media/Kconfig b/drivers/usb/media/Kconfig deleted file mode 100644 index 189d40f96be5..000000000000 --- a/drivers/usb/media/Kconfig +++ /dev/null | |||
@@ -1,241 +0,0 @@ | |||
1 | # | ||
2 | # USB Multimedia device configuration | ||
3 | # | ||
4 | comment "USB Multimedia devices" | ||
5 | depends on USB | ||
6 | |||
7 | config USB_DABUSB | ||
8 | tristate "DABUSB driver" | ||
9 | depends on USB | ||
10 | ---help--- | ||
11 | A Digital Audio Broadcasting (DAB) Receiver for USB and Linux | ||
12 | brought to you by the DAB-Team | ||
13 | <http://wwwbode.cs.tum.edu/Par/arch/dab/>. This driver can be taken | ||
14 | as an example for URB-based bulk, control, and isochronous | ||
15 | transactions. URB's are explained in | ||
16 | <file:Documentation/usb/URB.txt>. | ||
17 | |||
18 | To compile this driver as a module, choose M here: the | ||
19 | module will be called dabusb. | ||
20 | |||
21 | comment "Video4Linux support is needed for USB Multimedia device support" | ||
22 | depends on USB && VIDEO_DEV=n | ||
23 | |||
24 | config USB_VICAM | ||
25 | tristate "USB 3com HomeConnect (aka vicam) support (EXPERIMENTAL)" | ||
26 | depends on USB && VIDEO_DEV && EXPERIMENTAL | ||
27 | ---help--- | ||
28 | Say Y here if you have 3com homeconnect camera (vicam). | ||
29 | |||
30 | This driver uses the Video For Linux API. You must say Y or M to | ||
31 | "Video For Linux" (under Multimedia Devices) to use this driver. | ||
32 | Information on this API and pointers to "v4l" programs may be found | ||
33 | at <file:Documentation/video4linux/API.html>. | ||
34 | |||
35 | To compile this driver as a module, choose M here: the | ||
36 | module will be called vicam. | ||
37 | |||
38 | config USB_DSBR | ||
39 | tristate "D-Link USB FM radio support (EXPERIMENTAL)" | ||
40 | depends on USB && VIDEO_DEV && EXPERIMENTAL | ||
41 | ---help--- | ||
42 | Say Y here if you want to connect this type of radio to your | ||
43 | computer's USB port. Note that the audio is not digital, and | ||
44 | you must connect the line out connector to a sound card or a | ||
45 | set of speakers. | ||
46 | |||
47 | This driver uses the Video For Linux API. You must enable | ||
48 | (Y or M in config) Video For Linux (under Character Devices) | ||
49 | to use this driver. Information on this API and pointers to | ||
50 | "v4l" programs may be found at | ||
51 | <file:Documentation/video4linux/API.html>. | ||
52 | |||
53 | To compile this driver as a module, choose M here: the | ||
54 | module will be called dsbr100. | ||
55 | |||
56 | config USB_ET61X251 | ||
57 | tristate "USB ET61X[12]51 PC Camera Controller support" | ||
58 | depends on USB && VIDEO_DEV | ||
59 | ---help--- | ||
60 | Say Y here if you want support for cameras based on Etoms ET61X151 | ||
61 | or ET61X251 PC Camera Controllers. | ||
62 | |||
63 | See <file:Documentation/usb/et61x251.txt> for more informations. | ||
64 | |||
65 | This driver uses the Video For Linux API. You must say Y or M to | ||
66 | "Video For Linux" to use this driver. | ||
67 | |||
68 | To compile this driver as a module, choose M here: the | ||
69 | module will be called et61x251. | ||
70 | |||
71 | config USB_IBMCAM | ||
72 | tristate "USB IBM (Xirlink) C-it Camera support" | ||
73 | depends on USB && VIDEO_DEV | ||
74 | ---help--- | ||
75 | Say Y here if you want to connect a IBM "C-It" camera, also known as | ||
76 | "Xirlink PC Camera" to your computer's USB port. For more | ||
77 | information, read <file:Documentation/usb/ibmcam.txt>. | ||
78 | |||
79 | This driver uses the Video For Linux API. You must enable | ||
80 | (Y or M in config) Video For Linux (under Character Devices) | ||
81 | to use this driver. Information on this API and pointers to | ||
82 | "v4l" programs may be found at | ||
83 | <file:Documentation/video4linux/API.html>. | ||
84 | |||
85 | To compile this driver as a module, choose M here: the | ||
86 | module will be called ibmcam. | ||
87 | |||
88 | This camera has several configuration options which | ||
89 | can be specified when you load the module. Read | ||
90 | <file:Documentation/usb/ibmcam.txt> to learn more. | ||
91 | |||
92 | config USB_KONICAWC | ||
93 | tristate "USB Konica Webcam support" | ||
94 | depends on USB && VIDEO_DEV | ||
95 | ---help--- | ||
96 | Say Y here if you want support for webcams based on a Konica | ||
97 | chipset. This is known to work with the Intel YC76 webcam. | ||
98 | |||
99 | This driver uses the Video For Linux API. You must enable | ||
100 | (Y or M in config) Video For Linux (under Character Devices) | ||
101 | to use this driver. Information on this API and pointers to | ||
102 | "v4l" programs may be found at | ||
103 | <file:Documentation/video4linux/API.html>. | ||
104 | |||
105 | To compile this driver as a module, choose M here: the | ||
106 | module will be called konicawc. | ||
107 | |||
108 | config USB_OV511 | ||
109 | tristate "USB OV511 Camera support" | ||
110 | depends on USB && VIDEO_DEV | ||
111 | ---help--- | ||
112 | Say Y here if you want to connect this type of camera to your | ||
113 | computer's USB port. See <file:Documentation/usb/ov511.txt> for more | ||
114 | information and for a list of supported cameras. | ||
115 | |||
116 | This driver uses the Video For Linux API. You must say Y or M to | ||
117 | "Video For Linux" (under Character Devices) to use this driver. | ||
118 | Information on this API and pointers to "v4l" programs may be found | ||
119 | at <file:Documentation/video4linux/API.html>. | ||
120 | |||
121 | To compile this driver as a module, choose M here: the | ||
122 | module will be called ov511. | ||
123 | |||
124 | config USB_SE401 | ||
125 | tristate "USB SE401 Camera support" | ||
126 | depends on USB && VIDEO_DEV | ||
127 | ---help--- | ||
128 | Say Y here if you want to connect this type of camera to your | ||
129 | computer's USB port. See <file:Documentation/usb/se401.txt> for more | ||
130 | information and for a list of supported cameras. | ||
131 | |||
132 | This driver uses the Video For Linux API. You must say Y or M to | ||
133 | "Video For Linux" (under Multimedia Devices) to use this driver. | ||
134 | Information on this API and pointers to "v4l" programs may be found | ||
135 | at <file:Documentation/video4linux/API.html>. | ||
136 | |||
137 | To compile this driver as a module, choose M here: the | ||
138 | module will be called se401. | ||
139 | |||
140 | config USB_SN9C102 | ||
141 | tristate "USB SN9C10x PC Camera Controller support" | ||
142 | depends on USB && VIDEO_DEV | ||
143 | ---help--- | ||
144 | Say Y here if you want support for cameras based on SONiX SN9C101, | ||
145 | SN9C102 or SN9C103 PC Camera Controllers. | ||
146 | |||
147 | See <file:Documentation/usb/sn9c102.txt> for more informations. | ||
148 | |||
149 | This driver uses the Video For Linux API. You must say Y or M to | ||
150 | "Video For Linux" to use this driver. | ||
151 | |||
152 | To compile this driver as a module, choose M here: the | ||
153 | module will be called sn9c102. | ||
154 | |||
155 | config USB_STV680 | ||
156 | tristate "USB STV680 (Pencam) Camera support" | ||
157 | depends on USB && VIDEO_DEV | ||
158 | ---help--- | ||
159 | Say Y here if you want to connect this type of camera to your | ||
160 | computer's USB port. This includes the Pencam line of cameras. | ||
161 | See <file:Documentation/usb/stv680.txt> for more information and for | ||
162 | a list of supported cameras. | ||
163 | |||
164 | This driver uses the Video For Linux API. You must say Y or M to | ||
165 | "Video For Linux" (under Multimedia Devices) to use this driver. | ||
166 | Information on this API and pointers to "v4l" programs may be found | ||
167 | at <file:Documentation/video4linux/API.html>. | ||
168 | |||
169 | To compile this driver as a module, choose M here: the | ||
170 | module will be called stv680. | ||
171 | |||
172 | config USB_W9968CF | ||
173 | tristate "USB W996[87]CF JPEG Dual Mode Camera support" | ||
174 | depends on USB && VIDEO_DEV && I2C && VIDEO_OVCAMCHIP | ||
175 | ---help--- | ||
176 | Say Y here if you want support for cameras based on OV681 or | ||
177 | Winbond W9967CF/W9968CF JPEG USB Dual Mode Camera Chips. | ||
178 | |||
179 | This driver has an optional plugin, which is distributed as a | ||
180 | separate module only (released under GPL). It allows to use higher | ||
181 | resolutions and framerates, but cannot be included in the official | ||
182 | Linux kernel for performance purposes. | ||
183 | |||
184 | See <file:Documentation/usb/w9968cf.txt> for more informations. | ||
185 | |||
186 | This driver uses the Video For Linux and the I2C APIs. It needs the | ||
187 | OmniVision Camera Chip support as well. You must say Y or M to | ||
188 | "Video For Linux", "I2C Support" and "OmniVision Camera Chip | ||
189 | support" to use this driver. | ||
190 | |||
191 | To compile this driver as a module, choose M here: the | ||
192 | module will be called w9968cf. | ||
193 | |||
194 | config USB_ZC0301 | ||
195 | tristate "USB ZC0301 Image Processor and Control Chip support" | ||
196 | depends on USB && VIDEO_DEV | ||
197 | ---help--- | ||
198 | Say Y here if you want support for cameras based on the ZC0301 | ||
199 | Image Processor and Control Chip. | ||
200 | |||
201 | See <file:Documentation/usb/zc0301.txt> for more informations. | ||
202 | |||
203 | This driver uses the Video For Linux API. You must say Y or M to | ||
204 | "Video For Linux" to use this driver. | ||
205 | |||
206 | To compile this driver as a module, choose M here: the | ||
207 | module will be called zc0301. | ||
208 | |||
209 | config USB_PWC | ||
210 | tristate "USB Philips Cameras" | ||
211 | depends on USB && VIDEO_DEV | ||
212 | ---help--- | ||
213 | Say Y or M here if you want to use one of these Philips & OEM | ||
214 | webcams: | ||
215 | * Philips PCA645, PCA646 | ||
216 | * Philips PCVC675, PCVC680, PCVC690 | ||
217 | * Philips PCVC720/40, PCVC730, PCVC740, PCVC750 | ||
218 | * Askey VC010 | ||
219 | * Logitech QuickCam Pro 3000, 4000, 'Zoom', 'Notebook Pro' | ||
220 | and 'Orbit'/'Sphere' | ||
221 | * Samsung MPC-C10, MPC-C30 | ||
222 | * Creative Webcam 5, Pro Ex | ||
223 | * SOTEC Afina Eye | ||
224 | * Visionite VCS-UC300, VCS-UM100 | ||
225 | |||
226 | The PCA635, PCVC665 and PCVC720/20 are not supported by this driver | ||
227 | and never will be, but the 665 and 720/20 are supported by other | ||
228 | drivers. | ||
229 | |||
230 | See <file:Documentation/usb/philips.txt> for more information and | ||
231 | installation instructions. | ||
232 | |||
233 | The built-in microphone is enabled by selecting USB Audio support. | ||
234 | |||
235 | This driver uses the Video For Linux API. You must say Y or M to | ||
236 | "Video For Linux" (under Character Devices) to use this driver. | ||
237 | Information on this API and pointers to "v4l" programs may be found | ||
238 | at <file:Documentation/video4linux/API.html>. | ||
239 | |||
240 | To compile this driver as a module, choose M here: the | ||
241 | module will be called pwc. | ||
diff --git a/drivers/usb/media/Makefile b/drivers/usb/media/Makefile deleted file mode 100644 index 50e89a33b85e..000000000000 --- a/drivers/usb/media/Makefile +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | # | ||
2 | # Makefile for USB Media drivers | ||
3 | # | ||
4 | |||
5 | sn9c102-objs := sn9c102_core.o sn9c102_hv7131d.o sn9c102_mi0343.o \ | ||
6 | sn9c102_ov7630.o sn9c102_pas106b.o sn9c102_pas202bca.o \ | ||
7 | sn9c102_pas202bcb.o sn9c102_tas5110c1b.o \ | ||
8 | sn9c102_tas5130d1b.o | ||
9 | et61x251-objs := et61x251_core.o et61x251_tas5130d1b.o | ||
10 | zc0301-objs := zc0301_core.o zc0301_pas202bcb.o | ||
11 | |||
12 | obj-$(CONFIG_USB_DABUSB) += dabusb.o | ||
13 | obj-$(CONFIG_USB_DSBR) += dsbr100.o | ||
14 | obj-$(CONFIG_USB_ET61X251) += et61x251.o | ||
15 | obj-$(CONFIG_USB_IBMCAM) += ibmcam.o usbvideo.o ultracam.o | ||
16 | obj-$(CONFIG_USB_KONICAWC) += konicawc.o usbvideo.o | ||
17 | obj-$(CONFIG_USB_OV511) += ov511.o | ||
18 | obj-$(CONFIG_USB_SE401) += se401.o | ||
19 | obj-$(CONFIG_USB_SN9C102) += sn9c102.o | ||
20 | obj-$(CONFIG_USB_STV680) += stv680.o | ||
21 | obj-$(CONFIG_USB_VICAM) += vicam.o usbvideo.o | ||
22 | obj-$(CONFIG_USB_W9968CF) += w9968cf.o | ||
23 | obj-$(CONFIG_USB_ZC0301) += zc0301.o | ||
24 | obj-$(CONFIG_USB_PWC) += pwc/ | ||
diff --git a/drivers/usb/media/pwc/pwc-kiara.c b/drivers/usb/media/pwc/pwc-kiara.c deleted file mode 100644 index c498c68bace1..000000000000 --- a/drivers/usb/media/pwc/pwc-kiara.c +++ /dev/null | |||
@@ -1,318 +0,0 @@ | |||
1 | /* Linux driver for Philips webcam | ||
2 | (C) 2004 Luc Saillard (luc@saillard.org) | ||
3 | |||
4 | NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx | ||
5 | driver and thus may have bugs that are not present in the original version. | ||
6 | Please send bug reports and support requests to <luc@saillard.org>. | ||
7 | The decompression routines have been implemented by reverse-engineering the | ||
8 | Nemosoft binary pwcx module. Caveat emptor. | ||
9 | |||
10 | This program is free software; you can redistribute it and/or modify | ||
11 | it under the terms of the GNU General Public License as published by | ||
12 | the Free Software Foundation; either version 2 of the License, or | ||
13 | (at your option) any later version. | ||
14 | |||
15 | This program is distributed in the hope that it will be useful, | ||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | GNU General Public License for more details. | ||
19 | |||
20 | You should have received a copy of the GNU General Public License | ||
21 | along with this program; if not, write to the Free Software | ||
22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | |||
26 | /* This tables contains entries for the 730/740/750 (Kiara) camera, with | ||
27 | 4 different qualities (no compression, low, medium, high). | ||
28 | It lists the bandwidth requirements for said mode by its alternate interface | ||
29 | number. An alternate of 0 means that the mode is unavailable. | ||
30 | |||
31 | There are 6 * 4 * 4 entries: | ||
32 | 6 different resolutions subqcif, qsif, qcif, sif, cif, vga | ||
33 | 6 framerates: 5, 10, 15, 20, 25, 30 | ||
34 | 4 compression modi: none, low, medium, high | ||
35 | |||
36 | When an uncompressed mode is not available, the next available compressed mode | ||
37 | will be chosen (unless the decompressor is absent). Sometimes there are only | ||
38 | 1 or 2 compressed modes available; in that case entries are duplicated. | ||
39 | */ | ||
40 | |||
41 | |||
42 | #include "pwc-kiara.h" | ||
43 | #include "pwc-uncompress.h" | ||
44 | |||
45 | const struct Kiara_table_entry Kiara_table[PSZ_MAX][6][4] = | ||
46 | { | ||
47 | /* SQCIF */ | ||
48 | { | ||
49 | /* 5 fps */ | ||
50 | { | ||
51 | {0, }, | ||
52 | {0, }, | ||
53 | {0, }, | ||
54 | {0, }, | ||
55 | }, | ||
56 | /* 10 fps */ | ||
57 | { | ||
58 | {0, }, | ||
59 | {0, }, | ||
60 | {0, }, | ||
61 | {0, }, | ||
62 | }, | ||
63 | /* 15 fps */ | ||
64 | { | ||
65 | {0, }, | ||
66 | {0, }, | ||
67 | {0, }, | ||
68 | {0, }, | ||
69 | }, | ||
70 | /* 20 fps */ | ||
71 | { | ||
72 | {0, }, | ||
73 | {0, }, | ||
74 | {0, }, | ||
75 | {0, }, | ||
76 | }, | ||
77 | /* 25 fps */ | ||
78 | { | ||
79 | {0, }, | ||
80 | {0, }, | ||
81 | {0, }, | ||
82 | {0, }, | ||
83 | }, | ||
84 | /* 30 fps */ | ||
85 | { | ||
86 | {0, }, | ||
87 | {0, }, | ||
88 | {0, }, | ||
89 | {0, }, | ||
90 | }, | ||
91 | }, | ||
92 | /* QSIF */ | ||
93 | { | ||
94 | /* 5 fps */ | ||
95 | { | ||
96 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
97 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
98 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
99 | {1, 146, 0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}}, | ||
100 | }, | ||
101 | /* 10 fps */ | ||
102 | { | ||
103 | {2, 291, 0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}}, | ||
104 | {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, | ||
105 | {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, | ||
106 | {1, 192, 630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}}, | ||
107 | }, | ||
108 | /* 15 fps */ | ||
109 | { | ||
110 | {3, 437, 0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}}, | ||
111 | {2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, | ||
112 | {2, 292, 640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}}, | ||
113 | {1, 192, 420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, | ||
114 | }, | ||
115 | /* 20 fps */ | ||
116 | { | ||
117 | {4, 589, 0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}}, | ||
118 | {3, 448, 730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}}, | ||
119 | {2, 292, 476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}}, | ||
120 | {1, 192, 312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}}, | ||
121 | }, | ||
122 | /* 25 fps */ | ||
123 | { | ||
124 | {5, 703, 0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}}, | ||
125 | {3, 447, 610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}}, | ||
126 | {2, 292, 398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}}, | ||
127 | {1, 193, 262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}}, | ||
128 | }, | ||
129 | /* 30 fps */ | ||
130 | { | ||
131 | {8, 874, 0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}}, | ||
132 | {5, 704, 730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}}, | ||
133 | {3, 448, 492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}}, | ||
134 | {2, 292, 320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}}, | ||
135 | }, | ||
136 | }, | ||
137 | /* QCIF */ | ||
138 | { | ||
139 | /* 5 fps */ | ||
140 | { | ||
141 | {0, }, | ||
142 | {0, }, | ||
143 | {0, }, | ||
144 | {0, }, | ||
145 | }, | ||
146 | /* 10 fps */ | ||
147 | { | ||
148 | {0, }, | ||
149 | {0, }, | ||
150 | {0, }, | ||
151 | {0, }, | ||
152 | }, | ||
153 | /* 15 fps */ | ||
154 | { | ||
155 | {0, }, | ||
156 | {0, }, | ||
157 | {0, }, | ||
158 | {0, }, | ||
159 | }, | ||
160 | /* 20 fps */ | ||
161 | { | ||
162 | {0, }, | ||
163 | {0, }, | ||
164 | {0, }, | ||
165 | {0, }, | ||
166 | }, | ||
167 | /* 25 fps */ | ||
168 | { | ||
169 | {0, }, | ||
170 | {0, }, | ||
171 | {0, }, | ||
172 | {0, }, | ||
173 | }, | ||
174 | /* 30 fps */ | ||
175 | { | ||
176 | {0, }, | ||
177 | {0, }, | ||
178 | {0, }, | ||
179 | {0, }, | ||
180 | }, | ||
181 | }, | ||
182 | /* SIF */ | ||
183 | { | ||
184 | /* 5 fps */ | ||
185 | { | ||
186 | {4, 582, 0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}}, | ||
187 | {3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}}, | ||
188 | {2, 291, 960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}}, | ||
189 | {1, 191, 630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}}, | ||
190 | }, | ||
191 | /* 10 fps */ | ||
192 | { | ||
193 | {0, }, | ||
194 | {6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}}, | ||
195 | {3, 447, 736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}}, | ||
196 | {2, 292, 480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}}, | ||
197 | }, | ||
198 | /* 15 fps */ | ||
199 | { | ||
200 | {0, }, | ||
201 | {9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}}, | ||
202 | {4, 592, 650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}}, | ||
203 | {3, 448, 492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}}, | ||
204 | }, | ||
205 | /* 20 fps */ | ||
206 | { | ||
207 | {0, }, | ||
208 | {9, 958, 782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}}, | ||
209 | {5, 703, 574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}}, | ||
210 | {3, 446, 364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}}, | ||
211 | }, | ||
212 | /* 25 fps */ | ||
213 | { | ||
214 | {0, }, | ||
215 | {9, 958, 654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}}, | ||
216 | {6, 776, 530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}}, | ||
217 | {4, 592, 404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}}, | ||
218 | }, | ||
219 | /* 30 fps */ | ||
220 | { | ||
221 | {0, }, | ||
222 | {9, 957, 526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}}, | ||
223 | {6, 775, 426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}}, | ||
224 | {4, 590, 324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}}, | ||
225 | }, | ||
226 | }, | ||
227 | /* CIF */ | ||
228 | { | ||
229 | /* 5 fps */ | ||
230 | { | ||
231 | {0, }, | ||
232 | {0, }, | ||
233 | {0, }, | ||
234 | {0, }, | ||
235 | }, | ||
236 | /* 10 fps */ | ||
237 | { | ||
238 | {0, }, | ||
239 | {0, }, | ||
240 | {0, }, | ||
241 | {0, }, | ||
242 | }, | ||
243 | /* 15 fps */ | ||
244 | { | ||
245 | {0, }, | ||
246 | {0, }, | ||
247 | {0, }, | ||
248 | {0, }, | ||
249 | }, | ||
250 | /* 20 fps */ | ||
251 | { | ||
252 | {0, }, | ||
253 | {0, }, | ||
254 | {0, }, | ||
255 | {0, }, | ||
256 | }, | ||
257 | /* 25 fps */ | ||
258 | { | ||
259 | {0, }, | ||
260 | {0, }, | ||
261 | {0, }, | ||
262 | {0, }, | ||
263 | }, | ||
264 | /* 30 fps */ | ||
265 | { | ||
266 | {0, }, | ||
267 | {0, }, | ||
268 | {0, }, | ||
269 | {0, }, | ||
270 | }, | ||
271 | }, | ||
272 | /* VGA */ | ||
273 | { | ||
274 | /* 5 fps */ | ||
275 | { | ||
276 | {0, }, | ||
277 | {6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}}, | ||
278 | {4, 592, 976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}}, | ||
279 | {3, 448, 738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}}, | ||
280 | }, | ||
281 | /* 10 fps */ | ||
282 | { | ||
283 | {0, }, | ||
284 | {9, 956, 788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}}, | ||
285 | {6, 776, 640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}}, | ||
286 | {4, 592, 488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}}, | ||
287 | }, | ||
288 | /* 15 fps */ | ||
289 | { | ||
290 | {0, }, | ||
291 | {9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, | ||
292 | {9, 957, 526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}}, | ||
293 | {8, 895, 492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}}, | ||
294 | }, | ||
295 | /* 20 fps */ | ||
296 | { | ||
297 | {0, }, | ||
298 | {0, }, | ||
299 | {0, }, | ||
300 | {0, }, | ||
301 | }, | ||
302 | /* 25 fps */ | ||
303 | { | ||
304 | {0, }, | ||
305 | {0, }, | ||
306 | {0, }, | ||
307 | {0, }, | ||
308 | }, | ||
309 | /* 30 fps */ | ||
310 | { | ||
311 | {0, }, | ||
312 | {0, }, | ||
313 | {0, }, | ||
314 | {0, }, | ||
315 | }, | ||
316 | }, | ||
317 | }; | ||
318 | |||
diff --git a/drivers/usb/media/pwc/pwc-timon.c b/drivers/usb/media/pwc/pwc-timon.c deleted file mode 100644 index dee967173d6c..000000000000 --- a/drivers/usb/media/pwc/pwc-timon.c +++ /dev/null | |||
@@ -1,316 +0,0 @@ | |||
1 | /* Linux driver for Philips webcam | ||
2 | (C) 2004 Luc Saillard (luc@saillard.org) | ||
3 | |||
4 | NOTE: this version of pwc is an unofficial (modified) release of pwc & pcwx | ||
5 | driver and thus may have bugs that are not present in the original version. | ||
6 | Please send bug reports and support requests to <luc@saillard.org>. | ||
7 | The decompression routines have been implemented by reverse-engineering the | ||
8 | Nemosoft binary pwcx module. Caveat emptor. | ||
9 | |||
10 | This program is free software; you can redistribute it and/or modify | ||
11 | it under the terms of the GNU General Public License as published by | ||
12 | the Free Software Foundation; either version 2 of the License, or | ||
13 | (at your option) any later version. | ||
14 | |||
15 | This program is distributed in the hope that it will be useful, | ||
16 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
17 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
18 | GNU General Public License for more details. | ||
19 | |||
20 | You should have received a copy of the GNU General Public License | ||
21 | along with this program; if not, write to the Free Software | ||
22 | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
23 | */ | ||
24 | |||
25 | |||
26 | /* This tables contains entries for the 675/680/690 (Timon) camera, with | ||
27 | 4 different qualities (no compression, low, medium, high). | ||
28 | It lists the bandwidth requirements for said mode by its alternate interface | ||
29 | number. An alternate of 0 means that the mode is unavailable. | ||
30 | |||
31 | There are 6 * 4 * 4 entries: | ||
32 | 6 different resolutions subqcif, qsif, qcif, sif, cif, vga | ||
33 | 6 framerates: 5, 10, 15, 20, 25, 30 | ||
34 | 4 compression modi: none, low, medium, high | ||
35 | |||
36 | When an uncompressed mode is not available, the next available compressed mode | ||
37 | will be chosen (unless the decompressor is absent). Sometimes there are only | ||
38 | 1 or 2 compressed modes available; in that case entries are duplicated. | ||
39 | */ | ||
40 | |||
41 | #include "pwc-timon.h" | ||
42 | |||
43 | const struct Timon_table_entry Timon_table[PSZ_MAX][6][4] = | ||
44 | { | ||
45 | /* SQCIF */ | ||
46 | { | ||
47 | /* 5 fps */ | ||
48 | { | ||
49 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
50 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
51 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
52 | {1, 140, 0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}}, | ||
53 | }, | ||
54 | /* 10 fps */ | ||
55 | { | ||
56 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
57 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
58 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
59 | {2, 280, 0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}}, | ||
60 | }, | ||
61 | /* 15 fps */ | ||
62 | { | ||
63 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
64 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
65 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
66 | {3, 410, 0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}}, | ||
67 | }, | ||
68 | /* 20 fps */ | ||
69 | { | ||
70 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
71 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
72 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
73 | {4, 559, 0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}}, | ||
74 | }, | ||
75 | /* 25 fps */ | ||
76 | { | ||
77 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
78 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
79 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
80 | {5, 659, 0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}}, | ||
81 | }, | ||
82 | /* 30 fps */ | ||
83 | { | ||
84 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
85 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
86 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
87 | {7, 838, 0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}}, | ||
88 | }, | ||
89 | }, | ||
90 | /* QSIF */ | ||
91 | { | ||
92 | /* 5 fps */ | ||
93 | { | ||
94 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
95 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
96 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
97 | {1, 146, 0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}}, | ||
98 | }, | ||
99 | /* 10 fps */ | ||
100 | { | ||
101 | {2, 291, 0, {0x2C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0xA1, 0xC0, 0x02}}, | ||
102 | {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
103 | {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
104 | {1, 191, 630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
105 | }, | ||
106 | /* 15 fps */ | ||
107 | { | ||
108 | {3, 437, 0, {0x2B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x6D, 0xC0, 0x02}}, | ||
109 | {2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
110 | {2, 291, 640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
111 | {1, 191, 420, {0x2B, 0xF4, 0x0D, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x08, 0xBF, 0xF4, 0xC0, 0x02}}, | ||
112 | }, | ||
113 | /* 20 fps */ | ||
114 | { | ||
115 | {4, 588, 0, {0x2A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4C, 0x52, 0xC0, 0x02}}, | ||
116 | {3, 447, 730, {0x2A, 0xF4, 0x05, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
117 | {2, 292, 476, {0x2A, 0xF4, 0x0D, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, | ||
118 | {1, 192, 312, {0x2A, 0xF4, 0x1D, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, | ||
119 | }, | ||
120 | /* 25 fps */ | ||
121 | { | ||
122 | {5, 703, 0, {0x29, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x42, 0xC0, 0x02}}, | ||
123 | {3, 447, 610, {0x29, 0xF4, 0x05, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
124 | {2, 292, 398, {0x29, 0xF4, 0x0D, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, | ||
125 | {1, 192, 262, {0x29, 0xF4, 0x25, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}}, | ||
126 | }, | ||
127 | /* 30 fps */ | ||
128 | { | ||
129 | {8, 873, 0, {0x28, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x69, 0x37, 0xC0, 0x02}}, | ||
130 | {5, 704, 774, {0x28, 0xF4, 0x05, 0x18, 0x21, 0x17, 0x59, 0x0F, 0x18, 0xC0, 0x42, 0xC0, 0x02}}, | ||
131 | {3, 448, 492, {0x28, 0xF4, 0x05, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x18, 0xC0, 0x69, 0xC0, 0x02}}, | ||
132 | {2, 291, 320, {0x28, 0xF4, 0x1D, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, | ||
133 | }, | ||
134 | }, | ||
135 | /* QCIF */ | ||
136 | { | ||
137 | /* 5 fps */ | ||
138 | { | ||
139 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
140 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
141 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
142 | {1, 193, 0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}}, | ||
143 | }, | ||
144 | /* 10 fps */ | ||
145 | { | ||
146 | {3, 385, 0, {0x0C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x81, 0x79, 0xC0, 0x02}}, | ||
147 | {2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
148 | {2, 291, 800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}}, | ||
149 | {1, 194, 532, {0x0C, 0xF4, 0x05, 0x10, 0x9A, 0x0F, 0xBE, 0x1B, 0x08, 0xC2, 0xF0, 0xC0, 0x02}}, | ||
150 | }, | ||
151 | /* 15 fps */ | ||
152 | { | ||
153 | {4, 577, 0, {0x0B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x41, 0x52, 0xC0, 0x02}}, | ||
154 | {3, 447, 818, {0x0B, 0xF4, 0x05, 0x19, 0x89, 0x18, 0xAD, 0x0F, 0x10, 0xBF, 0x69, 0xC0, 0x02}}, | ||
155 | {2, 292, 534, {0x0B, 0xF4, 0x05, 0x10, 0xA3, 0x0F, 0xC7, 0x19, 0x10, 0x24, 0xA1, 0xC0, 0x02}}, | ||
156 | {1, 195, 356, {0x0B, 0xF4, 0x15, 0x0B, 0x11, 0x0A, 0x35, 0x1E, 0x10, 0xC3, 0xF0, 0xC0, 0x02}}, | ||
157 | }, | ||
158 | /* 20 fps */ | ||
159 | { | ||
160 | {6, 776, 0, {0x0A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x3F, 0xC0, 0x02}}, | ||
161 | {4, 591, 804, {0x0A, 0xF4, 0x05, 0x19, 0x1E, 0x18, 0x42, 0x0F, 0x18, 0x4F, 0x4E, 0xC0, 0x02}}, | ||
162 | {3, 447, 608, {0x0A, 0xF4, 0x05, 0x12, 0xFD, 0x12, 0x21, 0x15, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
163 | {2, 291, 396, {0x0A, 0xF4, 0x15, 0x0C, 0x5E, 0x0B, 0x82, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}}, | ||
164 | }, | ||
165 | /* 25 fps */ | ||
166 | { | ||
167 | {9, 928, 0, {0x09, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xA0, 0x33, 0xC0, 0x02}}, | ||
168 | {5, 703, 800, {0x09, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x10, 0x18, 0xBF, 0x42, 0xC0, 0x02}}, | ||
169 | {3, 447, 508, {0x09, 0xF4, 0x0D, 0x0F, 0xD2, 0x0E, 0xF6, 0x1B, 0x18, 0xBF, 0x69, 0xC0, 0x02}}, | ||
170 | {2, 292, 332, {0x09, 0xF4, 0x1D, 0x0A, 0x5A, 0x09, 0x7E, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}}, | ||
171 | }, | ||
172 | /* 30 fps */ | ||
173 | { | ||
174 | {0, }, | ||
175 | {9, 956, 876, {0x08, 0xF4, 0x05, 0x1B, 0x58, 0x1A, 0x7C, 0x0E, 0x20, 0xBC, 0x33, 0x10, 0x02}}, | ||
176 | {4, 592, 542, {0x08, 0xF4, 0x05, 0x10, 0xE4, 0x10, 0x08, 0x17, 0x20, 0x50, 0x4E, 0x10, 0x02}}, | ||
177 | {2, 291, 266, {0x08, 0xF4, 0x25, 0x08, 0x48, 0x07, 0x6C, 0x1E, 0x20, 0x23, 0xA1, 0x10, 0x02}}, | ||
178 | }, | ||
179 | }, | ||
180 | /* SIF */ | ||
181 | { | ||
182 | /* 5 fps */ | ||
183 | { | ||
184 | {4, 582, 0, {0x35, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x52, 0x60, 0x02}}, | ||
185 | {3, 387, 1276, {0x35, 0xF4, 0x05, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x79, 0x60, 0x02}}, | ||
186 | {2, 291, 960, {0x35, 0xF4, 0x0D, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0xA1, 0x60, 0x02}}, | ||
187 | {1, 191, 630, {0x35, 0xF4, 0x1D, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x08, 0xBF, 0xF4, 0x60, 0x02}}, | ||
188 | }, | ||
189 | /* 10 fps */ | ||
190 | { | ||
191 | {0, }, | ||
192 | {6, 775, 1278, {0x34, 0xF4, 0x05, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x3F, 0x10, 0x02}}, | ||
193 | {3, 447, 736, {0x34, 0xF4, 0x15, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x18, 0xBF, 0x69, 0x10, 0x02}}, | ||
194 | {2, 291, 480, {0x34, 0xF4, 0x2D, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x18, 0x23, 0xA1, 0x10, 0x02}}, | ||
195 | }, | ||
196 | /* 15 fps */ | ||
197 | { | ||
198 | {0, }, | ||
199 | {9, 955, 1050, {0x33, 0xF4, 0x05, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x33, 0x10, 0x02}}, | ||
200 | {4, 591, 650, {0x33, 0xF4, 0x15, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x4F, 0x4E, 0x10, 0x02}}, | ||
201 | {3, 448, 492, {0x33, 0xF4, 0x25, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x28, 0xC0, 0x69, 0x10, 0x02}}, | ||
202 | }, | ||
203 | /* 20 fps */ | ||
204 | { | ||
205 | {0, }, | ||
206 | {9, 958, 782, {0x32, 0xF4, 0x0D, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x33, 0xD0, 0x02}}, | ||
207 | {5, 703, 574, {0x32, 0xF4, 0x1D, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x42, 0xD0, 0x02}}, | ||
208 | {3, 446, 364, {0x32, 0xF4, 0x3D, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x30, 0xBE, 0x69, 0xD0, 0x02}}, | ||
209 | }, | ||
210 | /* 25 fps */ | ||
211 | { | ||
212 | {0, }, | ||
213 | {9, 958, 654, {0x31, 0xF4, 0x15, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x33, 0x90, 0x02}}, | ||
214 | {6, 776, 530, {0x31, 0xF4, 0x25, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x3F, 0x90, 0x02}}, | ||
215 | {4, 592, 404, {0x31, 0xF4, 0x35, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x38, 0x50, 0x4E, 0x90, 0x02}}, | ||
216 | }, | ||
217 | /* 30 fps */ | ||
218 | { | ||
219 | {0, }, | ||
220 | {9, 957, 526, {0x30, 0xF4, 0x25, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x33, 0x60, 0x02}}, | ||
221 | {6, 775, 426, {0x30, 0xF4, 0x35, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x3F, 0x60, 0x02}}, | ||
222 | {4, 590, 324, {0x30, 0x7A, 0x4B, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x40, 0x4E, 0x52, 0x60, 0x02}}, | ||
223 | }, | ||
224 | }, | ||
225 | /* CIF */ | ||
226 | { | ||
227 | /* 5 fps */ | ||
228 | { | ||
229 | {6, 771, 0, {0x15, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x3F, 0x80, 0x02}}, | ||
230 | {4, 465, 1278, {0x15, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x03, 0x18, 0xD1, 0x65, 0x80, 0x02}}, | ||
231 | {2, 291, 800, {0x15, 0xF4, 0x15, 0x18, 0xF4, 0x17, 0x3C, 0x05, 0x18, 0x23, 0xA1, 0x80, 0x02}}, | ||
232 | {1, 193, 528, {0x15, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x18, 0xC1, 0xF4, 0x80, 0x02}}, | ||
233 | }, | ||
234 | /* 10 fps */ | ||
235 | { | ||
236 | {0, }, | ||
237 | {9, 932, 1278, {0x14, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x04, 0x30, 0xA4, 0x33, 0x10, 0x02}}, | ||
238 | {4, 591, 812, {0x14, 0xF4, 0x15, 0x19, 0x56, 0x17, 0x9E, 0x06, 0x28, 0x4F, 0x4E, 0x10, 0x02}}, | ||
239 | {2, 291, 400, {0x14, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x28, 0x23, 0xA1, 0x10, 0x02}}, | ||
240 | }, | ||
241 | /* 15 fps */ | ||
242 | { | ||
243 | {0, }, | ||
244 | {9, 956, 876, {0x13, 0xF4, 0x0D, 0x1B, 0x58, 0x19, 0xA0, 0x05, 0x38, 0xBC, 0x33, 0x60, 0x02}}, | ||
245 | {5, 703, 644, {0x13, 0xF4, 0x1D, 0x14, 0x1C, 0x12, 0x64, 0x08, 0x38, 0xBF, 0x42, 0x60, 0x02}}, | ||
246 | {3, 448, 410, {0x13, 0xF4, 0x3D, 0x0C, 0xC4, 0x0B, 0x0C, 0x0E, 0x38, 0xC0, 0x69, 0x60, 0x02}}, | ||
247 | }, | ||
248 | /* 20 fps */ | ||
249 | { | ||
250 | {0, }, | ||
251 | {9, 956, 650, {0x12, 0xF4, 0x1D, 0x14, 0x4A, 0x12, 0x92, 0x09, 0x48, 0xBC, 0x33, 0x10, 0x03}}, | ||
252 | {6, 776, 528, {0x12, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x40, 0x08, 0x3F, 0x10, 0x03}}, | ||
253 | {4, 591, 402, {0x12, 0xF4, 0x3D, 0x0C, 0x8F, 0x0A, 0xD7, 0x0E, 0x40, 0x4F, 0x4E, 0x10, 0x03}}, | ||
254 | }, | ||
255 | /* 25 fps */ | ||
256 | { | ||
257 | {0, }, | ||
258 | {9, 956, 544, {0x11, 0xF4, 0x25, 0x10, 0xF4, 0x0F, 0x3C, 0x0A, 0x48, 0xBC, 0x33, 0xC0, 0x02}}, | ||
259 | {7, 840, 478, {0x11, 0xF4, 0x2D, 0x0E, 0xEB, 0x0D, 0x33, 0x0B, 0x48, 0x48, 0x3B, 0xC0, 0x02}}, | ||
260 | {5, 703, 400, {0x11, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x48, 0xBF, 0x42, 0xC0, 0x02}}, | ||
261 | }, | ||
262 | /* 30 fps */ | ||
263 | { | ||
264 | {0, }, | ||
265 | {9, 956, 438, {0x10, 0xF4, 0x35, 0x0D, 0xAC, 0x0B, 0xF4, 0x0D, 0x50, 0xBC, 0x33, 0x10, 0x02}}, | ||
266 | {7, 838, 384, {0x10, 0xF4, 0x45, 0x0B, 0xFD, 0x0A, 0x45, 0x0F, 0x50, 0x46, 0x3B, 0x10, 0x02}}, | ||
267 | {6, 773, 354, {0x10, 0x7A, 0x4B, 0x0B, 0x0C, 0x09, 0x80, 0x10, 0x50, 0x05, 0x3F, 0x10, 0x02}}, | ||
268 | }, | ||
269 | }, | ||
270 | /* VGA */ | ||
271 | { | ||
272 | /* 5 fps */ | ||
273 | { | ||
274 | {0, }, | ||
275 | {6, 773, 1272, {0x1D, 0xF4, 0x15, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x3F, 0x10, 0x02}}, | ||
276 | {4, 592, 976, {0x1D, 0xF4, 0x25, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x4E, 0x10, 0x02}}, | ||
277 | {3, 448, 738, {0x1D, 0xF4, 0x3D, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x69, 0x10, 0x02}}, | ||
278 | }, | ||
279 | /* 10 fps */ | ||
280 | { | ||
281 | {0, }, | ||
282 | {9, 956, 788, {0x1C, 0xF4, 0x35, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x33, 0x10, 0x02}}, | ||
283 | {6, 776, 640, {0x1C, 0x7A, 0x53, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x3F, 0x10, 0x02}}, | ||
284 | {4, 592, 488, {0x1C, 0x7A, 0x6B, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x4E, 0x10, 0x02}}, | ||
285 | }, | ||
286 | /* 15 fps */ | ||
287 | { | ||
288 | {0, }, | ||
289 | {9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, | ||
290 | {9, 957, 526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}}, | ||
291 | {8, 895, 492, {0x1B, 0x7A, 0x6B, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x37, 0x80, 0x02}}, | ||
292 | }, | ||
293 | /* 20 fps */ | ||
294 | { | ||
295 | {0, }, | ||
296 | {0, }, | ||
297 | {0, }, | ||
298 | {0, }, | ||
299 | }, | ||
300 | /* 25 fps */ | ||
301 | { | ||
302 | {0, }, | ||
303 | {0, }, | ||
304 | {0, }, | ||
305 | {0, }, | ||
306 | }, | ||
307 | /* 30 fps */ | ||
308 | { | ||
309 | {0, }, | ||
310 | {0, }, | ||
311 | {0, }, | ||
312 | {0, }, | ||
313 | }, | ||
314 | }, | ||
315 | }; | ||
316 | |||
diff --git a/drivers/video/backlight/locomolcd.c b/drivers/video/backlight/locomolcd.c index ada6e75eb048..60831bb23685 100644 --- a/drivers/video/backlight/locomolcd.c +++ b/drivers/video/backlight/locomolcd.c | |||
@@ -20,14 +20,10 @@ | |||
20 | 20 | ||
21 | #include <asm/hardware/locomo.h> | 21 | #include <asm/hardware/locomo.h> |
22 | #include <asm/irq.h> | 22 | #include <asm/irq.h> |
23 | #include <asm/mach/sharpsl_param.h> | ||
24 | #include <asm/mach-types.h> | ||
23 | 25 | ||
24 | #ifdef CONFIG_SA1100_COLLIE | 26 | #include "../../../arch/arm/mach-sa1100/generic.h" |
25 | #include <asm/arch/collie.h> | ||
26 | #else | ||
27 | #include <asm/arch/poodle.h> | ||
28 | #endif | ||
29 | |||
30 | extern void (*sa1100fb_lcd_power)(int on); | ||
31 | 27 | ||
32 | static struct locomo_dev *locomolcd_dev; | 28 | static struct locomo_dev *locomolcd_dev; |
33 | 29 | ||
@@ -82,7 +78,7 @@ static void locomolcd_off(int comadj) | |||
82 | 78 | ||
83 | void locomolcd_power(int on) | 79 | void locomolcd_power(int on) |
84 | { | 80 | { |
85 | int comadj = 118; | 81 | int comadj = sharpsl_param.comadj; |
86 | unsigned long flags; | 82 | unsigned long flags; |
87 | 83 | ||
88 | local_irq_save(flags); | 84 | local_irq_save(flags); |
@@ -93,11 +89,12 @@ void locomolcd_power(int on) | |||
93 | } | 89 | } |
94 | 90 | ||
95 | /* read comadj */ | 91 | /* read comadj */ |
96 | #ifdef CONFIG_MACH_POODLE | 92 | if (comadj == -1) { |
97 | comadj = 118; | 93 | if (machine_is_poodle()) |
98 | #else | 94 | comadj = 118; |
99 | comadj = 128; | 95 | if (machine_is_collie()) |
100 | #endif | 96 | comadj = 128; |
97 | } | ||
101 | 98 | ||
102 | if (on) | 99 | if (on) |
103 | locomolcd_on(comadj); | 100 | locomolcd_on(comadj); |
diff --git a/drivers/video/cirrusfb.c b/drivers/video/cirrusfb.c index e0dbdfc0c8b4..66d6f2f0a219 100644 --- a/drivers/video/cirrusfb.c +++ b/drivers/video/cirrusfb.c | |||
@@ -2622,7 +2622,7 @@ static int __init cirrusfb_init(void) | |||
2622 | #endif | 2622 | #endif |
2623 | 2623 | ||
2624 | #ifdef CONFIG_ZORRO | 2624 | #ifdef CONFIG_ZORRO |
2625 | error |= zorro_module_init(&cirrusfb_zorro_driver); | 2625 | error |= zorro_register_driver(&cirrusfb_zorro_driver); |
2626 | #endif | 2626 | #endif |
2627 | #ifdef CONFIG_PCI | 2627 | #ifdef CONFIG_PCI |
2628 | error |= pci_register_driver(&cirrusfb_pci_driver); | 2628 | error |= pci_register_driver(&cirrusfb_pci_driver); |
diff --git a/drivers/video/hpfb.c b/drivers/video/hpfb.c index bebdac59d231..abd920a663a0 100644 --- a/drivers/video/hpfb.c +++ b/drivers/video/hpfb.c | |||
@@ -386,7 +386,9 @@ int __init hpfb_init(void) | |||
386 | if (fb_get_options("hpfb", NULL)) | 386 | if (fb_get_options("hpfb", NULL)) |
387 | return -ENODEV; | 387 | return -ENODEV; |
388 | 388 | ||
389 | dio_module_init(&hpfb_driver); | 389 | err = dio_register_driver(&hpfb_driver); |
390 | if (err) | ||
391 | return err; | ||
390 | 392 | ||
391 | fs = get_fs(); | 393 | fs = get_fs(); |
392 | set_fs(KERNEL_DS); | 394 | set_fs(KERNEL_DS); |
diff --git a/drivers/video/pm3fb.c b/drivers/video/pm3fb.c index 0e78ddc81583..52c18a35fb41 100644 --- a/drivers/video/pm3fb.c +++ b/drivers/video/pm3fb.c | |||
@@ -3532,26 +3532,26 @@ int __init pm3fb_init(void) | |||
3532 | MODULE_AUTHOR("Romain Dolbeau"); | 3532 | MODULE_AUTHOR("Romain Dolbeau"); |
3533 | MODULE_DESCRIPTION("Permedia3 framebuffer device driver"); | 3533 | MODULE_DESCRIPTION("Permedia3 framebuffer device driver"); |
3534 | static char *mode[PM3_MAX_BOARD]; | 3534 | static char *mode[PM3_MAX_BOARD]; |
3535 | MODULE_PARM(mode,PM3_MAX_BOARD_MODULE_ARRAY_STRING); | 3535 | module_param_array(mode, charp, NULL, 0); |
3536 | MODULE_PARM_DESC(mode,"video mode"); | 3536 | MODULE_PARM_DESC(mode,"video mode"); |
3537 | MODULE_PARM(disable,PM3_MAX_BOARD_MODULE_ARRAY_SHORT); | 3537 | module_param_array(disable, short, NULL, 0); |
3538 | MODULE_PARM_DESC(disable,"disable board"); | 3538 | MODULE_PARM_DESC(disable,"disable board"); |
3539 | static short off[PM3_MAX_BOARD]; | 3539 | static short off[PM3_MAX_BOARD]; |
3540 | MODULE_PARM(off,PM3_MAX_BOARD_MODULE_ARRAY_SHORT); | 3540 | module_param_array(off, short, NULL, 0); |
3541 | MODULE_PARM_DESC(off,"disable board"); | 3541 | MODULE_PARM_DESC(off,"disable board"); |
3542 | static char *pciid[PM3_MAX_BOARD]; | 3542 | static char *pciid[PM3_MAX_BOARD]; |
3543 | MODULE_PARM(pciid,PM3_MAX_BOARD_MODULE_ARRAY_STRING); | 3543 | module_param_array(pciid, charp, NULL, 0); |
3544 | MODULE_PARM_DESC(pciid,"board PCI Id"); | 3544 | MODULE_PARM_DESC(pciid,"board PCI Id"); |
3545 | MODULE_PARM(noaccel,PM3_MAX_BOARD_MODULE_ARRAY_SHORT); | 3545 | module_param_array(noaccel, short, NULL, 0); |
3546 | MODULE_PARM_DESC(noaccel,"disable accel"); | 3546 | MODULE_PARM_DESC(noaccel,"disable accel"); |
3547 | static char *font[PM3_MAX_BOARD]; | 3547 | static char *font[PM3_MAX_BOARD]; |
3548 | MODULE_PARM(font,PM3_MAX_BOARD_MODULE_ARRAY_STRING); | 3548 | module_param_array(font, charp, NULL, 0); |
3549 | MODULE_PARM_DESC(font,"choose font"); | 3549 | MODULE_PARM_DESC(font,"choose font"); |
3550 | MODULE_PARM(depth,PM3_MAX_BOARD_MODULE_ARRAY_SHORT); | 3550 | module_param(depth, short, NULL, 0); |
3551 | MODULE_PARM_DESC(depth,"boot-time depth"); | 3551 | MODULE_PARM_DESC(depth,"boot-time depth"); |
3552 | MODULE_PARM(printtimings, "h"); | 3552 | module_param(printtimings, short, NULL, 0); |
3553 | MODULE_PARM_DESC(printtimings, "print the memory timings of the card(s)"); | 3553 | MODULE_PARM_DESC(printtimings, "print the memory timings of the card(s)"); |
3554 | MODULE_PARM(forcesize, PM3_MAX_BOARD_MODULE_ARRAY_SHORT); | 3554 | module_param(forcesize, short, NULL, 0); |
3555 | MODULE_PARM_DESC(forcesize, "force specified memory size"); | 3555 | MODULE_PARM_DESC(forcesize, "force specified memory size"); |
3556 | /* | 3556 | /* |
3557 | MODULE_SUPPORTED_DEVICE("Permedia3 PCI boards") | 3557 | MODULE_SUPPORTED_DEVICE("Permedia3 PCI boards") |
diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c index fcbee748c592..067c07be928c 100644 --- a/drivers/zorro/zorro-driver.c +++ b/drivers/zorro/zorro-driver.c | |||
@@ -65,22 +65,17 @@ static int zorro_device_probe(struct device *dev) | |||
65 | * @drv: the driver structure to register | 65 | * @drv: the driver structure to register |
66 | * | 66 | * |
67 | * Adds the driver structure to the list of registered drivers | 67 | * Adds the driver structure to the list of registered drivers |
68 | * Returns the number of Zorro devices which were claimed by the driver | 68 | * Returns zero or a negative error value. |
69 | * during registration. The driver remains registered even if the | ||
70 | * return value is zero. | ||
71 | */ | 69 | */ |
72 | 70 | ||
73 | int zorro_register_driver(struct zorro_driver *drv) | 71 | int zorro_register_driver(struct zorro_driver *drv) |
74 | { | 72 | { |
75 | int count = 0; | ||
76 | |||
77 | /* initialize common driver fields */ | 73 | /* initialize common driver fields */ |
78 | drv->driver.name = drv->name; | 74 | drv->driver.name = drv->name; |
79 | drv->driver.bus = &zorro_bus_type; | 75 | drv->driver.bus = &zorro_bus_type; |
80 | 76 | ||
81 | /* register with core */ | 77 | /* register with core */ |
82 | count = driver_register(&drv->driver); | 78 | return driver_register(&drv->driver); |
83 | return count ? count : 1; | ||
84 | } | 79 | } |
85 | 80 | ||
86 | 81 | ||
diff --git a/fs/9p/9p.h b/fs/9p/9p.h index 95d72aec1c1a..94e2f92ab2e8 100644 --- a/fs/9p/9p.h +++ b/fs/9p/9p.h | |||
@@ -8,9 +8,8 @@ | |||
8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License version 2 |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * as published by the Free Software Foundation. |
13 | * (at your option) any later version. | ||
14 | * | 13 | * |
15 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -235,6 +234,7 @@ struct Tcreate { | |||
235 | struct v9fs_str name; | 234 | struct v9fs_str name; |
236 | u32 perm; | 235 | u32 perm; |
237 | u8 mode; | 236 | u8 mode; |
237 | struct v9fs_str extension; | ||
238 | }; | 238 | }; |
239 | 239 | ||
240 | struct Rcreate { | 240 | struct Rcreate { |
@@ -364,7 +364,7 @@ int v9fs_t_remove(struct v9fs_session_info *v9ses, u32 fid, | |||
364 | struct v9fs_fcall **rcall); | 364 | struct v9fs_fcall **rcall); |
365 | 365 | ||
366 | int v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, | 366 | int v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, |
367 | u32 perm, u8 mode, struct v9fs_fcall **rcall); | 367 | u32 perm, u8 mode, char *extension, struct v9fs_fcall **rcall); |
368 | 368 | ||
369 | int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid, | 369 | int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid, |
370 | u64 offset, u32 count, struct v9fs_fcall **rcall); | 370 | u64 offset, u32 count, struct v9fs_fcall **rcall); |
@@ -372,3 +372,4 @@ int v9fs_t_read(struct v9fs_session_info *v9ses, u32 fid, | |||
372 | int v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset, | 372 | int v9fs_t_write(struct v9fs_session_info *v9ses, u32 fid, u64 offset, |
373 | u32 count, const char __user * data, | 373 | u32 count, const char __user * data, |
374 | struct v9fs_fcall **rcall); | 374 | struct v9fs_fcall **rcall); |
375 | int v9fs_printfcall(char *, int, struct v9fs_fcall *, int); | ||
diff --git a/fs/9p/Makefile b/fs/9p/Makefile index 2f4ce43f7b6c..87897f84dfb6 100644 --- a/fs/9p/Makefile +++ b/fs/9p/Makefile | |||
@@ -1,10 +1,9 @@ | |||
1 | obj-$(CONFIG_9P_FS) := 9p2000.o | 1 | obj-$(CONFIG_9P_FS) := 9p.o |
2 | 2 | ||
3 | 9p2000-objs := \ | 3 | 9p-objs := \ |
4 | trans_fd.o \ | 4 | trans_fd.o \ |
5 | trans_sock.o \ | ||
6 | mux.o \ | 5 | mux.o \ |
7 | 9p.o \ | 6 | fcall.o \ |
8 | conv.o \ | 7 | conv.o \ |
9 | vfs_super.o \ | 8 | vfs_super.o \ |
10 | vfs_inode.o \ | 9 | vfs_inode.o \ |
@@ -14,5 +13,6 @@ obj-$(CONFIG_9P_FS) := 9p2000.o | |||
14 | vfs_dentry.o \ | 13 | vfs_dentry.o \ |
15 | error.o \ | 14 | error.o \ |
16 | v9fs.o \ | 15 | v9fs.o \ |
17 | fid.o | 16 | fid.o \ |
17 | fcprint.o | ||
18 | 18 | ||
diff --git a/fs/9p/conv.c b/fs/9p/conv.c index bba817142465..a767e05b60bf 100644 --- a/fs/9p/conv.c +++ b/fs/9p/conv.c | |||
@@ -8,9 +8,8 @@ | |||
8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License version 2 |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * as published by the Free Software Foundation. |
13 | * (at your option) any later version. | ||
14 | * | 13 | * |
15 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -666,7 +665,8 @@ struct v9fs_fcall *v9fs_create_topen(u32 fid, u8 mode) | |||
666 | return fc; | 665 | return fc; |
667 | } | 666 | } |
668 | 667 | ||
669 | struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode) | 668 | struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode, |
669 | char *extension, int extended) | ||
670 | { | 670 | { |
671 | int size; | 671 | int size; |
672 | struct v9fs_fcall *fc; | 672 | struct v9fs_fcall *fc; |
@@ -674,6 +674,9 @@ struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode) | |||
674 | struct cbuf *bufp = &buffer; | 674 | struct cbuf *bufp = &buffer; |
675 | 675 | ||
676 | size = 4 + 2 + strlen(name) + 4 + 1; /* fid[4] name[s] perm[4] mode[1] */ | 676 | size = 4 + 2 + strlen(name) + 4 + 1; /* fid[4] name[s] perm[4] mode[1] */ |
677 | if (extended && extension!=NULL) | ||
678 | size += 2 + strlen(extension); /* extension[s] */ | ||
679 | |||
677 | fc = v9fs_create_common(bufp, size, TCREATE); | 680 | fc = v9fs_create_common(bufp, size, TCREATE); |
678 | if (IS_ERR(fc)) | 681 | if (IS_ERR(fc)) |
679 | goto error; | 682 | goto error; |
@@ -682,6 +685,8 @@ struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode) | |||
682 | v9fs_put_str(bufp, name, &fc->params.tcreate.name); | 685 | v9fs_put_str(bufp, name, &fc->params.tcreate.name); |
683 | v9fs_put_int32(bufp, perm, &fc->params.tcreate.perm); | 686 | v9fs_put_int32(bufp, perm, &fc->params.tcreate.perm); |
684 | v9fs_put_int8(bufp, mode, &fc->params.tcreate.mode); | 687 | v9fs_put_int8(bufp, mode, &fc->params.tcreate.mode); |
688 | if (extended) | ||
689 | v9fs_put_str(bufp, extension, &fc->params.tcreate.extension); | ||
685 | 690 | ||
686 | if (buf_check_overflow(bufp)) { | 691 | if (buf_check_overflow(bufp)) { |
687 | kfree(fc); | 692 | kfree(fc); |
diff --git a/fs/9p/conv.h b/fs/9p/conv.h index f5896628dae4..dd5b6b1b610f 100644 --- a/fs/9p/conv.h +++ b/fs/9p/conv.h | |||
@@ -8,9 +8,8 @@ | |||
8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License version 2 |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * as published by the Free Software Foundation. |
13 | * (at your option) any later version. | ||
14 | * | 13 | * |
15 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -39,7 +38,8 @@ struct v9fs_fcall *v9fs_create_tflush(u16 oldtag); | |||
39 | struct v9fs_fcall *v9fs_create_twalk(u32 fid, u32 newfid, u16 nwname, | 38 | struct v9fs_fcall *v9fs_create_twalk(u32 fid, u32 newfid, u16 nwname, |
40 | char **wnames); | 39 | char **wnames); |
41 | struct v9fs_fcall *v9fs_create_topen(u32 fid, u8 mode); | 40 | struct v9fs_fcall *v9fs_create_topen(u32 fid, u8 mode); |
42 | struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode); | 41 | struct v9fs_fcall *v9fs_create_tcreate(u32 fid, char *name, u32 perm, u8 mode, |
42 | char *extension, int extended); | ||
43 | struct v9fs_fcall *v9fs_create_tread(u32 fid, u64 offset, u32 count); | 43 | struct v9fs_fcall *v9fs_create_tread(u32 fid, u64 offset, u32 count); |
44 | struct v9fs_fcall *v9fs_create_twrite(u32 fid, u64 offset, u32 count, | 44 | struct v9fs_fcall *v9fs_create_twrite(u32 fid, u64 offset, u32 count, |
45 | const char __user *data); | 45 | const char __user *data); |
diff --git a/fs/9p/debug.h b/fs/9p/debug.h index fe551032788b..4228c0bb3c32 100644 --- a/fs/9p/debug.h +++ b/fs/9p/debug.h | |||
@@ -5,9 +5,8 @@ | |||
5 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 5 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License version 2 |
9 | * the Free Software Foundation; either version 2 of the License, or | 9 | * as published by the Free Software Foundation. |
10 | * (at your option) any later version. | ||
11 | * | 10 | * |
12 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -30,6 +29,7 @@ | |||
30 | #define DEBUG_MUX (1<<5) | 29 | #define DEBUG_MUX (1<<5) |
31 | #define DEBUG_TRANS (1<<6) | 30 | #define DEBUG_TRANS (1<<6) |
32 | #define DEBUG_SLABS (1<<7) | 31 | #define DEBUG_SLABS (1<<7) |
32 | #define DEBUG_FCALL (1<<8) | ||
33 | 33 | ||
34 | #define DEBUG_DUMP_PKT 0 | 34 | #define DEBUG_DUMP_PKT 0 |
35 | 35 | ||
diff --git a/fs/9p/error.c b/fs/9p/error.c index e4b6f8f38b6f..981fe8ecd780 100644 --- a/fs/9p/error.c +++ b/fs/9p/error.c | |||
@@ -11,9 +11,8 @@ | |||
11 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 11 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
12 | * | 12 | * |
13 | * This program is free software; you can redistribute it and/or modify | 13 | * This program is free software; you can redistribute it and/or modify |
14 | * it under the terms of the GNU General Public License as published by | 14 | * it under the terms of the GNU General Public License version 2 |
15 | * the Free Software Foundation; either version 2 of the License, or | 15 | * as published by the Free Software Foundation. |
16 | * (at your option) any later version. | ||
17 | * | 16 | * |
18 | * This program is distributed in the hope that it will be useful, | 17 | * This program is distributed in the hope that it will be useful, |
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 18 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/error.h b/fs/9p/error.h index a9794e85fe51..5f3ca522b316 100644 --- a/fs/9p/error.h +++ b/fs/9p/error.h | |||
@@ -12,9 +12,8 @@ | |||
12 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 12 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
13 | * | 13 | * |
14 | * This program is free software; you can redistribute it and/or modify | 14 | * This program is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License as published by | 15 | * it under the terms of the GNU General Public License version 2 |
16 | * the Free Software Foundation; either version 2 of the License, or | 16 | * as published by the Free Software Foundation. |
17 | * (at your option) any later version. | ||
18 | * | 17 | * |
19 | * This program is distributed in the hope that it will be useful, | 18 | * This program is distributed in the hope that it will be useful, |
20 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/9p.c b/fs/9p/fcall.c index c148e6ba07e5..71742ba150c4 100644 --- a/fs/9p/9p.c +++ b/fs/9p/fcall.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/9p/9p.c | 2 | * linux/fs/9p/fcall.c |
3 | * | 3 | * |
4 | * This file contains functions to perform synchronous 9P calls | 4 | * This file contains functions to perform synchronous 9P calls |
5 | * | 5 | * |
@@ -8,9 +8,8 @@ | |||
8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License version 2 |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * as published by the Free Software Foundation. |
13 | * (at your option) any later version. | ||
14 | * | 13 | * |
15 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -152,10 +151,9 @@ v9fs_t_clunk(struct v9fs_session_info *v9ses, u32 fid) | |||
152 | /** | 151 | /** |
153 | * v9fs_v9fs_t_flush - flush a pending transaction | 152 | * v9fs_v9fs_t_flush - flush a pending transaction |
154 | * @v9ses: 9P2000 session information | 153 | * @v9ses: 9P2000 session information |
155 | * @tag: tid to release | 154 | * @tag: tag to release |
156 | * | 155 | * |
157 | */ | 156 | */ |
158 | |||
159 | int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 oldtag) | 157 | int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 oldtag) |
160 | { | 158 | { |
161 | int ret; | 159 | int ret; |
@@ -172,7 +170,7 @@ int v9fs_t_flush(struct v9fs_session_info *v9ses, u16 oldtag) | |||
172 | 170 | ||
173 | return ret; | 171 | return ret; |
174 | } | 172 | } |
175 | #endif /* 0 */ | 173 | #endif |
176 | 174 | ||
177 | /** | 175 | /** |
178 | * v9fs_t_stat - read a file's meta-data | 176 | * v9fs_t_stat - read a file's meta-data |
@@ -334,8 +332,8 @@ v9fs_t_remove(struct v9fs_session_info *v9ses, u32 fid, | |||
334 | */ | 332 | */ |
335 | 333 | ||
336 | int | 334 | int |
337 | v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, | 335 | v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, u32 perm, |
338 | u32 perm, u8 mode, struct v9fs_fcall **rcp) | 336 | u8 mode, char *extension, struct v9fs_fcall **rcp) |
339 | { | 337 | { |
340 | int ret; | 338 | int ret; |
341 | struct v9fs_fcall *tc; | 339 | struct v9fs_fcall *tc; |
@@ -343,7 +341,9 @@ v9fs_t_create(struct v9fs_session_info *v9ses, u32 fid, char *name, | |||
343 | dprintk(DEBUG_9P, "fid %d name '%s' perm %x mode %d\n", | 341 | dprintk(DEBUG_9P, "fid %d name '%s' perm %x mode %d\n", |
344 | fid, name, perm, mode); | 342 | fid, name, perm, mode); |
345 | 343 | ||
346 | tc = v9fs_create_tcreate(fid, name, perm, mode); | 344 | tc = v9fs_create_tcreate(fid, name, perm, mode, extension, |
345 | v9ses->extended); | ||
346 | |||
347 | if (!IS_ERR(tc)) { | 347 | if (!IS_ERR(tc)) { |
348 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); | 348 | ret = v9fs_mux_rpc(v9ses->mux, tc, rcp); |
349 | kfree(tc); | 349 | kfree(tc); |
diff --git a/fs/9p/fcprint.c b/fs/9p/fcprint.c new file mode 100644 index 000000000000..583e827baebd --- /dev/null +++ b/fs/9p/fcprint.c | |||
@@ -0,0 +1,346 @@ | |||
1 | /* | ||
2 | * linux/fs/9p/fcprint.c | ||
3 | * | ||
4 | * Print 9P call. | ||
5 | * | ||
6 | * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License version 2 | ||
10 | * as published by the Free Software Foundation. | ||
11 | * | ||
12 | * This program is distributed in the hope that it will be useful, | ||
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | * GNU General Public License for more details. | ||
16 | * | ||
17 | * You should have received a copy of the GNU General Public License | ||
18 | * along with this program; if not, write to: | ||
19 | * Free Software Foundation | ||
20 | * 51 Franklin Street, Fifth Floor | ||
21 | * Boston, MA 02111-1301 USA | ||
22 | * | ||
23 | */ | ||
24 | #include <linux/config.h> | ||
25 | #include <linux/module.h> | ||
26 | #include <linux/errno.h> | ||
27 | #include <linux/fs.h> | ||
28 | #include <linux/idr.h> | ||
29 | |||
30 | #include "debug.h" | ||
31 | #include "v9fs.h" | ||
32 | #include "9p.h" | ||
33 | #include "mux.h" | ||
34 | |||
35 | static int | ||
36 | v9fs_printqid(char *buf, int buflen, struct v9fs_qid *q) | ||
37 | { | ||
38 | int n; | ||
39 | char b[10]; | ||
40 | |||
41 | n = 0; | ||
42 | if (q->type & V9FS_QTDIR) | ||
43 | b[n++] = 'd'; | ||
44 | if (q->type & V9FS_QTAPPEND) | ||
45 | b[n++] = 'a'; | ||
46 | if (q->type & V9FS_QTAUTH) | ||
47 | b[n++] = 'A'; | ||
48 | if (q->type & V9FS_QTEXCL) | ||
49 | b[n++] = 'l'; | ||
50 | if (q->type & V9FS_QTTMP) | ||
51 | b[n++] = 't'; | ||
52 | if (q->type & V9FS_QTSYMLINK) | ||
53 | b[n++] = 'L'; | ||
54 | b[n] = '\0'; | ||
55 | |||
56 | return scnprintf(buf, buflen, "(%.16llx %x %s)", (long long int) q->path, | ||
57 | q->version, b); | ||
58 | } | ||
59 | |||
60 | static int | ||
61 | v9fs_printperm(char *buf, int buflen, int perm) | ||
62 | { | ||
63 | int n; | ||
64 | char b[15]; | ||
65 | |||
66 | n = 0; | ||
67 | if (perm & V9FS_DMDIR) | ||
68 | b[n++] = 'd'; | ||
69 | if (perm & V9FS_DMAPPEND) | ||
70 | b[n++] = 'a'; | ||
71 | if (perm & V9FS_DMAUTH) | ||
72 | b[n++] = 'A'; | ||
73 | if (perm & V9FS_DMEXCL) | ||
74 | b[n++] = 'l'; | ||
75 | if (perm & V9FS_DMTMP) | ||
76 | b[n++] = 't'; | ||
77 | if (perm & V9FS_DMDEVICE) | ||
78 | b[n++] = 'D'; | ||
79 | if (perm & V9FS_DMSOCKET) | ||
80 | b[n++] = 'S'; | ||
81 | if (perm & V9FS_DMNAMEDPIPE) | ||
82 | b[n++] = 'P'; | ||
83 | if (perm & V9FS_DMSYMLINK) | ||
84 | b[n++] = 'L'; | ||
85 | b[n] = '\0'; | ||
86 | |||
87 | return scnprintf(buf, buflen, "%s%03o", b, perm&077); | ||
88 | } | ||
89 | |||
90 | static int | ||
91 | v9fs_printstat(char *buf, int buflen, struct v9fs_stat *st, int extended) | ||
92 | { | ||
93 | int n; | ||
94 | |||
95 | n = scnprintf(buf, buflen, "'%.*s' '%.*s'", st->name.len, | ||
96 | st->name.str, st->uid.len, st->uid.str); | ||
97 | if (extended) | ||
98 | n += scnprintf(buf+n, buflen-n, "(%d)", st->n_uid); | ||
99 | |||
100 | n += scnprintf(buf+n, buflen-n, " '%.*s'", st->gid.len, st->gid.str); | ||
101 | if (extended) | ||
102 | n += scnprintf(buf+n, buflen-n, "(%d)", st->n_gid); | ||
103 | |||
104 | n += scnprintf(buf+n, buflen-n, " '%.*s'", st->muid.len, st->muid.str); | ||
105 | if (extended) | ||
106 | n += scnprintf(buf+n, buflen-n, "(%d)", st->n_muid); | ||
107 | |||
108 | n += scnprintf(buf+n, buflen-n, " q "); | ||
109 | n += v9fs_printqid(buf+n, buflen-n, &st->qid); | ||
110 | n += scnprintf(buf+n, buflen-n, " m "); | ||
111 | n += v9fs_printperm(buf+n, buflen-n, st->mode); | ||
112 | n += scnprintf(buf+n, buflen-n, " at %d mt %d l %lld", | ||
113 | st->atime, st->mtime, (long long int) st->length); | ||
114 | |||
115 | if (extended) | ||
116 | n += scnprintf(buf+n, buflen-n, " ext '%.*s'", | ||
117 | st->extension.len, st->extension.str); | ||
118 | |||
119 | return n; | ||
120 | } | ||
121 | |||
122 | static int | ||
123 | v9fs_dumpdata(char *buf, int buflen, u8 *data, int datalen) | ||
124 | { | ||
125 | int i, n; | ||
126 | |||
127 | i = n = 0; | ||
128 | while (i < datalen) { | ||
129 | n += scnprintf(buf + n, buflen - n, "%02x", data[i]); | ||
130 | if (i%4 == 3) | ||
131 | n += scnprintf(buf + n, buflen - n, " "); | ||
132 | if (i%32 == 31) | ||
133 | n += scnprintf(buf + n, buflen - n, "\n"); | ||
134 | |||
135 | i++; | ||
136 | } | ||
137 | n += scnprintf(buf + n, buflen - n, "\n"); | ||
138 | |||
139 | return n; | ||
140 | } | ||
141 | |||
142 | static int | ||
143 | v9fs_printdata(char *buf, int buflen, u8 *data, int datalen) | ||
144 | { | ||
145 | return v9fs_dumpdata(buf, buflen, data, datalen<16?datalen:16); | ||
146 | } | ||
147 | |||
148 | int | ||
149 | v9fs_printfcall(char *buf, int buflen, struct v9fs_fcall *fc, int extended) | ||
150 | { | ||
151 | int i, ret, type, tag; | ||
152 | |||
153 | if (!fc) | ||
154 | return scnprintf(buf, buflen, "<NULL>"); | ||
155 | |||
156 | type = fc->id; | ||
157 | tag = fc->tag; | ||
158 | |||
159 | ret = 0; | ||
160 | switch (type) { | ||
161 | case TVERSION: | ||
162 | ret += scnprintf(buf+ret, buflen-ret, | ||
163 | "Tversion tag %u msize %u version '%.*s'", tag, | ||
164 | fc->params.tversion.msize, fc->params.tversion.version.len, | ||
165 | fc->params.tversion.version.str); | ||
166 | break; | ||
167 | |||
168 | case RVERSION: | ||
169 | ret += scnprintf(buf+ret, buflen-ret, | ||
170 | "Rversion tag %u msize %u version '%.*s'", tag, | ||
171 | fc->params.rversion.msize, fc->params.rversion.version.len, | ||
172 | fc->params.rversion.version.str); | ||
173 | break; | ||
174 | |||
175 | case TAUTH: | ||
176 | ret += scnprintf(buf+ret, buflen-ret, | ||
177 | "Tauth tag %u afid %d uname '%.*s' aname '%.*s'", tag, | ||
178 | fc->params.tauth.afid, fc->params.tauth.uname.len, | ||
179 | fc->params.tauth.uname.str, fc->params.tauth.aname.len, | ||
180 | fc->params.tauth.aname.str); | ||
181 | break; | ||
182 | |||
183 | case RAUTH: | ||
184 | ret += scnprintf(buf+ret, buflen-ret, "Rauth tag %u qid ", tag); | ||
185 | v9fs_printqid(buf+ret, buflen-ret, &fc->params.rauth.qid); | ||
186 | break; | ||
187 | |||
188 | case TATTACH: | ||
189 | ret += scnprintf(buf+ret, buflen-ret, | ||
190 | "Tattach tag %u fid %d afid %d uname '%.*s' aname '%.*s'", | ||
191 | tag, fc->params.tattach.fid, fc->params.tattach.afid, | ||
192 | fc->params.tattach.uname.len, fc->params.tattach.uname.str, | ||
193 | fc->params.tattach.aname.len, fc->params.tattach.aname.str); | ||
194 | break; | ||
195 | |||
196 | case RATTACH: | ||
197 | ret += scnprintf(buf+ret, buflen-ret, "Rattach tag %u qid ", tag); | ||
198 | v9fs_printqid(buf+ret, buflen-ret, &fc->params.rattach.qid); | ||
199 | break; | ||
200 | |||
201 | case RERROR: | ||
202 | ret += scnprintf(buf+ret, buflen-ret, "Rerror tag %u ename '%.*s'", | ||
203 | tag, fc->params.rerror.error.len, | ||
204 | fc->params.rerror.error.str); | ||
205 | if (extended) | ||
206 | ret += scnprintf(buf+ret, buflen-ret, " ecode %d\n", | ||
207 | fc->params.rerror.errno); | ||
208 | break; | ||
209 | |||
210 | case TFLUSH: | ||
211 | ret += scnprintf(buf+ret, buflen-ret, "Tflush tag %u oldtag %u", | ||
212 | tag, fc->params.tflush.oldtag); | ||
213 | break; | ||
214 | |||
215 | case RFLUSH: | ||
216 | ret += scnprintf(buf+ret, buflen-ret, "Rflush tag %u", tag); | ||
217 | break; | ||
218 | |||
219 | case TWALK: | ||
220 | ret += scnprintf(buf+ret, buflen-ret, | ||
221 | "Twalk tag %u fid %d newfid %d nwname %d", tag, | ||
222 | fc->params.twalk.fid, fc->params.twalk.newfid, | ||
223 | fc->params.twalk.nwname); | ||
224 | for(i = 0; i < fc->params.twalk.nwname; i++) | ||
225 | ret += scnprintf(buf+ret, buflen-ret," '%.*s'", | ||
226 | fc->params.twalk.wnames[i].len, | ||
227 | fc->params.twalk.wnames[i].str); | ||
228 | break; | ||
229 | |||
230 | case RWALK: | ||
231 | ret += scnprintf(buf+ret, buflen-ret, "Rwalk tag %u nwqid %d", | ||
232 | tag, fc->params.rwalk.nwqid); | ||
233 | for(i = 0; i < fc->params.rwalk.nwqid; i++) | ||
234 | ret += v9fs_printqid(buf+ret, buflen-ret, | ||
235 | &fc->params.rwalk.wqids[i]); | ||
236 | break; | ||
237 | |||
238 | case TOPEN: | ||
239 | ret += scnprintf(buf+ret, buflen-ret, | ||
240 | "Topen tag %u fid %d mode %d", tag, | ||
241 | fc->params.topen.fid, fc->params.topen.mode); | ||
242 | break; | ||
243 | |||
244 | case ROPEN: | ||
245 | ret += scnprintf(buf+ret, buflen-ret, "Ropen tag %u", tag); | ||
246 | ret += v9fs_printqid(buf+ret, buflen-ret, &fc->params.ropen.qid); | ||
247 | ret += scnprintf(buf+ret, buflen-ret," iounit %d", | ||
248 | fc->params.ropen.iounit); | ||
249 | break; | ||
250 | |||
251 | case TCREATE: | ||
252 | ret += scnprintf(buf+ret, buflen-ret, | ||
253 | "Tcreate tag %u fid %d name '%.*s' perm ", tag, | ||
254 | fc->params.tcreate.fid, fc->params.tcreate.name.len, | ||
255 | fc->params.tcreate.name.str); | ||
256 | |||
257 | ret += v9fs_printperm(buf+ret, buflen-ret, fc->params.tcreate.perm); | ||
258 | ret += scnprintf(buf+ret, buflen-ret, " mode %d", | ||
259 | fc->params.tcreate.mode); | ||
260 | break; | ||
261 | |||
262 | case RCREATE: | ||
263 | ret += scnprintf(buf+ret, buflen-ret, "Rcreate tag %u", tag); | ||
264 | ret += v9fs_printqid(buf+ret, buflen-ret, &fc->params.rcreate.qid); | ||
265 | ret += scnprintf(buf+ret, buflen-ret, " iounit %d", | ||
266 | fc->params.rcreate.iounit); | ||
267 | break; | ||
268 | |||
269 | case TREAD: | ||
270 | ret += scnprintf(buf+ret, buflen-ret, | ||
271 | "Tread tag %u fid %d offset %lld count %u", tag, | ||
272 | fc->params.tread.fid, | ||
273 | (long long int) fc->params.tread.offset, | ||
274 | fc->params.tread.count); | ||
275 | break; | ||
276 | |||
277 | case RREAD: | ||
278 | ret += scnprintf(buf+ret, buflen-ret, | ||
279 | "Rread tag %u count %u data ", tag, | ||
280 | fc->params.rread.count); | ||
281 | ret += v9fs_printdata(buf+ret, buflen-ret, fc->params.rread.data, | ||
282 | fc->params.rread.count); | ||
283 | break; | ||
284 | |||
285 | case TWRITE: | ||
286 | ret += scnprintf(buf+ret, buflen-ret, | ||
287 | "Twrite tag %u fid %d offset %lld count %u data ", | ||
288 | tag, fc->params.twrite.fid, | ||
289 | (long long int) fc->params.twrite.offset, | ||
290 | fc->params.twrite.count); | ||
291 | ret += v9fs_printdata(buf+ret, buflen-ret, fc->params.twrite.data, | ||
292 | fc->params.twrite.count); | ||
293 | break; | ||
294 | |||
295 | case RWRITE: | ||
296 | ret += scnprintf(buf+ret, buflen-ret, "Rwrite tag %u count %u", | ||
297 | tag, fc->params.rwrite.count); | ||
298 | break; | ||
299 | |||
300 | case TCLUNK: | ||
301 | ret += scnprintf(buf+ret, buflen-ret, "Tclunk tag %u fid %d", | ||
302 | tag, fc->params.tclunk.fid); | ||
303 | break; | ||
304 | |||
305 | case RCLUNK: | ||
306 | ret += scnprintf(buf+ret, buflen-ret, "Rclunk tag %u", tag); | ||
307 | break; | ||
308 | |||
309 | case TREMOVE: | ||
310 | ret += scnprintf(buf+ret, buflen-ret, "Tremove tag %u fid %d", | ||
311 | tag, fc->params.tremove.fid); | ||
312 | break; | ||
313 | |||
314 | case RREMOVE: | ||
315 | ret += scnprintf(buf+ret, buflen-ret, "Rremove tag %u", tag); | ||
316 | break; | ||
317 | |||
318 | case TSTAT: | ||
319 | ret += scnprintf(buf+ret, buflen-ret, "Tstat tag %u fid %d", | ||
320 | tag, fc->params.tstat.fid); | ||
321 | break; | ||
322 | |||
323 | case RSTAT: | ||
324 | ret += scnprintf(buf+ret, buflen-ret, "Rstat tag %u ", tag); | ||
325 | ret += v9fs_printstat(buf+ret, buflen-ret, &fc->params.rstat.stat, | ||
326 | extended); | ||
327 | break; | ||
328 | |||
329 | case TWSTAT: | ||
330 | ret += scnprintf(buf+ret, buflen-ret, "Twstat tag %u fid %d ", | ||
331 | tag, fc->params.twstat.fid); | ||
332 | ret += v9fs_printstat(buf+ret, buflen-ret, &fc->params.twstat.stat, | ||
333 | extended); | ||
334 | break; | ||
335 | |||
336 | case RWSTAT: | ||
337 | ret += scnprintf(buf+ret, buflen-ret, "Rwstat tag %u", tag); | ||
338 | break; | ||
339 | |||
340 | default: | ||
341 | ret += scnprintf(buf+ret, buflen-ret, "unknown type %d", type); | ||
342 | break; | ||
343 | } | ||
344 | |||
345 | return ret; | ||
346 | } | ||
diff --git a/fs/9p/fid.c b/fs/9p/fid.c index c4d13bf904d2..b7608af07ce8 100644 --- a/fs/9p/fid.c +++ b/fs/9p/fid.c | |||
@@ -4,9 +4,8 @@ | |||
4 | * Copyright (C) 2005, 2006 by Eric Van Hensbergen <ericvh@gmail.com> | 4 | * Copyright (C) 2005, 2006 by Eric Van Hensbergen <ericvh@gmail.com> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License version 2 |
8 | * the Free Software Foundation; either version 2 of the License, or | 8 | * as published by the Free Software Foundation. |
9 | * (at your option) any later version. | ||
10 | * | 9 | * |
11 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/fid.h b/fs/9p/fid.h index 1fc2dd08d75a..aa974d6875c3 100644 --- a/fs/9p/fid.h +++ b/fs/9p/fid.h | |||
@@ -4,9 +4,8 @@ | |||
4 | * Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com> | 4 | * Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com> |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify | 6 | * This program is free software; you can redistribute it and/or modify |
7 | * it under the terms of the GNU General Public License as published by | 7 | * it under the terms of the GNU General Public License version 2 |
8 | * the Free Software Foundation; either version 2 of the License, or | 8 | * as published by the Free Software Foundation. |
9 | * (at your option) any later version. | ||
10 | * | 9 | * |
11 | * This program is distributed in the hope that it will be useful, | 10 | * This program is distributed in the hope that it will be useful, |
12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/mux.c b/fs/9p/mux.c index e2ae60adda99..3e5b124a7212 100644 --- a/fs/9p/mux.c +++ b/fs/9p/mux.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2004-2005 by Latchesar Ionkov <lucho@ionkov.net> | 7 | * Copyright (C) 2004-2005 by Latchesar Ionkov <lucho@ionkov.net> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -70,7 +69,7 @@ struct v9fs_mux_data { | |||
70 | int msize; | 69 | int msize; |
71 | unsigned char *extended; | 70 | unsigned char *extended; |
72 | struct v9fs_transport *trans; | 71 | struct v9fs_transport *trans; |
73 | struct v9fs_idpool tidpool; | 72 | struct v9fs_idpool tagpool; |
74 | int err; | 73 | int err; |
75 | wait_queue_head_t equeue; | 74 | wait_queue_head_t equeue; |
76 | struct list_head req_list; | 75 | struct list_head req_list; |
@@ -280,8 +279,8 @@ struct v9fs_mux_data *v9fs_mux_init(struct v9fs_transport *trans, int msize, | |||
280 | m->msize = msize; | 279 | m->msize = msize; |
281 | m->extended = extended; | 280 | m->extended = extended; |
282 | m->trans = trans; | 281 | m->trans = trans; |
283 | idr_init(&m->tidpool.pool); | 282 | idr_init(&m->tagpool.pool); |
284 | init_MUTEX(&m->tidpool.lock); | 283 | init_MUTEX(&m->tagpool.lock); |
285 | m->err = 0; | 284 | m->err = 0; |
286 | init_waitqueue_head(&m->equeue); | 285 | init_waitqueue_head(&m->equeue); |
287 | INIT_LIST_HEAD(&m->req_list); | 286 | INIT_LIST_HEAD(&m->req_list); |
@@ -635,6 +634,14 @@ static void v9fs_read_work(void *a) | |||
635 | goto error; | 634 | goto error; |
636 | } | 635 | } |
637 | 636 | ||
637 | if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) { | ||
638 | char buf[150]; | ||
639 | |||
640 | v9fs_printfcall(buf, sizeof(buf), m->rcall, | ||
641 | *m->extended); | ||
642 | printk(KERN_NOTICE ">>> %p %s\n", m, buf); | ||
643 | } | ||
644 | |||
638 | rcall = m->rcall; | 645 | rcall = m->rcall; |
639 | rbuf = m->rbuf; | 646 | rbuf = m->rbuf; |
640 | if (m->rpos > n) { | 647 | if (m->rpos > n) { |
@@ -740,6 +747,13 @@ static struct v9fs_req *v9fs_send_request(struct v9fs_mux_data *m, | |||
740 | 747 | ||
741 | v9fs_set_tag(tc, n); | 748 | v9fs_set_tag(tc, n); |
742 | 749 | ||
750 | if ((v9fs_debug_level&DEBUG_FCALL) == DEBUG_FCALL) { | ||
751 | char buf[150]; | ||
752 | |||
753 | v9fs_printfcall(buf, sizeof(buf), tc, *m->extended); | ||
754 | printk(KERN_NOTICE "<<< %p %s\n", m, buf); | ||
755 | } | ||
756 | |||
743 | req->tag = n; | 757 | req->tag = n; |
744 | req->tcall = tc; | 758 | req->tcall = tc; |
745 | req->rcall = NULL; | 759 | req->rcall = NULL; |
@@ -965,7 +979,7 @@ static u16 v9fs_mux_get_tag(struct v9fs_mux_data *m) | |||
965 | { | 979 | { |
966 | int tag; | 980 | int tag; |
967 | 981 | ||
968 | tag = v9fs_get_idpool(&m->tidpool); | 982 | tag = v9fs_get_idpool(&m->tagpool); |
969 | if (tag < 0) | 983 | if (tag < 0) |
970 | return V9FS_NOTAG; | 984 | return V9FS_NOTAG; |
971 | else | 985 | else |
@@ -974,6 +988,6 @@ static u16 v9fs_mux_get_tag(struct v9fs_mux_data *m) | |||
974 | 988 | ||
975 | static void v9fs_mux_put_tag(struct v9fs_mux_data *m, u16 tag) | 989 | static void v9fs_mux_put_tag(struct v9fs_mux_data *m, u16 tag) |
976 | { | 990 | { |
977 | if (tag != V9FS_NOTAG && v9fs_check_idpool(tag, &m->tidpool)) | 991 | if (tag != V9FS_NOTAG && v9fs_check_idpool(tag, &m->tagpool)) |
978 | v9fs_put_idpool(tag, &m->tidpool); | 992 | v9fs_put_idpool(tag, &m->tagpool); |
979 | } | 993 | } |
diff --git a/fs/9p/mux.h b/fs/9p/mux.h index 17144fdfa11b..e90bfd32ea42 100644 --- a/fs/9p/mux.h +++ b/fs/9p/mux.h | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> | 7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/trans_fd.c b/fs/9p/trans_fd.c index 5b2ce21b10fa..94e0a7fd9fc2 100644 --- a/fs/9p/trans_fd.c +++ b/fs/9p/trans_fd.c | |||
@@ -1,15 +1,16 @@ | |||
1 | /* | 1 | /* |
2 | * linux/fs/9p/trans_fd.c | 2 | * linux/fs/9p/trans_fd.c |
3 | * | 3 | * |
4 | * File Descriptor Transport Layer | 4 | * Fd transport layer. Includes deprecated socket layer. |
5 | * | 5 | * |
6 | * Copyright (C) 2005 by Latchesar Ionkov <lucho@ionkov.net> | 6 | * Copyright (C) 2006 by Russ Cox <rsc@swtch.com> |
7 | * Copyright (C) 2005 by Eric Van Hensbergen <ericvh@gmail.com> | 7 | * Copyright (C) 2004-2005 by Latchesar Ionkov <lucho@ionkov.net> |
8 | * Copyright (C) 2004-2005 by Eric Van Hensbergen <ericvh@gmail.com> | ||
9 | * Copyright (C) 1997-2002 by Ron Minnich <rminnich@sarnoff.com> | ||
8 | * | 10 | * |
9 | * This program is free software; you can redistribute it and/or modify | 11 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 12 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 13 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 14 | * |
14 | * This program is distributed in the hope that it will be useful, | 15 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -25,6 +26,7 @@ | |||
25 | */ | 26 | */ |
26 | 27 | ||
27 | #include <linux/config.h> | 28 | #include <linux/config.h> |
29 | #include <linux/in.h> | ||
28 | #include <linux/module.h> | 30 | #include <linux/module.h> |
29 | #include <linux/net.h> | 31 | #include <linux/net.h> |
30 | #include <linux/ipv6.h> | 32 | #include <linux/ipv6.h> |
@@ -40,89 +42,119 @@ | |||
40 | #include "v9fs.h" | 42 | #include "v9fs.h" |
41 | #include "transport.h" | 43 | #include "transport.h" |
42 | 44 | ||
45 | #define V9FS_PORT 564 | ||
46 | |||
43 | struct v9fs_trans_fd { | 47 | struct v9fs_trans_fd { |
44 | struct file *in_file; | 48 | struct file *rd; |
45 | struct file *out_file; | 49 | struct file *wr; |
46 | }; | 50 | }; |
47 | 51 | ||
48 | /** | 52 | /** |
49 | * v9fs_fd_recv - receive from a socket | 53 | * v9fs_fd_read- read from a fd |
50 | * @v9ses: session information | 54 | * @v9ses: session information |
51 | * @v: buffer to receive data into | 55 | * @v: buffer to receive data into |
52 | * @len: size of receive buffer | 56 | * @len: size of receive buffer |
53 | * | 57 | * |
54 | */ | 58 | */ |
55 | 59 | static int v9fs_fd_read(struct v9fs_transport *trans, void *v, int len) | |
56 | static int v9fs_fd_recv(struct v9fs_transport *trans, void *v, int len) | ||
57 | { | 60 | { |
58 | struct v9fs_trans_fd *ts = trans ? trans->priv : NULL; | 61 | int ret; |
62 | struct v9fs_trans_fd *ts; | ||
59 | 63 | ||
60 | if (!trans || trans->status != Connected || !ts) | 64 | if (!trans || trans->status == Disconnected || !(ts = trans->priv)) |
61 | return -EIO; | 65 | return -EREMOTEIO; |
62 | 66 | ||
63 | return kernel_read(ts->in_file, ts->in_file->f_pos, v, len); | 67 | if (!(ts->rd->f_flags & O_NONBLOCK)) |
68 | dprintk(DEBUG_ERROR, "blocking read ...\n"); | ||
69 | |||
70 | ret = kernel_read(ts->rd, ts->rd->f_pos, v, len); | ||
71 | if (ret <= 0 && ret != -ERESTARTSYS && ret != -EAGAIN) | ||
72 | trans->status = Disconnected; | ||
73 | return ret; | ||
64 | } | 74 | } |
65 | 75 | ||
66 | /** | 76 | /** |
67 | * v9fs_fd_send - send to a socket | 77 | * v9fs_fd_write - write to a socket |
68 | * @v9ses: session information | 78 | * @v9ses: session information |
69 | * @v: buffer to send data from | 79 | * @v: buffer to send data from |
70 | * @len: size of send buffer | 80 | * @len: size of send buffer |
71 | * | 81 | * |
72 | */ | 82 | */ |
73 | 83 | static int v9fs_fd_write(struct v9fs_transport *trans, void *v, int len) | |
74 | static int v9fs_fd_send(struct v9fs_transport *trans, void *v, int len) | ||
75 | { | 84 | { |
76 | struct v9fs_trans_fd *ts = trans ? trans->priv : NULL; | 85 | int ret; |
77 | mm_segment_t oldfs = get_fs(); | 86 | mm_segment_t oldfs; |
78 | int ret = 0; | 87 | struct v9fs_trans_fd *ts; |
79 | 88 | ||
80 | if (!trans || trans->status != Connected || !ts) | 89 | if (!trans || trans->status == Disconnected || !(ts = trans->priv)) |
81 | return -EIO; | 90 | return -EREMOTEIO; |
91 | |||
92 | if (!(ts->wr->f_flags & O_NONBLOCK)) | ||
93 | dprintk(DEBUG_ERROR, "blocking write ...\n"); | ||
82 | 94 | ||
83 | oldfs = get_fs(); | 95 | oldfs = get_fs(); |
84 | set_fs(get_ds()); | 96 | set_fs(get_ds()); |
85 | /* The cast to a user pointer is valid due to the set_fs() */ | 97 | /* The cast to a user pointer is valid due to the set_fs() */ |
86 | ret = vfs_write(ts->out_file, (void __user *)v, len, &ts->out_file->f_pos); | 98 | ret = vfs_write(ts->wr, (void __user *)v, len, &ts->wr->f_pos); |
87 | set_fs(oldfs); | 99 | set_fs(oldfs); |
88 | 100 | ||
101 | if (ret <= 0 && ret != -ERESTARTSYS && ret != -EAGAIN) | ||
102 | trans->status = Disconnected; | ||
89 | return ret; | 103 | return ret; |
90 | } | 104 | } |
91 | 105 | ||
92 | /** | 106 | static unsigned int |
93 | * v9fs_fd_init - initialize file descriptor transport | 107 | v9fs_fd_poll(struct v9fs_transport *trans, struct poll_table_struct *pt) |
94 | * @v9ses: session information | ||
95 | * @addr: address of server to mount | ||
96 | * @data: mount options | ||
97 | * | ||
98 | */ | ||
99 | |||
100 | static int | ||
101 | v9fs_fd_init(struct v9fs_session_info *v9ses, const char *addr, char *data) | ||
102 | { | 108 | { |
103 | struct v9fs_trans_fd *ts = NULL; | 109 | int ret, n; |
104 | struct v9fs_transport *trans = v9ses->transport; | 110 | struct v9fs_trans_fd *ts; |
111 | mm_segment_t oldfs; | ||
105 | 112 | ||
106 | if((v9ses->wfdno == ~0) || (v9ses->rfdno == ~0)) { | 113 | if (!trans || trans->status != Connected || !(ts = trans->priv)) |
107 | printk(KERN_ERR "v9fs: Insufficient options for proto=fd\n"); | 114 | return -EREMOTEIO; |
108 | return -ENOPROTOOPT; | ||
109 | } | ||
110 | 115 | ||
111 | ts = kmalloc(sizeof(struct v9fs_trans_fd), GFP_KERNEL); | 116 | if (!ts->rd->f_op || !ts->rd->f_op->poll) |
117 | return -EIO; | ||
112 | 118 | ||
113 | if (!ts) | 119 | if (!ts->wr->f_op || !ts->wr->f_op->poll) |
114 | return -ENOMEM; | 120 | return -EIO; |
115 | 121 | ||
116 | ts->in_file = fget( v9ses->rfdno ); | 122 | oldfs = get_fs(); |
117 | ts->out_file = fget( v9ses->wfdno ); | 123 | set_fs(get_ds()); |
118 | 124 | ||
119 | if (!ts->in_file || !ts->out_file) { | 125 | ret = ts->rd->f_op->poll(ts->rd, pt); |
120 | if (ts->in_file) | 126 | if (ret < 0) |
121 | fput(ts->in_file); | 127 | goto end; |
122 | 128 | ||
123 | if (ts->out_file) | 129 | if (ts->rd != ts->wr) { |
124 | fput(ts->out_file); | 130 | n = ts->wr->f_op->poll(ts->wr, pt); |
131 | if (n < 0) { | ||
132 | ret = n; | ||
133 | goto end; | ||
134 | } | ||
135 | ret = (ret & ~POLLOUT) | (n & ~POLLIN); | ||
136 | } | ||
125 | 137 | ||
138 | end: | ||
139 | set_fs(oldfs); | ||
140 | return ret; | ||
141 | } | ||
142 | |||
143 | static int v9fs_fd_open(struct v9fs_session_info *v9ses, int rfd, int wfd) | ||
144 | { | ||
145 | struct v9fs_transport *trans = v9ses->transport; | ||
146 | struct v9fs_trans_fd *ts = kmalloc(sizeof(struct v9fs_trans_fd), | ||
147 | GFP_KERNEL); | ||
148 | if (!ts) | ||
149 | return -ENOMEM; | ||
150 | |||
151 | ts->rd = fget(rfd); | ||
152 | ts->wr = fget(wfd); | ||
153 | if (!ts->rd || !ts->wr) { | ||
154 | if (ts->rd) | ||
155 | fput(ts->rd); | ||
156 | if (ts->wr) | ||
157 | fput(ts->wr); | ||
126 | kfree(ts); | 158 | kfree(ts); |
127 | return -EIO; | 159 | return -EIO; |
128 | } | 160 | } |
@@ -133,84 +165,145 @@ v9fs_fd_init(struct v9fs_session_info *v9ses, const char *addr, char *data) | |||
133 | return 0; | 165 | return 0; |
134 | } | 166 | } |
135 | 167 | ||
136 | 168 | static int v9fs_fd_init(struct v9fs_session_info *v9ses, const char *addr, | |
137 | /** | 169 | char *data) |
138 | * v9fs_fd_close - shutdown file descriptor | ||
139 | * @trans: private socket structure | ||
140 | * | ||
141 | */ | ||
142 | |||
143 | static void v9fs_fd_close(struct v9fs_transport *trans) | ||
144 | { | 170 | { |
145 | struct v9fs_trans_fd *ts; | 171 | if (v9ses->rfdno == ~0 || v9ses->wfdno == ~0) { |
146 | 172 | printk(KERN_ERR "v9fs: Insufficient options for proto=fd\n"); | |
147 | if (!trans) | 173 | return -ENOPROTOOPT; |
148 | return; | 174 | } |
149 | |||
150 | ts = xchg(&trans->priv, NULL); | ||
151 | 175 | ||
152 | if (!ts) | 176 | return v9fs_fd_open(v9ses, v9ses->rfdno, v9ses->wfdno); |
153 | return; | 177 | } |
154 | 178 | ||
155 | trans->status = Disconnected; | 179 | static int v9fs_socket_open(struct v9fs_session_info *v9ses, |
156 | if (ts->in_file) | 180 | struct socket *csocket) |
157 | fput(ts->in_file); | 181 | { |
182 | int fd, ret; | ||
183 | |||
184 | csocket->sk->sk_allocation = GFP_NOIO; | ||
185 | if ((fd = sock_map_fd(csocket)) < 0) { | ||
186 | eprintk(KERN_ERR, "v9fs_socket_open: failed to map fd\n"); | ||
187 | ret = fd; | ||
188 | release_csocket: | ||
189 | sock_release(csocket); | ||
190 | return ret; | ||
191 | } | ||
158 | 192 | ||
159 | if (ts->out_file) | 193 | if ((ret = v9fs_fd_open(v9ses, fd, fd)) < 0) { |
160 | fput(ts->out_file); | 194 | sockfd_put(csocket); |
195 | eprintk(KERN_ERR, "v9fs_socket_open: failed to open fd\n"); | ||
196 | goto release_csocket; | ||
197 | } | ||
161 | 198 | ||
162 | kfree(ts); | 199 | ((struct v9fs_trans_fd *)v9ses->transport->priv)->rd->f_flags |= |
200 | O_NONBLOCK; | ||
201 | return 0; | ||
163 | } | 202 | } |
164 | 203 | ||
165 | static unsigned int | 204 | static int v9fs_tcp_init(struct v9fs_session_info *v9ses, const char *addr, |
166 | v9fs_fd_poll(struct v9fs_transport *trans, struct poll_table_struct *pt) | 205 | char *data) |
167 | { | 206 | { |
168 | int ret, n; | 207 | int ret; |
169 | struct v9fs_trans_fd *ts; | 208 | struct socket *csocket = NULL; |
170 | mm_segment_t oldfs; | 209 | struct sockaddr_in sin_server; |
210 | |||
211 | sin_server.sin_family = AF_INET; | ||
212 | sin_server.sin_addr.s_addr = in_aton(addr); | ||
213 | sin_server.sin_port = htons(v9ses->port); | ||
214 | sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &csocket); | ||
215 | |||
216 | if (!csocket) { | ||
217 | eprintk(KERN_ERR, "v9fs_trans_tcp: problem creating socket\n"); | ||
218 | return -1; | ||
219 | } | ||
171 | 220 | ||
172 | if (!trans) | 221 | ret = csocket->ops->connect(csocket, |
173 | return -EIO; | 222 | (struct sockaddr *)&sin_server, |
223 | sizeof(struct sockaddr_in), 0); | ||
224 | if (ret < 0) { | ||
225 | eprintk(KERN_ERR, | ||
226 | "v9fs_trans_tcp: problem connecting socket to %s\n", | ||
227 | addr); | ||
228 | return ret; | ||
229 | } | ||
174 | 230 | ||
175 | ts = trans->priv; | 231 | return v9fs_socket_open(v9ses, csocket); |
176 | if (trans->status != Connected || !ts) | 232 | } |
177 | return -EIO; | ||
178 | 233 | ||
179 | oldfs = get_fs(); | 234 | static int |
180 | set_fs(get_ds()); | 235 | v9fs_unix_init(struct v9fs_session_info *v9ses, const char *addr, char *data) |
236 | { | ||
237 | int ret; | ||
238 | struct socket *csocket; | ||
239 | struct sockaddr_un sun_server; | ||
240 | |||
241 | if (strlen(addr) > UNIX_PATH_MAX) { | ||
242 | eprintk(KERN_ERR, "v9fs_trans_unix: address too long: %s\n", | ||
243 | addr); | ||
244 | return -ENAMETOOLONG; | ||
245 | } | ||
181 | 246 | ||
182 | if (!ts->in_file->f_op || !ts->in_file->f_op->poll) { | 247 | sun_server.sun_family = PF_UNIX; |
183 | ret = -EIO; | 248 | strcpy(sun_server.sun_path, addr); |
184 | goto end; | 249 | sock_create_kern(PF_UNIX, SOCK_STREAM, 0, &csocket); |
250 | ret = csocket->ops->connect(csocket, (struct sockaddr *)&sun_server, | ||
251 | sizeof(struct sockaddr_un) - 1, 0); | ||
252 | if (ret < 0) { | ||
253 | eprintk(KERN_ERR, | ||
254 | "v9fs_trans_unix: problem connecting socket: %s: %d\n", | ||
255 | addr, ret); | ||
256 | return ret; | ||
185 | } | 257 | } |
186 | 258 | ||
187 | ret = ts->in_file->f_op->poll(ts->in_file, pt); | 259 | return v9fs_socket_open(v9ses, csocket); |
260 | } | ||
188 | 261 | ||
189 | if (ts->out_file != ts->in_file) { | 262 | /** |
190 | if (!ts->out_file->f_op || !ts->out_file->f_op->poll) { | 263 | * v9fs_sock_close - shutdown socket |
191 | ret = -EIO; | 264 | * @trans: private socket structure |
192 | goto end; | 265 | * |
193 | } | 266 | */ |
267 | static void v9fs_fd_close(struct v9fs_transport *trans) | ||
268 | { | ||
269 | struct v9fs_trans_fd *ts; | ||
194 | 270 | ||
195 | n = ts->out_file->f_op->poll(ts->out_file, pt); | 271 | if (!trans) |
272 | return; | ||
196 | 273 | ||
197 | ret &= ~POLLOUT; | 274 | ts = xchg(&trans->priv, NULL); |
198 | n &= ~POLLIN; | ||
199 | 275 | ||
200 | ret |= n; | 276 | if (!ts) |
201 | } | 277 | return; |
202 | 278 | ||
203 | end: | 279 | trans->status = Disconnected; |
204 | set_fs(oldfs); | 280 | if (ts->rd) |
205 | return ret; | 281 | fput(ts->rd); |
282 | if (ts->wr) | ||
283 | fput(ts->wr); | ||
284 | kfree(ts); | ||
206 | } | 285 | } |
207 | 286 | ||
208 | |||
209 | struct v9fs_transport v9fs_trans_fd = { | 287 | struct v9fs_transport v9fs_trans_fd = { |
210 | .init = v9fs_fd_init, | 288 | .init = v9fs_fd_init, |
211 | .write = v9fs_fd_send, | 289 | .write = v9fs_fd_write, |
212 | .read = v9fs_fd_recv, | 290 | .read = v9fs_fd_read, |
213 | .close = v9fs_fd_close, | 291 | .close = v9fs_fd_close, |
214 | .poll = v9fs_fd_poll, | 292 | .poll = v9fs_fd_poll, |
215 | }; | 293 | }; |
216 | 294 | ||
295 | struct v9fs_transport v9fs_trans_tcp = { | ||
296 | .init = v9fs_tcp_init, | ||
297 | .write = v9fs_fd_write, | ||
298 | .read = v9fs_fd_read, | ||
299 | .close = v9fs_fd_close, | ||
300 | .poll = v9fs_fd_poll, | ||
301 | }; | ||
302 | |||
303 | struct v9fs_transport v9fs_trans_unix = { | ||
304 | .init = v9fs_unix_init, | ||
305 | .write = v9fs_fd_write, | ||
306 | .read = v9fs_fd_read, | ||
307 | .close = v9fs_fd_close, | ||
308 | .poll = v9fs_fd_poll, | ||
309 | }; | ||
diff --git a/fs/9p/trans_sock.c b/fs/9p/trans_sock.c deleted file mode 100644 index 44e830697acb..000000000000 --- a/fs/9p/trans_sock.c +++ /dev/null | |||
@@ -1,334 +0,0 @@ | |||
1 | /* | ||
2 | * linux/fs/9p/trans_socket.c | ||
3 | * | ||
4 | * Socket Transport Layer | ||
5 | * | ||
6 | * Copyright (C) 2004-2005 by Latchesar Ionkov <lucho@ionkov.net> | ||
7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> | ||
8 | * Copyright (C) 1997-2002 by Ron Minnich <rminnich@sarnoff.com> | ||
9 | * Copyright (C) 1995, 1996 by Olaf Kirch <okir@monad.swb.de> | ||
10 | * | ||
11 | * This program is free software; you can redistribute it and/or modify | ||
12 | * it under the terms of the GNU General Public License as published by | ||
13 | * the Free Software Foundation; either version 2 of the License, or | ||
14 | * (at your option) any later version. | ||
15 | * | ||
16 | * This program is distributed in the hope that it will be useful, | ||
17 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
18 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
19 | * GNU General Public License for more details. | ||
20 | * | ||
21 | * You should have received a copy of the GNU General Public License | ||
22 | * along with this program; if not, write to: | ||
23 | * Free Software Foundation | ||
24 | * 51 Franklin Street, Fifth Floor | ||
25 | * Boston, MA 02111-1301 USA | ||
26 | * | ||
27 | */ | ||
28 | |||
29 | #include <linux/config.h> | ||
30 | #include <linux/in.h> | ||
31 | #include <linux/module.h> | ||
32 | #include <linux/net.h> | ||
33 | #include <linux/ipv6.h> | ||
34 | #include <linux/errno.h> | ||
35 | #include <linux/kernel.h> | ||
36 | #include <linux/un.h> | ||
37 | #include <asm/uaccess.h> | ||
38 | #include <linux/inet.h> | ||
39 | #include <linux/idr.h> | ||
40 | #include <linux/file.h> | ||
41 | |||
42 | #include "debug.h" | ||
43 | #include "v9fs.h" | ||
44 | #include "transport.h" | ||
45 | |||
46 | #define V9FS_PORT 564 | ||
47 | |||
48 | struct v9fs_trans_sock { | ||
49 | struct socket *s; | ||
50 | struct file *filp; | ||
51 | }; | ||
52 | |||
53 | /** | ||
54 | * v9fs_sock_recv - receive from a socket | ||
55 | * @v9ses: session information | ||
56 | * @v: buffer to receive data into | ||
57 | * @len: size of receive buffer | ||
58 | * | ||
59 | */ | ||
60 | |||
61 | static int v9fs_sock_recv(struct v9fs_transport *trans, void *v, int len) | ||
62 | { | ||
63 | int ret; | ||
64 | struct v9fs_trans_sock *ts; | ||
65 | |||
66 | if (!trans || trans->status == Disconnected) { | ||
67 | dprintk(DEBUG_ERROR, "disconnected ...\n"); | ||
68 | return -EREMOTEIO; | ||
69 | } | ||
70 | |||
71 | ts = trans->priv; | ||
72 | |||
73 | if (!(ts->filp->f_flags & O_NONBLOCK)) | ||
74 | dprintk(DEBUG_ERROR, "blocking read ...\n"); | ||
75 | |||
76 | ret = kernel_read(ts->filp, ts->filp->f_pos, v, len); | ||
77 | if (ret <= 0) { | ||
78 | if (ret != -ERESTARTSYS && ret != -EAGAIN) | ||
79 | trans->status = Disconnected; | ||
80 | } | ||
81 | |||
82 | return ret; | ||
83 | } | ||
84 | |||
85 | /** | ||
86 | * v9fs_sock_send - send to a socket | ||
87 | * @v9ses: session information | ||
88 | * @v: buffer to send data from | ||
89 | * @len: size of send buffer | ||
90 | * | ||
91 | */ | ||
92 | |||
93 | static int v9fs_sock_send(struct v9fs_transport *trans, void *v, int len) | ||
94 | { | ||
95 | int ret; | ||
96 | mm_segment_t oldfs; | ||
97 | struct v9fs_trans_sock *ts; | ||
98 | |||
99 | if (!trans || trans->status == Disconnected) { | ||
100 | dprintk(DEBUG_ERROR, "disconnected ...\n"); | ||
101 | return -EREMOTEIO; | ||
102 | } | ||
103 | |||
104 | ts = trans->priv; | ||
105 | if (!ts) { | ||
106 | dprintk(DEBUG_ERROR, "no transport ...\n"); | ||
107 | return -EREMOTEIO; | ||
108 | } | ||
109 | |||
110 | if (!(ts->filp->f_flags & O_NONBLOCK)) | ||
111 | dprintk(DEBUG_ERROR, "blocking write ...\n"); | ||
112 | |||
113 | oldfs = get_fs(); | ||
114 | set_fs(get_ds()); | ||
115 | ret = vfs_write(ts->filp, (void __user *)v, len, &ts->filp->f_pos); | ||
116 | set_fs(oldfs); | ||
117 | |||
118 | if (ret < 0) { | ||
119 | if (ret != -ERESTARTSYS) | ||
120 | trans->status = Disconnected; | ||
121 | } | ||
122 | |||
123 | return ret; | ||
124 | } | ||
125 | |||
126 | static unsigned int v9fs_sock_poll(struct v9fs_transport *trans, | ||
127 | struct poll_table_struct *pt) { | ||
128 | |||
129 | int ret; | ||
130 | struct v9fs_trans_sock *ts; | ||
131 | mm_segment_t oldfs; | ||
132 | |||
133 | if (!trans) { | ||
134 | dprintk(DEBUG_ERROR, "no transport\n"); | ||
135 | return -EIO; | ||
136 | } | ||
137 | |||
138 | ts = trans->priv; | ||
139 | if (trans->status != Connected || !ts) { | ||
140 | dprintk(DEBUG_ERROR, "transport disconnected: %d\n", trans->status); | ||
141 | return -EIO; | ||
142 | } | ||
143 | |||
144 | oldfs = get_fs(); | ||
145 | set_fs(get_ds()); | ||
146 | |||
147 | if (!ts->filp->f_op || !ts->filp->f_op->poll) { | ||
148 | dprintk(DEBUG_ERROR, "no poll operation\n"); | ||
149 | ret = -EIO; | ||
150 | goto end; | ||
151 | } | ||
152 | |||
153 | ret = ts->filp->f_op->poll(ts->filp, pt); | ||
154 | |||
155 | end: | ||
156 | set_fs(oldfs); | ||
157 | return ret; | ||
158 | } | ||
159 | |||
160 | |||
161 | /** | ||
162 | * v9fs_tcp_init - initialize TCP socket | ||
163 | * @v9ses: session information | ||
164 | * @addr: address of server to mount | ||
165 | * @data: mount options | ||
166 | * | ||
167 | */ | ||
168 | |||
169 | static int | ||
170 | v9fs_tcp_init(struct v9fs_session_info *v9ses, const char *addr, char *data) | ||
171 | { | ||
172 | struct socket *csocket = NULL; | ||
173 | struct sockaddr_in sin_server; | ||
174 | int rc = 0; | ||
175 | struct v9fs_trans_sock *ts = NULL; | ||
176 | struct v9fs_transport *trans = v9ses->transport; | ||
177 | int fd; | ||
178 | |||
179 | trans->status = Disconnected; | ||
180 | |||
181 | ts = kmalloc(sizeof(struct v9fs_trans_sock), GFP_KERNEL); | ||
182 | |||
183 | if (!ts) | ||
184 | return -ENOMEM; | ||
185 | |||
186 | trans->priv = ts; | ||
187 | ts->s = NULL; | ||
188 | ts->filp = NULL; | ||
189 | |||
190 | if (!addr) | ||
191 | return -EINVAL; | ||
192 | |||
193 | dprintk(DEBUG_TRANS, "Connecting to %s\n", addr); | ||
194 | |||
195 | sin_server.sin_family = AF_INET; | ||
196 | sin_server.sin_addr.s_addr = in_aton(addr); | ||
197 | sin_server.sin_port = htons(v9ses->port); | ||
198 | sock_create_kern(PF_INET, SOCK_STREAM, IPPROTO_TCP, &csocket); | ||
199 | rc = csocket->ops->connect(csocket, | ||
200 | (struct sockaddr *)&sin_server, | ||
201 | sizeof(struct sockaddr_in), 0); | ||
202 | if (rc < 0) { | ||
203 | eprintk(KERN_ERR, | ||
204 | "v9fs_trans_tcp: problem connecting socket to %s\n", | ||
205 | addr); | ||
206 | return rc; | ||
207 | } | ||
208 | csocket->sk->sk_allocation = GFP_NOIO; | ||
209 | |||
210 | fd = sock_map_fd(csocket); | ||
211 | if (fd < 0) { | ||
212 | sock_release(csocket); | ||
213 | kfree(ts); | ||
214 | trans->priv = NULL; | ||
215 | return fd; | ||
216 | } | ||
217 | |||
218 | ts->s = csocket; | ||
219 | ts->filp = fget(fd); | ||
220 | ts->filp->f_flags |= O_NONBLOCK; | ||
221 | trans->status = Connected; | ||
222 | |||
223 | return 0; | ||
224 | } | ||
225 | |||
226 | /** | ||
227 | * v9fs_unix_init - initialize UNIX domain socket | ||
228 | * @v9ses: session information | ||
229 | * @dev_name: path to named pipe | ||
230 | * @data: mount options | ||
231 | * | ||
232 | */ | ||
233 | |||
234 | static int | ||
235 | v9fs_unix_init(struct v9fs_session_info *v9ses, const char *dev_name, | ||
236 | char *data) | ||
237 | { | ||
238 | int rc, fd; | ||
239 | struct socket *csocket; | ||
240 | struct sockaddr_un sun_server; | ||
241 | struct v9fs_transport *trans; | ||
242 | struct v9fs_trans_sock *ts; | ||
243 | |||
244 | rc = 0; | ||
245 | csocket = NULL; | ||
246 | trans = v9ses->transport; | ||
247 | |||
248 | trans->status = Disconnected; | ||
249 | |||
250 | if (strlen(dev_name) > UNIX_PATH_MAX) { | ||
251 | eprintk(KERN_ERR, "v9fs_trans_unix: address too long: %s\n", | ||
252 | dev_name); | ||
253 | return -ENOMEM; | ||
254 | } | ||
255 | |||
256 | ts = kmalloc(sizeof(struct v9fs_trans_sock), GFP_KERNEL); | ||
257 | if (!ts) | ||
258 | return -ENOMEM; | ||
259 | |||
260 | trans->priv = ts; | ||
261 | ts->s = NULL; | ||
262 | ts->filp = NULL; | ||
263 | |||
264 | sun_server.sun_family = PF_UNIX; | ||
265 | strcpy(sun_server.sun_path, dev_name); | ||
266 | sock_create_kern(PF_UNIX, SOCK_STREAM, 0, &csocket); | ||
267 | rc = csocket->ops->connect(csocket, (struct sockaddr *)&sun_server, | ||
268 | sizeof(struct sockaddr_un) - 1, 0); /* -1 *is* important */ | ||
269 | if (rc < 0) { | ||
270 | eprintk(KERN_ERR, | ||
271 | "v9fs_trans_unix: problem connecting socket: %s: %d\n", | ||
272 | dev_name, rc); | ||
273 | return rc; | ||
274 | } | ||
275 | csocket->sk->sk_allocation = GFP_NOIO; | ||
276 | |||
277 | fd = sock_map_fd(csocket); | ||
278 | if (fd < 0) { | ||
279 | sock_release(csocket); | ||
280 | kfree(ts); | ||
281 | trans->priv = NULL; | ||
282 | return fd; | ||
283 | } | ||
284 | |||
285 | ts->s = csocket; | ||
286 | ts->filp = fget(fd); | ||
287 | ts->filp->f_flags |= O_NONBLOCK; | ||
288 | trans->status = Connected; | ||
289 | |||
290 | return 0; | ||
291 | } | ||
292 | |||
293 | /** | ||
294 | * v9fs_sock_close - shutdown socket | ||
295 | * @trans: private socket structure | ||
296 | * | ||
297 | */ | ||
298 | |||
299 | static void v9fs_sock_close(struct v9fs_transport *trans) | ||
300 | { | ||
301 | struct v9fs_trans_sock *ts; | ||
302 | |||
303 | if (!trans) | ||
304 | return; | ||
305 | |||
306 | ts = trans->priv; | ||
307 | |||
308 | if ((ts) && (ts->filp)) { | ||
309 | fput(ts->filp); | ||
310 | ts->filp = NULL; | ||
311 | ts->s = NULL; | ||
312 | trans->status = Disconnected; | ||
313 | } | ||
314 | |||
315 | kfree(ts); | ||
316 | |||
317 | trans->priv = NULL; | ||
318 | } | ||
319 | |||
320 | struct v9fs_transport v9fs_trans_tcp = { | ||
321 | .init = v9fs_tcp_init, | ||
322 | .write = v9fs_sock_send, | ||
323 | .read = v9fs_sock_recv, | ||
324 | .close = v9fs_sock_close, | ||
325 | .poll = v9fs_sock_poll, | ||
326 | }; | ||
327 | |||
328 | struct v9fs_transport v9fs_trans_unix = { | ||
329 | .init = v9fs_unix_init, | ||
330 | .write = v9fs_sock_send, | ||
331 | .read = v9fs_sock_recv, | ||
332 | .close = v9fs_sock_close, | ||
333 | .poll = v9fs_sock_poll, | ||
334 | }; | ||
diff --git a/fs/9p/transport.h b/fs/9p/transport.h index 91fcdb94b361..b38a4b8a41ce 100644 --- a/fs/9p/transport.h +++ b/fs/9p/transport.h | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> | 7 | * Copyright (C) 2004 by Eric Van Hensbergen <ericvh@gmail.com> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/v9fs.c b/fs/9p/v9fs.c index 61352491ba36..d37416eb5791 100644 --- a/fs/9p/v9fs.c +++ b/fs/9p/v9fs.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -51,7 +50,7 @@ enum { | |||
51 | Opt_port, Opt_msize, Opt_uid, Opt_gid, Opt_afid, Opt_debug, | 50 | Opt_port, Opt_msize, Opt_uid, Opt_gid, Opt_afid, Opt_debug, |
52 | Opt_rfdno, Opt_wfdno, | 51 | Opt_rfdno, Opt_wfdno, |
53 | /* String options */ | 52 | /* String options */ |
54 | Opt_name, Opt_remotename, | 53 | Opt_uname, Opt_remotename, |
55 | /* Options that take no arguments */ | 54 | /* Options that take no arguments */ |
56 | Opt_legacy, Opt_nodevmap, Opt_unix, Opt_tcp, Opt_fd, | 55 | Opt_legacy, Opt_nodevmap, Opt_unix, Opt_tcp, Opt_fd, |
57 | /* Error token */ | 56 | /* Error token */ |
@@ -67,7 +66,7 @@ static match_table_t tokens = { | |||
67 | {Opt_rfdno, "rfdno=%u"}, | 66 | {Opt_rfdno, "rfdno=%u"}, |
68 | {Opt_wfdno, "wfdno=%u"}, | 67 | {Opt_wfdno, "wfdno=%u"}, |
69 | {Opt_debug, "debug=%x"}, | 68 | {Opt_debug, "debug=%x"}, |
70 | {Opt_name, "name=%s"}, | 69 | {Opt_uname, "uname=%s"}, |
71 | {Opt_remotename, "aname=%s"}, | 70 | {Opt_remotename, "aname=%s"}, |
72 | {Opt_unix, "proto=unix"}, | 71 | {Opt_unix, "proto=unix"}, |
73 | {Opt_tcp, "proto=tcp"}, | 72 | {Opt_tcp, "proto=tcp"}, |
@@ -116,7 +115,7 @@ static void v9fs_parse_options(char *options, struct v9fs_session_info *v9ses) | |||
116 | if (!*p) | 115 | if (!*p) |
117 | continue; | 116 | continue; |
118 | token = match_token(p, tokens, args); | 117 | token = match_token(p, tokens, args); |
119 | if (token < Opt_name) { | 118 | if (token < Opt_uname) { |
120 | if ((ret = match_int(&args[0], &option)) < 0) { | 119 | if ((ret = match_int(&args[0], &option)) < 0) { |
121 | dprintk(DEBUG_ERROR, | 120 | dprintk(DEBUG_ERROR, |
122 | "integer field, but no integer?\n"); | 121 | "integer field, but no integer?\n"); |
@@ -158,7 +157,7 @@ static void v9fs_parse_options(char *options, struct v9fs_session_info *v9ses) | |||
158 | case Opt_fd: | 157 | case Opt_fd: |
159 | v9ses->proto = PROTO_FD; | 158 | v9ses->proto = PROTO_FD; |
160 | break; | 159 | break; |
161 | case Opt_name: | 160 | case Opt_uname: |
162 | match_strcpy(v9ses->name, &args[0]); | 161 | match_strcpy(v9ses->name, &args[0]); |
163 | break; | 162 | break; |
164 | case Opt_remotename: | 163 | case Opt_remotename: |
@@ -289,7 +288,7 @@ v9fs_session_init(struct v9fs_session_info *v9ses, | |||
289 | /* set global debug level */ | 288 | /* set global debug level */ |
290 | v9fs_debug_level = v9ses->debug; | 289 | v9fs_debug_level = v9ses->debug; |
291 | 290 | ||
292 | /* id pools that are session-dependent: FIDs and TIDs */ | 291 | /* id pools that are session-dependent: fids and tags */ |
293 | idr_init(&v9ses->fidpool.pool); | 292 | idr_init(&v9ses->fidpool.pool); |
294 | init_MUTEX(&v9ses->fidpool.lock); | 293 | init_MUTEX(&v9ses->fidpool.lock); |
295 | 294 | ||
diff --git a/fs/9p/v9fs.h b/fs/9p/v9fs.h index f337da7a0eec..c134d104cb28 100644 --- a/fs/9p/v9fs.h +++ b/fs/9p/v9fs.h | |||
@@ -5,9 +5,8 @@ | |||
5 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 5 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License version 2 |
9 | * the Free Software Foundation; either version 2 of the License, or | 9 | * as published by the Free Software Foundation. |
10 | * (at your option) any later version. | ||
11 | * | 10 | * |
12 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -91,6 +90,3 @@ void v9fs_session_cancel(struct v9fs_session_info *v9ses); | |||
91 | #define V9FS_DEFUSER "nobody" | 90 | #define V9FS_DEFUSER "nobody" |
92 | #define V9FS_DEFANAME "" | 91 | #define V9FS_DEFANAME "" |
93 | 92 | ||
94 | /* inital pool sizes for fids and tags */ | ||
95 | #define V9FS_START_FIDS 8192 | ||
96 | #define V9FS_START_TIDS 256 | ||
diff --git a/fs/9p/v9fs_vfs.h b/fs/9p/v9fs_vfs.h index a759278acaae..43c9f7de0314 100644 --- a/fs/9p/v9fs_vfs.h +++ b/fs/9p/v9fs_vfs.h | |||
@@ -5,9 +5,8 @@ | |||
5 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 5 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
6 | * | 6 | * |
7 | * This program is free software; you can redistribute it and/or modify | 7 | * This program is free software; you can redistribute it and/or modify |
8 | * it under the terms of the GNU General Public License as published by | 8 | * it under the terms of the GNU General Public License version 2 |
9 | * the Free Software Foundation; either version 2 of the License, or | 9 | * as published by the Free Software Foundation. |
10 | * (at your option) any later version. | ||
11 | * | 10 | * |
12 | * This program is distributed in the hope that it will be useful, | 11 | * This program is distributed in the hope that it will be useful, |
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 12 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/vfs_addr.c b/fs/9p/vfs_addr.c index 8100fb5171b7..efda46fb64d9 100644 --- a/fs/9p/vfs_addr.c +++ b/fs/9p/vfs_addr.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/vfs_dentry.c b/fs/9p/vfs_dentry.c index 12c9cc926b71..062daa6000ab 100644 --- a/fs/9p/vfs_dentry.c +++ b/fs/9p/vfs_dentry.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -51,7 +50,7 @@ | |||
51 | * | 50 | * |
52 | */ | 51 | */ |
53 | 52 | ||
54 | int v9fs_dentry_delete(struct dentry *dentry) | 53 | static int v9fs_dentry_delete(struct dentry *dentry) |
55 | { | 54 | { |
56 | dprintk(DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry); | 55 | dprintk(DEBUG_VFS, " dentry: %s (%p)\n", dentry->d_iname, dentry); |
57 | return 1; | 56 | return 1; |
diff --git a/fs/9p/vfs_dir.c b/fs/9p/vfs_dir.c index cd5eeb032d64..766f11f1215c 100644 --- a/fs/9p/vfs_dir.c +++ b/fs/9p/vfs_dir.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
diff --git a/fs/9p/vfs_file.c b/fs/9p/vfs_file.c index de3a129698da..59e744163407 100644 --- a/fs/9p/vfs_file.c +++ b/fs/9p/vfs_file.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -69,29 +68,30 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
69 | 68 | ||
70 | fid = v9fs_get_idpool(&v9ses->fidpool); | 69 | fid = v9fs_get_idpool(&v9ses->fidpool); |
71 | if (fid < 0) { | 70 | if (fid < 0) { |
72 | eprintk(KERN_WARNING, "newfid fails!\n"); | 71 | eprintk(KERN_WARNING, "newfid fails!\n"); |
73 | return -ENOSPC; | 72 | return -ENOSPC; |
74 | } | 73 | } |
75 | 74 | ||
76 | err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL); | 75 | err = v9fs_t_walk(v9ses, vfid->fid, fid, NULL, NULL); |
77 | if (err < 0) { | 76 | if (err < 0) { |
78 | dprintk(DEBUG_ERROR, "rewalk didn't work\n"); | 77 | dprintk(DEBUG_ERROR, "rewalk didn't work\n"); |
79 | goto put_fid; | 78 | goto put_fid; |
80 | } | 79 | } |
81 | 80 | ||
82 | vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL); | 81 | /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */ |
83 | if (vfid == NULL) { | 82 | /* translate open mode appropriately */ |
84 | dprintk(DEBUG_ERROR, "out of memory\n"); | ||
85 | goto clunk_fid; | ||
86 | } | ||
87 | |||
88 | /* TODO: do special things for O_EXCL, O_NOFOLLOW, O_SYNC */ | ||
89 | /* translate open mode appropriately */ | ||
90 | omode = v9fs_uflags2omode(file->f_flags); | 83 | omode = v9fs_uflags2omode(file->f_flags); |
91 | err = v9fs_t_open(v9ses, fid, omode, &fcall); | 84 | err = v9fs_t_open(v9ses, fid, omode, &fcall); |
92 | if (err < 0) { | 85 | if (err < 0) { |
93 | PRINT_FCALL_ERROR("open failed", fcall); | 86 | PRINT_FCALL_ERROR("open failed", fcall); |
94 | goto destroy_vfid; | 87 | goto clunk_fid; |
88 | } | ||
89 | |||
90 | vfid = kmalloc(sizeof(struct v9fs_fid), GFP_KERNEL); | ||
91 | if (vfid == NULL) { | ||
92 | dprintk(DEBUG_ERROR, "out of memory\n"); | ||
93 | err = -ENOMEM; | ||
94 | goto clunk_fid; | ||
95 | } | 95 | } |
96 | 96 | ||
97 | file->private_data = vfid; | 97 | file->private_data = vfid; |
@@ -106,15 +106,12 @@ int v9fs_file_open(struct inode *inode, struct file *file) | |||
106 | 106 | ||
107 | return 0; | 107 | return 0; |
108 | 108 | ||
109 | destroy_vfid: | ||
110 | v9fs_fid_destroy(vfid); | ||
111 | |||
112 | clunk_fid: | 109 | clunk_fid: |
113 | v9fs_t_clunk(v9ses, fid); | 110 | v9fs_t_clunk(v9ses, fid); |
114 | 111 | ||
115 | put_fid: | 112 | put_fid: |
116 | v9fs_put_idpool(fid, &v9ses->fidpool); | 113 | v9fs_put_idpool(fid, &v9ses->fidpool); |
117 | kfree(fcall); | 114 | kfree(fcall); |
118 | 115 | ||
119 | return err; | 116 | return err; |
120 | } | 117 | } |
diff --git a/fs/9p/vfs_inode.c b/fs/9p/vfs_inode.c index 651a9e14d9a9..133db366d306 100644 --- a/fs/9p/vfs_inode.c +++ b/fs/9p/vfs_inode.c | |||
@@ -7,9 +7,8 @@ | |||
7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 7 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
8 | * | 8 | * |
9 | * This program is free software; you can redistribute it and/or modify | 9 | * This program is free software; you can redistribute it and/or modify |
10 | * it under the terms of the GNU General Public License as published by | 10 | * it under the terms of the GNU General Public License version 2 |
11 | * the Free Software Foundation; either version 2 of the License, or | 11 | * as published by the Free Software Foundation. |
12 | * (at your option) any later version. | ||
13 | * | 12 | * |
14 | * This program is distributed in the hope that it will be useful, | 13 | * This program is distributed in the hope that it will be useful, |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -255,8 +254,8 @@ struct inode *v9fs_get_inode(struct super_block *sb, int mode) | |||
255 | } | 254 | } |
256 | 255 | ||
257 | static int | 256 | static int |
258 | v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, | 257 | v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, u32 perm, |
259 | u32 perm, u8 mode, u32 *fidp, struct v9fs_qid *qid, u32 *iounit) | 258 | u8 mode, char *extension, u32 *fidp, struct v9fs_qid *qid, u32 *iounit) |
260 | { | 259 | { |
261 | u32 fid; | 260 | u32 fid; |
262 | int err; | 261 | int err; |
@@ -271,14 +270,14 @@ v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, | |||
271 | err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall); | 270 | err = v9fs_t_walk(v9ses, pfid, fid, NULL, &fcall); |
272 | if (err < 0) { | 271 | if (err < 0) { |
273 | PRINT_FCALL_ERROR("clone error", fcall); | 272 | PRINT_FCALL_ERROR("clone error", fcall); |
274 | goto error; | 273 | goto put_fid; |
275 | } | 274 | } |
276 | kfree(fcall); | 275 | kfree(fcall); |
277 | 276 | ||
278 | err = v9fs_t_create(v9ses, fid, name, perm, mode, &fcall); | 277 | err = v9fs_t_create(v9ses, fid, name, perm, mode, extension, &fcall); |
279 | if (err < 0) { | 278 | if (err < 0) { |
280 | PRINT_FCALL_ERROR("create fails", fcall); | 279 | PRINT_FCALL_ERROR("create fails", fcall); |
281 | goto error; | 280 | goto clunk_fid; |
282 | } | 281 | } |
283 | 282 | ||
284 | if (iounit) | 283 | if (iounit) |
@@ -293,7 +292,11 @@ v9fs_create(struct v9fs_session_info *v9ses, u32 pfid, char *name, | |||
293 | kfree(fcall); | 292 | kfree(fcall); |
294 | return 0; | 293 | return 0; |
295 | 294 | ||
296 | error: | 295 | clunk_fid: |
296 | v9fs_t_clunk(v9ses, fid); | ||
297 | fid = V9FS_NOFID; | ||
298 | |||
299 | put_fid: | ||
297 | if (fid >= 0) | 300 | if (fid >= 0) |
298 | v9fs_put_idpool(fid, &v9ses->fidpool); | 301 | v9fs_put_idpool(fid, &v9ses->fidpool); |
299 | 302 | ||
@@ -348,7 +351,7 @@ error: | |||
348 | return ERR_PTR(err); | 351 | return ERR_PTR(err); |
349 | } | 352 | } |
350 | 353 | ||
351 | struct inode * | 354 | static struct inode * |
352 | v9fs_inode_from_fid(struct v9fs_session_info *v9ses, u32 fid, | 355 | v9fs_inode_from_fid(struct v9fs_session_info *v9ses, u32 fid, |
353 | struct super_block *sb) | 356 | struct super_block *sb) |
354 | { | 357 | { |
@@ -474,7 +477,7 @@ v9fs_vfs_create(struct inode *dir, struct dentry *dentry, int mode, | |||
474 | flags = O_RDWR; | 477 | flags = O_RDWR; |
475 | 478 | ||
476 | err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, | 479 | err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, |
477 | perm, v9fs_uflags2omode(flags), &fid, &qid, &iounit); | 480 | perm, v9fs_uflags2omode(flags), NULL, &fid, &qid, &iounit); |
478 | 481 | ||
479 | if (err) | 482 | if (err) |
480 | goto error; | 483 | goto error; |
@@ -550,7 +553,7 @@ static int v9fs_vfs_mkdir(struct inode *dir, struct dentry *dentry, int mode) | |||
550 | perm = unixmode2p9mode(v9ses, mode | S_IFDIR); | 553 | perm = unixmode2p9mode(v9ses, mode | S_IFDIR); |
551 | 554 | ||
552 | err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, | 555 | err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, |
553 | perm, V9FS_OREAD, &fid, NULL, NULL); | 556 | perm, V9FS_OREAD, NULL, &fid, NULL, NULL); |
554 | 557 | ||
555 | if (err) { | 558 | if (err) { |
556 | dprintk(DEBUG_ERROR, "create error %d\n", err); | 559 | dprintk(DEBUG_ERROR, "create error %d\n", err); |
@@ -1008,11 +1011,13 @@ static int v9fs_readlink(struct dentry *dentry, char *buffer, int buflen) | |||
1008 | 1011 | ||
1009 | /* copy extension buffer into buffer */ | 1012 | /* copy extension buffer into buffer */ |
1010 | if (fcall->params.rstat.stat.extension.len < buflen) | 1013 | if (fcall->params.rstat.stat.extension.len < buflen) |
1011 | buflen = fcall->params.rstat.stat.extension.len; | 1014 | buflen = fcall->params.rstat.stat.extension.len + 1; |
1012 | 1015 | ||
1013 | memcpy(buffer, fcall->params.rstat.stat.extension.str, buflen - 1); | 1016 | memmove(buffer, fcall->params.rstat.stat.extension.str, buflen - 1); |
1014 | buffer[buflen-1] = 0; | 1017 | buffer[buflen-1] = 0; |
1015 | 1018 | ||
1019 | dprintk(DEBUG_ERROR, "%s -> %.*s (%s)\n", dentry->d_name.name, fcall->params.rstat.stat.extension.len, | ||
1020 | fcall->params.rstat.stat.extension.str, buffer); | ||
1016 | retval = buflen; | 1021 | retval = buflen; |
1017 | 1022 | ||
1018 | FreeFcall: | 1023 | FreeFcall: |
@@ -1072,7 +1077,7 @@ static void *v9fs_vfs_follow_link(struct dentry *dentry, struct nameidata *nd) | |||
1072 | if (!link) | 1077 | if (!link) |
1073 | link = ERR_PTR(-ENOMEM); | 1078 | link = ERR_PTR(-ENOMEM); |
1074 | else { | 1079 | else { |
1075 | len = v9fs_readlink(dentry, link, strlen(link)); | 1080 | len = v9fs_readlink(dentry, link, PATH_MAX); |
1076 | 1081 | ||
1077 | if (len < 0) { | 1082 | if (len < 0) { |
1078 | __putname(link); | 1083 | __putname(link); |
@@ -1109,10 +1114,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, | |||
1109 | struct v9fs_session_info *v9ses; | 1114 | struct v9fs_session_info *v9ses; |
1110 | struct v9fs_fid *dfid, *vfid; | 1115 | struct v9fs_fid *dfid, *vfid; |
1111 | struct inode *inode; | 1116 | struct inode *inode; |
1112 | struct v9fs_fcall *fcall; | ||
1113 | struct v9fs_wstat wstat; | ||
1114 | 1117 | ||
1115 | fcall = NULL; | ||
1116 | inode = NULL; | 1118 | inode = NULL; |
1117 | vfid = NULL; | 1119 | vfid = NULL; |
1118 | v9ses = v9fs_inode2v9ses(dir); | 1120 | v9ses = v9fs_inode2v9ses(dir); |
@@ -1125,7 +1127,7 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, | |||
1125 | } | 1127 | } |
1126 | 1128 | ||
1127 | err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, | 1129 | err = v9fs_create(v9ses, dfid->fid, (char *) dentry->d_name.name, |
1128 | perm, V9FS_OREAD, &fid, NULL, NULL); | 1130 | perm, V9FS_OREAD, (char *) extension, &fid, NULL, NULL); |
1129 | 1131 | ||
1130 | if (err) | 1132 | if (err) |
1131 | goto error; | 1133 | goto error; |
@@ -1148,23 +1150,11 @@ static int v9fs_vfs_mkspecial(struct inode *dir, struct dentry *dentry, | |||
1148 | goto error; | 1150 | goto error; |
1149 | } | 1151 | } |
1150 | 1152 | ||
1151 | /* issue a Twstat */ | ||
1152 | v9fs_blank_wstat(&wstat); | ||
1153 | wstat.muid = v9ses->name; | ||
1154 | wstat.extension = (char *) extension; | ||
1155 | err = v9fs_t_wstat(v9ses, vfid->fid, &wstat, &fcall); | ||
1156 | if (err < 0) { | ||
1157 | PRINT_FCALL_ERROR("wstat error", fcall); | ||
1158 | goto error; | ||
1159 | } | ||
1160 | |||
1161 | kfree(fcall); | ||
1162 | dentry->d_op = &v9fs_dentry_operations; | 1153 | dentry->d_op = &v9fs_dentry_operations; |
1163 | d_instantiate(dentry, inode); | 1154 | d_instantiate(dentry, inode); |
1164 | return 0; | 1155 | return 0; |
1165 | 1156 | ||
1166 | error: | 1157 | error: |
1167 | kfree(fcall); | ||
1168 | if (vfid) | 1158 | if (vfid) |
1169 | v9fs_fid_destroy(vfid); | 1159 | v9fs_fid_destroy(vfid); |
1170 | 1160 | ||
@@ -1224,7 +1214,7 @@ v9fs_vfs_link(struct dentry *old_dentry, struct inode *dir, | |||
1224 | } | 1214 | } |
1225 | 1215 | ||
1226 | name = __getname(); | 1216 | name = __getname(); |
1227 | sprintf(name, "hardlink(%d)\n", oldfid->fid); | 1217 | sprintf(name, "%d\n", oldfid->fid); |
1228 | retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name); | 1218 | retval = v9fs_vfs_mkspecial(dir, dentry, V9FS_DMLINK, name); |
1229 | __putname(name); | 1219 | __putname(name); |
1230 | 1220 | ||
@@ -1253,6 +1243,8 @@ v9fs_vfs_mknod(struct inode *dir, struct dentry *dentry, int mode, dev_t rdev) | |||
1253 | return -EINVAL; | 1243 | return -EINVAL; |
1254 | 1244 | ||
1255 | name = __getname(); | 1245 | name = __getname(); |
1246 | if (!name) | ||
1247 | return -ENOMEM; | ||
1256 | /* build extension */ | 1248 | /* build extension */ |
1257 | if (S_ISBLK(mode)) | 1249 | if (S_ISBLK(mode)) |
1258 | sprintf(name, "b %u %u", MAJOR(rdev), MINOR(rdev)); | 1250 | sprintf(name, "b %u %u", MAJOR(rdev), MINOR(rdev)); |
diff --git a/fs/9p/vfs_super.c b/fs/9p/vfs_super.c index d05318fa684e..b0a0ae509c00 100644 --- a/fs/9p/vfs_super.c +++ b/fs/9p/vfs_super.c | |||
@@ -8,9 +8,8 @@ | |||
8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> | 8 | * Copyright (C) 2002 by Ron Minnich <rminnich@lanl.gov> |
9 | * | 9 | * |
10 | * This program is free software; you can redistribute it and/or modify | 10 | * This program is free software; you can redistribute it and/or modify |
11 | * it under the terms of the GNU General Public License as published by | 11 | * it under the terms of the GNU General Public License version 2 |
12 | * the Free Software Foundation; either version 2 of the License, or | 12 | * as published by the Free Software Foundation. |
13 | * (at your option) any later version. | ||
14 | * | 13 | * |
15 | * This program is distributed in the hope that it will be useful, | 14 | * This program is distributed in the hope that it will be useful, |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
@@ -262,7 +261,7 @@ static struct super_operations v9fs_super_ops = { | |||
262 | }; | 261 | }; |
263 | 262 | ||
264 | struct file_system_type v9fs_fs_type = { | 263 | struct file_system_type v9fs_fs_type = { |
265 | .name = "9P", | 264 | .name = "9p", |
266 | .get_sb = v9fs_get_sb, | 265 | .get_sb = v9fs_get_sb, |
267 | .kill_sb = v9fs_kill_super, | 266 | .kill_sb = v9fs_kill_super, |
268 | .owner = THIS_MODULE, | 267 | .owner = THIS_MODULE, |
@@ -122,10 +122,9 @@ static int aio_setup_ring(struct kioctx *ctx) | |||
122 | info->nr = 0; | 122 | info->nr = 0; |
123 | info->ring_pages = info->internal_pages; | 123 | info->ring_pages = info->internal_pages; |
124 | if (nr_pages > AIO_RING_PAGES) { | 124 | if (nr_pages > AIO_RING_PAGES) { |
125 | info->ring_pages = kmalloc(sizeof(struct page *) * nr_pages, GFP_KERNEL); | 125 | info->ring_pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL); |
126 | if (!info->ring_pages) | 126 | if (!info->ring_pages) |
127 | return -ENOMEM; | 127 | return -ENOMEM; |
128 | memset(info->ring_pages, 0, sizeof(struct page *) * nr_pages); | ||
129 | } | 128 | } |
130 | 129 | ||
131 | info->mmap_size = nr_pages * PAGE_SIZE; | 130 | info->mmap_size = nr_pages * PAGE_SIZE; |
diff --git a/fs/binfmt_elf.c b/fs/binfmt_elf.c index c2eac2a50bd2..4349113881fb 100644 --- a/fs/binfmt_elf.c +++ b/fs/binfmt_elf.c | |||
@@ -1334,7 +1334,7 @@ static int fill_psinfo(struct elf_prpsinfo *psinfo, struct task_struct *p, | |||
1334 | 1334 | ||
1335 | i = p->state ? ffz(~p->state) + 1 : 0; | 1335 | i = p->state ? ffz(~p->state) + 1 : 0; |
1336 | psinfo->pr_state = i; | 1336 | psinfo->pr_state = i; |
1337 | psinfo->pr_sname = (i < 0 || i > 5) ? '.' : "RSDTZW"[i]; | 1337 | psinfo->pr_sname = (i > 5) ? '.' : "RSDTZW"[i]; |
1338 | psinfo->pr_zomb = psinfo->pr_sname == 'Z'; | 1338 | psinfo->pr_zomb = psinfo->pr_sname == 'Z'; |
1339 | psinfo->pr_nice = task_nice(p); | 1339 | psinfo->pr_nice = task_nice(p); |
1340 | psinfo->pr_flag = p->flags; | 1340 | psinfo->pr_flag = p->flags; |
@@ -1465,12 +1465,11 @@ static int elf_core_dump(long signr, struct pt_regs * regs, struct file * file) | |||
1465 | read_lock(&tasklist_lock); | 1465 | read_lock(&tasklist_lock); |
1466 | do_each_thread(g,p) | 1466 | do_each_thread(g,p) |
1467 | if (current->mm == p->mm && current != p) { | 1467 | if (current->mm == p->mm && current != p) { |
1468 | tmp = kmalloc(sizeof(*tmp), GFP_ATOMIC); | 1468 | tmp = kzalloc(sizeof(*tmp), GFP_ATOMIC); |
1469 | if (!tmp) { | 1469 | if (!tmp) { |
1470 | read_unlock(&tasklist_lock); | 1470 | read_unlock(&tasklist_lock); |
1471 | goto cleanup; | 1471 | goto cleanup; |
1472 | } | 1472 | } |
1473 | memset(tmp, 0, sizeof(*tmp)); | ||
1474 | INIT_LIST_HEAD(&tmp->list); | 1473 | INIT_LIST_HEAD(&tmp->list); |
1475 | tmp->thread = p; | 1474 | tmp->thread = p; |
1476 | list_add(&tmp->list, &thread_list); | 1475 | list_add(&tmp->list, &thread_list); |
diff --git a/fs/binfmt_flat.c b/fs/binfmt_flat.c index 108d56bbd0d0..69f44dcdb0b4 100644 --- a/fs/binfmt_flat.c +++ b/fs/binfmt_flat.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/personality.h> | 36 | #include <linux/personality.h> |
37 | #include <linux/init.h> | 37 | #include <linux/init.h> |
38 | #include <linux/flat.h> | 38 | #include <linux/flat.h> |
39 | #include <linux/syscalls.h> | ||
39 | 40 | ||
40 | #include <asm/byteorder.h> | 41 | #include <asm/byteorder.h> |
41 | #include <asm/system.h> | 42 | #include <asm/system.h> |
@@ -426,6 +427,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
426 | int i, rev, relocs = 0; | 427 | int i, rev, relocs = 0; |
427 | loff_t fpos; | 428 | loff_t fpos; |
428 | unsigned long start_code, end_code; | 429 | unsigned long start_code, end_code; |
430 | int ret; | ||
431 | int exec_fileno; | ||
429 | 432 | ||
430 | hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ | 433 | hdr = ((struct flat_hdr *) bprm->buf); /* exec-header */ |
431 | inode = bprm->file->f_dentry->d_inode; | 434 | inode = bprm->file->f_dentry->d_inode; |
@@ -450,7 +453,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
450 | */ | 453 | */ |
451 | if (strncmp(hdr->magic, "#!", 2)) | 454 | if (strncmp(hdr->magic, "#!", 2)) |
452 | printk("BINFMT_FLAT: bad header magic\n"); | 455 | printk("BINFMT_FLAT: bad header magic\n"); |
453 | return -ENOEXEC; | 456 | ret = -ENOEXEC; |
457 | goto err; | ||
454 | } | 458 | } |
455 | 459 | ||
456 | if (flags & FLAT_FLAG_KTRACE) | 460 | if (flags & FLAT_FLAG_KTRACE) |
@@ -458,14 +462,16 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
458 | 462 | ||
459 | if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) { | 463 | if (rev != FLAT_VERSION && rev != OLD_FLAT_VERSION) { |
460 | printk("BINFMT_FLAT: bad flat file version 0x%x (supported 0x%x and 0x%x)\n", rev, FLAT_VERSION, OLD_FLAT_VERSION); | 464 | printk("BINFMT_FLAT: bad flat file version 0x%x (supported 0x%x and 0x%x)\n", rev, FLAT_VERSION, OLD_FLAT_VERSION); |
461 | return -ENOEXEC; | 465 | ret = -ENOEXEC; |
466 | goto err; | ||
462 | } | 467 | } |
463 | 468 | ||
464 | /* Don't allow old format executables to use shared libraries */ | 469 | /* Don't allow old format executables to use shared libraries */ |
465 | if (rev == OLD_FLAT_VERSION && id != 0) { | 470 | if (rev == OLD_FLAT_VERSION && id != 0) { |
466 | printk("BINFMT_FLAT: shared libraries are not available before rev 0x%x\n", | 471 | printk("BINFMT_FLAT: shared libraries are not available before rev 0x%x\n", |
467 | (int) FLAT_VERSION); | 472 | (int) FLAT_VERSION); |
468 | return -ENOEXEC; | 473 | ret = -ENOEXEC; |
474 | goto err; | ||
469 | } | 475 | } |
470 | 476 | ||
471 | /* | 477 | /* |
@@ -478,7 +484,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
478 | #ifndef CONFIG_BINFMT_ZFLAT | 484 | #ifndef CONFIG_BINFMT_ZFLAT |
479 | if (flags & (FLAT_FLAG_GZIP|FLAT_FLAG_GZDATA)) { | 485 | if (flags & (FLAT_FLAG_GZIP|FLAT_FLAG_GZDATA)) { |
480 | printk("Support for ZFLAT executables is not enabled.\n"); | 486 | printk("Support for ZFLAT executables is not enabled.\n"); |
481 | return -ENOEXEC; | 487 | ret = -ENOEXEC; |
488 | goto err; | ||
482 | } | 489 | } |
483 | #endif | 490 | #endif |
484 | 491 | ||
@@ -490,14 +497,27 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
490 | rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur; | 497 | rlim = current->signal->rlim[RLIMIT_DATA].rlim_cur; |
491 | if (rlim >= RLIM_INFINITY) | 498 | if (rlim >= RLIM_INFINITY) |
492 | rlim = ~0; | 499 | rlim = ~0; |
493 | if (data_len + bss_len > rlim) | 500 | if (data_len + bss_len > rlim) { |
494 | return -ENOMEM; | 501 | ret = -ENOMEM; |
502 | goto err; | ||
503 | } | ||
504 | |||
505 | /* check file descriptor */ | ||
506 | exec_fileno = get_unused_fd(); | ||
507 | if (exec_fileno < 0) { | ||
508 | ret = -EMFILE; | ||
509 | goto err; | ||
510 | } | ||
511 | get_file(bprm->file); | ||
512 | fd_install(exec_fileno, bprm->file); | ||
495 | 513 | ||
496 | /* Flush all traces of the currently running executable */ | 514 | /* Flush all traces of the currently running executable */ |
497 | if (id == 0) { | 515 | if (id == 0) { |
498 | result = flush_old_exec(bprm); | 516 | result = flush_old_exec(bprm); |
499 | if (result) | 517 | if (result) { |
500 | return result; | 518 | ret = result; |
519 | goto err_close; | ||
520 | } | ||
501 | 521 | ||
502 | /* OK, This is the point of no return */ | 522 | /* OK, This is the point of no return */ |
503 | set_personality(PER_LINUX); | 523 | set_personality(PER_LINUX); |
@@ -527,7 +547,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
527 | if (!textpos) | 547 | if (!textpos) |
528 | textpos = (unsigned long) -ENOMEM; | 548 | textpos = (unsigned long) -ENOMEM; |
529 | printk("Unable to mmap process text, errno %d\n", (int)-textpos); | 549 | printk("Unable to mmap process text, errno %d\n", (int)-textpos); |
530 | return(textpos); | 550 | ret = textpos; |
551 | goto err_close; | ||
531 | } | 552 | } |
532 | 553 | ||
533 | down_write(¤t->mm->mmap_sem); | 554 | down_write(¤t->mm->mmap_sem); |
@@ -542,7 +563,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
542 | printk("Unable to allocate RAM for process data, errno %d\n", | 563 | printk("Unable to allocate RAM for process data, errno %d\n", |
543 | (int)-datapos); | 564 | (int)-datapos); |
544 | do_munmap(current->mm, textpos, text_len); | 565 | do_munmap(current->mm, textpos, text_len); |
545 | return realdatastart; | 566 | ret = realdatastart; |
567 | goto err_close; | ||
546 | } | 568 | } |
547 | datapos = realdatastart + MAX_SHARED_LIBS * sizeof(unsigned long); | 569 | datapos = realdatastart + MAX_SHARED_LIBS * sizeof(unsigned long); |
548 | 570 | ||
@@ -564,7 +586,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
564 | printk("Unable to read data+bss, errno %d\n", (int)-result); | 586 | printk("Unable to read data+bss, errno %d\n", (int)-result); |
565 | do_munmap(current->mm, textpos, text_len); | 587 | do_munmap(current->mm, textpos, text_len); |
566 | do_munmap(current->mm, realdatastart, data_len + extra); | 588 | do_munmap(current->mm, realdatastart, data_len + extra); |
567 | return result; | 589 | ret = result; |
590 | goto err_close; | ||
568 | } | 591 | } |
569 | 592 | ||
570 | reloc = (unsigned long *) (datapos+(ntohl(hdr->reloc_start)-text_len)); | 593 | reloc = (unsigned long *) (datapos+(ntohl(hdr->reloc_start)-text_len)); |
@@ -582,7 +605,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
582 | textpos = (unsigned long) -ENOMEM; | 605 | textpos = (unsigned long) -ENOMEM; |
583 | printk("Unable to allocate RAM for process text/data, errno %d\n", | 606 | printk("Unable to allocate RAM for process text/data, errno %d\n", |
584 | (int)-textpos); | 607 | (int)-textpos); |
585 | return(textpos); | 608 | ret = textpos; |
609 | goto err_close; | ||
586 | } | 610 | } |
587 | 611 | ||
588 | realdatastart = textpos + ntohl(hdr->data_start); | 612 | realdatastart = textpos + ntohl(hdr->data_start); |
@@ -627,7 +651,8 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
627 | printk("Unable to read code+data+bss, errno %d\n",(int)-result); | 651 | printk("Unable to read code+data+bss, errno %d\n",(int)-result); |
628 | do_munmap(current->mm, textpos, text_len + data_len + extra + | 652 | do_munmap(current->mm, textpos, text_len + data_len + extra + |
629 | MAX_SHARED_LIBS * sizeof(unsigned long)); | 653 | MAX_SHARED_LIBS * sizeof(unsigned long)); |
630 | return result; | 654 | ret = result; |
655 | goto err_close; | ||
631 | } | 656 | } |
632 | } | 657 | } |
633 | 658 | ||
@@ -690,8 +715,10 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
690 | unsigned long addr; | 715 | unsigned long addr; |
691 | if (*rp) { | 716 | if (*rp) { |
692 | addr = calc_reloc(*rp, libinfo, id, 0); | 717 | addr = calc_reloc(*rp, libinfo, id, 0); |
693 | if (addr == RELOC_FAILED) | 718 | if (addr == RELOC_FAILED) { |
694 | return -ENOEXEC; | 719 | ret = -ENOEXEC; |
720 | goto err_close; | ||
721 | } | ||
695 | *rp = addr; | 722 | *rp = addr; |
696 | } | 723 | } |
697 | } | 724 | } |
@@ -718,8 +745,10 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
718 | relval = ntohl(reloc[i]); | 745 | relval = ntohl(reloc[i]); |
719 | addr = flat_get_relocate_addr(relval); | 746 | addr = flat_get_relocate_addr(relval); |
720 | rp = (unsigned long *) calc_reloc(addr, libinfo, id, 1); | 747 | rp = (unsigned long *) calc_reloc(addr, libinfo, id, 1); |
721 | if (rp == (unsigned long *)RELOC_FAILED) | 748 | if (rp == (unsigned long *)RELOC_FAILED) { |
722 | return -ENOEXEC; | 749 | ret = -ENOEXEC; |
750 | goto err_close; | ||
751 | } | ||
723 | 752 | ||
724 | /* Get the pointer's value. */ | 753 | /* Get the pointer's value. */ |
725 | addr = flat_get_addr_from_rp(rp, relval, flags); | 754 | addr = flat_get_addr_from_rp(rp, relval, flags); |
@@ -731,8 +760,10 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
731 | if ((flags & FLAT_FLAG_GOTPIC) == 0) | 760 | if ((flags & FLAT_FLAG_GOTPIC) == 0) |
732 | addr = ntohl(addr); | 761 | addr = ntohl(addr); |
733 | addr = calc_reloc(addr, libinfo, id, 0); | 762 | addr = calc_reloc(addr, libinfo, id, 0); |
734 | if (addr == RELOC_FAILED) | 763 | if (addr == RELOC_FAILED) { |
735 | return -ENOEXEC; | 764 | ret = -ENOEXEC; |
765 | goto err_close; | ||
766 | } | ||
736 | 767 | ||
737 | /* Write back the relocated pointer. */ | 768 | /* Write back the relocated pointer. */ |
738 | flat_put_addr_at_rp(rp, addr, relval); | 769 | flat_put_addr_at_rp(rp, addr, relval); |
@@ -752,6 +783,10 @@ static int load_flat_file(struct linux_binprm * bprm, | |||
752 | stack_len); | 783 | stack_len); |
753 | 784 | ||
754 | return 0; | 785 | return 0; |
786 | err_close: | ||
787 | sys_close(exec_fileno); | ||
788 | err: | ||
789 | return ret; | ||
755 | } | 790 | } |
756 | 791 | ||
757 | 792 | ||
@@ -636,12 +636,10 @@ static struct bio *__bio_map_user_iov(request_queue_t *q, | |||
636 | return ERR_PTR(-ENOMEM); | 636 | return ERR_PTR(-ENOMEM); |
637 | 637 | ||
638 | ret = -ENOMEM; | 638 | ret = -ENOMEM; |
639 | pages = kmalloc(nr_pages * sizeof(struct page *), GFP_KERNEL); | 639 | pages = kcalloc(nr_pages, sizeof(struct page *), GFP_KERNEL); |
640 | if (!pages) | 640 | if (!pages) |
641 | goto out; | 641 | goto out; |
642 | 642 | ||
643 | memset(pages, 0, nr_pages * sizeof(struct page *)); | ||
644 | |||
645 | for (i = 0; i < iov_count; i++) { | 643 | for (i = 0; i < iov_count; i++) { |
646 | unsigned long uaddr = (unsigned long)iov[i].iov_base; | 644 | unsigned long uaddr = (unsigned long)iov[i].iov_base; |
647 | unsigned long len = iov[i].iov_len; | 645 | unsigned long len = iov[i].iov_len; |
@@ -1186,12 +1184,11 @@ void bioset_free(struct bio_set *bs) | |||
1186 | 1184 | ||
1187 | struct bio_set *bioset_create(int bio_pool_size, int bvec_pool_size, int scale) | 1185 | struct bio_set *bioset_create(int bio_pool_size, int bvec_pool_size, int scale) |
1188 | { | 1186 | { |
1189 | struct bio_set *bs = kmalloc(sizeof(*bs), GFP_KERNEL); | 1187 | struct bio_set *bs = kzalloc(sizeof(*bs), GFP_KERNEL); |
1190 | 1188 | ||
1191 | if (!bs) | 1189 | if (!bs) |
1192 | return NULL; | 1190 | return NULL; |
1193 | 1191 | ||
1194 | memset(bs, 0, sizeof(*bs)); | ||
1195 | bs->bio_pool = mempool_create(bio_pool_size, mempool_alloc_slab, | 1192 | bs->bio_pool = mempool_create(bio_pool_size, mempool_alloc_slab, |
1196 | mempool_free_slab, bio_slab); | 1193 | mempool_free_slab, bio_slab); |
1197 | 1194 | ||
diff --git a/fs/buffer.c b/fs/buffer.c index 6d77ce9f54e5..3b3ab5281920 100644 --- a/fs/buffer.c +++ b/fs/buffer.c | |||
@@ -160,12 +160,7 @@ int sync_blockdev(struct block_device *bdev) | |||
160 | } | 160 | } |
161 | EXPORT_SYMBOL(sync_blockdev); | 161 | EXPORT_SYMBOL(sync_blockdev); |
162 | 162 | ||
163 | /* | 163 | static void __fsync_super(struct super_block *sb) |
164 | * Write out and wait upon all dirty data associated with this | ||
165 | * superblock. Filesystem data as well as the underlying block | ||
166 | * device. Takes the superblock lock. | ||
167 | */ | ||
168 | int fsync_super(struct super_block *sb) | ||
169 | { | 164 | { |
170 | sync_inodes_sb(sb, 0); | 165 | sync_inodes_sb(sb, 0); |
171 | DQUOT_SYNC(sb); | 166 | DQUOT_SYNC(sb); |
@@ -177,7 +172,16 @@ int fsync_super(struct super_block *sb) | |||
177 | sb->s_op->sync_fs(sb, 1); | 172 | sb->s_op->sync_fs(sb, 1); |
178 | sync_blockdev(sb->s_bdev); | 173 | sync_blockdev(sb->s_bdev); |
179 | sync_inodes_sb(sb, 1); | 174 | sync_inodes_sb(sb, 1); |
175 | } | ||
180 | 176 | ||
177 | /* | ||
178 | * Write out and wait upon all dirty data associated with this | ||
179 | * superblock. Filesystem data as well as the underlying block | ||
180 | * device. Takes the superblock lock. | ||
181 | */ | ||
182 | int fsync_super(struct super_block *sb) | ||
183 | { | ||
184 | __fsync_super(sb); | ||
181 | return sync_blockdev(sb->s_bdev); | 185 | return sync_blockdev(sb->s_bdev); |
182 | } | 186 | } |
183 | 187 | ||
@@ -216,19 +220,7 @@ struct super_block *freeze_bdev(struct block_device *bdev) | |||
216 | sb->s_frozen = SB_FREEZE_WRITE; | 220 | sb->s_frozen = SB_FREEZE_WRITE; |
217 | smp_wmb(); | 221 | smp_wmb(); |
218 | 222 | ||
219 | sync_inodes_sb(sb, 0); | 223 | __fsync_super(sb); |
220 | DQUOT_SYNC(sb); | ||
221 | |||
222 | lock_super(sb); | ||
223 | if (sb->s_dirt && sb->s_op->write_super) | ||
224 | sb->s_op->write_super(sb); | ||
225 | unlock_super(sb); | ||
226 | |||
227 | if (sb->s_op->sync_fs) | ||
228 | sb->s_op->sync_fs(sb, 1); | ||
229 | |||
230 | sync_blockdev(sb->s_bdev); | ||
231 | sync_inodes_sb(sb, 1); | ||
232 | 224 | ||
233 | sb->s_frozen = SB_FREEZE_TRANS; | 225 | sb->s_frozen = SB_FREEZE_TRANS; |
234 | smp_wmb(); | 226 | smp_wmb(); |
diff --git a/fs/char_dev.c b/fs/char_dev.c index 5c36345c9bf7..8c6eb04d31e2 100644 --- a/fs/char_dev.c +++ b/fs/char_dev.c | |||
@@ -146,12 +146,10 @@ __register_chrdev_region(unsigned int major, unsigned int baseminor, | |||
146 | int ret = 0; | 146 | int ret = 0; |
147 | int i; | 147 | int i; |
148 | 148 | ||
149 | cd = kmalloc(sizeof(struct char_device_struct), GFP_KERNEL); | 149 | cd = kzalloc(sizeof(struct char_device_struct), GFP_KERNEL); |
150 | if (cd == NULL) | 150 | if (cd == NULL) |
151 | return ERR_PTR(-ENOMEM); | 151 | return ERR_PTR(-ENOMEM); |
152 | 152 | ||
153 | memset(cd, 0, sizeof(struct char_device_struct)); | ||
154 | |||
155 | mutex_lock(&chrdevs_lock); | 153 | mutex_lock(&chrdevs_lock); |
156 | 154 | ||
157 | /* temporary */ | 155 | /* temporary */ |
@@ -466,9 +464,8 @@ static struct kobj_type ktype_cdev_dynamic = { | |||
466 | 464 | ||
467 | struct cdev *cdev_alloc(void) | 465 | struct cdev *cdev_alloc(void) |
468 | { | 466 | { |
469 | struct cdev *p = kmalloc(sizeof(struct cdev), GFP_KERNEL); | 467 | struct cdev *p = kzalloc(sizeof(struct cdev), GFP_KERNEL); |
470 | if (p) { | 468 | if (p) { |
471 | memset(p, 0, sizeof(struct cdev)); | ||
472 | p->kobj.ktype = &ktype_cdev_dynamic; | 469 | p->kobj.ktype = &ktype_cdev_dynamic; |
473 | INIT_LIST_HEAD(&p->list); | 470 | INIT_LIST_HEAD(&p->list); |
474 | kobject_init(&p->kobj); | 471 | kobject_init(&p->kobj); |
diff --git a/fs/compat.c b/fs/compat.c index 2a88477330fc..ef5a0771592d 100644 --- a/fs/compat.c +++ b/fs/compat.c | |||
@@ -1476,10 +1476,9 @@ int compat_do_execve(char * filename, | |||
1476 | int i; | 1476 | int i; |
1477 | 1477 | ||
1478 | retval = -ENOMEM; | 1478 | retval = -ENOMEM; |
1479 | bprm = kmalloc(sizeof(*bprm), GFP_KERNEL); | 1479 | bprm = kzalloc(sizeof(*bprm), GFP_KERNEL); |
1480 | if (!bprm) | 1480 | if (!bprm) |
1481 | goto out_ret; | 1481 | goto out_ret; |
1482 | memset(bprm, 0, sizeof(*bprm)); | ||
1483 | 1482 | ||
1484 | file = open_exec(filename); | 1483 | file = open_exec(filename); |
1485 | retval = PTR_ERR(file); | 1484 | retval = PTR_ERR(file); |
@@ -2170,9 +2169,12 @@ asmlinkage long compat_sys_nfsservctl(int cmd, struct compat_nfsctl_arg __user * | |||
2170 | 2169 | ||
2171 | default: | 2170 | default: |
2172 | err = -EINVAL; | 2171 | err = -EINVAL; |
2173 | goto done; | 2172 | break; |
2174 | } | 2173 | } |
2175 | 2174 | ||
2175 | if (err) | ||
2176 | goto done; | ||
2177 | |||
2176 | oldfs = get_fs(); | 2178 | oldfs = get_fs(); |
2177 | set_fs(KERNEL_DS); | 2179 | set_fs(KERNEL_DS); |
2178 | /* The __user pointer casts are valid because of the set_fs() */ | 2180 | /* The __user pointer casts are valid because of the set_fs() */ |
diff --git a/fs/dcache.c b/fs/dcache.c index 653f64ce98e2..939584648504 100644 --- a/fs/dcache.c +++ b/fs/dcache.c | |||
@@ -325,10 +325,13 @@ static struct dentry * __d_find_alias(struct inode *inode, int want_discon) | |||
325 | 325 | ||
326 | struct dentry * d_find_alias(struct inode *inode) | 326 | struct dentry * d_find_alias(struct inode *inode) |
327 | { | 327 | { |
328 | struct dentry *de; | 328 | struct dentry *de = NULL; |
329 | spin_lock(&dcache_lock); | 329 | |
330 | de = __d_find_alias(inode, 0); | 330 | if (!list_empty(&inode->i_dentry)) { |
331 | spin_unlock(&dcache_lock); | 331 | spin_lock(&dcache_lock); |
332 | de = __d_find_alias(inode, 0); | ||
333 | spin_unlock(&dcache_lock); | ||
334 | } | ||
332 | return de; | 335 | return de; |
333 | } | 336 | } |
334 | 337 | ||
@@ -486,6 +489,7 @@ repeat: | |||
486 | continue; | 489 | continue; |
487 | } | 490 | } |
488 | prune_one_dentry(dentry); | 491 | prune_one_dentry(dentry); |
492 | cond_resched_lock(&dcache_lock); | ||
489 | goto repeat; | 493 | goto repeat; |
490 | } | 494 | } |
491 | spin_unlock(&dcache_lock); | 495 | spin_unlock(&dcache_lock); |
@@ -799,6 +803,7 @@ void d_instantiate(struct dentry *entry, struct inode * inode) | |||
799 | if (inode) | 803 | if (inode) |
800 | list_add(&entry->d_alias, &inode->i_dentry); | 804 | list_add(&entry->d_alias, &inode->i_dentry); |
801 | entry->d_inode = inode; | 805 | entry->d_inode = inode; |
806 | fsnotify_d_instantiate(entry, inode); | ||
802 | spin_unlock(&dcache_lock); | 807 | spin_unlock(&dcache_lock); |
803 | security_d_instantiate(entry, inode); | 808 | security_d_instantiate(entry, inode); |
804 | } | 809 | } |
@@ -850,6 +855,7 @@ struct dentry *d_instantiate_unique(struct dentry *entry, struct inode *inode) | |||
850 | list_add(&entry->d_alias, &inode->i_dentry); | 855 | list_add(&entry->d_alias, &inode->i_dentry); |
851 | do_negative: | 856 | do_negative: |
852 | entry->d_inode = inode; | 857 | entry->d_inode = inode; |
858 | fsnotify_d_instantiate(entry, inode); | ||
853 | spin_unlock(&dcache_lock); | 859 | spin_unlock(&dcache_lock); |
854 | security_d_instantiate(entry, inode); | 860 | security_d_instantiate(entry, inode); |
855 | return NULL; | 861 | return NULL; |
@@ -980,6 +986,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) | |||
980 | new = __d_find_alias(inode, 1); | 986 | new = __d_find_alias(inode, 1); |
981 | if (new) { | 987 | if (new) { |
982 | BUG_ON(!(new->d_flags & DCACHE_DISCONNECTED)); | 988 | BUG_ON(!(new->d_flags & DCACHE_DISCONNECTED)); |
989 | fsnotify_d_instantiate(new, inode); | ||
983 | spin_unlock(&dcache_lock); | 990 | spin_unlock(&dcache_lock); |
984 | security_d_instantiate(new, inode); | 991 | security_d_instantiate(new, inode); |
985 | d_rehash(dentry); | 992 | d_rehash(dentry); |
@@ -989,6 +996,7 @@ struct dentry *d_splice_alias(struct inode *inode, struct dentry *dentry) | |||
989 | /* d_instantiate takes dcache_lock, so we do it by hand */ | 996 | /* d_instantiate takes dcache_lock, so we do it by hand */ |
990 | list_add(&dentry->d_alias, &inode->i_dentry); | 997 | list_add(&dentry->d_alias, &inode->i_dentry); |
991 | dentry->d_inode = inode; | 998 | dentry->d_inode = inode; |
999 | fsnotify_d_instantiate(dentry, inode); | ||
992 | spin_unlock(&dcache_lock); | 1000 | spin_unlock(&dcache_lock); |
993 | security_d_instantiate(dentry, inode); | 1001 | security_d_instantiate(dentry, inode); |
994 | d_rehash(dentry); | 1002 | d_rehash(dentry); |
@@ -1173,6 +1181,9 @@ void d_delete(struct dentry * dentry) | |||
1173 | spin_lock(&dentry->d_lock); | 1181 | spin_lock(&dentry->d_lock); |
1174 | isdir = S_ISDIR(dentry->d_inode->i_mode); | 1182 | isdir = S_ISDIR(dentry->d_inode->i_mode); |
1175 | if (atomic_read(&dentry->d_count) == 1) { | 1183 | if (atomic_read(&dentry->d_count) == 1) { |
1184 | /* remove this and other inotify debug checks after 2.6.18 */ | ||
1185 | dentry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED; | ||
1186 | |||
1176 | dentry_iput(dentry); | 1187 | dentry_iput(dentry); |
1177 | fsnotify_nameremove(dentry, isdir); | 1188 | fsnotify_nameremove(dentry, isdir); |
1178 | return; | 1189 | return; |
@@ -1339,6 +1350,7 @@ already_unhashed: | |||
1339 | 1350 | ||
1340 | list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); | 1351 | list_add(&dentry->d_u.d_child, &dentry->d_parent->d_subdirs); |
1341 | spin_unlock(&target->d_lock); | 1352 | spin_unlock(&target->d_lock); |
1353 | fsnotify_d_move(dentry); | ||
1342 | spin_unlock(&dentry->d_lock); | 1354 | spin_unlock(&dentry->d_lock); |
1343 | write_sequnlock(&rename_lock); | 1355 | write_sequnlock(&rename_lock); |
1344 | spin_unlock(&dcache_lock); | 1356 | spin_unlock(&dcache_lock); |
diff --git a/fs/direct-io.c b/fs/direct-io.c index 27f3e787faca..235ed8d1f11e 100644 --- a/fs/direct-io.c +++ b/fs/direct-io.c | |||
@@ -129,6 +129,7 @@ struct dio { | |||
129 | /* AIO related stuff */ | 129 | /* AIO related stuff */ |
130 | struct kiocb *iocb; /* kiocb */ | 130 | struct kiocb *iocb; /* kiocb */ |
131 | int is_async; /* is IO async ? */ | 131 | int is_async; /* is IO async ? */ |
132 | int io_error; /* IO error in completion path */ | ||
132 | ssize_t result; /* IO result */ | 133 | ssize_t result; /* IO result */ |
133 | }; | 134 | }; |
134 | 135 | ||
@@ -250,6 +251,10 @@ static void finished_one_bio(struct dio *dio) | |||
250 | ((offset + transferred) > dio->i_size)) | 251 | ((offset + transferred) > dio->i_size)) |
251 | transferred = dio->i_size - offset; | 252 | transferred = dio->i_size - offset; |
252 | 253 | ||
254 | /* check for error in completion path */ | ||
255 | if (dio->io_error) | ||
256 | transferred = dio->io_error; | ||
257 | |||
253 | dio_complete(dio, offset, transferred); | 258 | dio_complete(dio, offset, transferred); |
254 | 259 | ||
255 | /* Complete AIO later if falling back to buffered i/o */ | 260 | /* Complete AIO later if falling back to buffered i/o */ |
@@ -406,7 +411,7 @@ static int dio_bio_complete(struct dio *dio, struct bio *bio) | |||
406 | int page_no; | 411 | int page_no; |
407 | 412 | ||
408 | if (!uptodate) | 413 | if (!uptodate) |
409 | dio->result = -EIO; | 414 | dio->io_error = -EIO; |
410 | 415 | ||
411 | if (dio->is_async && dio->rw == READ) { | 416 | if (dio->is_async && dio->rw == READ) { |
412 | bio_check_pages_dirty(bio); /* transfers ownership */ | 417 | bio_check_pages_dirty(bio); /* transfers ownership */ |
@@ -971,6 +976,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode, | |||
971 | dio->next_block_for_io = -1; | 976 | dio->next_block_for_io = -1; |
972 | 977 | ||
973 | dio->page_errors = 0; | 978 | dio->page_errors = 0; |
979 | dio->io_error = 0; | ||
974 | dio->result = 0; | 980 | dio->result = 0; |
975 | dio->iocb = iocb; | 981 | dio->iocb = iocb; |
976 | dio->i_size = i_size_read(inode); | 982 | dio->i_size = i_size_read(inode); |
diff --git a/fs/eventpoll.c b/fs/eventpoll.c index 1c2b16fda13a..a0f682cdd03e 100644 --- a/fs/eventpoll.c +++ b/fs/eventpoll.c | |||
@@ -599,7 +599,7 @@ sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event) | |||
599 | switch (op) { | 599 | switch (op) { |
600 | case EPOLL_CTL_ADD: | 600 | case EPOLL_CTL_ADD: |
601 | if (!epi) { | 601 | if (!epi) { |
602 | epds.events |= POLLERR | POLLHUP; | 602 | epds.events |= POLLERR | POLLHUP | POLLRDHUP; |
603 | 603 | ||
604 | error = ep_insert(ep, &epds, tfile, fd); | 604 | error = ep_insert(ep, &epds, tfile, fd); |
605 | } else | 605 | } else |
@@ -613,7 +613,7 @@ sys_epoll_ctl(int epfd, int op, int fd, struct epoll_event __user *event) | |||
613 | break; | 613 | break; |
614 | case EPOLL_CTL_MOD: | 614 | case EPOLL_CTL_MOD: |
615 | if (epi) { | 615 | if (epi) { |
616 | epds.events |= POLLERR | POLLHUP; | 616 | epds.events |= POLLERR | POLLHUP | POLLRDHUP; |
617 | error = ep_modify(ep, epi, &epds); | 617 | error = ep_modify(ep, epi, &epds); |
618 | } else | 618 | } else |
619 | error = -ENOENT; | 619 | error = -ENOENT; |
@@ -127,7 +127,7 @@ asmlinkage long sys_uselib(const char __user * library) | |||
127 | struct nameidata nd; | 127 | struct nameidata nd; |
128 | int error; | 128 | int error; |
129 | 129 | ||
130 | error = __user_path_lookup_open(library, LOOKUP_FOLLOW, &nd, FMODE_READ); | 130 | error = __user_path_lookup_open(library, LOOKUP_FOLLOW, &nd, FMODE_READ|FMODE_EXEC); |
131 | if (error) | 131 | if (error) |
132 | goto out; | 132 | goto out; |
133 | 133 | ||
@@ -477,7 +477,7 @@ struct file *open_exec(const char *name) | |||
477 | int err; | 477 | int err; |
478 | struct file *file; | 478 | struct file *file; |
479 | 479 | ||
480 | err = path_lookup_open(AT_FDCWD, name, LOOKUP_FOLLOW, &nd, FMODE_READ); | 480 | err = path_lookup_open(AT_FDCWD, name, LOOKUP_FOLLOW, &nd, FMODE_READ|FMODE_EXEC); |
481 | file = ERR_PTR(err); | 481 | file = ERR_PTR(err); |
482 | 482 | ||
483 | if (!err) { | 483 | if (!err) { |
@@ -1143,10 +1143,9 @@ int do_execve(char * filename, | |||
1143 | int i; | 1143 | int i; |
1144 | 1144 | ||
1145 | retval = -ENOMEM; | 1145 | retval = -ENOMEM; |
1146 | bprm = kmalloc(sizeof(*bprm), GFP_KERNEL); | 1146 | bprm = kzalloc(sizeof(*bprm), GFP_KERNEL); |
1147 | if (!bprm) | 1147 | if (!bprm) |
1148 | goto out_ret; | 1148 | goto out_ret; |
1149 | memset(bprm, 0, sizeof(*bprm)); | ||
1150 | 1149 | ||
1151 | file = open_exec(filename); | 1150 | file = open_exec(filename); |
1152 | retval = PTR_ERR(file); | 1151 | retval = PTR_ERR(file); |
diff --git a/fs/ext2/super.c b/fs/ext2/super.c index 268b73f5847c..7e30bae174ed 100644 --- a/fs/ext2/super.c +++ b/fs/ext2/super.c | |||
@@ -211,8 +211,6 @@ static int ext2_show_options(struct seq_file *seq, struct vfsmount *vfs) | |||
211 | 211 | ||
212 | if (sbi->s_mount_opt & EXT2_MOUNT_GRPID) | 212 | if (sbi->s_mount_opt & EXT2_MOUNT_GRPID) |
213 | seq_puts(seq, ",grpid"); | 213 | seq_puts(seq, ",grpid"); |
214 | else | ||
215 | seq_puts(seq, ",nogrpid"); | ||
216 | 214 | ||
217 | #if defined(CONFIG_QUOTA) | 215 | #if defined(CONFIG_QUOTA) |
218 | if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA) | 216 | if (sbi->s_mount_opt & EXT2_MOUNT_USRQUOTA) |
diff --git a/fs/ext3/bitmap.c b/fs/ext3/bitmap.c index cb16b4c5d5df..ce4f82b9e528 100644 --- a/fs/ext3/bitmap.c +++ b/fs/ext3/bitmap.c | |||
@@ -7,11 +7,11 @@ | |||
7 | * Universite Pierre et Marie Curie (Paris VI) | 7 | * Universite Pierre et Marie Curie (Paris VI) |
8 | */ | 8 | */ |
9 | 9 | ||
10 | #ifdef EXT3FS_DEBUG | ||
11 | |||
12 | #include <linux/buffer_head.h> | 10 | #include <linux/buffer_head.h> |
11 | #include <linux/jbd.h> | ||
12 | #include <linux/ext3_fs.h> | ||
13 | 13 | ||
14 | #include "ext3_fs.h" | 14 | #ifdef EXT3FS_DEBUG |
15 | 15 | ||
16 | static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; | 16 | static int nibblemap[] = {4, 3, 3, 2, 3, 2, 2, 1, 3, 2, 2, 1, 2, 1, 1, 0}; |
17 | 17 | ||
diff --git a/fs/fs-writeback.c b/fs/fs-writeback.c index 785c7213a54f..f3fbe2d030f4 100644 --- a/fs/fs-writeback.c +++ b/fs/fs-writeback.c | |||
@@ -381,8 +381,8 @@ sync_sb_inodes(struct super_block *sb, struct writeback_control *wbc) | |||
381 | list_move(&inode->i_list, &sb->s_dirty); | 381 | list_move(&inode->i_list, &sb->s_dirty); |
382 | } | 382 | } |
383 | spin_unlock(&inode_lock); | 383 | spin_unlock(&inode_lock); |
384 | cond_resched(); | ||
385 | iput(inode); | 384 | iput(inode); |
385 | cond_resched(); | ||
386 | spin_lock(&inode_lock); | 386 | spin_lock(&inode_lock); |
387 | if (wbc->nr_to_write <= 0) | 387 | if (wbc->nr_to_write <= 0) |
388 | break; | 388 | break; |
diff --git a/fs/inode.c b/fs/inode.c index a51c671c54cf..85da11044adc 100644 --- a/fs/inode.c +++ b/fs/inode.c | |||
@@ -91,7 +91,7 @@ DEFINE_SPINLOCK(inode_lock); | |||
91 | * from its final dispose_list, the struct super_block they refer to | 91 | * from its final dispose_list, the struct super_block they refer to |
92 | * (for inode->i_sb->s_op) may already have been freed and reused. | 92 | * (for inode->i_sb->s_op) may already have been freed and reused. |
93 | */ | 93 | */ |
94 | DEFINE_MUTEX(iprune_mutex); | 94 | static DEFINE_MUTEX(iprune_mutex); |
95 | 95 | ||
96 | /* | 96 | /* |
97 | * Statistics gathering.. | 97 | * Statistics gathering.. |
diff --git a/fs/inotify.c b/fs/inotify.c index 0ee39ef591c6..a61e93e17853 100644 --- a/fs/inotify.c +++ b/fs/inotify.c | |||
@@ -38,7 +38,6 @@ | |||
38 | #include <asm/ioctls.h> | 38 | #include <asm/ioctls.h> |
39 | 39 | ||
40 | static atomic_t inotify_cookie; | 40 | static atomic_t inotify_cookie; |
41 | static atomic_t inotify_watches; | ||
42 | 41 | ||
43 | static kmem_cache_t *watch_cachep; | 42 | static kmem_cache_t *watch_cachep; |
44 | static kmem_cache_t *event_cachep; | 43 | static kmem_cache_t *event_cachep; |
@@ -381,6 +380,48 @@ static int find_inode(const char __user *dirname, struct nameidata *nd, | |||
381 | } | 380 | } |
382 | 381 | ||
383 | /* | 382 | /* |
383 | * inotify_inode_watched - returns nonzero if there are watches on this inode | ||
384 | * and zero otherwise. We call this lockless, we do not care if we race. | ||
385 | */ | ||
386 | static inline int inotify_inode_watched(struct inode *inode) | ||
387 | { | ||
388 | return !list_empty(&inode->inotify_watches); | ||
389 | } | ||
390 | |||
391 | /* | ||
392 | * Get child dentry flag into synch with parent inode. | ||
393 | * Flag should always be clear for negative dentrys. | ||
394 | */ | ||
395 | static void set_dentry_child_flags(struct inode *inode, int watched) | ||
396 | { | ||
397 | struct dentry *alias; | ||
398 | |||
399 | spin_lock(&dcache_lock); | ||
400 | list_for_each_entry(alias, &inode->i_dentry, d_alias) { | ||
401 | struct dentry *child; | ||
402 | |||
403 | list_for_each_entry(child, &alias->d_subdirs, d_u.d_child) { | ||
404 | if (!child->d_inode) { | ||
405 | WARN_ON(child->d_flags & DCACHE_INOTIFY_PARENT_WATCHED); | ||
406 | continue; | ||
407 | } | ||
408 | spin_lock(&child->d_lock); | ||
409 | if (watched) { | ||
410 | WARN_ON(child->d_flags & | ||
411 | DCACHE_INOTIFY_PARENT_WATCHED); | ||
412 | child->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED; | ||
413 | } else { | ||
414 | WARN_ON(!(child->d_flags & | ||
415 | DCACHE_INOTIFY_PARENT_WATCHED)); | ||
416 | child->d_flags&=~DCACHE_INOTIFY_PARENT_WATCHED; | ||
417 | } | ||
418 | spin_unlock(&child->d_lock); | ||
419 | } | ||
420 | } | ||
421 | spin_unlock(&dcache_lock); | ||
422 | } | ||
423 | |||
424 | /* | ||
384 | * create_watch - creates a watch on the given device. | 425 | * create_watch - creates a watch on the given device. |
385 | * | 426 | * |
386 | * Callers must hold dev->mutex. Calls inotify_dev_get_wd() so may sleep. | 427 | * Callers must hold dev->mutex. Calls inotify_dev_get_wd() so may sleep. |
@@ -426,7 +467,6 @@ static struct inotify_watch *create_watch(struct inotify_device *dev, | |||
426 | get_inotify_watch(watch); | 467 | get_inotify_watch(watch); |
427 | 468 | ||
428 | atomic_inc(&dev->user->inotify_watches); | 469 | atomic_inc(&dev->user->inotify_watches); |
429 | atomic_inc(&inotify_watches); | ||
430 | 470 | ||
431 | return watch; | 471 | return watch; |
432 | } | 472 | } |
@@ -458,8 +498,10 @@ static void remove_watch_no_event(struct inotify_watch *watch, | |||
458 | list_del(&watch->i_list); | 498 | list_del(&watch->i_list); |
459 | list_del(&watch->d_list); | 499 | list_del(&watch->d_list); |
460 | 500 | ||
501 | if (!inotify_inode_watched(watch->inode)) | ||
502 | set_dentry_child_flags(watch->inode, 0); | ||
503 | |||
461 | atomic_dec(&dev->user->inotify_watches); | 504 | atomic_dec(&dev->user->inotify_watches); |
462 | atomic_dec(&inotify_watches); | ||
463 | idr_remove(&dev->idr, watch->wd); | 505 | idr_remove(&dev->idr, watch->wd); |
464 | put_inotify_watch(watch); | 506 | put_inotify_watch(watch); |
465 | } | 507 | } |
@@ -481,16 +523,39 @@ static void remove_watch(struct inotify_watch *watch,struct inotify_device *dev) | |||
481 | remove_watch_no_event(watch, dev); | 523 | remove_watch_no_event(watch, dev); |
482 | } | 524 | } |
483 | 525 | ||
526 | /* Kernel API */ | ||
527 | |||
484 | /* | 528 | /* |
485 | * inotify_inode_watched - returns nonzero if there are watches on this inode | 529 | * inotify_d_instantiate - instantiate dcache entry for inode |
486 | * and zero otherwise. We call this lockless, we do not care if we race. | ||
487 | */ | 530 | */ |
488 | static inline int inotify_inode_watched(struct inode *inode) | 531 | void inotify_d_instantiate(struct dentry *entry, struct inode *inode) |
489 | { | 532 | { |
490 | return !list_empty(&inode->inotify_watches); | 533 | struct dentry *parent; |
534 | |||
535 | if (!inode) | ||
536 | return; | ||
537 | |||
538 | WARN_ON(entry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED); | ||
539 | spin_lock(&entry->d_lock); | ||
540 | parent = entry->d_parent; | ||
541 | if (inotify_inode_watched(parent->d_inode)) | ||
542 | entry->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED; | ||
543 | spin_unlock(&entry->d_lock); | ||
491 | } | 544 | } |
492 | 545 | ||
493 | /* Kernel API */ | 546 | /* |
547 | * inotify_d_move - dcache entry has been moved | ||
548 | */ | ||
549 | void inotify_d_move(struct dentry *entry) | ||
550 | { | ||
551 | struct dentry *parent; | ||
552 | |||
553 | parent = entry->d_parent; | ||
554 | if (inotify_inode_watched(parent->d_inode)) | ||
555 | entry->d_flags |= DCACHE_INOTIFY_PARENT_WATCHED; | ||
556 | else | ||
557 | entry->d_flags &= ~DCACHE_INOTIFY_PARENT_WATCHED; | ||
558 | } | ||
494 | 559 | ||
495 | /** | 560 | /** |
496 | * inotify_inode_queue_event - queue an event to all watches on this inode | 561 | * inotify_inode_queue_event - queue an event to all watches on this inode |
@@ -538,7 +603,7 @@ void inotify_dentry_parent_queue_event(struct dentry *dentry, u32 mask, | |||
538 | struct dentry *parent; | 603 | struct dentry *parent; |
539 | struct inode *inode; | 604 | struct inode *inode; |
540 | 605 | ||
541 | if (!atomic_read (&inotify_watches)) | 606 | if (!(dentry->d_flags & DCACHE_INOTIFY_PARENT_WATCHED)) |
542 | return; | 607 | return; |
543 | 608 | ||
544 | spin_lock(&dentry->d_lock); | 609 | spin_lock(&dentry->d_lock); |
@@ -993,6 +1058,9 @@ asmlinkage long sys_inotify_add_watch(int fd, const char __user *path, u32 mask) | |||
993 | goto out; | 1058 | goto out; |
994 | } | 1059 | } |
995 | 1060 | ||
1061 | if (!inotify_inode_watched(inode)) | ||
1062 | set_dentry_child_flags(inode, 1); | ||
1063 | |||
996 | /* Add the watch to the device's and the inode's list */ | 1064 | /* Add the watch to the device's and the inode's list */ |
997 | list_add(&watch->d_list, &dev->watches); | 1065 | list_add(&watch->d_list, &dev->watches); |
998 | list_add(&watch->i_list, &inode->inotify_watches); | 1066 | list_add(&watch->i_list, &inode->inotify_watches); |
@@ -1065,7 +1133,6 @@ static int __init inotify_setup(void) | |||
1065 | inotify_max_user_watches = 8192; | 1133 | inotify_max_user_watches = 8192; |
1066 | 1134 | ||
1067 | atomic_set(&inotify_cookie, 0); | 1135 | atomic_set(&inotify_cookie, 0); |
1068 | atomic_set(&inotify_watches, 0); | ||
1069 | 1136 | ||
1070 | watch_cachep = kmem_cache_create("inotify_watch_cache", | 1137 | watch_cachep = kmem_cache_create("inotify_watch_cache", |
1071 | sizeof(struct inotify_watch), | 1138 | sizeof(struct inotify_watch), |
diff --git a/fs/jbd/journal.c b/fs/jbd/journal.c index 95a628d8cac8..7f96b5cb6781 100644 --- a/fs/jbd/journal.c +++ b/fs/jbd/journal.c | |||
@@ -33,9 +33,11 @@ | |||
33 | #include <linux/mm.h> | 33 | #include <linux/mm.h> |
34 | #include <linux/suspend.h> | 34 | #include <linux/suspend.h> |
35 | #include <linux/pagemap.h> | 35 | #include <linux/pagemap.h> |
36 | #include <linux/kthread.h> | ||
37 | #include <linux/proc_fs.h> | ||
38 | |||
36 | #include <asm/uaccess.h> | 39 | #include <asm/uaccess.h> |
37 | #include <asm/page.h> | 40 | #include <asm/page.h> |
38 | #include <linux/proc_fs.h> | ||
39 | 41 | ||
40 | EXPORT_SYMBOL(journal_start); | 42 | EXPORT_SYMBOL(journal_start); |
41 | EXPORT_SYMBOL(journal_restart); | 43 | EXPORT_SYMBOL(journal_restart); |
@@ -111,18 +113,15 @@ static void commit_timeout(unsigned long __data) | |||
111 | 113 | ||
112 | static int kjournald(void *arg) | 114 | static int kjournald(void *arg) |
113 | { | 115 | { |
114 | journal_t *journal = (journal_t *) arg; | 116 | journal_t *journal = arg; |
115 | transaction_t *transaction; | 117 | transaction_t *transaction; |
116 | struct timer_list timer; | ||
117 | 118 | ||
118 | daemonize("kjournald"); | 119 | /* |
119 | 120 | * Set up an interval timer which can be used to trigger a commit wakeup | |
120 | /* Set up an interval timer which can be used to trigger a | 121 | * after the commit interval expires |
121 | commit wakeup after the commit interval expires */ | 122 | */ |
122 | init_timer(&timer); | 123 | setup_timer(&journal->j_commit_timer, commit_timeout, |
123 | timer.data = (unsigned long) current; | 124 | (unsigned long)current); |
124 | timer.function = commit_timeout; | ||
125 | journal->j_commit_timer = &timer; | ||
126 | 125 | ||
127 | /* Record that the journal thread is running */ | 126 | /* Record that the journal thread is running */ |
128 | journal->j_task = current; | 127 | journal->j_task = current; |
@@ -146,7 +145,7 @@ loop: | |||
146 | if (journal->j_commit_sequence != journal->j_commit_request) { | 145 | if (journal->j_commit_sequence != journal->j_commit_request) { |
147 | jbd_debug(1, "OK, requests differ\n"); | 146 | jbd_debug(1, "OK, requests differ\n"); |
148 | spin_unlock(&journal->j_state_lock); | 147 | spin_unlock(&journal->j_state_lock); |
149 | del_timer_sync(journal->j_commit_timer); | 148 | del_timer_sync(&journal->j_commit_timer); |
150 | journal_commit_transaction(journal); | 149 | journal_commit_transaction(journal); |
151 | spin_lock(&journal->j_state_lock); | 150 | spin_lock(&journal->j_state_lock); |
152 | goto loop; | 151 | goto loop; |
@@ -203,7 +202,7 @@ loop: | |||
203 | 202 | ||
204 | end_loop: | 203 | end_loop: |
205 | spin_unlock(&journal->j_state_lock); | 204 | spin_unlock(&journal->j_state_lock); |
206 | del_timer_sync(journal->j_commit_timer); | 205 | del_timer_sync(&journal->j_commit_timer); |
207 | journal->j_task = NULL; | 206 | journal->j_task = NULL; |
208 | wake_up(&journal->j_wait_done_commit); | 207 | wake_up(&journal->j_wait_done_commit); |
209 | jbd_debug(1, "Journal thread exiting.\n"); | 208 | jbd_debug(1, "Journal thread exiting.\n"); |
@@ -212,7 +211,7 @@ end_loop: | |||
212 | 211 | ||
213 | static void journal_start_thread(journal_t *journal) | 212 | static void journal_start_thread(journal_t *journal) |
214 | { | 213 | { |
215 | kernel_thread(kjournald, journal, CLONE_VM|CLONE_FS|CLONE_FILES); | 214 | kthread_run(kjournald, journal, "kjournald"); |
216 | wait_event(journal->j_wait_done_commit, journal->j_task != 0); | 215 | wait_event(journal->j_wait_done_commit, journal->j_task != 0); |
217 | } | 216 | } |
218 | 217 | ||
diff --git a/fs/jbd/transaction.c b/fs/jbd/transaction.c index 5fc40888f4cf..ada31fa272e3 100644 --- a/fs/jbd/transaction.c +++ b/fs/jbd/transaction.c | |||
@@ -53,8 +53,8 @@ get_transaction(journal_t *journal, transaction_t *transaction) | |||
53 | spin_lock_init(&transaction->t_handle_lock); | 53 | spin_lock_init(&transaction->t_handle_lock); |
54 | 54 | ||
55 | /* Set up the commit timer for the new transaction. */ | 55 | /* Set up the commit timer for the new transaction. */ |
56 | journal->j_commit_timer->expires = transaction->t_expires; | 56 | journal->j_commit_timer.expires = transaction->t_expires; |
57 | add_timer(journal->j_commit_timer); | 57 | add_timer(&journal->j_commit_timer); |
58 | 58 | ||
59 | J_ASSERT(journal->j_running_transaction == NULL); | 59 | J_ASSERT(journal->j_running_transaction == NULL); |
60 | journal->j_running_transaction = transaction; | 60 | journal->j_running_transaction = transaction; |
diff --git a/fs/minix/bitmap.c b/fs/minix/bitmap.c index dc6a4e4abcdc..4a6abc49418e 100644 --- a/fs/minix/bitmap.c +++ b/fs/minix/bitmap.c | |||
@@ -56,7 +56,7 @@ void minix_free_block(struct inode * inode, int block) | |||
56 | unsigned int bit,zone; | 56 | unsigned int bit,zone; |
57 | 57 | ||
58 | if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) { | 58 | if (block < sbi->s_firstdatazone || block >= sbi->s_nzones) { |
59 | printk("trying to free block not in datazone\n"); | 59 | printk("Trying to free block not in datazone\n"); |
60 | return; | 60 | return; |
61 | } | 61 | } |
62 | zone = block - sbi->s_firstdatazone + 1; | 62 | zone = block - sbi->s_firstdatazone + 1; |
@@ -124,7 +124,7 @@ minix_V1_raw_inode(struct super_block *sb, ino_t ino, struct buffer_head **bh) | |||
124 | ino / MINIX_INODES_PER_BLOCK; | 124 | ino / MINIX_INODES_PER_BLOCK; |
125 | *bh = sb_bread(sb, block); | 125 | *bh = sb_bread(sb, block); |
126 | if (!*bh) { | 126 | if (!*bh) { |
127 | printk("unable to read i-node block\n"); | 127 | printk("Unable to read inode block\n"); |
128 | return NULL; | 128 | return NULL; |
129 | } | 129 | } |
130 | p = (void *)(*bh)->b_data; | 130 | p = (void *)(*bh)->b_data; |
@@ -149,7 +149,7 @@ minix_V2_raw_inode(struct super_block *sb, ino_t ino, struct buffer_head **bh) | |||
149 | ino / MINIX2_INODES_PER_BLOCK; | 149 | ino / MINIX2_INODES_PER_BLOCK; |
150 | *bh = sb_bread(sb, block); | 150 | *bh = sb_bread(sb, block); |
151 | if (!*bh) { | 151 | if (!*bh) { |
152 | printk("unable to read i-node block\n"); | 152 | printk("Unable to read inode block\n"); |
153 | return NULL; | 153 | return NULL; |
154 | } | 154 | } |
155 | p = (void *)(*bh)->b_data; | 155 | p = (void *)(*bh)->b_data; |
@@ -204,7 +204,7 @@ void minix_free_inode(struct inode * inode) | |||
204 | bh = sbi->s_imap[ino >> 13]; | 204 | bh = sbi->s_imap[ino >> 13]; |
205 | lock_kernel(); | 205 | lock_kernel(); |
206 | if (!minix_test_and_clear_bit(ino & 8191, bh->b_data)) | 206 | if (!minix_test_and_clear_bit(ino & 8191, bh->b_data)) |
207 | printk("minix_free_inode: bit %lu already cleared.\n", ino); | 207 | printk("minix_free_inode: bit %lu already cleared\n", ino); |
208 | unlock_kernel(); | 208 | unlock_kernel(); |
209 | mark_buffer_dirty(bh); | 209 | mark_buffer_dirty(bh); |
210 | out: | 210 | out: |
@@ -238,7 +238,7 @@ struct inode * minix_new_inode(const struct inode * dir, int * error) | |||
238 | return NULL; | 238 | return NULL; |
239 | } | 239 | } |
240 | if (minix_test_and_set_bit(j,bh->b_data)) { /* shouldn't happen */ | 240 | if (minix_test_and_set_bit(j,bh->b_data)) { /* shouldn't happen */ |
241 | printk("new_inode: bit already set"); | 241 | printk("new_inode: bit already set\n"); |
242 | unlock_kernel(); | 242 | unlock_kernel(); |
243 | iput(inode); | 243 | iput(inode); |
244 | return NULL; | 244 | return NULL; |
diff --git a/fs/minix/inode.c b/fs/minix/inode.c index d9ffc43fee59..2dcccf1d1b7f 100644 --- a/fs/minix/inode.c +++ b/fs/minix/inode.c | |||
@@ -127,11 +127,11 @@ static int minix_remount (struct super_block * sb, int * flags, char * data) | |||
127 | mark_buffer_dirty(sbi->s_sbh); | 127 | mark_buffer_dirty(sbi->s_sbh); |
128 | 128 | ||
129 | if (!(sbi->s_mount_state & MINIX_VALID_FS)) | 129 | if (!(sbi->s_mount_state & MINIX_VALID_FS)) |
130 | printk ("MINIX-fs warning: remounting unchecked fs, " | 130 | printk("MINIX-fs warning: remounting unchecked fs, " |
131 | "running fsck is recommended.\n"); | 131 | "running fsck is recommended\n"); |
132 | else if ((sbi->s_mount_state & MINIX_ERROR_FS)) | 132 | else if ((sbi->s_mount_state & MINIX_ERROR_FS)) |
133 | printk ("MINIX-fs warning: remounting fs with errors, " | 133 | printk("MINIX-fs warning: remounting fs with errors, " |
134 | "running fsck is recommended.\n"); | 134 | "running fsck is recommended\n"); |
135 | } | 135 | } |
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
@@ -245,11 +245,11 @@ static int minix_fill_super(struct super_block *s, void *data, int silent) | |||
245 | mark_buffer_dirty(bh); | 245 | mark_buffer_dirty(bh); |
246 | } | 246 | } |
247 | if (!(sbi->s_mount_state & MINIX_VALID_FS)) | 247 | if (!(sbi->s_mount_state & MINIX_VALID_FS)) |
248 | printk ("MINIX-fs: mounting unchecked file system, " | 248 | printk("MINIX-fs: mounting unchecked file system, " |
249 | "running fsck is recommended.\n"); | 249 | "running fsck is recommended\n"); |
250 | else if (sbi->s_mount_state & MINIX_ERROR_FS) | 250 | else if (sbi->s_mount_state & MINIX_ERROR_FS) |
251 | printk ("MINIX-fs: mounting file system with errors, " | 251 | printk("MINIX-fs: mounting file system with errors, " |
252 | "running fsck is recommended.\n"); | 252 | "running fsck is recommended\n"); |
253 | return 0; | 253 | return 0; |
254 | 254 | ||
255 | out_iput: | 255 | out_iput: |
@@ -273,19 +273,19 @@ out_no_bitmap: | |||
273 | 273 | ||
274 | out_no_map: | 274 | out_no_map: |
275 | if (!silent) | 275 | if (!silent) |
276 | printk ("MINIX-fs: can't allocate map\n"); | 276 | printk("MINIX-fs: can't allocate map\n"); |
277 | goto out_release; | 277 | goto out_release; |
278 | 278 | ||
279 | out_no_fs: | 279 | out_no_fs: |
280 | if (!silent) | 280 | if (!silent) |
281 | printk("VFS: Can't find a Minix or Minix V2 filesystem on device " | 281 | printk("VFS: Can't find a Minix or Minix V2 filesystem " |
282 | "%s.\n", s->s_id); | 282 | "on device %s\n", s->s_id); |
283 | out_release: | 283 | out_release: |
284 | brelse(bh); | 284 | brelse(bh); |
285 | goto out; | 285 | goto out; |
286 | 286 | ||
287 | out_bad_hblock: | 287 | out_bad_hblock: |
288 | printk("MINIX-fs: blocksize too small for device.\n"); | 288 | printk("MINIX-fs: blocksize too small for device\n"); |
289 | goto out; | 289 | goto out; |
290 | 290 | ||
291 | out_bad_sb: | 291 | out_bad_sb: |
@@ -524,7 +524,7 @@ int minix_sync_inode(struct inode * inode) | |||
524 | sync_dirty_buffer(bh); | 524 | sync_dirty_buffer(bh); |
525 | if (buffer_req(bh) && !buffer_uptodate(bh)) | 525 | if (buffer_req(bh) && !buffer_uptodate(bh)) |
526 | { | 526 | { |
527 | printk ("IO error syncing minix inode [%s:%08lx]\n", | 527 | printk("IO error syncing minix inode [%s:%08lx]\n", |
528 | inode->i_sb->s_id, inode->i_ino); | 528 | inode->i_sb->s_id, inode->i_ino); |
529 | err = -1; | 529 | err = -1; |
530 | } | 530 | } |
diff --git a/fs/minix/itree_v1.c b/fs/minix/itree_v1.c index ba06aef4aca1..656b1347a25b 100644 --- a/fs/minix/itree_v1.c +++ b/fs/minix/itree_v1.c | |||
@@ -25,9 +25,9 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) | |||
25 | int n = 0; | 25 | int n = 0; |
26 | 26 | ||
27 | if (block < 0) { | 27 | if (block < 0) { |
28 | printk("minix_bmap: block<0"); | 28 | printk("minix_bmap: block<0\n"); |
29 | } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { | 29 | } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { |
30 | printk("minix_bmap: block>big"); | 30 | printk("minix_bmap: block>big\n"); |
31 | } else if (block < 7) { | 31 | } else if (block < 7) { |
32 | offsets[n++] = block; | 32 | offsets[n++] = block; |
33 | } else if ((block -= 7) < 512) { | 33 | } else if ((block -= 7) < 512) { |
diff --git a/fs/minix/itree_v2.c b/fs/minix/itree_v2.c index 3adc7675560f..9adcdc754e0f 100644 --- a/fs/minix/itree_v2.c +++ b/fs/minix/itree_v2.c | |||
@@ -25,9 +25,9 @@ static int block_to_path(struct inode * inode, long block, int offsets[DEPTH]) | |||
25 | int n = 0; | 25 | int n = 0; |
26 | 26 | ||
27 | if (block < 0) { | 27 | if (block < 0) { |
28 | printk("minix_bmap: block<0"); | 28 | printk("minix_bmap: block<0\n"); |
29 | } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { | 29 | } else if (block >= (minix_sb(inode->i_sb)->s_max_size/BLOCK_SIZE)) { |
30 | printk("minix_bmap: block>big"); | 30 | printk("minix_bmap: block>big\n"); |
31 | } else if (block < 7) { | 31 | } else if (block < 7) { |
32 | offsets[n++] = block; | 32 | offsets[n++] = block; |
33 | } else if ((block -= 7) < 256) { | 33 | } else if ((block -= 7) < 256) { |
diff --git a/fs/namei.c b/fs/namei.c index c72b940797fc..712dfc77793b 100644 --- a/fs/namei.c +++ b/fs/namei.c | |||
@@ -1628,6 +1628,12 @@ do_last: | |||
1628 | goto exit; | 1628 | goto exit; |
1629 | } | 1629 | } |
1630 | 1630 | ||
1631 | if (IS_ERR(nd->intent.open.file)) { | ||
1632 | mutex_unlock(&dir->d_inode->i_mutex); | ||
1633 | error = PTR_ERR(nd->intent.open.file); | ||
1634 | goto exit_dput; | ||
1635 | } | ||
1636 | |||
1631 | /* Negative dentry, just create the file */ | 1637 | /* Negative dentry, just create the file */ |
1632 | if (!path.dentry->d_inode) { | 1638 | if (!path.dentry->d_inode) { |
1633 | if (!IS_POSIXACL(dir->d_inode)) | 1639 | if (!IS_POSIXACL(dir->d_inode)) |
@@ -2621,16 +2627,27 @@ int __page_symlink(struct inode *inode, const char *symname, int len, | |||
2621 | int err = -ENOMEM; | 2627 | int err = -ENOMEM; |
2622 | char *kaddr; | 2628 | char *kaddr; |
2623 | 2629 | ||
2630 | retry: | ||
2624 | page = find_or_create_page(mapping, 0, gfp_mask); | 2631 | page = find_or_create_page(mapping, 0, gfp_mask); |
2625 | if (!page) | 2632 | if (!page) |
2626 | goto fail; | 2633 | goto fail; |
2627 | err = mapping->a_ops->prepare_write(NULL, page, 0, len-1); | 2634 | err = mapping->a_ops->prepare_write(NULL, page, 0, len-1); |
2635 | if (err == AOP_TRUNCATED_PAGE) { | ||
2636 | page_cache_release(page); | ||
2637 | goto retry; | ||
2638 | } | ||
2628 | if (err) | 2639 | if (err) |
2629 | goto fail_map; | 2640 | goto fail_map; |
2630 | kaddr = kmap_atomic(page, KM_USER0); | 2641 | kaddr = kmap_atomic(page, KM_USER0); |
2631 | memcpy(kaddr, symname, len-1); | 2642 | memcpy(kaddr, symname, len-1); |
2632 | kunmap_atomic(kaddr, KM_USER0); | 2643 | kunmap_atomic(kaddr, KM_USER0); |
2633 | mapping->a_ops->commit_write(NULL, page, 0, len-1); | 2644 | err = mapping->a_ops->commit_write(NULL, page, 0, len-1); |
2645 | if (err == AOP_TRUNCATED_PAGE) { | ||
2646 | page_cache_release(page); | ||
2647 | goto retry; | ||
2648 | } | ||
2649 | if (err) | ||
2650 | goto fail_map; | ||
2634 | /* | 2651 | /* |
2635 | * Notice that we are _not_ going to block here - end of page is | 2652 | * Notice that we are _not_ going to block here - end of page is |
2636 | * unmapped, so this will only try to map the rest of page, see | 2653 | * unmapped, so this will only try to map the rest of page, see |
@@ -2640,7 +2657,8 @@ int __page_symlink(struct inode *inode, const char *symname, int len, | |||
2640 | */ | 2657 | */ |
2641 | if (!PageUptodate(page)) { | 2658 | if (!PageUptodate(page)) { |
2642 | err = mapping->a_ops->readpage(NULL, page); | 2659 | err = mapping->a_ops->readpage(NULL, page); |
2643 | wait_on_page_locked(page); | 2660 | if (err != AOP_TRUNCATED_PAGE) |
2661 | wait_on_page_locked(page); | ||
2644 | } else { | 2662 | } else { |
2645 | unlock_page(page); | 2663 | unlock_page(page); |
2646 | } | 2664 | } |
@@ -890,6 +890,10 @@ EXPORT_SYMBOL(filp_open); | |||
890 | * a fully instantiated struct file to the caller. | 890 | * a fully instantiated struct file to the caller. |
891 | * This function is meant to be called from within a filesystem's | 891 | * This function is meant to be called from within a filesystem's |
892 | * lookup method. | 892 | * lookup method. |
893 | * Beware of calling it for non-regular files! Those ->open methods might block | ||
894 | * (e.g. in fifo_open), leaving you with parent locked (and in case of fifo, | ||
895 | * leading to a deadlock, as nobody can open that fifo anymore, because | ||
896 | * another process to open fifo will block on locked parent when doing lookup). | ||
893 | * Note that in case of error, nd->intent.open.file is destroyed, but the | 897 | * Note that in case of error, nd->intent.open.file is destroyed, but the |
894 | * path information remains valid. | 898 | * path information remains valid. |
895 | * If the open callback is set to NULL, then the standard f_op->open() | 899 | * If the open callback is set to NULL, then the standard f_op->open() |
@@ -662,10 +662,9 @@ struct inode* pipe_new(struct inode* inode) | |||
662 | { | 662 | { |
663 | struct pipe_inode_info *info; | 663 | struct pipe_inode_info *info; |
664 | 664 | ||
665 | info = kmalloc(sizeof(struct pipe_inode_info), GFP_KERNEL); | 665 | info = kzalloc(sizeof(struct pipe_inode_info), GFP_KERNEL); |
666 | if (!info) | 666 | if (!info) |
667 | goto fail_page; | 667 | goto fail_page; |
668 | memset(info, 0, sizeof(*info)); | ||
669 | inode->i_pipe = info; | 668 | inode->i_pipe = info; |
670 | 669 | ||
671 | init_waitqueue_head(PIPE_WAIT(*inode)); | 670 | init_waitqueue_head(PIPE_WAIT(*inode)); |
diff --git a/fs/proc/proc_misc.c b/fs/proc/proc_misc.c index 826c131994c3..1e9ea37d457e 100644 --- a/fs/proc/proc_misc.c +++ b/fs/proc/proc_misc.c | |||
@@ -485,6 +485,40 @@ static struct file_operations proc_slabinfo_operations = { | |||
485 | .llseek = seq_lseek, | 485 | .llseek = seq_lseek, |
486 | .release = seq_release, | 486 | .release = seq_release, |
487 | }; | 487 | }; |
488 | |||
489 | #ifdef CONFIG_DEBUG_SLAB_LEAK | ||
490 | extern struct seq_operations slabstats_op; | ||
491 | static int slabstats_open(struct inode *inode, struct file *file) | ||
492 | { | ||
493 | unsigned long *n = kzalloc(PAGE_SIZE, GFP_KERNEL); | ||
494 | int ret = -ENOMEM; | ||
495 | if (n) { | ||
496 | ret = seq_open(file, &slabstats_op); | ||
497 | if (!ret) { | ||
498 | struct seq_file *m = file->private_data; | ||
499 | *n = PAGE_SIZE / (2 * sizeof(unsigned long)); | ||
500 | m->private = n; | ||
501 | n = NULL; | ||
502 | } | ||
503 | kfree(n); | ||
504 | } | ||
505 | return ret; | ||
506 | } | ||
507 | |||
508 | static int slabstats_release(struct inode *inode, struct file *file) | ||
509 | { | ||
510 | struct seq_file *m = file->private_data; | ||
511 | kfree(m->private); | ||
512 | return seq_release(inode, file); | ||
513 | } | ||
514 | |||
515 | static struct file_operations proc_slabstats_operations = { | ||
516 | .open = slabstats_open, | ||
517 | .read = seq_read, | ||
518 | .llseek = seq_lseek, | ||
519 | .release = slabstats_release, | ||
520 | }; | ||
521 | #endif | ||
488 | #endif | 522 | #endif |
489 | 523 | ||
490 | static int show_stat(struct seq_file *p, void *v) | 524 | static int show_stat(struct seq_file *p, void *v) |
@@ -744,6 +778,9 @@ void __init proc_misc_init(void) | |||
744 | create_seq_entry("interrupts", 0, &proc_interrupts_operations); | 778 | create_seq_entry("interrupts", 0, &proc_interrupts_operations); |
745 | #ifdef CONFIG_SLAB | 779 | #ifdef CONFIG_SLAB |
746 | create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); | 780 | create_seq_entry("slabinfo",S_IWUSR|S_IRUGO,&proc_slabinfo_operations); |
781 | #ifdef CONFIG_DEBUG_SLAB_LEAK | ||
782 | create_seq_entry("slab_allocators", 0 ,&proc_slabstats_operations); | ||
783 | #endif | ||
747 | #endif | 784 | #endif |
748 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); | 785 | create_seq_entry("buddyinfo",S_IRUGO, &fragmentation_file_operations); |
749 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); | 786 | create_seq_entry("vmstat",S_IRUGO, &proc_vmstat_file_operations); |
diff --git a/fs/read_write.c b/fs/read_write.c index 3f7a1a62165f..34b1bf259efd 100644 --- a/fs/read_write.c +++ b/fs/read_write.c | |||
@@ -470,7 +470,7 @@ static ssize_t do_readv_writev(int type, struct file *file, | |||
470 | * verify all the pointers | 470 | * verify all the pointers |
471 | */ | 471 | */ |
472 | ret = -EINVAL; | 472 | ret = -EINVAL; |
473 | if ((nr_segs > UIO_MAXIOV) || (nr_segs <= 0)) | 473 | if (nr_segs > UIO_MAXIOV) |
474 | goto out; | 474 | goto out; |
475 | if (!file->f_op) | 475 | if (!file->f_op) |
476 | goto out; | 476 | goto out; |
diff --git a/fs/reiserfs/file.c b/fs/reiserfs/file.c index be12879bb179..d0c1e865963e 100644 --- a/fs/reiserfs/file.c +++ b/fs/reiserfs/file.c | |||
@@ -1532,7 +1532,7 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t | |||
1532 | buf += write_bytes; | 1532 | buf += write_bytes; |
1533 | *ppos = pos += write_bytes; | 1533 | *ppos = pos += write_bytes; |
1534 | count -= write_bytes; | 1534 | count -= write_bytes; |
1535 | balance_dirty_pages_ratelimited(inode->i_mapping); | 1535 | balance_dirty_pages_ratelimited_nr(inode->i_mapping, num_pages); |
1536 | } | 1536 | } |
1537 | 1537 | ||
1538 | /* this is only true on error */ | 1538 | /* this is only true on error */ |
@@ -1546,10 +1546,10 @@ static ssize_t reiserfs_file_write(struct file *file, /* the file we are going t | |||
1546 | } | 1546 | } |
1547 | } | 1547 | } |
1548 | 1548 | ||
1549 | if ((file->f_flags & O_SYNC) || IS_SYNC(inode)) | 1549 | if (likely(res >= 0) && |
1550 | res = | 1550 | (unlikely((file->f_flags & O_SYNC) || IS_SYNC(inode)))) |
1551 | generic_osync_inode(inode, file->f_mapping, | 1551 | res = generic_osync_inode(inode, file->f_mapping, |
1552 | OSYNC_METADATA | OSYNC_DATA); | 1552 | OSYNC_METADATA | OSYNC_DATA); |
1553 | 1553 | ||
1554 | mutex_unlock(&inode->i_mutex); | 1554 | mutex_unlock(&inode->i_mutex); |
1555 | reiserfs_async_progress_wait(inode->i_sb); | 1555 | reiserfs_async_progress_wait(inode->i_sb); |
diff --git a/fs/reiserfs/fix_node.c b/fs/reiserfs/fix_node.c index aa22588019ec..5600d3d60cf7 100644 --- a/fs/reiserfs/fix_node.c +++ b/fs/reiserfs/fix_node.c | |||
@@ -191,9 +191,7 @@ static void create_virtual_node(struct tree_balance *tb, int h) | |||
191 | "vs-8045: create_virtual_node: rdkey %k, affected item==%d (mode==%c) Must be %c", | 191 | "vs-8045: create_virtual_node: rdkey %k, affected item==%d (mode==%c) Must be %c", |
192 | key, vn->vn_affected_item_num, | 192 | key, vn->vn_affected_item_num, |
193 | vn->vn_mode, M_DELETE); | 193 | vn->vn_mode, M_DELETE); |
194 | } else | 194 | } |
195 | /* we can delete directory item, that has only one directory entry in it */ | ||
196 | ; | ||
197 | } | 195 | } |
198 | #endif | 196 | #endif |
199 | 197 | ||
diff --git a/fs/reiserfs/item_ops.c b/fs/reiserfs/item_ops.c index e237cd668e5b..7a88adbceef6 100644 --- a/fs/reiserfs/item_ops.c +++ b/fs/reiserfs/item_ops.c | |||
@@ -275,7 +275,7 @@ static void indirect_print_item(struct item_head *ih, char *item) | |||
275 | int j; | 275 | int j; |
276 | __le32 *unp; | 276 | __le32 *unp; |
277 | __u32 prev = INT_MAX; | 277 | __u32 prev = INT_MAX; |
278 | int num; | 278 | int num = 0; |
279 | 279 | ||
280 | unp = (__le32 *) item; | 280 | unp = (__le32 *) item; |
281 | 281 | ||
diff --git a/fs/reiserfs/journal.c b/fs/reiserfs/journal.c index 5a9d2722fa0a..1b73529b8099 100644 --- a/fs/reiserfs/journal.c +++ b/fs/reiserfs/journal.c | |||
@@ -2227,6 +2227,9 @@ static int journal_read_transaction(struct super_block *p_s_sb, | |||
2227 | journal->j_start = cur_dblock - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb); | 2227 | journal->j_start = cur_dblock - SB_ONDISK_JOURNAL_1st_BLOCK(p_s_sb); |
2228 | journal->j_last_flush_trans_id = trans_id; | 2228 | journal->j_last_flush_trans_id = trans_id; |
2229 | journal->j_trans_id = trans_id + 1; | 2229 | journal->j_trans_id = trans_id + 1; |
2230 | /* check for trans_id overflow */ | ||
2231 | if (journal->j_trans_id == 0) | ||
2232 | journal->j_trans_id = 10; | ||
2230 | brelse(c_bh); | 2233 | brelse(c_bh); |
2231 | brelse(d_bh); | 2234 | brelse(d_bh); |
2232 | kfree(log_blocks); | 2235 | kfree(log_blocks); |
@@ -2450,6 +2453,9 @@ static int journal_read(struct super_block *p_s_sb) | |||
2450 | journal->j_start = le32_to_cpu(jh->j_first_unflushed_offset); | 2453 | journal->j_start = le32_to_cpu(jh->j_first_unflushed_offset); |
2451 | journal->j_trans_id = | 2454 | journal->j_trans_id = |
2452 | le32_to_cpu(jh->j_last_flush_trans_id) + 1; | 2455 | le32_to_cpu(jh->j_last_flush_trans_id) + 1; |
2456 | /* check for trans_id overflow */ | ||
2457 | if (journal->j_trans_id == 0) | ||
2458 | journal->j_trans_id = 10; | ||
2453 | journal->j_last_flush_trans_id = | 2459 | journal->j_last_flush_trans_id = |
2454 | le32_to_cpu(jh->j_last_flush_trans_id); | 2460 | le32_to_cpu(jh->j_last_flush_trans_id); |
2455 | journal->j_mount_id = le32_to_cpu(jh->j_mount_id) + 1; | 2461 | journal->j_mount_id = le32_to_cpu(jh->j_mount_id) + 1; |
@@ -3873,8 +3879,8 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
3873 | int cur_write_start = 0; /* start index of current log write */ | 3879 | int cur_write_start = 0; /* start index of current log write */ |
3874 | int old_start; | 3880 | int old_start; |
3875 | int i; | 3881 | int i; |
3876 | int flush = flags & FLUSH_ALL; | 3882 | int flush; |
3877 | int wait_on_commit = flags & WAIT; | 3883 | int wait_on_commit; |
3878 | struct reiserfs_journal_list *jl, *temp_jl; | 3884 | struct reiserfs_journal_list *jl, *temp_jl; |
3879 | struct list_head *entry, *safe; | 3885 | struct list_head *entry, *safe; |
3880 | unsigned long jindex; | 3886 | unsigned long jindex; |
@@ -3884,6 +3890,13 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
3884 | BUG_ON(th->t_refcount > 1); | 3890 | BUG_ON(th->t_refcount > 1); |
3885 | BUG_ON(!th->t_trans_id); | 3891 | BUG_ON(!th->t_trans_id); |
3886 | 3892 | ||
3893 | /* protect flush_older_commits from doing mistakes if the | ||
3894 | transaction ID counter gets overflowed. */ | ||
3895 | if (th->t_trans_id == ~0UL) | ||
3896 | flags |= FLUSH_ALL | COMMIT_NOW | WAIT; | ||
3897 | flush = flags & FLUSH_ALL; | ||
3898 | wait_on_commit = flags & WAIT; | ||
3899 | |||
3887 | put_fs_excl(); | 3900 | put_fs_excl(); |
3888 | current->journal_info = th->t_handle_save; | 3901 | current->journal_info = th->t_handle_save; |
3889 | reiserfs_check_lock_depth(p_s_sb, "journal end"); | 3902 | reiserfs_check_lock_depth(p_s_sb, "journal end"); |
@@ -4105,7 +4118,9 @@ static int do_journal_end(struct reiserfs_transaction_handle *th, | |||
4105 | journal->j_first = NULL; | 4118 | journal->j_first = NULL; |
4106 | journal->j_len = 0; | 4119 | journal->j_len = 0; |
4107 | journal->j_trans_start_time = 0; | 4120 | journal->j_trans_start_time = 0; |
4108 | journal->j_trans_id++; | 4121 | /* check for trans_id overflow */ |
4122 | if (++journal->j_trans_id == 0) | ||
4123 | journal->j_trans_id = 10; | ||
4109 | journal->j_current_jl->j_trans_id = journal->j_trans_id; | 4124 | journal->j_current_jl->j_trans_id = journal->j_trans_id; |
4110 | journal->j_must_wait = 0; | 4125 | journal->j_must_wait = 0; |
4111 | journal->j_len_alloc = 0; | 4126 | journal->j_len_alloc = 0; |
diff --git a/fs/reiserfs/stree.c b/fs/reiserfs/stree.c index e2d08d7bcffc..d2b25e1ba6e9 100644 --- a/fs/reiserfs/stree.c +++ b/fs/reiserfs/stree.c | |||
@@ -981,6 +981,8 @@ static inline int prepare_for_direntry_item(struct path *path, | |||
981 | return M_CUT; | 981 | return M_CUT; |
982 | } | 982 | } |
983 | 983 | ||
984 | #define JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD (2 * JOURNAL_PER_BALANCE_CNT + 1) | ||
985 | |||
984 | /* If the path points to a directory or direct item, calculate mode and the size cut, for balance. | 986 | /* If the path points to a directory or direct item, calculate mode and the size cut, for balance. |
985 | If the path points to an indirect item, remove some number of its unformatted nodes. | 987 | If the path points to an indirect item, remove some number of its unformatted nodes. |
986 | In case of file truncate calculate whether this item must be deleted/truncated or last | 988 | In case of file truncate calculate whether this item must be deleted/truncated or last |
@@ -1020,148 +1022,79 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st | |||
1020 | 1022 | ||
1021 | /* Case of an indirect item. */ | 1023 | /* Case of an indirect item. */ |
1022 | { | 1024 | { |
1023 | int n_unfm_number, /* Number of the item unformatted nodes. */ | 1025 | int blk_size = p_s_sb->s_blocksize; |
1024 | n_counter, n_blk_size; | 1026 | struct item_head s_ih; |
1025 | __le32 *p_n_unfm_pointer; /* Pointer to the unformatted node number. */ | 1027 | int need_re_search; |
1026 | __u32 tmp; | 1028 | int delete = 0; |
1027 | struct item_head s_ih; /* Item header. */ | 1029 | int result = M_CUT; |
1028 | char c_mode; /* Returned mode of the balance. */ | 1030 | int pos = 0; |
1029 | int need_research; | 1031 | |
1030 | 1032 | if ( n_new_file_length == max_reiserfs_offset (inode) ) { | |
1031 | n_blk_size = p_s_sb->s_blocksize; | 1033 | /* prepare_for_delete_or_cut() is called by |
1032 | 1034 | * reiserfs_delete_item() */ | |
1033 | /* Search for the needed object indirect item until there are no unformatted nodes to be removed. */ | 1035 | n_new_file_length = 0; |
1034 | do { | 1036 | delete = 1; |
1035 | need_research = 0; | 1037 | } |
1036 | p_s_bh = PATH_PLAST_BUFFER(p_s_path); | 1038 | |
1037 | /* Copy indirect item header to a temp variable. */ | 1039 | do { |
1038 | copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); | 1040 | need_re_search = 0; |
1039 | /* Calculate number of unformatted nodes in this item. */ | 1041 | *p_n_cut_size = 0; |
1040 | n_unfm_number = I_UNFM_NUM(&s_ih); | 1042 | p_s_bh = PATH_PLAST_BUFFER(p_s_path); |
1041 | 1043 | copy_item_head(&s_ih, PATH_PITEM_HEAD(p_s_path)); | |
1042 | RFALSE(!is_indirect_le_ih(&s_ih) || !n_unfm_number || | 1044 | pos = I_UNFM_NUM(&s_ih); |
1043 | pos_in_item(p_s_path) + 1 != n_unfm_number, | ||
1044 | "PAP-5240: invalid item %h " | ||
1045 | "n_unfm_number = %d *p_n_pos_in_item = %d", | ||
1046 | &s_ih, n_unfm_number, pos_in_item(p_s_path)); | ||
1047 | |||
1048 | /* Calculate balance mode and position in the item to remove unformatted nodes. */ | ||
1049 | if (n_new_file_length == max_reiserfs_offset(inode)) { /* Case of delete. */ | ||
1050 | pos_in_item(p_s_path) = 0; | ||
1051 | *p_n_cut_size = -(IH_SIZE + ih_item_len(&s_ih)); | ||
1052 | c_mode = M_DELETE; | ||
1053 | } else { /* Case of truncate. */ | ||
1054 | if (n_new_file_length < le_ih_k_offset(&s_ih)) { | ||
1055 | pos_in_item(p_s_path) = 0; | ||
1056 | *p_n_cut_size = | ||
1057 | -(IH_SIZE + ih_item_len(&s_ih)); | ||
1058 | c_mode = M_DELETE; /* Delete this item. */ | ||
1059 | } else { | ||
1060 | /* indirect item must be truncated starting from *p_n_pos_in_item-th position */ | ||
1061 | pos_in_item(p_s_path) = | ||
1062 | (n_new_file_length + n_blk_size - | ||
1063 | le_ih_k_offset(&s_ih)) >> p_s_sb-> | ||
1064 | s_blocksize_bits; | ||
1065 | |||
1066 | RFALSE(pos_in_item(p_s_path) > | ||
1067 | n_unfm_number, | ||
1068 | "PAP-5250: invalid position in the item"); | ||
1069 | |||
1070 | /* Either convert last unformatted node of indirect item to direct item or increase | ||
1071 | its free space. */ | ||
1072 | if (pos_in_item(p_s_path) == | ||
1073 | n_unfm_number) { | ||
1074 | *p_n_cut_size = 0; /* Nothing to cut. */ | ||
1075 | return M_CONVERT; /* Maybe convert last unformatted node to the direct item. */ | ||
1076 | } | ||
1077 | /* Calculate size to cut. */ | ||
1078 | *p_n_cut_size = | ||
1079 | -(ih_item_len(&s_ih) - | ||
1080 | pos_in_item(p_s_path) * | ||
1081 | UNFM_P_SIZE); | ||
1082 | |||
1083 | c_mode = M_CUT; /* Cut from this indirect item. */ | ||
1084 | } | ||
1085 | } | ||
1086 | 1045 | ||
1087 | RFALSE(n_unfm_number <= pos_in_item(p_s_path), | 1046 | while (le_ih_k_offset (&s_ih) + (pos - 1) * blk_size > n_new_file_length) { |
1088 | "PAP-5260: invalid position in the indirect item"); | 1047 | __u32 *unfm, block; |
1089 | |||
1090 | /* pointers to be cut */ | ||
1091 | n_unfm_number -= pos_in_item(p_s_path); | ||
1092 | /* Set pointer to the last unformatted node pointer that is to be cut. */ | ||
1093 | p_n_unfm_pointer = | ||
1094 | (__le32 *) B_I_PITEM(p_s_bh, | ||
1095 | &s_ih) + I_UNFM_NUM(&s_ih) - | ||
1096 | 1 - *p_n_removed; | ||
1097 | |||
1098 | /* We go through the unformatted nodes pointers of the indirect | ||
1099 | item and look for the unformatted nodes in the cache. If we | ||
1100 | found some of them we free it, zero corresponding indirect item | ||
1101 | entry and log buffer containing that indirect item. For this we | ||
1102 | need to prepare last path element for logging. If some | ||
1103 | unformatted node has b_count > 1 we must not free this | ||
1104 | unformatted node since it is in use. */ | ||
1105 | reiserfs_prepare_for_journal(p_s_sb, p_s_bh, 1); | ||
1106 | // note: path could be changed, first line in for loop takes care | ||
1107 | // of it | ||
1108 | 1048 | ||
1109 | for (n_counter = *p_n_removed; | 1049 | /* Each unformatted block deletion may involve one additional |
1110 | n_counter < n_unfm_number; | 1050 | * bitmap block into the transaction, thereby the initial |
1111 | n_counter++, p_n_unfm_pointer--) { | 1051 | * journal space reservation might not be enough. */ |
1052 | if (!delete && (*p_n_cut_size) != 0 && | ||
1053 | reiserfs_transaction_free_space(th) < JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD) { | ||
1054 | break; | ||
1055 | } | ||
1112 | 1056 | ||
1113 | cond_resched(); | 1057 | unfm = (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + pos - 1; |
1114 | if (item_moved(&s_ih, p_s_path)) { | 1058 | block = get_block_num(unfm, 0); |
1115 | need_research = 1; | ||
1116 | break; | ||
1117 | } | ||
1118 | RFALSE(p_n_unfm_pointer < | ||
1119 | (__le32 *) B_I_PITEM(p_s_bh, &s_ih) | ||
1120 | || p_n_unfm_pointer > | ||
1121 | (__le32 *) B_I_PITEM(p_s_bh, | ||
1122 | &s_ih) + | ||
1123 | I_UNFM_NUM(&s_ih) - 1, | ||
1124 | "vs-5265: pointer out of range"); | ||
1125 | |||
1126 | /* Hole, nothing to remove. */ | ||
1127 | if (!get_block_num(p_n_unfm_pointer, 0)) { | ||
1128 | (*p_n_removed)++; | ||
1129 | continue; | ||
1130 | } | ||
1131 | 1059 | ||
1132 | (*p_n_removed)++; | 1060 | if (block != 0) { |
1061 | reiserfs_prepare_for_journal(p_s_sb, p_s_bh, 1); | ||
1062 | put_block_num(unfm, 0, 0); | ||
1063 | journal_mark_dirty (th, p_s_sb, p_s_bh); | ||
1064 | reiserfs_free_block(th, inode, block, 1); | ||
1065 | } | ||
1133 | 1066 | ||
1134 | tmp = get_block_num(p_n_unfm_pointer, 0); | 1067 | cond_resched(); |
1135 | put_block_num(p_n_unfm_pointer, 0, 0); | ||
1136 | journal_mark_dirty(th, p_s_sb, p_s_bh); | ||
1137 | reiserfs_free_block(th, inode, tmp, 1); | ||
1138 | if (item_moved(&s_ih, p_s_path)) { | ||
1139 | need_research = 1; | ||
1140 | break; | ||
1141 | } | ||
1142 | } | ||
1143 | 1068 | ||
1144 | /* a trick. If the buffer has been logged, this | 1069 | if (item_moved (&s_ih, p_s_path)) { |
1145 | ** will do nothing. If we've broken the loop without | 1070 | need_re_search = 1; |
1146 | ** logging it, it will restore the buffer | 1071 | break; |
1147 | ** | 1072 | } |
1148 | */ | 1073 | |
1149 | reiserfs_restore_prepared_buffer(p_s_sb, p_s_bh); | 1074 | pos --; |
1150 | 1075 | (*p_n_removed) ++; | |
1151 | /* This loop can be optimized. */ | 1076 | (*p_n_cut_size) -= UNFM_P_SIZE; |
1152 | } while ((*p_n_removed < n_unfm_number || need_research) && | 1077 | |
1153 | search_for_position_by_key(p_s_sb, p_s_item_key, | 1078 | if (pos == 0) { |
1154 | p_s_path) == | 1079 | (*p_n_cut_size) -= IH_SIZE; |
1155 | POSITION_FOUND); | 1080 | result = M_DELETE; |
1156 | 1081 | break; | |
1157 | RFALSE(*p_n_removed < n_unfm_number, | 1082 | } |
1158 | "PAP-5310: indirect item is not found"); | 1083 | } |
1159 | RFALSE(item_moved(&s_ih, p_s_path), | 1084 | /* a trick. If the buffer has been logged, this will do nothing. If |
1160 | "after while, comp failed, retry"); | 1085 | ** we've broken the loop without logging it, it will restore the |
1161 | 1086 | ** buffer */ | |
1162 | if (c_mode == M_CUT) | 1087 | reiserfs_restore_prepared_buffer(p_s_sb, p_s_bh); |
1163 | pos_in_item(p_s_path) *= UNFM_P_SIZE; | 1088 | } while (need_re_search && |
1164 | return c_mode; | 1089 | search_for_position_by_key(p_s_sb, p_s_item_key, p_s_path) == POSITION_FOUND); |
1090 | pos_in_item(p_s_path) = pos * UNFM_P_SIZE; | ||
1091 | |||
1092 | if (*p_n_cut_size == 0) { | ||
1093 | /* Nothing were cut. maybe convert last unformatted node to the | ||
1094 | * direct item? */ | ||
1095 | result = M_CONVERT; | ||
1096 | } | ||
1097 | return result; | ||
1165 | } | 1098 | } |
1166 | } | 1099 | } |
1167 | 1100 | ||
@@ -1948,7 +1881,8 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p | |||
1948 | ** sure the file is consistent before ending the current trans | 1881 | ** sure the file is consistent before ending the current trans |
1949 | ** and starting a new one | 1882 | ** and starting a new one |
1950 | */ | 1883 | */ |
1951 | if (journal_transaction_should_end(th, th->t_blocks_allocated)) { | 1884 | if (journal_transaction_should_end(th, 0) || |
1885 | reiserfs_transaction_free_space(th) <= JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD) { | ||
1952 | int orig_len_alloc = th->t_blocks_allocated; | 1886 | int orig_len_alloc = th->t_blocks_allocated; |
1953 | decrement_counters_in_path(&s_search_path); | 1887 | decrement_counters_in_path(&s_search_path); |
1954 | 1888 | ||
@@ -1962,7 +1896,7 @@ int reiserfs_do_truncate(struct reiserfs_transaction_handle *th, struct inode *p | |||
1962 | if (err) | 1896 | if (err) |
1963 | goto out; | 1897 | goto out; |
1964 | err = journal_begin(th, p_s_inode->i_sb, | 1898 | err = journal_begin(th, p_s_inode->i_sb, |
1965 | JOURNAL_PER_BALANCE_CNT * 6); | 1899 | JOURNAL_FOR_FREE_BLOCK_AND_UPDATE_SD + JOURNAL_PER_BALANCE_CNT * 4) ; |
1966 | if (err) | 1900 | if (err) |
1967 | goto out; | 1901 | goto out; |
1968 | reiserfs_update_inode_transaction(p_s_inode); | 1902 | reiserfs_update_inode_transaction(p_s_inode); |
diff --git a/fs/reiserfs/super.c b/fs/reiserfs/super.c index 93e6ef9360e3..cae2abbc0c71 100644 --- a/fs/reiserfs/super.c +++ b/fs/reiserfs/super.c | |||
@@ -685,14 +685,14 @@ static const arg_desc_t logging_mode[] = { | |||
685 | (1 << REISERFS_DATA_ORDERED | 1 << REISERFS_DATA_WRITEBACK)}, | 685 | (1 << REISERFS_DATA_ORDERED | 1 << REISERFS_DATA_WRITEBACK)}, |
686 | {"writeback", 1 << REISERFS_DATA_WRITEBACK, | 686 | {"writeback", 1 << REISERFS_DATA_WRITEBACK, |
687 | (1 << REISERFS_DATA_ORDERED | 1 << REISERFS_DATA_LOG)}, | 687 | (1 << REISERFS_DATA_ORDERED | 1 << REISERFS_DATA_LOG)}, |
688 | {NULL, 0} | 688 | {.value = NULL} |
689 | }; | 689 | }; |
690 | 690 | ||
691 | /* possible values for -o barrier= */ | 691 | /* possible values for -o barrier= */ |
692 | static const arg_desc_t barrier_mode[] = { | 692 | static const arg_desc_t barrier_mode[] = { |
693 | {"none", 1 << REISERFS_BARRIER_NONE, 1 << REISERFS_BARRIER_FLUSH}, | 693 | {"none", 1 << REISERFS_BARRIER_NONE, 1 << REISERFS_BARRIER_FLUSH}, |
694 | {"flush", 1 << REISERFS_BARRIER_FLUSH, 1 << REISERFS_BARRIER_NONE}, | 694 | {"flush", 1 << REISERFS_BARRIER_FLUSH, 1 << REISERFS_BARRIER_NONE}, |
695 | {NULL, 0} | 695 | {.value = NULL} |
696 | }; | 696 | }; |
697 | 697 | ||
698 | /* possible values for "-o block-allocator=" and bits which are to be set in | 698 | /* possible values for "-o block-allocator=" and bits which are to be set in |
@@ -890,7 +890,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin | |||
890 | {"acl",.setmask = 1 << REISERFS_UNSUPPORTED_OPT}, | 890 | {"acl",.setmask = 1 << REISERFS_UNSUPPORTED_OPT}, |
891 | {"noacl",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT}, | 891 | {"noacl",.clrmask = 1 << REISERFS_UNSUPPORTED_OPT}, |
892 | #endif | 892 | #endif |
893 | {"nolog",}, /* This is unsupported */ | 893 | {.option_name = "nolog"}, |
894 | {"replayonly",.setmask = 1 << REPLAYONLY}, | 894 | {"replayonly",.setmask = 1 << REPLAYONLY}, |
895 | {"block-allocator",.arg_required = 'a',.values = balloc}, | 895 | {"block-allocator",.arg_required = 'a',.values = balloc}, |
896 | {"data",.arg_required = 'd',.values = logging_mode}, | 896 | {"data",.arg_required = 'd',.values = logging_mode}, |
@@ -908,7 +908,7 @@ static int reiserfs_parse_options(struct super_block *s, char *options, /* strin | |||
908 | {"grpjquota",.arg_required = | 908 | {"grpjquota",.arg_required = |
909 | 'g' | (1 << REISERFS_OPT_ALLOWEMPTY),.values = NULL}, | 909 | 'g' | (1 << REISERFS_OPT_ALLOWEMPTY),.values = NULL}, |
910 | {"jqfmt",.arg_required = 'f',.values = NULL}, | 910 | {"jqfmt",.arg_required = 'f',.values = NULL}, |
911 | {NULL,} | 911 | {.option_name = NULL} |
912 | }; | 912 | }; |
913 | 913 | ||
914 | *blocks = 0; | 914 | *blocks = 0; |
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index ab8894c3b9e5..58c418fbca2c 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -182,7 +182,7 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type) | |||
182 | { | 182 | { |
183 | char *name, *value; | 183 | char *name, *value; |
184 | struct posix_acl *acl, **p_acl; | 184 | struct posix_acl *acl, **p_acl; |
185 | size_t size; | 185 | int size; |
186 | int retval; | 186 | int retval; |
187 | struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode); | 187 | struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode); |
188 | 188 | ||
@@ -206,7 +206,7 @@ struct posix_acl *reiserfs_get_acl(struct inode *inode, int type) | |||
206 | return posix_acl_dup(*p_acl); | 206 | return posix_acl_dup(*p_acl); |
207 | 207 | ||
208 | size = reiserfs_xattr_get(inode, name, NULL, 0); | 208 | size = reiserfs_xattr_get(inode, name, NULL, 0); |
209 | if ((int)size < 0) { | 209 | if (size < 0) { |
210 | if (size == -ENODATA || size == -ENOSYS) { | 210 | if (size == -ENODATA || size == -ENOSYS) { |
211 | *p_acl = ERR_PTR(-ENODATA); | 211 | *p_acl = ERR_PTR(-ENODATA); |
212 | return NULL; | 212 | return NULL; |
diff --git a/fs/smbfs/inode.c b/fs/smbfs/inode.c index 44ed1d418b46..fdeabc0a34f7 100644 --- a/fs/smbfs/inode.c +++ b/fs/smbfs/inode.c | |||
@@ -217,7 +217,7 @@ smb_set_inode_attr(struct inode *inode, struct smb_fattr *fattr) | |||
217 | if (inode->i_mtime.tv_sec != last_time || inode->i_size != last_sz) { | 217 | if (inode->i_mtime.tv_sec != last_time || inode->i_size != last_sz) { |
218 | VERBOSE("%ld changed, old=%ld, new=%ld, oz=%ld, nz=%ld\n", | 218 | VERBOSE("%ld changed, old=%ld, new=%ld, oz=%ld, nz=%ld\n", |
219 | inode->i_ino, | 219 | inode->i_ino, |
220 | (long) last_time, (long) inode->i_mtime, | 220 | (long) last_time, (long) inode->i_mtime.tv_sec, |
221 | (long) last_sz, (long) inode->i_size); | 221 | (long) last_sz, (long) inode->i_size); |
222 | 222 | ||
223 | if (!S_ISDIR(inode->i_mode)) | 223 | if (!S_ISDIR(inode->i_mode)) |
diff --git a/fs/super.c b/fs/super.c index 37554b876182..8743e9bbb297 100644 --- a/fs/super.c +++ b/fs/super.c | |||
@@ -55,11 +55,10 @@ DEFINE_SPINLOCK(sb_lock); | |||
55 | */ | 55 | */ |
56 | static struct super_block *alloc_super(void) | 56 | static struct super_block *alloc_super(void) |
57 | { | 57 | { |
58 | struct super_block *s = kmalloc(sizeof(struct super_block), GFP_USER); | 58 | struct super_block *s = kzalloc(sizeof(struct super_block), GFP_USER); |
59 | static struct super_operations default_op; | 59 | static struct super_operations default_op; |
60 | 60 | ||
61 | if (s) { | 61 | if (s) { |
62 | memset(s, 0, sizeof(struct super_block)); | ||
63 | if (security_sb_alloc(s)) { | 62 | if (security_sb_alloc(s)) { |
64 | kfree(s); | 63 | kfree(s); |
65 | s = NULL; | 64 | s = NULL; |
diff --git a/fs/udf/inode.c b/fs/udf/inode.c index d04cff2273b6..81e0e8459af1 100644 --- a/fs/udf/inode.c +++ b/fs/udf/inode.c | |||
@@ -1341,13 +1341,11 @@ udf_update_inode(struct inode *inode, int do_sync) | |||
1341 | 1341 | ||
1342 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET)) | 1342 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_FORGET)) |
1343 | fe->uid = cpu_to_le32(-1); | 1343 | fe->uid = cpu_to_le32(-1); |
1344 | else if (inode->i_uid != UDF_SB(inode->i_sb)->s_uid) | 1344 | else fe->uid = cpu_to_le32(inode->i_uid); |
1345 | fe->uid = cpu_to_le32(inode->i_uid); | ||
1346 | 1345 | ||
1347 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET)) | 1346 | if (UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_FORGET)) |
1348 | fe->gid = cpu_to_le32(-1); | 1347 | fe->gid = cpu_to_le32(-1); |
1349 | else if (inode->i_gid != UDF_SB(inode->i_sb)->s_gid) | 1348 | else fe->gid = cpu_to_le32(inode->i_gid); |
1350 | fe->gid = cpu_to_le32(inode->i_gid); | ||
1351 | 1349 | ||
1352 | udfperms = ((inode->i_mode & S_IRWXO) ) | | 1350 | udfperms = ((inode->i_mode & S_IRWXO) ) | |
1353 | ((inode->i_mode & S_IRWXG) << 2) | | 1351 | ((inode->i_mode & S_IRWXG) << 2) | |
diff --git a/include/asm-alpha/poll.h b/include/asm-alpha/poll.h index 34f333b762a0..95707182b3ed 100644 --- a/include/asm-alpha/poll.h +++ b/include/asm-alpha/poll.h | |||
@@ -13,6 +13,8 @@ | |||
13 | #define POLLWRBAND (1 << 9) | 13 | #define POLLWRBAND (1 << 9) |
14 | #define POLLMSG (1 << 10) | 14 | #define POLLMSG (1 << 10) |
15 | #define POLLREMOVE (1 << 11) | 15 | #define POLLREMOVE (1 << 11) |
16 | #define POLLRDHUP (1 << 12) | ||
17 | |||
16 | 18 | ||
17 | struct pollfd { | 19 | struct pollfd { |
18 | int fd; | 20 | int fd; |
diff --git a/include/asm-arm/poll.h b/include/asm-arm/poll.h index 2744ca831f5d..5030b2b232a3 100644 --- a/include/asm-arm/poll.h +++ b/include/asm-arm/poll.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define POLLWRBAND 0x0200 | 16 | #define POLLWRBAND 0x0200 |
17 | #define POLLMSG 0x0400 | 17 | #define POLLMSG 0x0400 |
18 | #define POLLREMOVE 0x1000 | 18 | #define POLLREMOVE 0x1000 |
19 | #define POLLRDHUP 0x2000 | ||
19 | 20 | ||
20 | struct pollfd { | 21 | struct pollfd { |
21 | int fd; | 22 | int fd; |
diff --git a/include/asm-arm26/poll.h b/include/asm-arm26/poll.h index fdfdab064a65..9ccb7f4190ca 100644 --- a/include/asm-arm26/poll.h +++ b/include/asm-arm26/poll.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #define POLLWRNORM 0x0100 | 15 | #define POLLWRNORM 0x0100 |
16 | #define POLLWRBAND 0x0200 | 16 | #define POLLWRBAND 0x0200 |
17 | #define POLLMSG 0x0400 | 17 | #define POLLMSG 0x0400 |
18 | #define POLLRDHUP 0x2000 | ||
18 | 19 | ||
19 | struct pollfd { | 20 | struct pollfd { |
20 | int fd; | 21 | int fd; |
diff --git a/include/asm-cris/poll.h b/include/asm-cris/poll.h index 1c0efc3e4be7..1b25d4cf498c 100644 --- a/include/asm-cris/poll.h +++ b/include/asm-cris/poll.h | |||
@@ -15,6 +15,7 @@ | |||
15 | #define POLLWRBAND 512 | 15 | #define POLLWRBAND 512 |
16 | #define POLLMSG 1024 | 16 | #define POLLMSG 1024 |
17 | #define POLLREMOVE 4096 | 17 | #define POLLREMOVE 4096 |
18 | #define POLLRDHUP 8192 | ||
18 | 19 | ||
19 | struct pollfd { | 20 | struct pollfd { |
20 | int fd; | 21 | int fd; |
diff --git a/include/asm-frv/poll.h b/include/asm-frv/poll.h index 8cbcd60e334f..c8fe8801d075 100644 --- a/include/asm-frv/poll.h +++ b/include/asm-frv/poll.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #define POLLRDBAND 128 | 12 | #define POLLRDBAND 128 |
13 | #define POLLWRBAND 256 | 13 | #define POLLWRBAND 256 |
14 | #define POLLMSG 0x0400 | 14 | #define POLLMSG 0x0400 |
15 | #define POLLRDHUP 0x2000 | ||
15 | 16 | ||
16 | struct pollfd { | 17 | struct pollfd { |
17 | int fd; | 18 | int fd; |
diff --git a/include/asm-h8300/poll.h b/include/asm-h8300/poll.h index bf49ab8ad6da..fc52103b276a 100644 --- a/include/asm-h8300/poll.h +++ b/include/asm-h8300/poll.h | |||
@@ -12,6 +12,7 @@ | |||
12 | #define POLLRDBAND 128 | 12 | #define POLLRDBAND 128 |
13 | #define POLLWRBAND 256 | 13 | #define POLLWRBAND 256 |
14 | #define POLLMSG 0x0400 | 14 | #define POLLMSG 0x0400 |
15 | #define POLLRDHUP 0x2000 | ||
15 | 16 | ||
16 | struct pollfd { | 17 | struct pollfd { |
17 | int fd; | 18 | int fd; |
diff --git a/include/asm-i386/poll.h b/include/asm-i386/poll.h index aecc80a15d36..2cd4929abd40 100644 --- a/include/asm-i386/poll.h +++ b/include/asm-i386/poll.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define POLLWRBAND 0x0200 | 16 | #define POLLWRBAND 0x0200 |
17 | #define POLLMSG 0x0400 | 17 | #define POLLMSG 0x0400 |
18 | #define POLLREMOVE 0x1000 | 18 | #define POLLREMOVE 0x1000 |
19 | #define POLLRDHUP 0x2000 | ||
19 | 20 | ||
20 | struct pollfd { | 21 | struct pollfd { |
21 | int fd; | 22 | int fd; |
diff --git a/include/asm-ia64/poll.h b/include/asm-ia64/poll.h index 160258a0528d..bcaf9f140242 100644 --- a/include/asm-ia64/poll.h +++ b/include/asm-ia64/poll.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define POLLWRBAND 0x0200 | 21 | #define POLLWRBAND 0x0200 |
22 | #define POLLMSG 0x0400 | 22 | #define POLLMSG 0x0400 |
23 | #define POLLREMOVE 0x1000 | 23 | #define POLLREMOVE 0x1000 |
24 | #define POLLRDHUP 0x2000 | ||
24 | 25 | ||
25 | struct pollfd { | 26 | struct pollfd { |
26 | int fd; | 27 | int fd; |
diff --git a/include/asm-m32r/poll.h b/include/asm-m32r/poll.h index 43b7acf732d5..9e0e700e727c 100644 --- a/include/asm-m32r/poll.h +++ b/include/asm-m32r/poll.h | |||
@@ -21,6 +21,7 @@ | |||
21 | #define POLLWRBAND 0x0200 | 21 | #define POLLWRBAND 0x0200 |
22 | #define POLLMSG 0x0400 | 22 | #define POLLMSG 0x0400 |
23 | #define POLLREMOVE 0x1000 | 23 | #define POLLREMOVE 0x1000 |
24 | #define POLLRDHUP 0x2000 | ||
24 | 25 | ||
25 | struct pollfd { | 26 | struct pollfd { |
26 | int fd; | 27 | int fd; |
diff --git a/include/asm-m68k/poll.h b/include/asm-m68k/poll.h index c4b69c4a87e1..0fb8843647f8 100644 --- a/include/asm-m68k/poll.h +++ b/include/asm-m68k/poll.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define POLLWRBAND 256 | 13 | #define POLLWRBAND 256 |
14 | #define POLLMSG 0x0400 | 14 | #define POLLMSG 0x0400 |
15 | #define POLLREMOVE 0x1000 | 15 | #define POLLREMOVE 0x1000 |
16 | #define POLLRDHUP 0x2000 | ||
16 | 17 | ||
17 | struct pollfd { | 18 | struct pollfd { |
18 | int fd; | 19 | int fd; |
diff --git a/include/asm-mips/poll.h b/include/asm-mips/poll.h index a000f1f789e3..70881f8c5c50 100644 --- a/include/asm-mips/poll.h +++ b/include/asm-mips/poll.h | |||
@@ -17,6 +17,7 @@ | |||
17 | /* These seem to be more or less nonstandard ... */ | 17 | /* These seem to be more or less nonstandard ... */ |
18 | #define POLLMSG 0x0400 | 18 | #define POLLMSG 0x0400 |
19 | #define POLLREMOVE 0x1000 | 19 | #define POLLREMOVE 0x1000 |
20 | #define POLLRDHUP 0x2000 | ||
20 | 21 | ||
21 | struct pollfd { | 22 | struct pollfd { |
22 | int fd; | 23 | int fd; |
diff --git a/include/asm-parisc/poll.h b/include/asm-parisc/poll.h index 1c1da86934cf..20e4d03c74cb 100644 --- a/include/asm-parisc/poll.h +++ b/include/asm-parisc/poll.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define POLLWRBAND 0x0200 | 16 | #define POLLWRBAND 0x0200 |
17 | #define POLLMSG 0x0400 | 17 | #define POLLMSG 0x0400 |
18 | #define POLLREMOVE 0x1000 | 18 | #define POLLREMOVE 0x1000 |
19 | #define POLLRDHUP 0x2000 | ||
19 | 20 | ||
20 | struct pollfd { | 21 | struct pollfd { |
21 | int fd; | 22 | int fd; |
diff --git a/include/asm-powerpc/poll.h b/include/asm-powerpc/poll.h index edd2054da86b..9c7d12631033 100644 --- a/include/asm-powerpc/poll.h +++ b/include/asm-powerpc/poll.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define POLLWRBAND 0x0200 | 13 | #define POLLWRBAND 0x0200 |
14 | #define POLLMSG 0x0400 | 14 | #define POLLMSG 0x0400 |
15 | #define POLLREMOVE 0x1000 | 15 | #define POLLREMOVE 0x1000 |
16 | #define POLLRDHUP 0x2000 | ||
16 | 17 | ||
17 | struct pollfd { | 18 | struct pollfd { |
18 | int fd; | 19 | int fd; |
diff --git a/include/asm-s390/poll.h b/include/asm-s390/poll.h index e90a5ca42061..6f7f65ac7d27 100644 --- a/include/asm-s390/poll.h +++ b/include/asm-s390/poll.h | |||
@@ -24,6 +24,7 @@ | |||
24 | #define POLLWRBAND 0x0200 | 24 | #define POLLWRBAND 0x0200 |
25 | #define POLLMSG 0x0400 | 25 | #define POLLMSG 0x0400 |
26 | #define POLLREMOVE 0x1000 | 26 | #define POLLREMOVE 0x1000 |
27 | #define POLLRDHUP 0x2000 | ||
27 | 28 | ||
28 | struct pollfd { | 29 | struct pollfd { |
29 | int fd; | 30 | int fd; |
diff --git a/include/asm-sh/poll.h b/include/asm-sh/poll.h index 52f95b9188dc..dbca9b32f4a6 100644 --- a/include/asm-sh/poll.h +++ b/include/asm-sh/poll.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define POLLWRBAND 0x0200 | 16 | #define POLLWRBAND 0x0200 |
17 | #define POLLMSG 0x0400 | 17 | #define POLLMSG 0x0400 |
18 | #define POLLREMOVE 0x1000 | 18 | #define POLLREMOVE 0x1000 |
19 | #define POLLRDHUP 0x2000 | ||
19 | 20 | ||
20 | struct pollfd { | 21 | struct pollfd { |
21 | int fd; | 22 | int fd; |
diff --git a/include/asm-sh64/poll.h b/include/asm-sh64/poll.h index a420d14eb704..3a6cbad08d28 100644 --- a/include/asm-sh64/poll.h +++ b/include/asm-sh64/poll.h | |||
@@ -26,6 +26,7 @@ | |||
26 | #define POLLWRNORM 0x0100 | 26 | #define POLLWRNORM 0x0100 |
27 | #define POLLWRBAND 0x0200 | 27 | #define POLLWRBAND 0x0200 |
28 | #define POLLMSG 0x0400 | 28 | #define POLLMSG 0x0400 |
29 | #define POLLRDHUP 0x2000 | ||
29 | 30 | ||
30 | struct pollfd { | 31 | struct pollfd { |
31 | int fd; | 32 | int fd; |
diff --git a/include/asm-sparc/poll.h b/include/asm-sparc/poll.h index 3ddcc6481f09..26f13fb35497 100644 --- a/include/asm-sparc/poll.h +++ b/include/asm-sparc/poll.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define POLLWRBAND 256 | 13 | #define POLLWRBAND 256 |
14 | #define POLLMSG 512 | 14 | #define POLLMSG 512 |
15 | #define POLLREMOVE 1024 | 15 | #define POLLREMOVE 1024 |
16 | #define POLLRDHUP 2048 | ||
16 | 17 | ||
17 | struct pollfd { | 18 | struct pollfd { |
18 | int fd; | 19 | int fd; |
diff --git a/include/asm-sparc64/poll.h b/include/asm-sparc64/poll.h index 31b611aa7468..ab6b0d1bb4ad 100644 --- a/include/asm-sparc64/poll.h +++ b/include/asm-sparc64/poll.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define POLLWRBAND 256 | 13 | #define POLLWRBAND 256 |
14 | #define POLLMSG 512 | 14 | #define POLLMSG 512 |
15 | #define POLLREMOVE 1024 | 15 | #define POLLREMOVE 1024 |
16 | #define POLLRDHUP 2048 | ||
16 | 17 | ||
17 | struct pollfd { | 18 | struct pollfd { |
18 | int fd; | 19 | int fd; |
diff --git a/include/asm-v850/poll.h b/include/asm-v850/poll.h index 0369562c7e15..c10176c2c28f 100644 --- a/include/asm-v850/poll.h +++ b/include/asm-v850/poll.h | |||
@@ -13,6 +13,7 @@ | |||
13 | #define POLLWRBAND 0x0100 | 13 | #define POLLWRBAND 0x0100 |
14 | #define POLLMSG 0x0400 | 14 | #define POLLMSG 0x0400 |
15 | #define POLLREMOVE 0x1000 | 15 | #define POLLREMOVE 0x1000 |
16 | #define POLLRDHUP 0x2000 | ||
16 | 17 | ||
17 | struct pollfd { | 18 | struct pollfd { |
18 | int fd; | 19 | int fd; |
diff --git a/include/asm-x86_64/poll.h b/include/asm-x86_64/poll.h index c43cbba31913..c0475a9d8bb8 100644 --- a/include/asm-x86_64/poll.h +++ b/include/asm-x86_64/poll.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define POLLWRBAND 0x0200 | 16 | #define POLLWRBAND 0x0200 |
17 | #define POLLMSG 0x0400 | 17 | #define POLLMSG 0x0400 |
18 | #define POLLREMOVE 0x1000 | 18 | #define POLLREMOVE 0x1000 |
19 | #define POLLRDHUP 0x2000 | ||
19 | 20 | ||
20 | struct pollfd { | 21 | struct pollfd { |
21 | int fd; | 22 | int fd; |
diff --git a/include/asm-xtensa/poll.h b/include/asm-xtensa/poll.h index dffe447534e0..6fd94773e866 100644 --- a/include/asm-xtensa/poll.h +++ b/include/asm-xtensa/poll.h | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #define POLLMSG 0x0400 | 28 | #define POLLMSG 0x0400 |
29 | #define POLLREMOVE 0x0800 | 29 | #define POLLREMOVE 0x0800 |
30 | #define POLLRDHUP 0x2000 | ||
30 | 31 | ||
31 | struct pollfd { | 32 | struct pollfd { |
32 | int fd; | 33 | int fd; |
diff --git a/include/linux/bitops.h b/include/linux/bitops.h index 208650b1ad3a..f17525a963d1 100644 --- a/include/linux/bitops.h +++ b/include/linux/bitops.h | |||
@@ -175,4 +175,11 @@ static inline __u32 ror32(__u32 word, unsigned int shift) | |||
175 | return (word >> shift) | (word << (32 - shift)); | 175 | return (word >> shift) | (word << (32 - shift)); |
176 | } | 176 | } |
177 | 177 | ||
178 | static inline unsigned fls_long(unsigned long l) | ||
179 | { | ||
180 | if (sizeof(l) == 4) | ||
181 | return fls(l); | ||
182 | return fls64(l); | ||
183 | } | ||
184 | |||
178 | #endif | 185 | #endif |
diff --git a/include/linux/capability.h b/include/linux/capability.h index 5a23ce752629..6548b35ab9f6 100644 --- a/include/linux/capability.h +++ b/include/linux/capability.h | |||
@@ -357,7 +357,8 @@ static inline kernel_cap_t cap_invert(kernel_cap_t c) | |||
357 | 357 | ||
358 | #define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) | 358 | #define cap_is_fs_cap(c) (CAP_TO_MASK(c) & CAP_FS_MASK) |
359 | 359 | ||
360 | extern int capable(int cap); | 360 | int capable(int cap); |
361 | int __capable(struct task_struct *t, int cap); | ||
361 | 362 | ||
362 | #endif /* __KERNEL__ */ | 363 | #endif /* __KERNEL__ */ |
363 | 364 | ||
diff --git a/include/linux/cpu.h b/include/linux/cpu.h index d612b89dce33..08d50c53aab4 100644 --- a/include/linux/cpu.h +++ b/include/linux/cpu.h | |||
@@ -74,7 +74,6 @@ extern int lock_cpu_hotplug_interruptible(void); | |||
74 | register_cpu_notifier(&fn##_nb); \ | 74 | register_cpu_notifier(&fn##_nb); \ |
75 | } | 75 | } |
76 | int cpu_down(unsigned int cpu); | 76 | int cpu_down(unsigned int cpu); |
77 | extern int __attribute__((weak)) smp_prepare_cpu(int cpu); | ||
78 | #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) | 77 | #define cpu_is_offline(cpu) unlikely(!cpu_online(cpu)) |
79 | #else | 78 | #else |
80 | #define lock_cpu_hotplug() do { } while (0) | 79 | #define lock_cpu_hotplug() do { } while (0) |
diff --git a/include/linux/cpumask.h b/include/linux/cpumask.h index 60e56c6e03dd..99e6115d8e52 100644 --- a/include/linux/cpumask.h +++ b/include/linux/cpumask.h | |||
@@ -212,17 +212,15 @@ static inline void __cpus_shift_left(cpumask_t *dstp, | |||
212 | bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); | 212 | bitmap_shift_left(dstp->bits, srcp->bits, n, nbits); |
213 | } | 213 | } |
214 | 214 | ||
215 | #define first_cpu(src) __first_cpu(&(src), NR_CPUS) | 215 | #ifdef CONFIG_SMP |
216 | static inline int __first_cpu(const cpumask_t *srcp, int nbits) | 216 | int __first_cpu(const cpumask_t *srcp); |
217 | { | 217 | #define first_cpu(src) __first_cpu(&(src)) |
218 | return min_t(int, nbits, find_first_bit(srcp->bits, nbits)); | 218 | int __next_cpu(int n, const cpumask_t *srcp); |
219 | } | 219 | #define next_cpu(n, src) __next_cpu((n), &(src)) |
220 | 220 | #else | |
221 | #define next_cpu(n, src) __next_cpu((n), &(src), NR_CPUS) | 221 | #define first_cpu(src) 0 |
222 | static inline int __next_cpu(int n, const cpumask_t *srcp, int nbits) | 222 | #define next_cpu(n, src) 1 |
223 | { | 223 | #endif |
224 | return min_t(int, nbits, find_next_bit(srcp->bits, nbits, n+1)); | ||
225 | } | ||
226 | 224 | ||
227 | #define cpumask_of_cpu(cpu) \ | 225 | #define cpumask_of_cpu(cpu) \ |
228 | ({ \ | 226 | ({ \ |
@@ -398,27 +396,17 @@ extern cpumask_t cpu_present_map; | |||
398 | #define cpu_present(cpu) ((cpu) == 0) | 396 | #define cpu_present(cpu) ((cpu) == 0) |
399 | #endif | 397 | #endif |
400 | 398 | ||
401 | #define any_online_cpu(mask) \ | 399 | #ifdef CONFIG_SMP |
402 | ({ \ | 400 | int highest_possible_processor_id(void); |
403 | int cpu; \ | 401 | #define any_online_cpu(mask) __any_online_cpu(&(mask)) |
404 | for_each_cpu_mask(cpu, (mask)) \ | 402 | int __any_online_cpu(const cpumask_t *mask); |
405 | if (cpu_online(cpu)) \ | 403 | #else |
406 | break; \ | 404 | #define highest_possible_processor_id() 0 |
407 | cpu; \ | 405 | #define any_online_cpu(mask) 0 |
408 | }) | 406 | #endif |
409 | 407 | ||
410 | #define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) | 408 | #define for_each_cpu(cpu) for_each_cpu_mask((cpu), cpu_possible_map) |
411 | #define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) | 409 | #define for_each_online_cpu(cpu) for_each_cpu_mask((cpu), cpu_online_map) |
412 | #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) | 410 | #define for_each_present_cpu(cpu) for_each_cpu_mask((cpu), cpu_present_map) |
413 | 411 | ||
414 | /* Find the highest possible smp_processor_id() */ | ||
415 | #define highest_possible_processor_id() \ | ||
416 | ({ \ | ||
417 | unsigned int cpu, highest = 0; \ | ||
418 | for_each_cpu_mask(cpu, cpu_possible_map) \ | ||
419 | highest = cpu; \ | ||
420 | highest; \ | ||
421 | }) | ||
422 | |||
423 | |||
424 | #endif /* __LINUX_CPUMASK_H */ | 412 | #endif /* __LINUX_CPUMASK_H */ |
diff --git a/include/linux/dcache.h b/include/linux/dcache.h index 4361f3789975..d10bd30c337e 100644 --- a/include/linux/dcache.h +++ b/include/linux/dcache.h | |||
@@ -162,6 +162,8 @@ d_iput: no no no yes | |||
162 | #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ | 162 | #define DCACHE_REFERENCED 0x0008 /* Recently used, don't discard. */ |
163 | #define DCACHE_UNHASHED 0x0010 | 163 | #define DCACHE_UNHASHED 0x0010 |
164 | 164 | ||
165 | #define DCACHE_INOTIFY_PARENT_WATCHED 0x0020 /* Parent inode is watched */ | ||
166 | |||
165 | extern spinlock_t dcache_lock; | 167 | extern spinlock_t dcache_lock; |
166 | 168 | ||
167 | /** | 169 | /** |
diff --git a/include/linux/dio.h b/include/linux/dio.h index fae9395fcf4f..1e65ebc2a3db 100644 --- a/include/linux/dio.h +++ b/include/linux/dio.h | |||
@@ -276,37 +276,5 @@ static inline void dio_set_drvdata (struct dio_dev *d, void *data) | |||
276 | dev_set_drvdata(&d->dev, data); | 276 | dev_set_drvdata(&d->dev, data); |
277 | } | 277 | } |
278 | 278 | ||
279 | /* | ||
280 | * A helper function which helps ensure correct dio_driver | ||
281 | * setup and cleanup for commonly-encountered hotplug/modular cases | ||
282 | * | ||
283 | * This MUST stay in a header, as it checks for -DMODULE | ||
284 | */ | ||
285 | static inline int dio_module_init(struct dio_driver *drv) | ||
286 | { | ||
287 | int rc = dio_register_driver(drv); | ||
288 | |||
289 | if (rc > 0) | ||
290 | return 0; | ||
291 | |||
292 | /* iff CONFIG_HOTPLUG and built into kernel, we should | ||
293 | * leave the driver around for future hotplug events. | ||
294 | * For the module case, a hotplug daemon of some sort | ||
295 | * should load a module in response to an insert event. */ | ||
296 | #if defined(CONFIG_HOTPLUG) && !defined(MODULE) | ||
297 | if (rc == 0) | ||
298 | return 0; | ||
299 | #else | ||
300 | if (rc == 0) | ||
301 | rc = -ENODEV; | ||
302 | #endif | ||
303 | |||
304 | /* if we get here, we need to clean up DIO driver instance | ||
305 | * and return some sort of error */ | ||
306 | dio_unregister_driver(drv); | ||
307 | |||
308 | return rc; | ||
309 | } | ||
310 | |||
311 | #endif /* __KERNEL__ */ | 279 | #endif /* __KERNEL__ */ |
312 | #endif /* ndef _LINUX_DIO_H */ | 280 | #endif /* ndef _LINUX_DIO_H */ |
diff --git a/include/linux/fs.h b/include/linux/fs.h index 215696a0f16f..21e8cf795c38 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -65,6 +65,11 @@ extern int dir_notify_enable; | |||
65 | #define FMODE_PREAD 8 | 65 | #define FMODE_PREAD 8 |
66 | #define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ | 66 | #define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */ |
67 | 67 | ||
68 | /* File is being opened for execution. Primary users of this flag are | ||
69 | distributed filesystems that can use it to achieve correct ETXTBUSY | ||
70 | behavior for cross-node execution/opening_for_writing of files */ | ||
71 | #define FMODE_EXEC 16 | ||
72 | |||
68 | #define RW_MASK 1 | 73 | #define RW_MASK 1 |
69 | #define RWA_MASK 2 | 74 | #define RWA_MASK 2 |
70 | #define READ 0 | 75 | #define READ 0 |
@@ -1558,7 +1563,6 @@ extern void destroy_inode(struct inode *); | |||
1558 | extern struct inode *new_inode(struct super_block *); | 1563 | extern struct inode *new_inode(struct super_block *); |
1559 | extern int remove_suid(struct dentry *); | 1564 | extern int remove_suid(struct dentry *); |
1560 | extern void remove_dquot_ref(struct super_block *, int, struct list_head *); | 1565 | extern void remove_dquot_ref(struct super_block *, int, struct list_head *); |
1561 | extern struct mutex iprune_mutex; | ||
1562 | 1566 | ||
1563 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); | 1567 | extern void __insert_inode_hash(struct inode *, unsigned long hashval); |
1564 | extern void remove_inode_hash(struct inode *); | 1568 | extern void remove_inode_hash(struct inode *); |
diff --git a/include/linux/fsnotify.h b/include/linux/fsnotify.h index 03b8e7932b83..f7e517c1f1bd 100644 --- a/include/linux/fsnotify.h +++ b/include/linux/fsnotify.h | |||
@@ -17,6 +17,25 @@ | |||
17 | #include <linux/inotify.h> | 17 | #include <linux/inotify.h> |
18 | 18 | ||
19 | /* | 19 | /* |
20 | * fsnotify_d_instantiate - instantiate a dentry for inode | ||
21 | * Called with dcache_lock held. | ||
22 | */ | ||
23 | static inline void fsnotify_d_instantiate(struct dentry *entry, | ||
24 | struct inode *inode) | ||
25 | { | ||
26 | inotify_d_instantiate(entry, inode); | ||
27 | } | ||
28 | |||
29 | /* | ||
30 | * fsnotify_d_move - entry has been moved | ||
31 | * Called with dcache_lock and entry->d_lock held. | ||
32 | */ | ||
33 | static inline void fsnotify_d_move(struct dentry *entry) | ||
34 | { | ||
35 | inotify_d_move(entry); | ||
36 | } | ||
37 | |||
38 | /* | ||
20 | * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir | 39 | * fsnotify_move - file old_name at old_dir was moved to new_name at new_dir |
21 | */ | 40 | */ |
22 | static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, | 41 | static inline void fsnotify_move(struct inode *old_dir, struct inode *new_dir, |
diff --git a/include/linux/i2c-id.h b/include/linux/i2c-id.h index ec311bc89439..679b46a6a565 100644 --- a/include/linux/i2c-id.h +++ b/include/linux/i2c-id.h | |||
@@ -184,6 +184,7 @@ | |||
184 | #define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */ | 184 | #define I2C_HW_B_SAVAGE 0x01001d /* savage framebuffer driver */ |
185 | #define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ | 185 | #define I2C_HW_B_RADEON 0x01001e /* radeon framebuffer driver */ |
186 | #define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ | 186 | #define I2C_HW_B_EM28XX 0x01001f /* em28xx video capture cards */ |
187 | #define I2C_HW_B_CX2341X 0x010020 /* Conexant CX2341X MPEG encoder cards */ | ||
187 | 188 | ||
188 | /* --- PCF 8584 based algorithms */ | 189 | /* --- PCF 8584 based algorithms */ |
189 | #define I2C_HW_P_LP 0x020000 /* Parallel port interface */ | 190 | #define I2C_HW_P_LP 0x020000 /* Parallel port interface */ |
diff --git a/include/linux/init.h b/include/linux/init.h index ff8d8b8632f4..ed0ac7c39fdc 100644 --- a/include/linux/init.h +++ b/include/linux/init.h | |||
@@ -69,6 +69,10 @@ extern initcall_t __security_initcall_start[], __security_initcall_end[]; | |||
69 | 69 | ||
70 | /* Defined in init/main.c */ | 70 | /* Defined in init/main.c */ |
71 | extern char saved_command_line[]; | 71 | extern char saved_command_line[]; |
72 | |||
73 | /* used by init/main.c */ | ||
74 | extern void setup_arch(char **); | ||
75 | |||
72 | #endif | 76 | #endif |
73 | 77 | ||
74 | #ifndef MODULE | 78 | #ifndef MODULE |
diff --git a/include/linux/inotify.h b/include/linux/inotify.h index 267c88b5f742..09e00433c78e 100644 --- a/include/linux/inotify.h +++ b/include/linux/inotify.h | |||
@@ -71,6 +71,8 @@ struct inotify_event { | |||
71 | 71 | ||
72 | #ifdef CONFIG_INOTIFY | 72 | #ifdef CONFIG_INOTIFY |
73 | 73 | ||
74 | extern void inotify_d_instantiate(struct dentry *, struct inode *); | ||
75 | extern void inotify_d_move(struct dentry *); | ||
74 | extern void inotify_inode_queue_event(struct inode *, __u32, __u32, | 76 | extern void inotify_inode_queue_event(struct inode *, __u32, __u32, |
75 | const char *); | 77 | const char *); |
76 | extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, | 78 | extern void inotify_dentry_parent_queue_event(struct dentry *, __u32, __u32, |
@@ -81,6 +83,15 @@ extern u32 inotify_get_cookie(void); | |||
81 | 83 | ||
82 | #else | 84 | #else |
83 | 85 | ||
86 | static inline void inotify_d_instantiate(struct dentry *dentry, | ||
87 | struct inode *inode) | ||
88 | { | ||
89 | } | ||
90 | |||
91 | static inline void inotify_d_move(struct dentry *dentry) | ||
92 | { | ||
93 | } | ||
94 | |||
84 | static inline void inotify_inode_queue_event(struct inode *inode, | 95 | static inline void inotify_inode_queue_event(struct inode *inode, |
85 | __u32 mask, __u32 cookie, | 96 | __u32 mask, __u32 cookie, |
86 | const char *filename) | 97 | const char *filename) |
diff --git a/include/linux/irq.h b/include/linux/irq.h index 6c5d4c898ccb..ee2a82a572f7 100644 --- a/include/linux/irq.h +++ b/include/linux/irq.h | |||
@@ -114,53 +114,8 @@ static inline void set_native_irq_info(int irq, cpumask_t mask) | |||
114 | #if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE) | 114 | #if defined (CONFIG_GENERIC_PENDING_IRQ) || defined (CONFIG_IRQBALANCE) |
115 | extern cpumask_t pending_irq_cpumask[NR_IRQS]; | 115 | extern cpumask_t pending_irq_cpumask[NR_IRQS]; |
116 | 116 | ||
117 | static inline void set_pending_irq(unsigned int irq, cpumask_t mask) | 117 | void set_pending_irq(unsigned int irq, cpumask_t mask); |
118 | { | 118 | void move_native_irq(int irq); |
119 | irq_desc_t *desc = irq_desc + irq; | ||
120 | unsigned long flags; | ||
121 | |||
122 | spin_lock_irqsave(&desc->lock, flags); | ||
123 | desc->move_irq = 1; | ||
124 | pending_irq_cpumask[irq] = mask; | ||
125 | spin_unlock_irqrestore(&desc->lock, flags); | ||
126 | } | ||
127 | |||
128 | static inline void | ||
129 | move_native_irq(int irq) | ||
130 | { | ||
131 | cpumask_t tmp; | ||
132 | irq_desc_t *desc = irq_descp(irq); | ||
133 | |||
134 | if (likely (!desc->move_irq)) | ||
135 | return; | ||
136 | |||
137 | desc->move_irq = 0; | ||
138 | |||
139 | if (likely(cpus_empty(pending_irq_cpumask[irq]))) | ||
140 | return; | ||
141 | |||
142 | if (!desc->handler->set_affinity) | ||
143 | return; | ||
144 | |||
145 | /* note - we hold the desc->lock */ | ||
146 | cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map); | ||
147 | |||
148 | /* | ||
149 | * If there was a valid mask to work with, please | ||
150 | * do the disable, re-program, enable sequence. | ||
151 | * This is *not* particularly important for level triggered | ||
152 | * but in a edge trigger case, we might be setting rte | ||
153 | * when an active trigger is comming in. This could | ||
154 | * cause some ioapics to mal-function. | ||
155 | * Being paranoid i guess! | ||
156 | */ | ||
157 | if (unlikely(!cpus_empty(tmp))) { | ||
158 | desc->handler->disable(irq); | ||
159 | desc->handler->set_affinity(irq,tmp); | ||
160 | desc->handler->enable(irq); | ||
161 | } | ||
162 | cpus_clear(pending_irq_cpumask[irq]); | ||
163 | } | ||
164 | 119 | ||
165 | #ifdef CONFIG_PCI_MSI | 120 | #ifdef CONFIG_PCI_MSI |
166 | /* | 121 | /* |
diff --git a/include/linux/jbd.h b/include/linux/jbd.h index 2ccbfb6340ba..4fc7dffd66ef 100644 --- a/include/linux/jbd.h +++ b/include/linux/jbd.h | |||
@@ -29,6 +29,8 @@ | |||
29 | #include <linux/stddef.h> | 29 | #include <linux/stddef.h> |
30 | #include <linux/bit_spinlock.h> | 30 | #include <linux/bit_spinlock.h> |
31 | #include <linux/mutex.h> | 31 | #include <linux/mutex.h> |
32 | #include <linux/timer.h> | ||
33 | |||
32 | #include <asm/semaphore.h> | 34 | #include <asm/semaphore.h> |
33 | #endif | 35 | #endif |
34 | 36 | ||
@@ -787,7 +789,7 @@ struct journal_s | |||
787 | unsigned long j_commit_interval; | 789 | unsigned long j_commit_interval; |
788 | 790 | ||
789 | /* The timer used to wakeup the commit thread: */ | 791 | /* The timer used to wakeup the commit thread: */ |
790 | struct timer_list *j_commit_timer; | 792 | struct timer_list j_commit_timer; |
791 | 793 | ||
792 | /* | 794 | /* |
793 | * The revoke table: maintains the list of revoked blocks in the | 795 | * The revoke table: maintains the list of revoked blocks in the |
diff --git a/include/linux/kernel.h b/include/linux/kernel.h index bb6e7ddee2fd..03d6cfaa5b8a 100644 --- a/include/linux/kernel.h +++ b/include/linux/kernel.h | |||
@@ -154,9 +154,10 @@ static inline int __attribute_pure__ long_log2(unsigned long x) | |||
154 | return r; | 154 | return r; |
155 | } | 155 | } |
156 | 156 | ||
157 | static inline unsigned long __attribute_const__ roundup_pow_of_two(unsigned long x) | 157 | static inline unsigned long |
158 | __attribute_const__ roundup_pow_of_two(unsigned long x) | ||
158 | { | 159 | { |
159 | return (1UL << fls(x - 1)); | 160 | return 1UL << fls_long(x - 1); |
160 | } | 161 | } |
161 | 162 | ||
162 | extern int printk_ratelimit(void); | 163 | extern int printk_ratelimit(void); |
diff --git a/include/linux/major.h b/include/linux/major.h index e36a46702d94..0a74c52924c9 100644 --- a/include/linux/major.h +++ b/include/linux/major.h | |||
@@ -113,6 +113,7 @@ | |||
113 | 113 | ||
114 | #define UBD_MAJOR 98 | 114 | #define UBD_MAJOR 98 |
115 | 115 | ||
116 | #define PP_MAJOR 99 | ||
116 | #define JSFD_MAJOR 99 | 117 | #define JSFD_MAJOR 99 |
117 | 118 | ||
118 | #define PHONE_MAJOR 100 | 119 | #define PHONE_MAJOR 100 |
diff --git a/include/linux/module.h b/include/linux/module.h index d9569151c182..eaec13ddd667 100644 --- a/include/linux/module.h +++ b/include/linux/module.h | |||
@@ -555,25 +555,6 @@ static inline void module_remove_driver(struct device_driver *driver) | |||
555 | 555 | ||
556 | /* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */ | 556 | /* BELOW HERE ALL THESE ARE OBSOLETE AND WILL VANISH */ |
557 | 557 | ||
558 | struct obsolete_modparm { | ||
559 | char name[64]; | ||
560 | char type[64-sizeof(void *)]; | ||
561 | void *addr; | ||
562 | }; | ||
563 | |||
564 | static inline void MODULE_PARM_(void) { } | ||
565 | #ifdef MODULE | ||
566 | /* DEPRECATED: Do not use. */ | ||
567 | #define MODULE_PARM(var,type) \ | ||
568 | extern struct obsolete_modparm __parm_##var \ | ||
569 | __attribute__((section("__obsparm"))); \ | ||
570 | struct obsolete_modparm __parm_##var = \ | ||
571 | { __stringify(var), type, &MODULE_PARM_ }; \ | ||
572 | __MODULE_PARM_TYPE(var, type); | ||
573 | #else | ||
574 | #define MODULE_PARM(var,type) static void __attribute__((__unused__)) *__parm_##var = &MODULE_PARM_; | ||
575 | #endif | ||
576 | |||
577 | #define __MODULE_STRING(x) __stringify(x) | 558 | #define __MODULE_STRING(x) __stringify(x) |
578 | 559 | ||
579 | /* Use symbol_get and symbol_put instead. You'll thank me. */ | 560 | /* Use symbol_get and symbol_put instead. You'll thank me. */ |
diff --git a/include/linux/moduleparam.h b/include/linux/moduleparam.h index b5c98c43779e..7c0c2c198f1f 100644 --- a/include/linux/moduleparam.h +++ b/include/linux/moduleparam.h | |||
@@ -162,13 +162,6 @@ extern int param_array_get(char *buffer, struct kernel_param *kp); | |||
162 | extern int param_set_copystring(const char *val, struct kernel_param *kp); | 162 | extern int param_set_copystring(const char *val, struct kernel_param *kp); |
163 | extern int param_get_string(char *buffer, struct kernel_param *kp); | 163 | extern int param_get_string(char *buffer, struct kernel_param *kp); |
164 | 164 | ||
165 | int param_array(const char *name, | ||
166 | const char *val, | ||
167 | unsigned int min, unsigned int max, | ||
168 | void *elem, int elemsize, | ||
169 | int (*set)(const char *, struct kernel_param *kp), | ||
170 | int *num); | ||
171 | |||
172 | /* for exporting parameters in /sys/parameters */ | 165 | /* for exporting parameters in /sys/parameters */ |
173 | 166 | ||
174 | struct module; | 167 | struct module; |
diff --git a/include/linux/ppdev.h b/include/linux/ppdev.h index 141c96586824..f376a7598a78 100644 --- a/include/linux/ppdev.h +++ b/include/linux/ppdev.h | |||
@@ -14,8 +14,6 @@ | |||
14 | * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001 | 14 | * Added PPGETMODES/PPGETMODE/PPGETPHASE, Fred Barnes <frmb2@ukc.ac.uk>, 03/01/2001 |
15 | */ | 15 | */ |
16 | 16 | ||
17 | #define PP_MAJOR 99 | ||
18 | |||
19 | #define PP_IOCTL 'p' | 17 | #define PP_IOCTL 'p' |
20 | 18 | ||
21 | /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ | 19 | /* Set mode for read/write (e.g. IEEE1284_MODE_EPP) */ |
diff --git a/include/linux/quota.h b/include/linux/quota.h index 8dc2d04a103f..2dab71e1c3d1 100644 --- a/include/linux/quota.h +++ b/include/linux/quota.h | |||
@@ -209,7 +209,6 @@ extern struct dqstats dqstats; | |||
209 | #define DQ_FAKE_B 3 /* no limits only usage */ | 209 | #define DQ_FAKE_B 3 /* no limits only usage */ |
210 | #define DQ_READ_B 4 /* dquot was read into memory */ | 210 | #define DQ_READ_B 4 /* dquot was read into memory */ |
211 | #define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */ | 211 | #define DQ_ACTIVE_B 5 /* dquot is active (dquot_release not called) */ |
212 | #define DQ_WAITFREE_B 6 /* dquot being waited (by invalidate_dquots) */ | ||
213 | 212 | ||
214 | struct dquot { | 213 | struct dquot { |
215 | struct hlist_node dq_hash; /* Hash list in memory */ | 214 | struct hlist_node dq_hash; /* Hash list in memory */ |
diff --git a/include/linux/radix-tree.h b/include/linux/radix-tree.h index c57ff2fcb30a..dd83cca28001 100644 --- a/include/linux/radix-tree.h +++ b/include/linux/radix-tree.h | |||
@@ -45,6 +45,8 @@ do { \ | |||
45 | (root)->rnode = NULL; \ | 45 | (root)->rnode = NULL; \ |
46 | } while (0) | 46 | } while (0) |
47 | 47 | ||
48 | #define RADIX_TREE_MAX_TAGS 2 | ||
49 | |||
48 | int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); | 50 | int radix_tree_insert(struct radix_tree_root *, unsigned long, void *); |
49 | void *radix_tree_lookup(struct radix_tree_root *, unsigned long); | 51 | void *radix_tree_lookup(struct radix_tree_root *, unsigned long); |
50 | void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); | 52 | void **radix_tree_lookup_slot(struct radix_tree_root *, unsigned long); |
@@ -55,15 +57,16 @@ radix_tree_gang_lookup(struct radix_tree_root *root, void **results, | |||
55 | int radix_tree_preload(gfp_t gfp_mask); | 57 | int radix_tree_preload(gfp_t gfp_mask); |
56 | void radix_tree_init(void); | 58 | void radix_tree_init(void); |
57 | void *radix_tree_tag_set(struct radix_tree_root *root, | 59 | void *radix_tree_tag_set(struct radix_tree_root *root, |
58 | unsigned long index, int tag); | 60 | unsigned long index, unsigned int tag); |
59 | void *radix_tree_tag_clear(struct radix_tree_root *root, | 61 | void *radix_tree_tag_clear(struct radix_tree_root *root, |
60 | unsigned long index, int tag); | 62 | unsigned long index, unsigned int tag); |
61 | int radix_tree_tag_get(struct radix_tree_root *root, | 63 | int radix_tree_tag_get(struct radix_tree_root *root, |
62 | unsigned long index, int tag); | 64 | unsigned long index, unsigned int tag); |
63 | unsigned int | 65 | unsigned int |
64 | radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, | 66 | radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, |
65 | unsigned long first_index, unsigned int max_items, int tag); | 67 | unsigned long first_index, unsigned int max_items, |
66 | int radix_tree_tagged(struct radix_tree_root *root, int tag); | 68 | unsigned int tag); |
69 | int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag); | ||
67 | 70 | ||
68 | static inline void radix_tree_preload_end(void) | 71 | static inline void radix_tree_preload_end(void) |
69 | { | 72 | { |
diff --git a/include/linux/reiserfs_fs.h b/include/linux/reiserfs_fs.h index dad78cecfd20..912f1b7cb18f 100644 --- a/include/linux/reiserfs_fs.h +++ b/include/linux/reiserfs_fs.h | |||
@@ -1704,6 +1704,11 @@ static inline int reiserfs_transaction_running(struct super_block *s) | |||
1704 | return 0; | 1704 | return 0; |
1705 | } | 1705 | } |
1706 | 1706 | ||
1707 | static inline int reiserfs_transaction_free_space(struct reiserfs_transaction_handle *th) | ||
1708 | { | ||
1709 | return th->t_blocks_allocated - th->t_blocks_logged; | ||
1710 | } | ||
1711 | |||
1707 | int reiserfs_async_progress_wait(struct super_block *s); | 1712 | int reiserfs_async_progress_wait(struct super_block *s); |
1708 | 1713 | ||
1709 | struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct | 1714 | struct reiserfs_transaction_handle *reiserfs_persistent_transaction(struct |
diff --git a/include/linux/reiserfs_xattr.h b/include/linux/reiserfs_xattr.h index 87280eb6083d..5353afb11db3 100644 --- a/include/linux/reiserfs_xattr.h +++ b/include/linux/reiserfs_xattr.h | |||
@@ -101,13 +101,13 @@ static inline void reiserfs_mark_inode_private(struct inode *inode) | |||
101 | #else | 101 | #else |
102 | 102 | ||
103 | #define is_reiserfs_priv_object(inode) 0 | 103 | #define is_reiserfs_priv_object(inode) 0 |
104 | #define reiserfs_mark_inode_private(inode) | 104 | #define reiserfs_mark_inode_private(inode) do {;} while(0) |
105 | #define reiserfs_getxattr NULL | 105 | #define reiserfs_getxattr NULL |
106 | #define reiserfs_setxattr NULL | 106 | #define reiserfs_setxattr NULL |
107 | #define reiserfs_listxattr NULL | 107 | #define reiserfs_listxattr NULL |
108 | #define reiserfs_removexattr NULL | 108 | #define reiserfs_removexattr NULL |
109 | #define reiserfs_write_lock_xattrs(sb) | 109 | #define reiserfs_write_lock_xattrs(sb) do {;} while(0) |
110 | #define reiserfs_write_unlock_xattrs(sb) | 110 | #define reiserfs_write_unlock_xattrs(sb) do {;} while(0) |
111 | #define reiserfs_read_lock_xattrs(sb) | 111 | #define reiserfs_read_lock_xattrs(sb) |
112 | #define reiserfs_read_unlock_xattrs(sb) | 112 | #define reiserfs_read_unlock_xattrs(sb) |
113 | 113 | ||
diff --git a/include/linux/security.h b/include/linux/security.h index b18eb8cfa639..3c19be35124b 100644 --- a/include/linux/security.h +++ b/include/linux/security.h | |||
@@ -1040,6 +1040,11 @@ struct swap_info_struct; | |||
1040 | * @effective contains the effective capability set. | 1040 | * @effective contains the effective capability set. |
1041 | * @inheritable contains the inheritable capability set. | 1041 | * @inheritable contains the inheritable capability set. |
1042 | * @permitted contains the permitted capability set. | 1042 | * @permitted contains the permitted capability set. |
1043 | * @capable: | ||
1044 | * Check whether the @tsk process has the @cap capability. | ||
1045 | * @tsk contains the task_struct for the process. | ||
1046 | * @cap contains the capability <include/linux/capability.h>. | ||
1047 | * Return 0 if the capability is granted for @tsk. | ||
1043 | * @acct: | 1048 | * @acct: |
1044 | * Check permission before enabling or disabling process accounting. If | 1049 | * Check permission before enabling or disabling process accounting. If |
1045 | * accounting is being enabled, then @file refers to the open file used to | 1050 | * accounting is being enabled, then @file refers to the open file used to |
@@ -1053,11 +1058,6 @@ struct swap_info_struct; | |||
1053 | * @table contains the ctl_table structure for the sysctl variable. | 1058 | * @table contains the ctl_table structure for the sysctl variable. |
1054 | * @op contains the operation (001 = search, 002 = write, 004 = read). | 1059 | * @op contains the operation (001 = search, 002 = write, 004 = read). |
1055 | * Return 0 if permission is granted. | 1060 | * Return 0 if permission is granted. |
1056 | * @capable: | ||
1057 | * Check whether the @tsk process has the @cap capability. | ||
1058 | * @tsk contains the task_struct for the process. | ||
1059 | * @cap contains the capability <include/linux/capability.h>. | ||
1060 | * Return 0 if the capability is granted for @tsk. | ||
1061 | * @syslog: | 1061 | * @syslog: |
1062 | * Check permission before accessing the kernel message ring or changing | 1062 | * Check permission before accessing the kernel message ring or changing |
1063 | * logging to the console. | 1063 | * logging to the console. |
@@ -1099,9 +1099,9 @@ struct security_operations { | |||
1099 | kernel_cap_t * effective, | 1099 | kernel_cap_t * effective, |
1100 | kernel_cap_t * inheritable, | 1100 | kernel_cap_t * inheritable, |
1101 | kernel_cap_t * permitted); | 1101 | kernel_cap_t * permitted); |
1102 | int (*capable) (struct task_struct * tsk, int cap); | ||
1102 | int (*acct) (struct file * file); | 1103 | int (*acct) (struct file * file); |
1103 | int (*sysctl) (struct ctl_table * table, int op); | 1104 | int (*sysctl) (struct ctl_table * table, int op); |
1104 | int (*capable) (struct task_struct * tsk, int cap); | ||
1105 | int (*quotactl) (int cmds, int type, int id, struct super_block * sb); | 1105 | int (*quotactl) (int cmds, int type, int id, struct super_block * sb); |
1106 | int (*quota_on) (struct dentry * dentry); | 1106 | int (*quota_on) (struct dentry * dentry); |
1107 | int (*syslog) (int type); | 1107 | int (*syslog) (int type); |
@@ -1347,6 +1347,11 @@ static inline void security_capset_set (struct task_struct *target, | |||
1347 | security_ops->capset_set (target, effective, inheritable, permitted); | 1347 | security_ops->capset_set (target, effective, inheritable, permitted); |
1348 | } | 1348 | } |
1349 | 1349 | ||
1350 | static inline int security_capable(struct task_struct *tsk, int cap) | ||
1351 | { | ||
1352 | return security_ops->capable(tsk, cap); | ||
1353 | } | ||
1354 | |||
1350 | static inline int security_acct (struct file *file) | 1355 | static inline int security_acct (struct file *file) |
1351 | { | 1356 | { |
1352 | return security_ops->acct (file); | 1357 | return security_ops->acct (file); |
@@ -2050,6 +2055,11 @@ static inline void security_capset_set (struct task_struct *target, | |||
2050 | cap_capset_set (target, effective, inheritable, permitted); | 2055 | cap_capset_set (target, effective, inheritable, permitted); |
2051 | } | 2056 | } |
2052 | 2057 | ||
2058 | static inline int security_capable(struct task_struct *tsk, int cap) | ||
2059 | { | ||
2060 | return cap_capable(tsk, cap); | ||
2061 | } | ||
2062 | |||
2053 | static inline int security_acct (struct file *file) | 2063 | static inline int security_acct (struct file *file) |
2054 | { | 2064 | { |
2055 | return 0; | 2065 | return 0; |
diff --git a/include/linux/slab.h b/include/linux/slab.h index e2ee5b268797..15e1d9736b1b 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h | |||
@@ -64,6 +64,7 @@ extern kmem_cache_t *kmem_cache_create(const char *, size_t, size_t, unsigned lo | |||
64 | extern int kmem_cache_destroy(kmem_cache_t *); | 64 | extern int kmem_cache_destroy(kmem_cache_t *); |
65 | extern int kmem_cache_shrink(kmem_cache_t *); | 65 | extern int kmem_cache_shrink(kmem_cache_t *); |
66 | extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); | 66 | extern void *kmem_cache_alloc(kmem_cache_t *, gfp_t); |
67 | extern void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); | ||
67 | extern void kmem_cache_free(kmem_cache_t *, void *); | 68 | extern void kmem_cache_free(kmem_cache_t *, void *); |
68 | extern unsigned int kmem_cache_size(kmem_cache_t *); | 69 | extern unsigned int kmem_cache_size(kmem_cache_t *); |
69 | extern const char *kmem_cache_name(kmem_cache_t *); | 70 | extern const char *kmem_cache_name(kmem_cache_t *); |
@@ -77,11 +78,12 @@ struct cache_sizes { | |||
77 | }; | 78 | }; |
78 | extern struct cache_sizes malloc_sizes[]; | 79 | extern struct cache_sizes malloc_sizes[]; |
79 | 80 | ||
80 | #ifndef CONFIG_DEBUG_SLAB | ||
81 | extern void *__kmalloc(size_t, gfp_t); | 81 | extern void *__kmalloc(size_t, gfp_t); |
82 | #ifndef CONFIG_DEBUG_SLAB | ||
83 | #define ____kmalloc(size, flags) __kmalloc(size, flags) | ||
82 | #else | 84 | #else |
83 | extern void *__kmalloc_track_caller(size_t, gfp_t, void*); | 85 | extern void *__kmalloc_track_caller(size_t, gfp_t, void*); |
84 | #define __kmalloc(size, flags) \ | 86 | #define ____kmalloc(size, flags) \ |
85 | __kmalloc_track_caller(size, flags, __builtin_return_address(0)) | 87 | __kmalloc_track_caller(size, flags, __builtin_return_address(0)) |
86 | #endif | 88 | #endif |
87 | 89 | ||
@@ -108,7 +110,30 @@ found: | |||
108 | return __kmalloc(size, flags); | 110 | return __kmalloc(size, flags); |
109 | } | 111 | } |
110 | 112 | ||
111 | extern void *kzalloc(size_t, gfp_t); | 113 | extern void *__kzalloc(size_t, gfp_t); |
114 | |||
115 | static inline void *kzalloc(size_t size, gfp_t flags) | ||
116 | { | ||
117 | if (__builtin_constant_p(size)) { | ||
118 | int i = 0; | ||
119 | #define CACHE(x) \ | ||
120 | if (size <= x) \ | ||
121 | goto found; \ | ||
122 | else \ | ||
123 | i++; | ||
124 | #include "kmalloc_sizes.h" | ||
125 | #undef CACHE | ||
126 | { | ||
127 | extern void __you_cannot_kzalloc_that_much(void); | ||
128 | __you_cannot_kzalloc_that_much(); | ||
129 | } | ||
130 | found: | ||
131 | return kmem_cache_zalloc((flags & GFP_DMA) ? | ||
132 | malloc_sizes[i].cs_dmacachep : | ||
133 | malloc_sizes[i].cs_cachep, flags); | ||
134 | } | ||
135 | return __kzalloc(size, flags); | ||
136 | } | ||
112 | 137 | ||
113 | /** | 138 | /** |
114 | * kcalloc - allocate memory for an array. The memory is set to zero. | 139 | * kcalloc - allocate memory for an array. The memory is set to zero. |
@@ -155,17 +180,18 @@ struct kmem_cache *kmem_cache_create(const char *c, size_t, size_t, | |||
155 | void (*)(void *, struct kmem_cache *, unsigned long)); | 180 | void (*)(void *, struct kmem_cache *, unsigned long)); |
156 | int kmem_cache_destroy(struct kmem_cache *c); | 181 | int kmem_cache_destroy(struct kmem_cache *c); |
157 | void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); | 182 | void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags); |
183 | void *kmem_cache_zalloc(struct kmem_cache *, gfp_t); | ||
158 | void kmem_cache_free(struct kmem_cache *c, void *b); | 184 | void kmem_cache_free(struct kmem_cache *c, void *b); |
159 | const char *kmem_cache_name(struct kmem_cache *); | 185 | const char *kmem_cache_name(struct kmem_cache *); |
160 | void *kmalloc(size_t size, gfp_t flags); | 186 | void *kmalloc(size_t size, gfp_t flags); |
161 | void *kzalloc(size_t size, gfp_t flags); | 187 | void *__kzalloc(size_t size, gfp_t flags); |
162 | void kfree(const void *m); | 188 | void kfree(const void *m); |
163 | unsigned int ksize(const void *m); | 189 | unsigned int ksize(const void *m); |
164 | unsigned int kmem_cache_size(struct kmem_cache *c); | 190 | unsigned int kmem_cache_size(struct kmem_cache *c); |
165 | 191 | ||
166 | static inline void *kcalloc(size_t n, size_t size, gfp_t flags) | 192 | static inline void *kcalloc(size_t n, size_t size, gfp_t flags) |
167 | { | 193 | { |
168 | return kzalloc(n * size, flags); | 194 | return __kzalloc(n * size, flags); |
169 | } | 195 | } |
170 | 196 | ||
171 | #define kmem_cache_shrink(d) (0) | 197 | #define kmem_cache_shrink(d) (0) |
@@ -173,6 +199,8 @@ static inline void *kcalloc(size_t n, size_t size, gfp_t flags) | |||
173 | #define kmem_ptr_validate(a, b) (0) | 199 | #define kmem_ptr_validate(a, b) (0) |
174 | #define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f) | 200 | #define kmem_cache_alloc_node(c, f, n) kmem_cache_alloc(c, f) |
175 | #define kmalloc_node(s, f, n) kmalloc(s, f) | 201 | #define kmalloc_node(s, f, n) kmalloc(s, f) |
202 | #define kzalloc(s, f) __kzalloc(s, f) | ||
203 | #define ____kmalloc kmalloc | ||
176 | 204 | ||
177 | #endif /* CONFIG_SLOB */ | 205 | #endif /* CONFIG_SLOB */ |
178 | 206 | ||
diff --git a/include/linux/time.h b/include/linux/time.h index d9cdba54b789..bf0e785e2e03 100644 --- a/include/linux/time.h +++ b/include/linux/time.h | |||
@@ -101,6 +101,7 @@ extern long do_utimes(int dfd, char __user *filename, struct timeval *times); | |||
101 | struct itimerval; | 101 | struct itimerval; |
102 | extern int do_setitimer(int which, struct itimerval *value, | 102 | extern int do_setitimer(int which, struct itimerval *value, |
103 | struct itimerval *ovalue); | 103 | struct itimerval *ovalue); |
104 | extern unsigned int alarm_setitimer(unsigned int seconds); | ||
104 | extern int do_getitimer(int which, struct itimerval *value); | 105 | extern int do_getitimer(int which, struct itimerval *value); |
105 | extern void getnstimeofday(struct timespec *tv); | 106 | extern void getnstimeofday(struct timespec *tv); |
106 | 107 | ||
diff --git a/include/linux/timex.h b/include/linux/timex.h index b7ca1204e42a..82dc9ae79d37 100644 --- a/include/linux/timex.h +++ b/include/linux/timex.h | |||
@@ -97,38 +97,11 @@ | |||
97 | 97 | ||
98 | #define MAXPHASE 512000L /* max phase error (us) */ | 98 | #define MAXPHASE 512000L /* max phase error (us) */ |
99 | #define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ | 99 | #define MAXFREQ (512L << SHIFT_USEC) /* max frequency error (ppm) */ |
100 | #define MAXTIME (200L << PPS_AVG) /* max PPS error (jitter) (200 us) */ | ||
101 | #define MINSEC 16L /* min interval between updates (s) */ | 100 | #define MINSEC 16L /* min interval between updates (s) */ |
102 | #define MAXSEC 1200L /* max interval between updates (s) */ | 101 | #define MAXSEC 1200L /* max interval between updates (s) */ |
103 | #define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ | 102 | #define NTP_PHASE_LIMIT (MAXPHASE << 5) /* beyond max. dispersion */ |
104 | 103 | ||
105 | /* | 104 | /* |
106 | * The following defines are used only if a pulse-per-second (PPS) | ||
107 | * signal is available and connected via a modem control lead, such as | ||
108 | * produced by the optional ppsclock feature incorporated in the Sun | ||
109 | * asynch driver. They establish the design parameters of the frequency- | ||
110 | * lock loop used to discipline the CPU clock oscillator to the PPS | ||
111 | * signal. | ||
112 | * | ||
113 | * PPS_AVG is the averaging factor for the frequency loop, as well as | ||
114 | * the time and frequency dispersion. | ||
115 | * | ||
116 | * PPS_SHIFT and PPS_SHIFTMAX specify the minimum and maximum | ||
117 | * calibration intervals, respectively, in seconds as a power of two. | ||
118 | * | ||
119 | * PPS_VALID is the maximum interval before the PPS signal is considered | ||
120 | * invalid and protocol updates used directly instead. | ||
121 | * | ||
122 | * MAXGLITCH is the maximum interval before a time offset of more than | ||
123 | * MAXTIME is believed. | ||
124 | */ | ||
125 | #define PPS_AVG 2 /* pps averaging constant (shift) */ | ||
126 | #define PPS_SHIFT 2 /* min interval duration (s) (shift) */ | ||
127 | #define PPS_SHIFTMAX 8 /* max interval duration (s) (shift) */ | ||
128 | #define PPS_VALID 120 /* pps signal watchdog max (s) */ | ||
129 | #define MAXGLITCH 30 /* pps signal glitch max (s) */ | ||
130 | |||
131 | /* | ||
132 | * syscall interface - used (mainly by NTP daemon) | 105 | * syscall interface - used (mainly by NTP daemon) |
133 | * to discipline kernel clock oscillator | 106 | * to discipline kernel clock oscillator |
134 | */ | 107 | */ |
@@ -246,20 +219,6 @@ extern long time_reftime; /* time at last adjustment (s) */ | |||
246 | extern long time_adjust; /* The amount of adjtime left */ | 219 | extern long time_adjust; /* The amount of adjtime left */ |
247 | extern long time_next_adjust; /* Value for time_adjust at next tick */ | 220 | extern long time_next_adjust; /* Value for time_adjust at next tick */ |
248 | 221 | ||
249 | /* interface variables pps->timer interrupt */ | ||
250 | extern long pps_offset; /* pps time offset (us) */ | ||
251 | extern long pps_jitter; /* time dispersion (jitter) (us) */ | ||
252 | extern long pps_freq; /* frequency offset (scaled ppm) */ | ||
253 | extern long pps_stabil; /* frequency dispersion (scaled ppm) */ | ||
254 | extern long pps_valid; /* pps signal watchdog counter */ | ||
255 | |||
256 | /* interface variables pps->adjtimex */ | ||
257 | extern int pps_shift; /* interval duration (s) (shift) */ | ||
258 | extern long pps_jitcnt; /* jitter limit exceeded */ | ||
259 | extern long pps_calcnt; /* calibration intervals */ | ||
260 | extern long pps_errcnt; /* calibration errors */ | ||
261 | extern long pps_stbcnt; /* stability limit exceeded */ | ||
262 | |||
263 | /** | 222 | /** |
264 | * ntp_clear - Clears the NTP state variables | 223 | * ntp_clear - Clears the NTP state variables |
265 | * | 224 | * |
diff --git a/include/linux/tty_flip.h b/include/linux/tty_flip.h index 0c6169fff366..0976a163b459 100644 --- a/include/linux/tty_flip.h +++ b/include/linux/tty_flip.h | |||
@@ -2,8 +2,8 @@ | |||
2 | #define _LINUX_TTY_FLIP_H | 2 | #define _LINUX_TTY_FLIP_H |
3 | 3 | ||
4 | extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); | 4 | extern int tty_buffer_request_room(struct tty_struct *tty, size_t size); |
5 | extern int tty_insert_flip_string(struct tty_struct *tty, unsigned char *chars, size_t size); | 5 | extern int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size); |
6 | extern int tty_insert_flip_string_flags(struct tty_struct *tty, unsigned char *chars, char *flags, size_t size); | 6 | extern int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size); |
7 | extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); | 7 | extern int tty_prepare_flip_string(struct tty_struct *tty, unsigned char **chars, size_t size); |
8 | extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); | 8 | extern int tty_prepare_flip_string_flags(struct tty_struct *tty, unsigned char **chars, char **flags, size_t size); |
9 | 9 | ||
diff --git a/include/linux/udf_fs_i.h b/include/linux/udf_fs_i.h index 1e7508420fcf..ffaf05679ffb 100644 --- a/include/linux/udf_fs_i.h +++ b/include/linux/udf_fs_i.h | |||
@@ -15,27 +15,6 @@ | |||
15 | 15 | ||
16 | #ifdef __KERNEL__ | 16 | #ifdef __KERNEL__ |
17 | 17 | ||
18 | #ifndef _ECMA_167_H | ||
19 | typedef struct | ||
20 | { | ||
21 | __u32 logicalBlockNum; | ||
22 | __u16 partitionReferenceNum; | ||
23 | } __attribute__ ((packed)) lb_addr; | ||
24 | |||
25 | typedef struct | ||
26 | { | ||
27 | __u32 extLength; | ||
28 | __u32 extPosition; | ||
29 | } __attribute__ ((packed)) short_ad; | ||
30 | |||
31 | typedef struct | ||
32 | { | ||
33 | __u32 extLength; | ||
34 | lb_addr extLocation; | ||
35 | __u8 impUse[6]; | ||
36 | } __attribute__ ((packed)) long_ad; | ||
37 | #endif | ||
38 | |||
39 | struct udf_inode_info | 18 | struct udf_inode_info |
40 | { | 19 | { |
41 | struct timespec i_crtime; | 20 | struct timespec i_crtime; |
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h index 724cfbf54b8a..2275bfec5b68 100644 --- a/include/linux/videodev2.h +++ b/include/linux/videodev2.h | |||
@@ -883,6 +883,7 @@ struct v4l2_modulator | |||
883 | #define V4L2_TUNER_MODE_LANG2 0x0002 | 883 | #define V4L2_TUNER_MODE_LANG2 0x0002 |
884 | #define V4L2_TUNER_MODE_SAP 0x0002 | 884 | #define V4L2_TUNER_MODE_SAP 0x0002 |
885 | #define V4L2_TUNER_MODE_LANG1 0x0003 | 885 | #define V4L2_TUNER_MODE_LANG1 0x0003 |
886 | #define V4L2_TUNER_MODE_LANG1_LANG2 0x0004 | ||
886 | 887 | ||
887 | struct v4l2_frequency | 888 | struct v4l2_frequency |
888 | { | 889 | { |
diff --git a/include/linux/zorro.h b/include/linux/zorro.h index ba5b72768bbe..2f135cf6eef1 100644 --- a/include/linux/zorro.h +++ b/include/linux/zorro.h | |||
@@ -271,39 +271,6 @@ static inline void zorro_set_drvdata (struct zorro_dev *z, void *data) | |||
271 | } | 271 | } |
272 | 272 | ||
273 | 273 | ||
274 | /* | ||
275 | * A helper function which helps ensure correct zorro_driver | ||
276 | * setup and cleanup for commonly-encountered hotplug/modular cases | ||
277 | * | ||
278 | * This MUST stay in a header, as it checks for -DMODULE | ||
279 | */ | ||
280 | static inline int zorro_module_init(struct zorro_driver *drv) | ||
281 | { | ||
282 | int rc = zorro_register_driver(drv); | ||
283 | |||
284 | if (rc > 0) | ||
285 | return 0; | ||
286 | |||
287 | /* iff CONFIG_HOTPLUG and built into kernel, we should | ||
288 | * leave the driver around for future hotplug events. | ||
289 | * For the module case, a hotplug daemon of some sort | ||
290 | * should load a module in response to an insert event. */ | ||
291 | #if defined(CONFIG_HOTPLUG) && !defined(MODULE) | ||
292 | if (rc == 0) | ||
293 | return 0; | ||
294 | #else | ||
295 | if (rc == 0) | ||
296 | rc = -ENODEV; | ||
297 | #endif | ||
298 | |||
299 | /* if we get here, we need to clean up Zorro driver instance | ||
300 | * and return some sort of error */ | ||
301 | zorro_unregister_driver(drv); | ||
302 | |||
303 | return rc; | ||
304 | } | ||
305 | |||
306 | |||
307 | /* | 274 | /* |
308 | * Bitmask indicating portions of available Zorro II RAM that are unused | 275 | * Bitmask indicating portions of available Zorro II RAM that are unused |
309 | * by the system. Every bit represents a 64K chunk, for a maximum of 8MB | 276 | * by the system. Every bit represents a 64K chunk, for a maximum of 8MB |
diff --git a/include/media/audiochip.h b/include/media/audiochip.h index 295d256ee811..1fd4a2207574 100644 --- a/include/media/audiochip.h +++ b/include/media/audiochip.h | |||
@@ -21,18 +21,4 @@ enum audiochip { | |||
21 | AUDIO_CHIP_MSP34XX | 21 | AUDIO_CHIP_MSP34XX |
22 | }; | 22 | }; |
23 | 23 | ||
24 | /* ---------------------------------------------------------------------- */ | ||
25 | |||
26 | /* audio inputs */ | ||
27 | #define AUDIO_TUNER 0x00 | ||
28 | #define AUDIO_RADIO 0x01 | ||
29 | #define AUDIO_EXTERN 0x02 | ||
30 | #define AUDIO_INTERN 0x03 | ||
31 | #define AUDIO_OFF 0x04 | ||
32 | #define AUDIO_ON 0x05 | ||
33 | #define AUDIO_EXTERN_1 AUDIO_EXTERN | ||
34 | #define AUDIO_EXTERN_2 0x06 | ||
35 | #define AUDIO_MUTE 0x80 | ||
36 | #define AUDIO_UNMUTE 0x81 | ||
37 | |||
38 | #endif /* AUDIOCHIP_H */ | 24 | #endif /* AUDIOCHIP_H */ |
diff --git a/include/media/cs53l32a.h b/include/media/cs53l32a.h new file mode 100644 index 000000000000..bf76197d3790 --- /dev/null +++ b/include/media/cs53l32a.h | |||
@@ -0,0 +1,34 @@ | |||
1 | /* | ||
2 | cs53l32a.h - definition for cs53l32a inputs and outputs | ||
3 | |||
4 | Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _CS53L32A_H_ | ||
22 | #define _CS53L32A_H_ | ||
23 | |||
24 | /* There are 2 physical inputs, but the second input can be | ||
25 | placed in two modes, the first mode bypasses the PGA (gain), | ||
26 | the second goes through the PGA. Hence there are three | ||
27 | possible inputs to choose from. */ | ||
28 | |||
29 | /* CS53L32A HW inputs */ | ||
30 | #define CS53L32A_IN0 0 | ||
31 | #define CS53L32A_IN1 1 | ||
32 | #define CS53L32A_IN2 2 | ||
33 | |||
34 | #endif | ||
diff --git a/include/media/i2c-addr.h b/include/media/i2c-addr.h new file mode 100644 index 000000000000..e7ff44a35ca0 --- /dev/null +++ b/include/media/i2c-addr.h | |||
@@ -0,0 +1,44 @@ | |||
1 | /* | ||
2 | * V4L I2C address list | ||
3 | * | ||
4 | * | ||
5 | * Copyright (C) 2006 Mauro Carvalho Chehab <mchehab@infradead.org> | ||
6 | * Based on a previous mapping by | ||
7 | * Ralph Metzler (rjkm@thp.uni-koeln.de) | ||
8 | * Gerd Knorr <kraxel@goldbach.in-berlin.de> | ||
9 | * | ||
10 | */ | ||
11 | |||
12 | /* bttv address list */ | ||
13 | #define I2C_ADDR_TSA5522 0xc2 | ||
14 | #define I2C_ADDR_TDA7432 0x8a | ||
15 | #define I2C_ADDR_BT832_ALT1 0x88 | ||
16 | #define I2C_ADDR_BT832_ALT2 0x8a // alternate setting | ||
17 | #define I2C_ADDR_TDA8425 0x82 | ||
18 | #define I2C_ADDR_TDA9840 0x84 | ||
19 | #define I2C_ADDR_TDA9850 0xb6 /* also used by 9855,9873 */ | ||
20 | #define I2C_ADDR_TDA9874 0xb0 /* also used by 9875 */ | ||
21 | #define I2C_ADDR_TDA9875 0xb0 | ||
22 | #define I2C_ADDR_HAUPEE 0xa0 | ||
23 | #define I2C_ADDR_STBEE 0xae | ||
24 | #define I2C_ADDR_VHX 0xc0 | ||
25 | #define I2C_ADDR_MSP3400 0x80 | ||
26 | #define I2C_ADDR_MSP3400_ALT 0x88 | ||
27 | #define I2C_ADDR_TEA6300 0x80 /* also used by 6320 */ | ||
28 | #define I2C_ADDR_DPL3518 0x84 | ||
29 | #define I2C_ADDR_TDA9887 0x86 | ||
30 | |||
31 | /* | ||
32 | * i2c bus addresses for the chips supported by tvaudio.c | ||
33 | */ | ||
34 | |||
35 | #define I2C_ADDR_TDA8425 0x82 | ||
36 | #define I2C_ADDR_TDA9840 0x84 /* also used by TA8874Z */ | ||
37 | #define I2C_ADDR_TDA985x_L 0xb4 /* also used by 9873 */ | ||
38 | #define I2C_ADDR_TDA985x_H 0xb6 | ||
39 | #define I2C_ADDR_TDA9874 0xb0 /* also used by 9875 */ | ||
40 | |||
41 | #define I2C_ADDR_TEA6300 0x80 /* also used by 6320 */ | ||
42 | #define I2C_ADDR_TEA6420 0x98 | ||
43 | |||
44 | #define I2C_ADDR_PIC16C54 0x96 /* PV951 */ | ||
diff --git a/include/media/msp3400.h b/include/media/msp3400.h new file mode 100644 index 000000000000..0be61a021d45 --- /dev/null +++ b/include/media/msp3400.h | |||
@@ -0,0 +1,226 @@ | |||
1 | /* | ||
2 | msp3400.h - definition for msp3400 inputs and outputs | ||
3 | |||
4 | Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _MSP3400_H_ | ||
22 | #define _MSP3400_H_ | ||
23 | |||
24 | /* msp3400 routing | ||
25 | =============== | ||
26 | |||
27 | The msp3400 has a complicated routing scheme with many possible | ||
28 | combinations. The details are all in the datasheets but I will try | ||
29 | to give a short description here. | ||
30 | |||
31 | Inputs | ||
32 | ====== | ||
33 | |||
34 | There are 1) tuner inputs, 2) I2S inputs, 3) SCART inputs. You will have | ||
35 | to select which tuner input to use and which SCART input to use. The | ||
36 | selected tuner input, the selected SCART input and all I2S inputs go to | ||
37 | the DSP (the tuner input first goes through the demodulator). | ||
38 | |||
39 | The DSP handles things like volume, bass/treble, balance, and some chips | ||
40 | have support for surround sound. It has several outputs: MAIN, AUX, I2S | ||
41 | and SCART1/2. Each output can select which DSP input to use. So the MAIN | ||
42 | output can select the tuner input while at the same time the SCART1 output | ||
43 | uses the I2S input. | ||
44 | |||
45 | Outputs | ||
46 | ======= | ||
47 | |||
48 | Most DSP outputs are also the outputs of the msp3400. However, the SCART | ||
49 | outputs of the msp3400 can select which input to use: either the SCART1 or | ||
50 | SCART2 output from the DSP, or the msp3400 SCART inputs, thus completely | ||
51 | bypassing the DSP. | ||
52 | |||
53 | Summary | ||
54 | ======= | ||
55 | |||
56 | So to specify a complete routing scheme for the msp3400 you will have to | ||
57 | specify in the 'input' field of the v4l2_routing struct: | ||
58 | |||
59 | 1) which tuner input to use | ||
60 | 2) which SCART input to use | ||
61 | 3) which DSP input to use for each DSP output | ||
62 | |||
63 | And in the 'output' field of the v4l2_routing struct you specify: | ||
64 | |||
65 | 1) which SCART input to use for each SCART output | ||
66 | |||
67 | Depending on how the msp is wired to the other components you can | ||
68 | ignore or mute certain inputs or outputs. | ||
69 | |||
70 | Also, depending on the msp version only a subset of the inputs or | ||
71 | outputs may be present. At the end of this header some tables are | ||
72 | added containing a list of what is available for each msp version. | ||
73 | */ | ||
74 | |||
75 | /* Inputs to the DSP unit: two independent selections have to be made: | ||
76 | 1) the tuner (SIF) input | ||
77 | 2) the SCART input | ||
78 | Bits 0-2 are used for the SCART input select, bit 3 is used for the tuner | ||
79 | input, bits 4-7 are reserved. | ||
80 | */ | ||
81 | |||
82 | /* SCART input to DSP selection */ | ||
83 | #define MSP_IN_SCART_1 0 /* Pin SC1_IN */ | ||
84 | #define MSP_IN_SCART_2 1 /* Pin SC2_IN */ | ||
85 | #define MSP_IN_SCART_3 2 /* Pin SC3_IN */ | ||
86 | #define MSP_IN_SCART_4 3 /* Pin SC4_IN */ | ||
87 | #define MSP_IN_MONO 6 /* Pin MONO_IN */ | ||
88 | #define MSP_IN_MUTE 7 /* Mute DSP input */ | ||
89 | #define MSP_SCART_TO_DSP(in) (in) | ||
90 | /* Tuner input to demodulator and DSP selection */ | ||
91 | #define MSP_IN_TUNER_1 0 /* Analog Sound IF input pin ANA_IN1 */ | ||
92 | #define MSP_IN_TUNER_2 1 /* Analog Sound IF input pin ANA_IN2 */ | ||
93 | #define MSP_TUNER_TO_DSP(in) ((in) << 3) | ||
94 | |||
95 | /* The msp has up to 5 DSP outputs, each output can independently select | ||
96 | a DSP input. | ||
97 | |||
98 | The DSP outputs are: loudspeaker output (aka MAIN), headphones output | ||
99 | (aka AUX), SCART1 DA output, SCART2 DA output and an I2S output. | ||
100 | There also is a quasi-peak detector output, but that is not used by | ||
101 | this driver and is set to the same input as the loudspeaker output. | ||
102 | Not all outputs are supported by all msp models. Setting the input | ||
103 | of an unsupported output will be ignored by the driver. | ||
104 | |||
105 | There are up to 16 DSP inputs to choose from, so each output is | ||
106 | assigned 4 bits. | ||
107 | |||
108 | Note: the 44x8G can mix two inputs and feed the result back to the | ||
109 | DSP. This is currently not implemented. Also not implemented is the | ||
110 | multi-channel capable I2S3 input of the 44x0G. If someone can demonstrate | ||
111 | a need for one of those features then additional support can be added. */ | ||
112 | #define MSP_DSP_OUT_TUNER 0 /* Tuner output */ | ||
113 | #define MSP_DSP_OUT_SCART 2 /* SCART output */ | ||
114 | #define MSP_DSP_OUT_I2S1 5 /* I2S1 output */ | ||
115 | #define MSP_DSP_OUT_I2S2 6 /* I2S2 output */ | ||
116 | #define MSP_DSP_OUT_I2S3 7 /* I2S3 output */ | ||
117 | #define MSP_DSP_OUT_MAIN_AVC 11 /* MAIN AVC processed output */ | ||
118 | #define MSP_DSP_OUT_MAIN 12 /* MAIN output */ | ||
119 | #define MSP_DSP_OUT_AUX 13 /* AUX output */ | ||
120 | #define MSP_DSP_TO_MAIN(in) ((in) << 4) | ||
121 | #define MSP_DSP_TO_AUX(in) ((in) << 8) | ||
122 | #define MSP_DSP_TO_SCART1(in) ((in) << 12) | ||
123 | #define MSP_DSP_TO_SCART2(in) ((in) << 16) | ||
124 | #define MSP_DSP_TO_I2S(in) ((in) << 20) | ||
125 | |||
126 | /* Output SCART select: the SCART outputs can select which input | ||
127 | to use. */ | ||
128 | #define MSP_OUT_SCART1 0 /* SCART1 input, bypassing the DSP */ | ||
129 | #define MSP_OUT_SCART2 1 /* SCART2 input, bypassing the DSP */ | ||
130 | #define MSP_OUT_SCART3 2 /* SCART3 input, bypassing the DSP */ | ||
131 | #define MSP_OUT_SCART4 3 /* SCART4 input, bypassing the DSP */ | ||
132 | #define MSP_OUT_SCART1_DA 4 /* DSP SCART1 output */ | ||
133 | #define MSP_OUT_SCART2_DA 5 /* DSP SCART2 output */ | ||
134 | #define MSP_OUT_MONO 6 /* MONO input, bypassing the DSP */ | ||
135 | #define MSP_OUT_MUTE 7 /* MUTE output */ | ||
136 | #define MSP_OUT_TO_SCART1(in) (in) | ||
137 | #define MSP_OUT_TO_SCART2(in) ((in) << 4) | ||
138 | |||
139 | /* Shortcut macros */ | ||
140 | #define MSP_INPUT(sc, t, main_aux_src, sc_i2s_src) \ | ||
141 | (MSP_SCART_TO_DSP(sc) | \ | ||
142 | MSP_TUNER_TO_DSP(t) | \ | ||
143 | MSP_DSP_TO_MAIN(main_aux_src) | \ | ||
144 | MSP_DSP_TO_AUX(main_aux_src) | \ | ||
145 | MSP_DSP_TO_SCART1(sc_i2s_src) | \ | ||
146 | MSP_DSP_TO_SCART2(sc_i2s_src) | \ | ||
147 | MSP_DSP_TO_I2S(sc_i2s_src)) | ||
148 | #define MSP_INPUT_DEFAULT MSP_INPUT(MSP_IN_SCART_1, MSP_IN_TUNER_1, \ | ||
149 | MSP_DSP_OUT_TUNER, MSP_DSP_OUT_TUNER) | ||
150 | #define MSP_OUTPUT(sc) \ | ||
151 | (MSP_OUT_TO_SCART1(sc) | \ | ||
152 | MSP_OUT_TO_SCART2(sc)) | ||
153 | /* This equals the RESET position of the msp3400 ACB register */ | ||
154 | #define MSP_OUTPUT_DEFAULT (MSP_OUT_TO_SCART1(MSP_OUT_SCART3) | \ | ||
155 | MSP_OUT_TO_SCART2(MSP_OUT_SCART1_DA)) | ||
156 | |||
157 | /* Tuner inputs vs. msp version */ | ||
158 | /* Chip TUNER_1 TUNER_2 | ||
159 | ------------------------- | ||
160 | msp34x0b y y | ||
161 | msp34x0c y y | ||
162 | msp34x0d y y | ||
163 | msp34x5d y n | ||
164 | msp34x7d y n | ||
165 | msp34x0g y y | ||
166 | msp34x1g y y | ||
167 | msp34x2g y y | ||
168 | msp34x5g y n | ||
169 | msp34x7g y n | ||
170 | msp44x0g y y | ||
171 | msp44x8g y y | ||
172 | */ | ||
173 | |||
174 | /* SCART inputs vs. msp version */ | ||
175 | /* Chip SC1 SC2 SC3 SC4 | ||
176 | ------------------------- | ||
177 | msp34x0b y y y n | ||
178 | msp34x0c y y y n | ||
179 | msp34x0d y y y y | ||
180 | msp34x5d y y n n | ||
181 | msp34x7d y n n n | ||
182 | msp34x0g y y y y | ||
183 | msp34x1g y y y y | ||
184 | msp34x2g y y y y | ||
185 | msp34x5g y y n n | ||
186 | msp34x7g y n n n | ||
187 | msp44x0g y y y y | ||
188 | msp44x8g y y y y | ||
189 | */ | ||
190 | |||
191 | /* DSP inputs vs. msp version (tuner and SCART inputs are always available) */ | ||
192 | /* Chip I2S1 I2S2 I2S3 MAIN_AVC MAIN AUX | ||
193 | ------------------------------------------ | ||
194 | msp34x0b y n n n n n | ||
195 | msp34x0c y y n n n n | ||
196 | msp34x0d y y n n n n | ||
197 | msp34x5d y y n n n n | ||
198 | msp34x7d n n n n n n | ||
199 | msp34x0g y y n n n n | ||
200 | msp34x1g y y n n n n | ||
201 | msp34x2g y y n y y y | ||
202 | msp34x5g y y n n n n | ||
203 | msp34x7g n n n n n n | ||
204 | msp44x0g y y y y y y | ||
205 | msp44x8g y y y n n n | ||
206 | */ | ||
207 | |||
208 | /* DSP outputs vs. msp version */ | ||
209 | /* Chip MAIN AUX SCART1 SCART2 I2S | ||
210 | ------------------------------------ | ||
211 | msp34x0b y y y n y | ||
212 | msp34x0c y y y n y | ||
213 | msp34x0d y y y y y | ||
214 | msp34x5d y n y n y | ||
215 | msp34x7d y n y n n | ||
216 | msp34x0g y y y y y | ||
217 | msp34x1g y y y y y | ||
218 | msp34x2g y y y y y | ||
219 | msp34x5g y n y n y | ||
220 | msp34x7g y n y n n | ||
221 | msp44x0g y y y y y | ||
222 | msp44x8g y y y y y | ||
223 | */ | ||
224 | |||
225 | #endif /* MSP3400_H */ | ||
226 | |||
diff --git a/drivers/media/video/rds.h b/include/media/rds.h index 0d30eb744e61..951c1ae0be74 100644 --- a/drivers/media/video/rds.h +++ b/include/media/rds.h | |||
@@ -42,7 +42,3 @@ struct rds_command { | |||
42 | #define RDS_CMD_POLL _IOR('R',4,int) | 42 | #define RDS_CMD_POLL _IOR('R',4,int) |
43 | 43 | ||
44 | #endif | 44 | #endif |
45 | |||
46 | |||
47 | |||
48 | |||
diff --git a/include/media/saa7146_vv.h b/include/media/saa7146_vv.h index e5e749e984ee..4507cb61ae93 100644 --- a/include/media/saa7146_vv.h +++ b/include/media/saa7146_vv.h | |||
@@ -197,7 +197,8 @@ void saa7146_buffer_finish(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, | |||
197 | void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); | 197 | void saa7146_buffer_next(struct saa7146_dev *dev, struct saa7146_dmaqueue *q,int vbi); |
198 | int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); | 198 | int saa7146_buffer_queue(struct saa7146_dev *dev, struct saa7146_dmaqueue *q, struct saa7146_buf *buf); |
199 | void saa7146_buffer_timeout(unsigned long data); | 199 | void saa7146_buffer_timeout(unsigned long data); |
200 | void saa7146_dma_free(struct saa7146_dev *dev,struct saa7146_buf *buf); | 200 | void saa7146_dma_free(struct saa7146_dev* dev,struct videobuf_queue *q, |
201 | struct saa7146_buf *buf); | ||
201 | 202 | ||
202 | int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv); | 203 | int saa7146_vv_init(struct saa7146_dev* dev, struct saa7146_ext_vv *ext_vv); |
203 | int saa7146_vv_release(struct saa7146_dev* dev); | 204 | int saa7146_vv_release(struct saa7146_dev* dev); |
diff --git a/include/media/tvaudio.h b/include/media/tvaudio.h new file mode 100644 index 000000000000..6915aafc875a --- /dev/null +++ b/include/media/tvaudio.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* | ||
2 | tvaudio.h - definition for tvaudio inputs | ||
3 | |||
4 | Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _TVAUDIO_H | ||
22 | #define _TVAUDIO_H | ||
23 | |||
24 | /* The tvaudio module accepts the following inputs: */ | ||
25 | #define TVAUDIO_INPUT_TUNER 0 | ||
26 | #define TVAUDIO_INPUT_RADIO 1 | ||
27 | #define TVAUDIO_INPUT_EXTERN 2 | ||
28 | #define TVAUDIO_INPUT_INTERN 3 | ||
29 | |||
30 | #endif | ||
diff --git a/include/media/v4l2-common.h b/include/media/v4l2-common.h index 2360453e7496..642520acdfa7 100644 --- a/include/media/v4l2-common.h +++ b/include/media/v4l2-common.h | |||
@@ -123,17 +123,6 @@ enum v4l2_chip_ident { | |||
123 | /* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ | 123 | /* v4l device was opened in Radio mode, to be replaced by VIDIOC_INT_S_TUNER_MODE */ |
124 | #define AUDC_SET_RADIO _IO('d',88) | 124 | #define AUDC_SET_RADIO _IO('d',88) |
125 | 125 | ||
126 | /* select from TV,radio,extern,MUTE, to be replaced with VIDIOC_INT_S_AUDIO_ROUTING */ | ||
127 | #define AUDC_SET_INPUT _IOW('d',89,int) | ||
128 | |||
129 | /* msp3400 ioctl: will be removed in the near future, to be replaced by | ||
130 | VIDIOC_INT_S_AUDIO_ROUTING. */ | ||
131 | struct msp_matrix { | ||
132 | int input; | ||
133 | int output; | ||
134 | }; | ||
135 | #define MSP_SET_MATRIX _IOW('m',17,struct msp_matrix) | ||
136 | |||
137 | /* tuner ioctls */ | 126 | /* tuner ioctls */ |
138 | 127 | ||
139 | /* Sets tuner type and its I2C addr */ | 128 | /* Sets tuner type and its I2C addr */ |
@@ -209,10 +198,10 @@ struct v4l2_routing { | |||
209 | }; | 198 | }; |
210 | 199 | ||
211 | /* These internal commands should be used to define the inputs and outputs | 200 | /* These internal commands should be used to define the inputs and outputs |
212 | of an audio/video chip. They will replace AUDC_SET_INPUT. | 201 | of an audio/video chip. They will replace the v4l2 API commands |
213 | The v4l2 API commands VIDIOC_S/G_INPUT, VIDIOC_S/G_OUTPUT, | 202 | VIDIOC_S/G_INPUT, VIDIOC_S/G_OUTPUT, VIDIOC_S/G_AUDIO and VIDIOC_S/G_AUDOUT |
214 | VIDIOC_S/G_AUDIO and VIDIOC_S/G_AUDOUT are meant to be used by the | 203 | that are meant to be used by the user. |
215 | user. Internally these commands should be used to switch inputs/outputs | 204 | The internal commands should be used to switch inputs/outputs |
216 | because only the driver knows how to map a 'Television' input to the precise | 205 | because only the driver knows how to map a 'Television' input to the precise |
217 | input/output routing of an A/D converter, or a DSP, or a video digitizer. | 206 | input/output routing of an A/D converter, or a DSP, or a video digitizer. |
218 | These four commands should only be sent directly to an i2c device, they | 207 | These four commands should only be sent directly to an i2c device, they |
diff --git a/include/media/video-buf.h b/include/media/video-buf.h index d90dec5484ee..fff3fd0fbf94 100644 --- a/include/media/video-buf.h +++ b/include/media/video-buf.h | |||
@@ -1,15 +1,20 @@ | |||
1 | /* | 1 | /* |
2 | * | 2 | * |
3 | * generic helper functions for video4linux capture buffers, to handle | 3 | * generic helper functions for video4linux capture buffers, to handle |
4 | * memory management and PCI DMA. Right now bttv + saa7134 use it. | 4 | * memory management and PCI DMA. |
5 | * Right now, bttv, saa7134, saa7146 and cx88 use it. | ||
5 | * | 6 | * |
6 | * The functions expect the hardware being able to scatter gatter | 7 | * The functions expect the hardware being able to scatter gatter |
7 | * (i.e. the buffers are not linear in physical memory, but fragmented | 8 | * (i.e. the buffers are not linear in physical memory, but fragmented |
8 | * into PAGE_SIZE chunks). They also assume the driver does not need | 9 | * into PAGE_SIZE chunks). They also assume the driver does not need |
9 | * to touch the video data (thus it is probably not useful for USB as | 10 | * to touch the video data. |
10 | * data often must be uncompressed by the drivers). | 11 | * |
12 | * device specific map/unmap/sync stuff now are mapped as file operations | ||
13 | * to allow its usage by USB and virtual devices. | ||
11 | * | 14 | * |
12 | * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> | 15 | * (c) 2001,02 Gerd Knorr <kraxel@bytesex.org> |
16 | * (c) 2006 Mauro Carvalho Chehab, <mchehab@infradead.org> | ||
17 | * (c) 2006 Ted Walther and John Sokol | ||
13 | * | 18 | * |
14 | * This program is free software; you can redistribute it and/or modify | 19 | * This program is free software; you can redistribute it and/or modify |
15 | * it under the terms of the GNU General Public License as published by | 20 | * it under the terms of the GNU General Public License as published by |
@@ -38,6 +43,9 @@ struct scatterlist* videobuf_vmalloc_to_sg(unsigned char *virt, int nr_pages); | |||
38 | struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, | 43 | struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, |
39 | int offset); | 44 | int offset); |
40 | 45 | ||
46 | struct videobuf_buffer; | ||
47 | struct videobuf_queue; | ||
48 | |||
41 | /* --------------------------------------------------------------------- */ | 49 | /* --------------------------------------------------------------------- */ |
42 | 50 | ||
43 | /* | 51 | /* |
@@ -49,7 +57,7 @@ struct scatterlist* videobuf_pages_to_sg(struct page **pages, int nr_pages, | |||
49 | * pointer + length. The kernel version just wants the size and | 57 | * pointer + length. The kernel version just wants the size and |
50 | * does memory allocation too using vmalloc_32(). | 58 | * does memory allocation too using vmalloc_32(). |
51 | * | 59 | * |
52 | * videobuf_dma_pci_*() | 60 | * videobuf_dma_*() |
53 | * see Documentation/DMA-mapping.txt, these functions to | 61 | * see Documentation/DMA-mapping.txt, these functions to |
54 | * basically the same. The map function does also build a | 62 | * basically the same. The map function does also build a |
55 | * scatterlist for the buffer (and unmap frees it ...) | 63 | * scatterlist for the buffer (and unmap frees it ...) |
@@ -86,12 +94,18 @@ int videobuf_dma_init_kernel(struct videobuf_dmabuf *dma, int direction, | |||
86 | int nr_pages); | 94 | int nr_pages); |
87 | int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, | 95 | int videobuf_dma_init_overlay(struct videobuf_dmabuf *dma, int direction, |
88 | dma_addr_t addr, int nr_pages); | 96 | dma_addr_t addr, int nr_pages); |
89 | int videobuf_dma_pci_map(struct pci_dev *dev, struct videobuf_dmabuf *dma); | ||
90 | int videobuf_dma_pci_sync(struct pci_dev *dev, | ||
91 | struct videobuf_dmabuf *dma); | ||
92 | int videobuf_dma_pci_unmap(struct pci_dev *dev, struct videobuf_dmabuf *dma); | ||
93 | int videobuf_dma_free(struct videobuf_dmabuf *dma); | 97 | int videobuf_dma_free(struct videobuf_dmabuf *dma); |
94 | 98 | ||
99 | int videobuf_dma_map(struct videobuf_queue* q,struct videobuf_dmabuf *dma); | ||
100 | int videobuf_dma_sync(struct videobuf_queue* q,struct videobuf_dmabuf *dma); | ||
101 | int videobuf_dma_unmap(struct videobuf_queue* q,struct videobuf_dmabuf *dma); | ||
102 | |||
103 | /*FIXME: these variants are used only on *-alsa code, where videobuf is | ||
104 | * used without queue | ||
105 | */ | ||
106 | int videobuf_pci_dma_map(struct pci_dev *pci,struct videobuf_dmabuf *dma); | ||
107 | int videobuf_pci_dma_unmap(struct pci_dev *pci,struct videobuf_dmabuf *dma); | ||
108 | |||
95 | /* --------------------------------------------------------------------- */ | 109 | /* --------------------------------------------------------------------- */ |
96 | 110 | ||
97 | /* | 111 | /* |
@@ -115,9 +129,6 @@ int videobuf_dma_free(struct videobuf_dmabuf *dma); | |||
115 | * | 129 | * |
116 | */ | 130 | */ |
117 | 131 | ||
118 | struct videobuf_buffer; | ||
119 | struct videobuf_queue; | ||
120 | |||
121 | struct videobuf_mapping { | 132 | struct videobuf_mapping { |
122 | unsigned int count; | 133 | unsigned int count; |
123 | unsigned long start; | 134 | unsigned long start; |
@@ -164,6 +175,10 @@ struct videobuf_buffer { | |||
164 | struct timeval ts; | 175 | struct timeval ts; |
165 | }; | 176 | }; |
166 | 177 | ||
178 | typedef int (vb_map_sg_t)(void *dev,struct scatterlist *sglist,int nr_pages, | ||
179 | int direction); | ||
180 | |||
181 | |||
167 | struct videobuf_queue_ops { | 182 | struct videobuf_queue_ops { |
168 | int (*buf_setup)(struct videobuf_queue *q, | 183 | int (*buf_setup)(struct videobuf_queue *q, |
169 | unsigned int *count, unsigned int *size); | 184 | unsigned int *count, unsigned int *size); |
@@ -174,12 +189,20 @@ struct videobuf_queue_ops { | |||
174 | struct videobuf_buffer *vb); | 189 | struct videobuf_buffer *vb); |
175 | void (*buf_release)(struct videobuf_queue *q, | 190 | void (*buf_release)(struct videobuf_queue *q, |
176 | struct videobuf_buffer *vb); | 191 | struct videobuf_buffer *vb); |
192 | |||
193 | /* Helper operations - device dependent. | ||
194 | * If null, videobuf_init defaults all to PCI handling | ||
195 | */ | ||
196 | |||
197 | vb_map_sg_t *vb_map_sg; | ||
198 | vb_map_sg_t *vb_dma_sync_sg; | ||
199 | vb_map_sg_t *vb_unmap_sg; | ||
177 | }; | 200 | }; |
178 | 201 | ||
179 | struct videobuf_queue { | 202 | struct videobuf_queue { |
180 | struct mutex lock; | 203 | struct mutex lock; |
181 | spinlock_t *irqlock; | 204 | spinlock_t *irqlock; |
182 | struct pci_dev *pci; | 205 | void *dev; /* on pci, points to struct pci_dev */ |
183 | 206 | ||
184 | enum v4l2_buf_type type; | 207 | enum v4l2_buf_type type; |
185 | unsigned int inputs; /* for V4L2_BUF_FLAG_INPUT */ | 208 | unsigned int inputs; /* for V4L2_BUF_FLAG_INPUT */ |
@@ -204,12 +227,15 @@ struct videobuf_queue { | |||
204 | 227 | ||
205 | void* videobuf_alloc(unsigned int size); | 228 | void* videobuf_alloc(unsigned int size); |
206 | int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); | 229 | int videobuf_waiton(struct videobuf_buffer *vb, int non_blocking, int intr); |
207 | int videobuf_iolock(struct pci_dev *pci, struct videobuf_buffer *vb, | 230 | int videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb, |
208 | struct v4l2_framebuffer *fbuf); | 231 | struct v4l2_framebuffer *fbuf); |
232 | |||
233 | /* Maps fops to PCI stuff */ | ||
234 | void videobuf_queue_pci(struct videobuf_queue* q); | ||
209 | 235 | ||
210 | void videobuf_queue_init(struct videobuf_queue *q, | 236 | void videobuf_queue_init(struct videobuf_queue *q, |
211 | struct videobuf_queue_ops *ops, | 237 | struct videobuf_queue_ops *ops, |
212 | struct pci_dev *pci, | 238 | void *dev, |
213 | spinlock_t *irqlock, | 239 | spinlock_t *irqlock, |
214 | enum v4l2_buf_type type, | 240 | enum v4l2_buf_type type, |
215 | enum v4l2_field field, | 241 | enum v4l2_field field, |
diff --git a/include/media/wm8775.h b/include/media/wm8775.h new file mode 100644 index 000000000000..60739c5a23ae --- /dev/null +++ b/include/media/wm8775.h | |||
@@ -0,0 +1,35 @@ | |||
1 | /* | ||
2 | wm8775.h - definition for wm8775 inputs and outputs | ||
3 | |||
4 | Copyright (C) 2006 Hans Verkuil (hverkuil@xs4all.nl) | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | You should have received a copy of the GNU General Public License | ||
17 | along with this program; if not, write to the Free Software | ||
18 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
19 | */ | ||
20 | |||
21 | #ifndef _WM8775_H_ | ||
22 | #define _WM8775_H_ | ||
23 | |||
24 | /* The WM8775 has 4 inputs and one output. Zero or more inputs | ||
25 | are multiplexed together to the output. Hence there are | ||
26 | 16 combinations. | ||
27 | If only one input is active (the normal case) then the | ||
28 | input values 1, 2, 4 or 8 should be used. */ | ||
29 | |||
30 | #define WM8775_AIN1 1 | ||
31 | #define WM8775_AIN2 2 | ||
32 | #define WM8775_AIN3 4 | ||
33 | #define WM8775_AIN4 8 | ||
34 | |||
35 | #endif | ||
diff --git a/include/video/pm3fb.h b/include/video/pm3fb.h index 6f4ea808cf74..ac021379ac40 100644 --- a/include/video/pm3fb.h +++ b/include/video/pm3fb.h | |||
@@ -1128,10 +1128,7 @@ | |||
1128 | #endif | 1128 | #endif |
1129 | 1129 | ||
1130 | /* max number of simultaneous board */ | 1130 | /* max number of simultaneous board */ |
1131 | /* warning : make sure module array def's are coherent with PM3_MAX_BOARD */ | ||
1132 | #define PM3_MAX_BOARD 4 | 1131 | #define PM3_MAX_BOARD 4 |
1133 | #define PM3_MAX_BOARD_MODULE_ARRAY_SHORT "1-4h" | ||
1134 | #define PM3_MAX_BOARD_MODULE_ARRAY_STRING "1-4s" | ||
1135 | 1132 | ||
1136 | /* max size of options */ | 1133 | /* max size of options */ |
1137 | #define PM3_OPTIONS_SIZE 256 | 1134 | #define PM3_OPTIONS_SIZE 256 |
diff --git a/init/Kconfig b/init/Kconfig index 1d19fd25204b..05951c1d654e 100644 --- a/init/Kconfig +++ b/init/Kconfig | |||
@@ -470,15 +470,6 @@ config MODULE_FORCE_UNLOAD | |||
470 | rmmod). This is mainly for kernel developers and desperate users. | 470 | rmmod). This is mainly for kernel developers and desperate users. |
471 | If unsure, say N. | 471 | If unsure, say N. |
472 | 472 | ||
473 | config OBSOLETE_MODPARM | ||
474 | bool | ||
475 | default y | ||
476 | depends on MODULES | ||
477 | help | ||
478 | You need this option to use module parameters on modules which | ||
479 | have not been converted to the new module parameter system yet. | ||
480 | If unsure, say Y. | ||
481 | |||
482 | config MODVERSIONS | 473 | config MODVERSIONS |
483 | bool "Module versioning support" | 474 | bool "Module versioning support" |
484 | depends on MODULES | 475 | depends on MODULES |
diff --git a/init/initramfs.c b/init/initramfs.c index 637344b05981..77b934cccefe 100644 --- a/init/initramfs.c +++ b/init/initramfs.c | |||
@@ -506,6 +506,7 @@ void __init populate_rootfs(void) | |||
506 | panic(err); | 506 | panic(err); |
507 | #ifdef CONFIG_BLK_DEV_INITRD | 507 | #ifdef CONFIG_BLK_DEV_INITRD |
508 | if (initrd_start) { | 508 | if (initrd_start) { |
509 | #ifdef CONFIG_BLK_DEV_RAM | ||
509 | int fd; | 510 | int fd; |
510 | printk(KERN_INFO "checking if image is initramfs..."); | 511 | printk(KERN_INFO "checking if image is initramfs..."); |
511 | err = unpack_to_rootfs((char *)initrd_start, | 512 | err = unpack_to_rootfs((char *)initrd_start, |
@@ -525,6 +526,15 @@ void __init populate_rootfs(void) | |||
525 | sys_close(fd); | 526 | sys_close(fd); |
526 | free_initrd(); | 527 | free_initrd(); |
527 | } | 528 | } |
529 | #else | ||
530 | printk(KERN_INFO "Unpacking initramfs..."); | ||
531 | err = unpack_to_rootfs((char *)initrd_start, | ||
532 | initrd_end - initrd_start, 0); | ||
533 | if (err) | ||
534 | panic(err); | ||
535 | printk(" done\n"); | ||
536 | free_initrd(); | ||
537 | #endif | ||
528 | } | 538 | } |
529 | #endif | 539 | #endif |
530 | } | 540 | } |
diff --git a/init/main.c b/init/main.c index 2714e0e7cfec..006dcd547dc2 100644 --- a/init/main.c +++ b/init/main.c | |||
@@ -306,8 +306,6 @@ static int __init rdinit_setup(char *str) | |||
306 | } | 306 | } |
307 | __setup("rdinit=", rdinit_setup); | 307 | __setup("rdinit=", rdinit_setup); |
308 | 308 | ||
309 | extern void setup_arch(char **); | ||
310 | |||
311 | #ifndef CONFIG_SMP | 309 | #ifndef CONFIG_SMP |
312 | 310 | ||
313 | #ifdef CONFIG_X86_LOCAL_APIC | 311 | #ifdef CONFIG_X86_LOCAL_APIC |
@@ -571,17 +569,23 @@ static void __init do_initcalls(void) | |||
571 | int count = preempt_count(); | 569 | int count = preempt_count(); |
572 | 570 | ||
573 | for (call = __initcall_start; call < __initcall_end; call++) { | 571 | for (call = __initcall_start; call < __initcall_end; call++) { |
574 | char *msg; | 572 | char *msg = NULL; |
573 | char msgbuf[40]; | ||
574 | int result; | ||
575 | 575 | ||
576 | if (initcall_debug) { | 576 | if (initcall_debug) { |
577 | printk(KERN_DEBUG "Calling initcall 0x%p", *call); | 577 | printk("Calling initcall 0x%p", *call); |
578 | print_fn_descriptor_symbol(": %s()", (unsigned long) *call); | 578 | print_fn_descriptor_symbol(": %s()", |
579 | (unsigned long) *call); | ||
579 | printk("\n"); | 580 | printk("\n"); |
580 | } | 581 | } |
581 | 582 | ||
582 | (*call)(); | 583 | result = (*call)(); |
583 | 584 | ||
584 | msg = NULL; | 585 | if (result && (result != -ENODEV || initcall_debug)) { |
586 | sprintf(msgbuf, "error code %d", result); | ||
587 | msg = msgbuf; | ||
588 | } | ||
585 | if (preempt_count() != count) { | 589 | if (preempt_count() != count) { |
586 | msg = "preemption imbalance"; | 590 | msg = "preemption imbalance"; |
587 | preempt_count() = count; | 591 | preempt_count() = count; |
@@ -591,8 +595,10 @@ static void __init do_initcalls(void) | |||
591 | local_irq_enable(); | 595 | local_irq_enable(); |
592 | } | 596 | } |
593 | if (msg) { | 597 | if (msg) { |
594 | printk(KERN_WARNING "error in initcall at 0x%p: " | 598 | printk(KERN_WARNING "initcall at 0x%p", *call); |
595 | "returned with %s\n", *call, msg); | 599 | print_fn_descriptor_symbol(": %s()", |
600 | (unsigned long) *call); | ||
601 | printk(": returned with %s\n", msg); | ||
596 | } | 602 | } |
597 | } | 603 | } |
598 | 604 | ||
diff --git a/kernel/capability.c b/kernel/capability.c index bfa3c92e16f2..1a4d8a40d3f9 100644 --- a/kernel/capability.c +++ b/kernel/capability.c | |||
@@ -233,3 +233,19 @@ out: | |||
233 | 233 | ||
234 | return ret; | 234 | return ret; |
235 | } | 235 | } |
236 | |||
237 | int __capable(struct task_struct *t, int cap) | ||
238 | { | ||
239 | if (security_capable(t, cap) == 0) { | ||
240 | t->flags |= PF_SUPERPRIV; | ||
241 | return 1; | ||
242 | } | ||
243 | return 0; | ||
244 | } | ||
245 | EXPORT_SYMBOL(__capable); | ||
246 | |||
247 | int capable(int cap) | ||
248 | { | ||
249 | return __capable(current, cap); | ||
250 | } | ||
251 | EXPORT_SYMBOL(capable); | ||
diff --git a/kernel/irq/Makefile b/kernel/irq/Makefile index 49378738ff5e..2b33f852be3e 100644 --- a/kernel/irq/Makefile +++ b/kernel/irq/Makefile | |||
@@ -1,5 +1,4 @@ | |||
1 | 1 | ||
2 | obj-y := handle.o manage.o spurious.o | 2 | obj-y := handle.o manage.o spurious.o migration.o |
3 | obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o | 3 | obj-$(CONFIG_GENERIC_IRQ_PROBE) += autoprobe.o |
4 | obj-$(CONFIG_PROC_FS) += proc.o | 4 | obj-$(CONFIG_PROC_FS) += proc.o |
5 | |||
diff --git a/kernel/irq/manage.c b/kernel/irq/manage.c index 97d5559997d2..6edfcef291e8 100644 --- a/kernel/irq/manage.c +++ b/kernel/irq/manage.c | |||
@@ -204,10 +204,14 @@ int setup_irq(unsigned int irq, struct irqaction * new) | |||
204 | p = &desc->action; | 204 | p = &desc->action; |
205 | if ((old = *p) != NULL) { | 205 | if ((old = *p) != NULL) { |
206 | /* Can't share interrupts unless both agree to */ | 206 | /* Can't share interrupts unless both agree to */ |
207 | if (!(old->flags & new->flags & SA_SHIRQ)) { | 207 | if (!(old->flags & new->flags & SA_SHIRQ)) |
208 | spin_unlock_irqrestore(&desc->lock,flags); | 208 | goto mismatch; |
209 | return -EBUSY; | 209 | |
210 | } | 210 | #if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ) |
211 | /* All handlers must agree on per-cpuness */ | ||
212 | if ((old->flags & IRQ_PER_CPU) != (new->flags & IRQ_PER_CPU)) | ||
213 | goto mismatch; | ||
214 | #endif | ||
211 | 215 | ||
212 | /* add new interrupt at end of irq queue */ | 216 | /* add new interrupt at end of irq queue */ |
213 | do { | 217 | do { |
@@ -218,7 +222,10 @@ int setup_irq(unsigned int irq, struct irqaction * new) | |||
218 | } | 222 | } |
219 | 223 | ||
220 | *p = new; | 224 | *p = new; |
221 | 225 | #if defined(ARCH_HAS_IRQ_PER_CPU) && defined(SA_PERCPU_IRQ) | |
226 | if (new->flags & SA_PERCPU_IRQ) | ||
227 | desc->status |= IRQ_PER_CPU; | ||
228 | #endif | ||
222 | if (!shared) { | 229 | if (!shared) { |
223 | desc->depth = 0; | 230 | desc->depth = 0; |
224 | desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | | 231 | desc->status &= ~(IRQ_DISABLED | IRQ_AUTODETECT | |
@@ -236,6 +243,12 @@ int setup_irq(unsigned int irq, struct irqaction * new) | |||
236 | register_handler_proc(irq, new); | 243 | register_handler_proc(irq, new); |
237 | 244 | ||
238 | return 0; | 245 | return 0; |
246 | |||
247 | mismatch: | ||
248 | spin_unlock_irqrestore(&desc->lock, flags); | ||
249 | printk(KERN_ERR "%s: irq handler mismatch\n", __FUNCTION__); | ||
250 | dump_stack(); | ||
251 | return -EBUSY; | ||
239 | } | 252 | } |
240 | 253 | ||
241 | /** | 254 | /** |
diff --git a/kernel/irq/migration.c b/kernel/irq/migration.c new file mode 100644 index 000000000000..52a8655fa080 --- /dev/null +++ b/kernel/irq/migration.c | |||
@@ -0,0 +1,65 @@ | |||
1 | #include <linux/irq.h> | ||
2 | |||
3 | #if defined(CONFIG_GENERIC_PENDING_IRQ) | ||
4 | |||
5 | void set_pending_irq(unsigned int irq, cpumask_t mask) | ||
6 | { | ||
7 | irq_desc_t *desc = irq_desc + irq; | ||
8 | unsigned long flags; | ||
9 | |||
10 | spin_lock_irqsave(&desc->lock, flags); | ||
11 | desc->move_irq = 1; | ||
12 | pending_irq_cpumask[irq] = mask; | ||
13 | spin_unlock_irqrestore(&desc->lock, flags); | ||
14 | } | ||
15 | |||
16 | void move_native_irq(int irq) | ||
17 | { | ||
18 | cpumask_t tmp; | ||
19 | irq_desc_t *desc = irq_descp(irq); | ||
20 | |||
21 | if (likely(!desc->move_irq)) | ||
22 | return; | ||
23 | |||
24 | /* | ||
25 | * Paranoia: cpu-local interrupts shouldn't be calling in here anyway. | ||
26 | */ | ||
27 | if (CHECK_IRQ_PER_CPU(desc->status)) { | ||
28 | WARN_ON(1); | ||
29 | return; | ||
30 | } | ||
31 | |||
32 | desc->move_irq = 0; | ||
33 | |||
34 | if (likely(cpus_empty(pending_irq_cpumask[irq]))) | ||
35 | return; | ||
36 | |||
37 | if (!desc->handler->set_affinity) | ||
38 | return; | ||
39 | |||
40 | assert_spin_locked(&desc->lock); | ||
41 | |||
42 | cpus_and(tmp, pending_irq_cpumask[irq], cpu_online_map); | ||
43 | |||
44 | /* | ||
45 | * If there was a valid mask to work with, please | ||
46 | * do the disable, re-program, enable sequence. | ||
47 | * This is *not* particularly important for level triggered | ||
48 | * but in a edge trigger case, we might be setting rte | ||
49 | * when an active trigger is comming in. This could | ||
50 | * cause some ioapics to mal-function. | ||
51 | * Being paranoid i guess! | ||
52 | */ | ||
53 | if (unlikely(!cpus_empty(tmp))) { | ||
54 | if (likely(!(desc->status & IRQ_DISABLED))) | ||
55 | desc->handler->disable(irq); | ||
56 | |||
57 | desc->handler->set_affinity(irq,tmp); | ||
58 | |||
59 | if (likely(!(desc->status & IRQ_DISABLED))) | ||
60 | desc->handler->enable(irq); | ||
61 | } | ||
62 | cpus_clear(pending_irq_cpumask[irq]); | ||
63 | } | ||
64 | |||
65 | #endif | ||
diff --git a/kernel/itimer.c b/kernel/itimer.c index 379be2f8c84c..680e6b70c872 100644 --- a/kernel/itimer.c +++ b/kernel/itimer.c | |||
@@ -143,6 +143,60 @@ int it_real_fn(void *data) | |||
143 | return HRTIMER_NORESTART; | 143 | return HRTIMER_NORESTART; |
144 | } | 144 | } |
145 | 145 | ||
146 | /* | ||
147 | * We do not care about correctness. We just sanitize the values so | ||
148 | * the ktime_t operations which expect normalized values do not | ||
149 | * break. This converts negative values to long timeouts similar to | ||
150 | * the code in kernel versions < 2.6.16 | ||
151 | * | ||
152 | * Print a limited number of warning messages when an invalid timeval | ||
153 | * is detected. | ||
154 | */ | ||
155 | static void fixup_timeval(struct timeval *tv, int interval) | ||
156 | { | ||
157 | static int warnlimit = 10; | ||
158 | unsigned long tmp; | ||
159 | |||
160 | if (warnlimit > 0) { | ||
161 | warnlimit--; | ||
162 | printk(KERN_WARNING | ||
163 | "setitimer: %s (pid = %d) provided " | ||
164 | "invalid timeval %s: tv_sec = %ld tv_usec = %ld\n", | ||
165 | current->comm, current->pid, | ||
166 | interval ? "it_interval" : "it_value", | ||
167 | tv->tv_sec, (long) tv->tv_usec); | ||
168 | } | ||
169 | |||
170 | tmp = tv->tv_usec; | ||
171 | if (tmp >= USEC_PER_SEC) { | ||
172 | tv->tv_usec = tmp % USEC_PER_SEC; | ||
173 | tv->tv_sec += tmp / USEC_PER_SEC; | ||
174 | } | ||
175 | |||
176 | tmp = tv->tv_sec; | ||
177 | if (tmp > LONG_MAX) | ||
178 | tv->tv_sec = LONG_MAX; | ||
179 | } | ||
180 | |||
181 | /* | ||
182 | * Returns true if the timeval is in canonical form | ||
183 | */ | ||
184 | #define timeval_valid(t) \ | ||
185 | (((t)->tv_sec >= 0) && (((unsigned long) (t)->tv_usec) < USEC_PER_SEC)) | ||
186 | |||
187 | /* | ||
188 | * Check for invalid timevals, sanitize them and print a limited | ||
189 | * number of warnings. | ||
190 | */ | ||
191 | static void check_itimerval(struct itimerval *value) { | ||
192 | |||
193 | if (unlikely(!timeval_valid(&value->it_value))) | ||
194 | fixup_timeval(&value->it_value, 0); | ||
195 | |||
196 | if (unlikely(!timeval_valid(&value->it_interval))) | ||
197 | fixup_timeval(&value->it_interval, 1); | ||
198 | } | ||
199 | |||
146 | int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) | 200 | int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) |
147 | { | 201 | { |
148 | struct task_struct *tsk = current; | 202 | struct task_struct *tsk = current; |
@@ -150,6 +204,18 @@ int do_setitimer(int which, struct itimerval *value, struct itimerval *ovalue) | |||
150 | ktime_t expires; | 204 | ktime_t expires; |
151 | cputime_t cval, cinterval, nval, ninterval; | 205 | cputime_t cval, cinterval, nval, ninterval; |
152 | 206 | ||
207 | /* | ||
208 | * Validate the timevals in value. | ||
209 | * | ||
210 | * Note: Although the spec requires that invalid values shall | ||
211 | * return -EINVAL, we just fixup the value and print a limited | ||
212 | * number of warnings in order not to break users of this | ||
213 | * historical misfeature. | ||
214 | * | ||
215 | * Scheduled for replacement in March 2007 | ||
216 | */ | ||
217 | check_itimerval(value); | ||
218 | |||
153 | switch (which) { | 219 | switch (which) { |
154 | case ITIMER_REAL: | 220 | case ITIMER_REAL: |
155 | again: | 221 | again: |
@@ -226,6 +292,43 @@ again: | |||
226 | return 0; | 292 | return 0; |
227 | } | 293 | } |
228 | 294 | ||
295 | /** | ||
296 | * alarm_setitimer - set alarm in seconds | ||
297 | * | ||
298 | * @seconds: number of seconds until alarm | ||
299 | * 0 disables the alarm | ||
300 | * | ||
301 | * Returns the remaining time in seconds of a pending timer or 0 when | ||
302 | * the timer is not active. | ||
303 | * | ||
304 | * On 32 bit machines the seconds value is limited to (INT_MAX/2) to avoid | ||
305 | * negative timeval settings which would cause immediate expiry. | ||
306 | */ | ||
307 | unsigned int alarm_setitimer(unsigned int seconds) | ||
308 | { | ||
309 | struct itimerval it_new, it_old; | ||
310 | |||
311 | #if BITS_PER_LONG < 64 | ||
312 | if (seconds > INT_MAX) | ||
313 | seconds = INT_MAX; | ||
314 | #endif | ||
315 | it_new.it_value.tv_sec = seconds; | ||
316 | it_new.it_value.tv_usec = 0; | ||
317 | it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0; | ||
318 | |||
319 | do_setitimer(ITIMER_REAL, &it_new, &it_old); | ||
320 | |||
321 | /* | ||
322 | * We can't return 0 if we have an alarm pending ... And we'd | ||
323 | * better return too much than too little anyway | ||
324 | */ | ||
325 | if ((!it_old.it_value.tv_sec && it_old.it_value.tv_usec) || | ||
326 | it_old.it_value.tv_usec >= 500000) | ||
327 | it_old.it_value.tv_sec++; | ||
328 | |||
329 | return it_old.it_value.tv_sec; | ||
330 | } | ||
331 | |||
229 | asmlinkage long sys_setitimer(int which, | 332 | asmlinkage long sys_setitimer(int which, |
230 | struct itimerval __user *value, | 333 | struct itimerval __user *value, |
231 | struct itimerval __user *ovalue) | 334 | struct itimerval __user *ovalue) |
diff --git a/kernel/kthread.c b/kernel/kthread.c index 6a5373868a98..c5f3c6613b6d 100644 --- a/kernel/kthread.c +++ b/kernel/kthread.c | |||
@@ -115,7 +115,9 @@ static void keventd_create_kthread(void *_create) | |||
115 | create->result = ERR_PTR(pid); | 115 | create->result = ERR_PTR(pid); |
116 | } else { | 116 | } else { |
117 | wait_for_completion(&create->started); | 117 | wait_for_completion(&create->started); |
118 | read_lock(&tasklist_lock); | ||
118 | create->result = find_task_by_pid(pid); | 119 | create->result = find_task_by_pid(pid); |
120 | read_unlock(&tasklist_lock); | ||
119 | } | 121 | } |
120 | complete(&create->done); | 122 | complete(&create->done); |
121 | } | 123 | } |
diff --git a/kernel/module.c b/kernel/module.c index 54623c714bba..ddfe45ac2fd1 100644 --- a/kernel/module.c +++ b/kernel/module.c | |||
@@ -233,24 +233,6 @@ static unsigned long __find_symbol(const char *name, | |||
233 | return 0; | 233 | return 0; |
234 | } | 234 | } |
235 | 235 | ||
236 | /* Find a symbol in this elf symbol table */ | ||
237 | static unsigned long find_local_symbol(Elf_Shdr *sechdrs, | ||
238 | unsigned int symindex, | ||
239 | const char *strtab, | ||
240 | const char *name) | ||
241 | { | ||
242 | unsigned int i; | ||
243 | Elf_Sym *sym = (void *)sechdrs[symindex].sh_addr; | ||
244 | |||
245 | /* Search (defined) internal symbols first. */ | ||
246 | for (i = 1; i < sechdrs[symindex].sh_size/sizeof(*sym); i++) { | ||
247 | if (sym[i].st_shndx != SHN_UNDEF | ||
248 | && strcmp(name, strtab + sym[i].st_name) == 0) | ||
249 | return sym[i].st_value; | ||
250 | } | ||
251 | return 0; | ||
252 | } | ||
253 | |||
254 | /* Search for module by name: must hold module_mutex. */ | 236 | /* Search for module by name: must hold module_mutex. */ |
255 | static struct module *find_module(const char *name) | 237 | static struct module *find_module(const char *name) |
256 | { | 238 | { |
@@ -785,139 +767,6 @@ static struct module_attribute *modinfo_attrs[] = { | |||
785 | NULL, | 767 | NULL, |
786 | }; | 768 | }; |
787 | 769 | ||
788 | #ifdef CONFIG_OBSOLETE_MODPARM | ||
789 | /* Bounds checking done below */ | ||
790 | static int obsparm_copy_string(const char *val, struct kernel_param *kp) | ||
791 | { | ||
792 | strcpy(kp->arg, val); | ||
793 | return 0; | ||
794 | } | ||
795 | |||
796 | static int set_obsolete(const char *val, struct kernel_param *kp) | ||
797 | { | ||
798 | unsigned int min, max; | ||
799 | unsigned int size, maxsize; | ||
800 | int dummy; | ||
801 | char *endp; | ||
802 | const char *p; | ||
803 | struct obsolete_modparm *obsparm = kp->arg; | ||
804 | |||
805 | if (!val) { | ||
806 | printk(KERN_ERR "Parameter %s needs an argument\n", kp->name); | ||
807 | return -EINVAL; | ||
808 | } | ||
809 | |||
810 | /* type is: [min[-max]]{b,h,i,l,s} */ | ||
811 | p = obsparm->type; | ||
812 | min = simple_strtol(p, &endp, 10); | ||
813 | if (endp == obsparm->type) | ||
814 | min = max = 1; | ||
815 | else if (*endp == '-') { | ||
816 | p = endp+1; | ||
817 | max = simple_strtol(p, &endp, 10); | ||
818 | } else | ||
819 | max = min; | ||
820 | switch (*endp) { | ||
821 | case 'b': | ||
822 | return param_array(kp->name, val, min, max, obsparm->addr, | ||
823 | 1, param_set_byte, &dummy); | ||
824 | case 'h': | ||
825 | return param_array(kp->name, val, min, max, obsparm->addr, | ||
826 | sizeof(short), param_set_short, &dummy); | ||
827 | case 'i': | ||
828 | return param_array(kp->name, val, min, max, obsparm->addr, | ||
829 | sizeof(int), param_set_int, &dummy); | ||
830 | case 'l': | ||
831 | return param_array(kp->name, val, min, max, obsparm->addr, | ||
832 | sizeof(long), param_set_long, &dummy); | ||
833 | case 's': | ||
834 | return param_array(kp->name, val, min, max, obsparm->addr, | ||
835 | sizeof(char *), param_set_charp, &dummy); | ||
836 | |||
837 | case 'c': | ||
838 | /* Undocumented: 1-5c50 means 1-5 strings of up to 49 chars, | ||
839 | and the decl is "char xxx[5][50];" */ | ||
840 | p = endp+1; | ||
841 | maxsize = simple_strtol(p, &endp, 10); | ||
842 | /* We check lengths here (yes, this is a hack). */ | ||
843 | p = val; | ||
844 | while (p[size = strcspn(p, ",")]) { | ||
845 | if (size >= maxsize) | ||
846 | goto oversize; | ||
847 | p += size+1; | ||
848 | } | ||
849 | if (size >= maxsize) | ||
850 | goto oversize; | ||
851 | return param_array(kp->name, val, min, max, obsparm->addr, | ||
852 | maxsize, obsparm_copy_string, &dummy); | ||
853 | } | ||
854 | printk(KERN_ERR "Unknown obsolete parameter type %s\n", obsparm->type); | ||
855 | return -EINVAL; | ||
856 | oversize: | ||
857 | printk(KERN_ERR | ||
858 | "Parameter %s doesn't fit in %u chars.\n", kp->name, maxsize); | ||
859 | return -EINVAL; | ||
860 | } | ||
861 | |||
862 | static int obsolete_params(const char *name, | ||
863 | char *args, | ||
864 | struct obsolete_modparm obsparm[], | ||
865 | unsigned int num, | ||
866 | Elf_Shdr *sechdrs, | ||
867 | unsigned int symindex, | ||
868 | const char *strtab) | ||
869 | { | ||
870 | struct kernel_param *kp; | ||
871 | unsigned int i; | ||
872 | int ret; | ||
873 | |||
874 | kp = kmalloc(sizeof(kp[0]) * num, GFP_KERNEL); | ||
875 | if (!kp) | ||
876 | return -ENOMEM; | ||
877 | |||
878 | for (i = 0; i < num; i++) { | ||
879 | char sym_name[128 + sizeof(MODULE_SYMBOL_PREFIX)]; | ||
880 | |||
881 | snprintf(sym_name, sizeof(sym_name), "%s%s", | ||
882 | MODULE_SYMBOL_PREFIX, obsparm[i].name); | ||
883 | |||
884 | kp[i].name = obsparm[i].name; | ||
885 | kp[i].perm = 000; | ||
886 | kp[i].set = set_obsolete; | ||
887 | kp[i].get = NULL; | ||
888 | obsparm[i].addr | ||
889 | = (void *)find_local_symbol(sechdrs, symindex, strtab, | ||
890 | sym_name); | ||
891 | if (!obsparm[i].addr) { | ||
892 | printk("%s: falsely claims to have parameter %s\n", | ||
893 | name, obsparm[i].name); | ||
894 | ret = -EINVAL; | ||
895 | goto out; | ||
896 | } | ||
897 | kp[i].arg = &obsparm[i]; | ||
898 | } | ||
899 | |||
900 | ret = parse_args(name, args, kp, num, NULL); | ||
901 | out: | ||
902 | kfree(kp); | ||
903 | return ret; | ||
904 | } | ||
905 | #else | ||
906 | static int obsolete_params(const char *name, | ||
907 | char *args, | ||
908 | struct obsolete_modparm obsparm[], | ||
909 | unsigned int num, | ||
910 | Elf_Shdr *sechdrs, | ||
911 | unsigned int symindex, | ||
912 | const char *strtab) | ||
913 | { | ||
914 | if (num != 0) | ||
915 | printk(KERN_WARNING "%s: Ignoring obsolete parameters\n", | ||
916 | name); | ||
917 | return 0; | ||
918 | } | ||
919 | #endif /* CONFIG_OBSOLETE_MODPARM */ | ||
920 | |||
921 | static const char vermagic[] = VERMAGIC_STRING; | 770 | static const char vermagic[] = VERMAGIC_STRING; |
922 | 771 | ||
923 | #ifdef CONFIG_MODVERSIONS | 772 | #ifdef CONFIG_MODVERSIONS |
@@ -1874,27 +1723,17 @@ static struct module *load_module(void __user *umod, | |||
1874 | set_fs(old_fs); | 1723 | set_fs(old_fs); |
1875 | 1724 | ||
1876 | mod->args = args; | 1725 | mod->args = args; |
1877 | if (obsparmindex) { | 1726 | if (obsparmindex) |
1878 | err = obsolete_params(mod->name, mod->args, | 1727 | printk(KERN_WARNING "%s: Ignoring obsolete parameters\n", |
1879 | (struct obsolete_modparm *) | 1728 | mod->name); |
1880 | sechdrs[obsparmindex].sh_addr, | 1729 | |
1881 | sechdrs[obsparmindex].sh_size | 1730 | /* Size of section 0 is 0, so this works well if no params */ |
1882 | / sizeof(struct obsolete_modparm), | 1731 | err = parse_args(mod->name, mod->args, |
1883 | sechdrs, symindex, | 1732 | (struct kernel_param *) |
1884 | (char *)sechdrs[strindex].sh_addr); | 1733 | sechdrs[setupindex].sh_addr, |
1885 | if (setupindex) | 1734 | sechdrs[setupindex].sh_size |
1886 | printk(KERN_WARNING "%s: Ignoring new-style " | 1735 | / sizeof(struct kernel_param), |
1887 | "parameters in presence of obsolete ones\n", | 1736 | NULL); |
1888 | mod->name); | ||
1889 | } else { | ||
1890 | /* Size of section 0 is 0, so this works well if no params */ | ||
1891 | err = parse_args(mod->name, mod->args, | ||
1892 | (struct kernel_param *) | ||
1893 | sechdrs[setupindex].sh_addr, | ||
1894 | sechdrs[setupindex].sh_size | ||
1895 | / sizeof(struct kernel_param), | ||
1896 | NULL); | ||
1897 | } | ||
1898 | if (err < 0) | 1737 | if (err < 0) |
1899 | goto arch_cleanup; | 1738 | goto arch_cleanup; |
1900 | 1739 | ||
diff --git a/kernel/params.c b/kernel/params.c index a29150582310..9de637a5c8bc 100644 --- a/kernel/params.c +++ b/kernel/params.c | |||
@@ -265,12 +265,12 @@ int param_get_invbool(char *buffer, struct kernel_param *kp) | |||
265 | } | 265 | } |
266 | 266 | ||
267 | /* We cheat here and temporarily mangle the string. */ | 267 | /* We cheat here and temporarily mangle the string. */ |
268 | int param_array(const char *name, | 268 | static int param_array(const char *name, |
269 | const char *val, | 269 | const char *val, |
270 | unsigned int min, unsigned int max, | 270 | unsigned int min, unsigned int max, |
271 | void *elem, int elemsize, | 271 | void *elem, int elemsize, |
272 | int (*set)(const char *, struct kernel_param *kp), | 272 | int (*set)(const char *, struct kernel_param *kp), |
273 | int *num) | 273 | int *num) |
274 | { | 274 | { |
275 | int ret; | 275 | int ret; |
276 | struct kernel_param kp; | 276 | struct kernel_param kp; |
diff --git a/kernel/power/smp.c b/kernel/power/smp.c index 911fc62b8225..5957312b2d68 100644 --- a/kernel/power/smp.c +++ b/kernel/power/smp.c | |||
@@ -49,9 +49,7 @@ void enable_nonboot_cpus(void) | |||
49 | 49 | ||
50 | printk("Thawing cpus ...\n"); | 50 | printk("Thawing cpus ...\n"); |
51 | for_each_cpu_mask(cpu, frozen_cpus) { | 51 | for_each_cpu_mask(cpu, frozen_cpus) { |
52 | error = smp_prepare_cpu(cpu); | 52 | error = cpu_up(cpu); |
53 | if (!error) | ||
54 | error = cpu_up(cpu); | ||
55 | if (!error) { | 53 | if (!error) { |
56 | printk("CPU%d is up\n", cpu); | 54 | printk("CPU%d is up\n", cpu); |
57 | continue; | 55 | continue; |
diff --git a/kernel/rcutorture.c b/kernel/rcutorture.c index 9a1fa8894b95..b4b362b5baf5 100644 --- a/kernel/rcutorture.c +++ b/kernel/rcutorture.c | |||
@@ -54,15 +54,15 @@ static int verbose; /* Print more debug info. */ | |||
54 | static int test_no_idle_hz; /* Test RCU's support for tickless idle CPUs. */ | 54 | static int test_no_idle_hz; /* Test RCU's support for tickless idle CPUs. */ |
55 | static int shuffle_interval = 5; /* Interval between shuffles (in sec)*/ | 55 | static int shuffle_interval = 5; /* Interval between shuffles (in sec)*/ |
56 | 56 | ||
57 | MODULE_PARM(nreaders, "i"); | 57 | module_param(nreaders, int, 0); |
58 | MODULE_PARM_DESC(nreaders, "Number of RCU reader threads"); | 58 | MODULE_PARM_DESC(nreaders, "Number of RCU reader threads"); |
59 | MODULE_PARM(stat_interval, "i"); | 59 | module_param(stat_interval, int, 0); |
60 | MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s"); | 60 | MODULE_PARM_DESC(stat_interval, "Number of seconds between stats printk()s"); |
61 | MODULE_PARM(verbose, "i"); | 61 | module_param(verbose, bool, 0); |
62 | MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s"); | 62 | MODULE_PARM_DESC(verbose, "Enable verbose debugging printk()s"); |
63 | MODULE_PARM(test_no_idle_hz, "i"); | 63 | module_param(test_no_idle_hz, bool, 0); |
64 | MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs"); | 64 | MODULE_PARM_DESC(test_no_idle_hz, "Test support for tickless idle CPUs"); |
65 | MODULE_PARM(shuffle_interval, "i"); | 65 | module_param(shuffle_interval, int, 0); |
66 | MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles"); | 66 | MODULE_PARM_DESC(shuffle_interval, "Number of seconds between shuffles"); |
67 | #define TORTURE_FLAG "rcutorture: " | 67 | #define TORTURE_FLAG "rcutorture: " |
68 | #define PRINTK_STRING(s) \ | 68 | #define PRINTK_STRING(s) \ |
diff --git a/kernel/softlockup.c b/kernel/softlockup.c index dd9524fa649a..d9b3d5847ed8 100644 --- a/kernel/softlockup.c +++ b/kernel/softlockup.c | |||
@@ -118,6 +118,7 @@ cpu_callback(struct notifier_block *nfb, unsigned long action, void *hcpu) | |||
118 | printk("watchdog for %i failed\n", hotcpu); | 118 | printk("watchdog for %i failed\n", hotcpu); |
119 | return NOTIFY_BAD; | 119 | return NOTIFY_BAD; |
120 | } | 120 | } |
121 | per_cpu(touch_timestamp, hotcpu) = jiffies; | ||
121 | per_cpu(watchdog_task, hotcpu) = p; | 122 | per_cpu(watchdog_task, hotcpu) = p; |
122 | kthread_bind(p, hotcpu); | 123 | kthread_bind(p, hotcpu); |
123 | break; | 124 | break; |
diff --git a/kernel/sys.c b/kernel/sys.c index 19d058be49d4..38bc73ede2ba 100644 --- a/kernel/sys.c +++ b/kernel/sys.c | |||
@@ -224,18 +224,6 @@ int unregister_reboot_notifier(struct notifier_block * nb) | |||
224 | 224 | ||
225 | EXPORT_SYMBOL(unregister_reboot_notifier); | 225 | EXPORT_SYMBOL(unregister_reboot_notifier); |
226 | 226 | ||
227 | #ifndef CONFIG_SECURITY | ||
228 | int capable(int cap) | ||
229 | { | ||
230 | if (cap_raised(current->cap_effective, cap)) { | ||
231 | current->flags |= PF_SUPERPRIV; | ||
232 | return 1; | ||
233 | } | ||
234 | return 0; | ||
235 | } | ||
236 | EXPORT_SYMBOL(capable); | ||
237 | #endif | ||
238 | |||
239 | static int set_one_prio(struct task_struct *p, int niceval, int error) | 227 | static int set_one_prio(struct task_struct *p, int niceval, int error) |
240 | { | 228 | { |
241 | int no_nice; | 229 | int no_nice; |
@@ -1375,7 +1363,7 @@ static void groups_sort(struct group_info *group_info) | |||
1375 | /* a simple bsearch */ | 1363 | /* a simple bsearch */ |
1376 | int groups_search(struct group_info *group_info, gid_t grp) | 1364 | int groups_search(struct group_info *group_info, gid_t grp) |
1377 | { | 1365 | { |
1378 | int left, right; | 1366 | unsigned int left, right; |
1379 | 1367 | ||
1380 | if (!group_info) | 1368 | if (!group_info) |
1381 | return 0; | 1369 | return 0; |
@@ -1383,7 +1371,7 @@ int groups_search(struct group_info *group_info, gid_t grp) | |||
1383 | left = 0; | 1371 | left = 0; |
1384 | right = group_info->ngroups; | 1372 | right = group_info->ngroups; |
1385 | while (left < right) { | 1373 | while (left < right) { |
1386 | int mid = (left+right)/2; | 1374 | unsigned int mid = (left+right)/2; |
1387 | int cmp = grp - GROUP_AT(group_info, mid); | 1375 | int cmp = grp - GROUP_AT(group_info, mid); |
1388 | if (cmp > 0) | 1376 | if (cmp > 0) |
1389 | left = mid + 1; | 1377 | left = mid + 1; |
@@ -1433,7 +1421,6 @@ asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist) | |||
1433 | return -EINVAL; | 1421 | return -EINVAL; |
1434 | 1422 | ||
1435 | /* no need to grab task_lock here; it cannot change */ | 1423 | /* no need to grab task_lock here; it cannot change */ |
1436 | get_group_info(current->group_info); | ||
1437 | i = current->group_info->ngroups; | 1424 | i = current->group_info->ngroups; |
1438 | if (gidsetsize) { | 1425 | if (gidsetsize) { |
1439 | if (i > gidsetsize) { | 1426 | if (i > gidsetsize) { |
@@ -1446,7 +1433,6 @@ asmlinkage long sys_getgroups(int gidsetsize, gid_t __user *grouplist) | |||
1446 | } | 1433 | } |
1447 | } | 1434 | } |
1448 | out: | 1435 | out: |
1449 | put_group_info(current->group_info); | ||
1450 | return i; | 1436 | return i; |
1451 | } | 1437 | } |
1452 | 1438 | ||
@@ -1487,9 +1473,7 @@ int in_group_p(gid_t grp) | |||
1487 | { | 1473 | { |
1488 | int retval = 1; | 1474 | int retval = 1; |
1489 | if (grp != current->fsgid) { | 1475 | if (grp != current->fsgid) { |
1490 | get_group_info(current->group_info); | ||
1491 | retval = groups_search(current->group_info, grp); | 1476 | retval = groups_search(current->group_info, grp); |
1492 | put_group_info(current->group_info); | ||
1493 | } | 1477 | } |
1494 | return retval; | 1478 | return retval; |
1495 | } | 1479 | } |
@@ -1500,9 +1484,7 @@ int in_egroup_p(gid_t grp) | |||
1500 | { | 1484 | { |
1501 | int retval = 1; | 1485 | int retval = 1; |
1502 | if (grp != current->egid) { | 1486 | if (grp != current->egid) { |
1503 | get_group_info(current->group_info); | ||
1504 | retval = groups_search(current->group_info, grp); | 1487 | retval = groups_search(current->group_info, grp); |
1505 | put_group_info(current->group_info); | ||
1506 | } | 1488 | } |
1507 | return retval; | 1489 | return retval; |
1508 | } | 1490 | } |
diff --git a/kernel/time.c b/kernel/time.c index 804539165d8b..e00a97b77241 100644 --- a/kernel/time.c +++ b/kernel/time.c | |||
@@ -202,24 +202,6 @@ asmlinkage long sys_settimeofday(struct timeval __user *tv, | |||
202 | return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL); | 202 | return do_sys_settimeofday(tv ? &new_ts : NULL, tz ? &new_tz : NULL); |
203 | } | 203 | } |
204 | 204 | ||
205 | long pps_offset; /* pps time offset (us) */ | ||
206 | long pps_jitter = MAXTIME; /* time dispersion (jitter) (us) */ | ||
207 | |||
208 | long pps_freq; /* frequency offset (scaled ppm) */ | ||
209 | long pps_stabil = MAXFREQ; /* frequency dispersion (scaled ppm) */ | ||
210 | |||
211 | long pps_valid = PPS_VALID; /* pps signal watchdog counter */ | ||
212 | |||
213 | int pps_shift = PPS_SHIFT; /* interval duration (s) (shift) */ | ||
214 | |||
215 | long pps_jitcnt; /* jitter limit exceeded */ | ||
216 | long pps_calcnt; /* calibration intervals */ | ||
217 | long pps_errcnt; /* calibration errors */ | ||
218 | long pps_stbcnt; /* stability limit exceeded */ | ||
219 | |||
220 | /* hook for a loadable hardpps kernel module */ | ||
221 | void (*hardpps_ptr)(struct timeval *); | ||
222 | |||
223 | /* we call this to notify the arch when the clock is being | 205 | /* we call this to notify the arch when the clock is being |
224 | * controlled. If no such arch routine, do nothing. | 206 | * controlled. If no such arch routine, do nothing. |
225 | */ | 207 | */ |
@@ -279,7 +261,7 @@ int do_adjtimex(struct timex *txc) | |||
279 | result = -EINVAL; | 261 | result = -EINVAL; |
280 | goto leave; | 262 | goto leave; |
281 | } | 263 | } |
282 | time_freq = txc->freq - pps_freq; | 264 | time_freq = txc->freq; |
283 | } | 265 | } |
284 | 266 | ||
285 | if (txc->modes & ADJ_MAXERROR) { | 267 | if (txc->modes & ADJ_MAXERROR) { |
@@ -312,10 +294,8 @@ int do_adjtimex(struct timex *txc) | |||
312 | if ((time_next_adjust = txc->offset) == 0) | 294 | if ((time_next_adjust = txc->offset) == 0) |
313 | time_adjust = 0; | 295 | time_adjust = 0; |
314 | } | 296 | } |
315 | else if ( time_status & (STA_PLL | STA_PPSTIME) ) { | 297 | else if (time_status & STA_PLL) { |
316 | ltemp = (time_status & (STA_PPSTIME | STA_PPSSIGNAL)) == | 298 | ltemp = txc->offset; |
317 | (STA_PPSTIME | STA_PPSSIGNAL) ? | ||
318 | pps_offset : txc->offset; | ||
319 | 299 | ||
320 | /* | 300 | /* |
321 | * Scale the phase adjustment and | 301 | * Scale the phase adjustment and |
@@ -356,23 +336,14 @@ int do_adjtimex(struct timex *txc) | |||
356 | } | 336 | } |
357 | time_freq = min(time_freq, time_tolerance); | 337 | time_freq = min(time_freq, time_tolerance); |
358 | time_freq = max(time_freq, -time_tolerance); | 338 | time_freq = max(time_freq, -time_tolerance); |
359 | } /* STA_PLL || STA_PPSTIME */ | 339 | } /* STA_PLL */ |
360 | } /* txc->modes & ADJ_OFFSET */ | 340 | } /* txc->modes & ADJ_OFFSET */ |
361 | if (txc->modes & ADJ_TICK) { | 341 | if (txc->modes & ADJ_TICK) { |
362 | tick_usec = txc->tick; | 342 | tick_usec = txc->tick; |
363 | tick_nsec = TICK_USEC_TO_NSEC(tick_usec); | 343 | tick_nsec = TICK_USEC_TO_NSEC(tick_usec); |
364 | } | 344 | } |
365 | } /* txc->modes */ | 345 | } /* txc->modes */ |
366 | leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0 | 346 | leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0) |
367 | || ((time_status & (STA_PPSFREQ|STA_PPSTIME)) != 0 | ||
368 | && (time_status & STA_PPSSIGNAL) == 0) | ||
369 | /* p. 24, (b) */ | ||
370 | || ((time_status & (STA_PPSTIME|STA_PPSJITTER)) | ||
371 | == (STA_PPSTIME|STA_PPSJITTER)) | ||
372 | /* p. 24, (c) */ | ||
373 | || ((time_status & STA_PPSFREQ) != 0 | ||
374 | && (time_status & (STA_PPSWANDER|STA_PPSERROR)) != 0)) | ||
375 | /* p. 24, (d) */ | ||
376 | result = TIME_ERROR; | 347 | result = TIME_ERROR; |
377 | 348 | ||
378 | if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) | 349 | if ((txc->modes & ADJ_OFFSET_SINGLESHOT) == ADJ_OFFSET_SINGLESHOT) |
@@ -380,7 +351,7 @@ leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0 | |||
380 | else { | 351 | else { |
381 | txc->offset = shift_right(time_offset, SHIFT_UPDATE); | 352 | txc->offset = shift_right(time_offset, SHIFT_UPDATE); |
382 | } | 353 | } |
383 | txc->freq = time_freq + pps_freq; | 354 | txc->freq = time_freq; |
384 | txc->maxerror = time_maxerror; | 355 | txc->maxerror = time_maxerror; |
385 | txc->esterror = time_esterror; | 356 | txc->esterror = time_esterror; |
386 | txc->status = time_status; | 357 | txc->status = time_status; |
@@ -388,14 +359,16 @@ leave: if ((time_status & (STA_UNSYNC|STA_CLOCKERR)) != 0 | |||
388 | txc->precision = time_precision; | 359 | txc->precision = time_precision; |
389 | txc->tolerance = time_tolerance; | 360 | txc->tolerance = time_tolerance; |
390 | txc->tick = tick_usec; | 361 | txc->tick = tick_usec; |
391 | txc->ppsfreq = pps_freq; | 362 | |
392 | txc->jitter = pps_jitter >> PPS_AVG; | 363 | /* PPS is not implemented, so these are zero */ |
393 | txc->shift = pps_shift; | 364 | txc->ppsfreq = 0; |
394 | txc->stabil = pps_stabil; | 365 | txc->jitter = 0; |
395 | txc->jitcnt = pps_jitcnt; | 366 | txc->shift = 0; |
396 | txc->calcnt = pps_calcnt; | 367 | txc->stabil = 0; |
397 | txc->errcnt = pps_errcnt; | 368 | txc->jitcnt = 0; |
398 | txc->stbcnt = pps_stbcnt; | 369 | txc->calcnt = 0; |
370 | txc->errcnt = 0; | ||
371 | txc->stbcnt = 0; | ||
399 | write_sequnlock_irq(&xtime_lock); | 372 | write_sequnlock_irq(&xtime_lock); |
400 | do_gettimeofday(&txc->time); | 373 | do_gettimeofday(&txc->time); |
401 | notify_arch_cmos_timer(); | 374 | notify_arch_cmos_timer(); |
diff --git a/kernel/timer.c b/kernel/timer.c index 17d956cebcb9..ab189dd187cb 100644 --- a/kernel/timer.c +++ b/kernel/timer.c | |||
@@ -697,18 +697,9 @@ static void second_overflow(void) | |||
697 | 697 | ||
698 | /* | 698 | /* |
699 | * Compute the frequency estimate and additional phase adjustment due | 699 | * Compute the frequency estimate and additional phase adjustment due |
700 | * to frequency error for the next second. When the PPS signal is | 700 | * to frequency error for the next second. |
701 | * engaged, gnaw on the watchdog counter and update the frequency | ||
702 | * computed by the pll and the PPS signal. | ||
703 | */ | 701 | */ |
704 | pps_valid++; | 702 | ltemp = time_freq; |
705 | if (pps_valid == PPS_VALID) { /* PPS signal lost */ | ||
706 | pps_jitter = MAXTIME; | ||
707 | pps_stabil = MAXFREQ; | ||
708 | time_status &= ~(STA_PPSSIGNAL | STA_PPSJITTER | | ||
709 | STA_PPSWANDER | STA_PPSERROR); | ||
710 | } | ||
711 | ltemp = time_freq + pps_freq; | ||
712 | time_adj += shift_right(ltemp,(SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE)); | 703 | time_adj += shift_right(ltemp,(SHIFT_USEC + SHIFT_HZ - SHIFT_SCALE)); |
713 | 704 | ||
714 | #if HZ == 100 | 705 | #if HZ == 100 |
@@ -956,19 +947,7 @@ void do_timer(struct pt_regs *regs) | |||
956 | */ | 947 | */ |
957 | asmlinkage unsigned long sys_alarm(unsigned int seconds) | 948 | asmlinkage unsigned long sys_alarm(unsigned int seconds) |
958 | { | 949 | { |
959 | struct itimerval it_new, it_old; | 950 | return alarm_setitimer(seconds); |
960 | unsigned int oldalarm; | ||
961 | |||
962 | it_new.it_interval.tv_sec = it_new.it_interval.tv_usec = 0; | ||
963 | it_new.it_value.tv_sec = seconds; | ||
964 | it_new.it_value.tv_usec = 0; | ||
965 | do_setitimer(ITIMER_REAL, &it_new, &it_old); | ||
966 | oldalarm = it_old.it_value.tv_sec; | ||
967 | /* ehhh.. We can't return 0 if we have an alarm pending.. */ | ||
968 | /* And we'd better return too much than too little anyway */ | ||
969 | if ((!oldalarm && it_old.it_value.tv_usec) || it_old.it_value.tv_usec >= 500000) | ||
970 | oldalarm++; | ||
971 | return oldalarm; | ||
972 | } | 951 | } |
973 | 952 | ||
974 | #endif | 953 | #endif |
diff --git a/lib/Kconfig.debug b/lib/Kconfig.debug index f2618e1c2b93..0bda3c5259f7 100644 --- a/lib/Kconfig.debug +++ b/lib/Kconfig.debug | |||
@@ -78,13 +78,17 @@ config SCHEDSTATS | |||
78 | this adds. | 78 | this adds. |
79 | 79 | ||
80 | config DEBUG_SLAB | 80 | config DEBUG_SLAB |
81 | bool "Debug memory allocations" | 81 | bool "Debug slab memory allocations" |
82 | depends on DEBUG_KERNEL && SLAB | 82 | depends on DEBUG_KERNEL && SLAB |
83 | help | 83 | help |
84 | Say Y here to have the kernel do limited verification on memory | 84 | Say Y here to have the kernel do limited verification on memory |
85 | allocation as well as poisoning memory on free to catch use of freed | 85 | allocation as well as poisoning memory on free to catch use of freed |
86 | memory. This can make kmalloc/kfree-intensive workloads much slower. | 86 | memory. This can make kmalloc/kfree-intensive workloads much slower. |
87 | 87 | ||
88 | config DEBUG_SLAB_LEAK | ||
89 | bool "Memory leak debugging" | ||
90 | depends on DEBUG_SLAB | ||
91 | |||
88 | config DEBUG_PREEMPT | 92 | config DEBUG_PREEMPT |
89 | bool "Debug preemptible kernel" | 93 | bool "Debug preemptible kernel" |
90 | depends on DEBUG_KERNEL && PREEMPT | 94 | depends on DEBUG_KERNEL && PREEMPT |
diff --git a/lib/Makefile b/lib/Makefile index 648b2c1242fd..f827e3c24ec0 100644 --- a/lib/Makefile +++ b/lib/Makefile | |||
@@ -7,6 +7,8 @@ lib-y := errno.o ctype.o string.o vsprintf.o cmdline.o \ | |||
7 | idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \ | 7 | idr.o div64.o int_sqrt.o bitmap.o extable.o prio_tree.o \ |
8 | sha1.o | 8 | sha1.o |
9 | 9 | ||
10 | lib-$(CONFIG_SMP) += cpumask.o | ||
11 | |||
10 | lib-y += kobject.o kref.o kobject_uevent.o klist.o | 12 | lib-y += kobject.o kref.o kobject_uevent.o klist.o |
11 | 13 | ||
12 | obj-y += sort.o parser.o halfmd4.o iomap_copy.o | 14 | obj-y += sort.o parser.o halfmd4.o iomap_copy.o |
diff --git a/lib/cpumask.c b/lib/cpumask.c new file mode 100644 index 000000000000..3a67dc5ada7d --- /dev/null +++ b/lib/cpumask.c | |||
@@ -0,0 +1,45 @@ | |||
1 | #include <linux/kernel.h> | ||
2 | #include <linux/bitops.h> | ||
3 | #include <linux/cpumask.h> | ||
4 | #include <linux/module.h> | ||
5 | |||
6 | int __first_cpu(const cpumask_t *srcp) | ||
7 | { | ||
8 | return min_t(int, NR_CPUS, find_first_bit(srcp->bits, NR_CPUS)); | ||
9 | } | ||
10 | EXPORT_SYMBOL(__first_cpu); | ||
11 | |||
12 | int __next_cpu(int n, const cpumask_t *srcp) | ||
13 | { | ||
14 | return min_t(int, NR_CPUS, find_next_bit(srcp->bits, NR_CPUS, n+1)); | ||
15 | } | ||
16 | EXPORT_SYMBOL(__next_cpu); | ||
17 | |||
18 | /* | ||
19 | * Find the highest possible smp_processor_id() | ||
20 | * | ||
21 | * Note: if we're prepared to assume that cpu_possible_map never changes | ||
22 | * (reasonable) then this function should cache its return value. | ||
23 | */ | ||
24 | int highest_possible_processor_id(void) | ||
25 | { | ||
26 | unsigned int cpu; | ||
27 | unsigned highest = 0; | ||
28 | |||
29 | for_each_cpu_mask(cpu, cpu_possible_map) | ||
30 | highest = cpu; | ||
31 | return highest; | ||
32 | } | ||
33 | EXPORT_SYMBOL(highest_possible_processor_id); | ||
34 | |||
35 | int __any_online_cpu(const cpumask_t *mask) | ||
36 | { | ||
37 | int cpu; | ||
38 | |||
39 | for_each_cpu_mask(cpu, *mask) { | ||
40 | if (cpu_online(cpu)) | ||
41 | break; | ||
42 | } | ||
43 | return cpu; | ||
44 | } | ||
45 | EXPORT_SYMBOL(__any_online_cpu); | ||
diff --git a/lib/radix-tree.c b/lib/radix-tree.c index 1e5b17dc7e3d..7097bb239e40 100644 --- a/lib/radix-tree.c +++ b/lib/radix-tree.c | |||
@@ -37,7 +37,6 @@ | |||
37 | #else | 37 | #else |
38 | #define RADIX_TREE_MAP_SHIFT 3 /* For more stressful testing */ | 38 | #define RADIX_TREE_MAP_SHIFT 3 /* For more stressful testing */ |
39 | #endif | 39 | #endif |
40 | #define RADIX_TREE_TAGS 2 | ||
41 | 40 | ||
42 | #define RADIX_TREE_MAP_SIZE (1UL << RADIX_TREE_MAP_SHIFT) | 41 | #define RADIX_TREE_MAP_SIZE (1UL << RADIX_TREE_MAP_SHIFT) |
43 | #define RADIX_TREE_MAP_MASK (RADIX_TREE_MAP_SIZE-1) | 42 | #define RADIX_TREE_MAP_MASK (RADIX_TREE_MAP_SIZE-1) |
@@ -48,7 +47,7 @@ | |||
48 | struct radix_tree_node { | 47 | struct radix_tree_node { |
49 | unsigned int count; | 48 | unsigned int count; |
50 | void *slots[RADIX_TREE_MAP_SIZE]; | 49 | void *slots[RADIX_TREE_MAP_SIZE]; |
51 | unsigned long tags[RADIX_TREE_TAGS][RADIX_TREE_TAG_LONGS]; | 50 | unsigned long tags[RADIX_TREE_MAX_TAGS][RADIX_TREE_TAG_LONGS]; |
52 | }; | 51 | }; |
53 | 52 | ||
54 | struct radix_tree_path { | 53 | struct radix_tree_path { |
@@ -135,17 +134,20 @@ out: | |||
135 | return ret; | 134 | return ret; |
136 | } | 135 | } |
137 | 136 | ||
138 | static inline void tag_set(struct radix_tree_node *node, int tag, int offset) | 137 | static inline void tag_set(struct radix_tree_node *node, unsigned int tag, |
138 | int offset) | ||
139 | { | 139 | { |
140 | __set_bit(offset, node->tags[tag]); | 140 | __set_bit(offset, node->tags[tag]); |
141 | } | 141 | } |
142 | 142 | ||
143 | static inline void tag_clear(struct radix_tree_node *node, int tag, int offset) | 143 | static inline void tag_clear(struct radix_tree_node *node, unsigned int tag, |
144 | int offset) | ||
144 | { | 145 | { |
145 | __clear_bit(offset, node->tags[tag]); | 146 | __clear_bit(offset, node->tags[tag]); |
146 | } | 147 | } |
147 | 148 | ||
148 | static inline int tag_get(struct radix_tree_node *node, int tag, int offset) | 149 | static inline int tag_get(struct radix_tree_node *node, unsigned int tag, |
150 | int offset) | ||
149 | { | 151 | { |
150 | return test_bit(offset, node->tags[tag]); | 152 | return test_bit(offset, node->tags[tag]); |
151 | } | 153 | } |
@@ -154,7 +156,7 @@ static inline int tag_get(struct radix_tree_node *node, int tag, int offset) | |||
154 | * Returns 1 if any slot in the node has this tag set. | 156 | * Returns 1 if any slot in the node has this tag set. |
155 | * Otherwise returns 0. | 157 | * Otherwise returns 0. |
156 | */ | 158 | */ |
157 | static inline int any_tag_set(struct radix_tree_node *node, int tag) | 159 | static inline int any_tag_set(struct radix_tree_node *node, unsigned int tag) |
158 | { | 160 | { |
159 | int idx; | 161 | int idx; |
160 | for (idx = 0; idx < RADIX_TREE_TAG_LONGS; idx++) { | 162 | for (idx = 0; idx < RADIX_TREE_TAG_LONGS; idx++) { |
@@ -180,7 +182,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index) | |||
180 | { | 182 | { |
181 | struct radix_tree_node *node; | 183 | struct radix_tree_node *node; |
182 | unsigned int height; | 184 | unsigned int height; |
183 | char tags[RADIX_TREE_TAGS]; | 185 | char tags[RADIX_TREE_MAX_TAGS]; |
184 | int tag; | 186 | int tag; |
185 | 187 | ||
186 | /* Figure out what the height should be. */ | 188 | /* Figure out what the height should be. */ |
@@ -197,7 +199,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index) | |||
197 | * Prepare the tag status of the top-level node for propagation | 199 | * Prepare the tag status of the top-level node for propagation |
198 | * into the newly-pushed top-level node(s) | 200 | * into the newly-pushed top-level node(s) |
199 | */ | 201 | */ |
200 | for (tag = 0; tag < RADIX_TREE_TAGS; tag++) { | 202 | for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { |
201 | tags[tag] = 0; | 203 | tags[tag] = 0; |
202 | if (any_tag_set(root->rnode, tag)) | 204 | if (any_tag_set(root->rnode, tag)) |
203 | tags[tag] = 1; | 205 | tags[tag] = 1; |
@@ -211,7 +213,7 @@ static int radix_tree_extend(struct radix_tree_root *root, unsigned long index) | |||
211 | node->slots[0] = root->rnode; | 213 | node->slots[0] = root->rnode; |
212 | 214 | ||
213 | /* Propagate the aggregated tag info into the new root */ | 215 | /* Propagate the aggregated tag info into the new root */ |
214 | for (tag = 0; tag < RADIX_TREE_TAGS; tag++) { | 216 | for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { |
215 | if (tags[tag]) | 217 | if (tags[tag]) |
216 | tag_set(node, tag, 0); | 218 | tag_set(node, tag, 0); |
217 | } | 219 | } |
@@ -349,14 +351,15 @@ EXPORT_SYMBOL(radix_tree_lookup); | |||
349 | * @index: index key | 351 | * @index: index key |
350 | * @tag: tag index | 352 | * @tag: tag index |
351 | * | 353 | * |
352 | * Set the search tag corresponging to @index in the radix tree. From | 354 | * Set the search tag (which must be < RADIX_TREE_MAX_TAGS) |
355 | * corresponding to @index in the radix tree. From | ||
353 | * the root all the way down to the leaf node. | 356 | * the root all the way down to the leaf node. |
354 | * | 357 | * |
355 | * Returns the address of the tagged item. Setting a tag on a not-present | 358 | * Returns the address of the tagged item. Setting a tag on a not-present |
356 | * item is a bug. | 359 | * item is a bug. |
357 | */ | 360 | */ |
358 | void *radix_tree_tag_set(struct radix_tree_root *root, | 361 | void *radix_tree_tag_set(struct radix_tree_root *root, |
359 | unsigned long index, int tag) | 362 | unsigned long index, unsigned int tag) |
360 | { | 363 | { |
361 | unsigned int height, shift; | 364 | unsigned int height, shift; |
362 | struct radix_tree_node *slot; | 365 | struct radix_tree_node *slot; |
@@ -390,7 +393,8 @@ EXPORT_SYMBOL(radix_tree_tag_set); | |||
390 | * @index: index key | 393 | * @index: index key |
391 | * @tag: tag index | 394 | * @tag: tag index |
392 | * | 395 | * |
393 | * Clear the search tag corresponging to @index in the radix tree. If | 396 | * Clear the search tag (which must be < RADIX_TREE_MAX_TAGS) |
397 | * corresponding to @index in the radix tree. If | ||
394 | * this causes the leaf node to have no tags set then clear the tag in the | 398 | * this causes the leaf node to have no tags set then clear the tag in the |
395 | * next-to-leaf node, etc. | 399 | * next-to-leaf node, etc. |
396 | * | 400 | * |
@@ -398,7 +402,7 @@ EXPORT_SYMBOL(radix_tree_tag_set); | |||
398 | * has the same return value and semantics as radix_tree_lookup(). | 402 | * has the same return value and semantics as radix_tree_lookup(). |
399 | */ | 403 | */ |
400 | void *radix_tree_tag_clear(struct radix_tree_root *root, | 404 | void *radix_tree_tag_clear(struct radix_tree_root *root, |
401 | unsigned long index, int tag) | 405 | unsigned long index, unsigned int tag) |
402 | { | 406 | { |
403 | struct radix_tree_path path[RADIX_TREE_MAX_PATH], *pathp = path; | 407 | struct radix_tree_path path[RADIX_TREE_MAX_PATH], *pathp = path; |
404 | struct radix_tree_node *slot; | 408 | struct radix_tree_node *slot; |
@@ -450,7 +454,7 @@ EXPORT_SYMBOL(radix_tree_tag_clear); | |||
450 | * radix_tree_tag_get - get a tag on a radix tree node | 454 | * radix_tree_tag_get - get a tag on a radix tree node |
451 | * @root: radix tree root | 455 | * @root: radix tree root |
452 | * @index: index key | 456 | * @index: index key |
453 | * @tag: tag index | 457 | * @tag: tag index (< RADIX_TREE_MAX_TAGS) |
454 | * | 458 | * |
455 | * Return values: | 459 | * Return values: |
456 | * | 460 | * |
@@ -459,7 +463,7 @@ EXPORT_SYMBOL(radix_tree_tag_clear); | |||
459 | * -1: tag present, unset | 463 | * -1: tag present, unset |
460 | */ | 464 | */ |
461 | int radix_tree_tag_get(struct radix_tree_root *root, | 465 | int radix_tree_tag_get(struct radix_tree_root *root, |
462 | unsigned long index, int tag) | 466 | unsigned long index, unsigned int tag) |
463 | { | 467 | { |
464 | unsigned int height, shift; | 468 | unsigned int height, shift; |
465 | struct radix_tree_node *slot; | 469 | struct radix_tree_node *slot; |
@@ -592,7 +596,7 @@ EXPORT_SYMBOL(radix_tree_gang_lookup); | |||
592 | */ | 596 | */ |
593 | static unsigned int | 597 | static unsigned int |
594 | __lookup_tag(struct radix_tree_root *root, void **results, unsigned long index, | 598 | __lookup_tag(struct radix_tree_root *root, void **results, unsigned long index, |
595 | unsigned int max_items, unsigned long *next_index, int tag) | 599 | unsigned int max_items, unsigned long *next_index, unsigned int tag) |
596 | { | 600 | { |
597 | unsigned int nr_found = 0; | 601 | unsigned int nr_found = 0; |
598 | unsigned int shift; | 602 | unsigned int shift; |
@@ -646,7 +650,7 @@ out: | |||
646 | * @results: where the results of the lookup are placed | 650 | * @results: where the results of the lookup are placed |
647 | * @first_index: start the lookup from this key | 651 | * @first_index: start the lookup from this key |
648 | * @max_items: place up to this many items at *results | 652 | * @max_items: place up to this many items at *results |
649 | * @tag: the tag index | 653 | * @tag: the tag index (< RADIX_TREE_MAX_TAGS) |
650 | * | 654 | * |
651 | * Performs an index-ascending scan of the tree for present items which | 655 | * Performs an index-ascending scan of the tree for present items which |
652 | * have the tag indexed by @tag set. Places the items at *@results and | 656 | * have the tag indexed by @tag set. Places the items at *@results and |
@@ -654,7 +658,8 @@ out: | |||
654 | */ | 658 | */ |
655 | unsigned int | 659 | unsigned int |
656 | radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, | 660 | radix_tree_gang_lookup_tag(struct radix_tree_root *root, void **results, |
657 | unsigned long first_index, unsigned int max_items, int tag) | 661 | unsigned long first_index, unsigned int max_items, |
662 | unsigned int tag) | ||
658 | { | 663 | { |
659 | const unsigned long max_index = radix_tree_maxindex(root->height); | 664 | const unsigned long max_index = radix_tree_maxindex(root->height); |
660 | unsigned long cur_index = first_index; | 665 | unsigned long cur_index = first_index; |
@@ -716,7 +721,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) | |||
716 | struct radix_tree_node *slot; | 721 | struct radix_tree_node *slot; |
717 | unsigned int height, shift; | 722 | unsigned int height, shift; |
718 | void *ret = NULL; | 723 | void *ret = NULL; |
719 | char tags[RADIX_TREE_TAGS]; | 724 | char tags[RADIX_TREE_MAX_TAGS]; |
720 | int nr_cleared_tags; | 725 | int nr_cleared_tags; |
721 | int tag; | 726 | int tag; |
722 | int offset; | 727 | int offset; |
@@ -751,7 +756,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) | |||
751 | * Clear all tags associated with the just-deleted item | 756 | * Clear all tags associated with the just-deleted item |
752 | */ | 757 | */ |
753 | nr_cleared_tags = 0; | 758 | nr_cleared_tags = 0; |
754 | for (tag = 0; tag < RADIX_TREE_TAGS; tag++) { | 759 | for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { |
755 | tags[tag] = 1; | 760 | tags[tag] = 1; |
756 | if (tag_get(pathp->node, tag, pathp->offset)) { | 761 | if (tag_get(pathp->node, tag, pathp->offset)) { |
757 | tag_clear(pathp->node, tag, pathp->offset); | 762 | tag_clear(pathp->node, tag, pathp->offset); |
@@ -763,7 +768,7 @@ void *radix_tree_delete(struct radix_tree_root *root, unsigned long index) | |||
763 | } | 768 | } |
764 | 769 | ||
765 | for (pathp--; nr_cleared_tags && pathp->node; pathp--) { | 770 | for (pathp--; nr_cleared_tags && pathp->node; pathp--) { |
766 | for (tag = 0; tag < RADIX_TREE_TAGS; tag++) { | 771 | for (tag = 0; tag < RADIX_TREE_MAX_TAGS; tag++) { |
767 | if (tags[tag]) | 772 | if (tags[tag]) |
768 | continue; | 773 | continue; |
769 | 774 | ||
@@ -801,7 +806,7 @@ EXPORT_SYMBOL(radix_tree_delete); | |||
801 | * @root: radix tree root | 806 | * @root: radix tree root |
802 | * @tag: tag to test | 807 | * @tag: tag to test |
803 | */ | 808 | */ |
804 | int radix_tree_tagged(struct radix_tree_root *root, int tag) | 809 | int radix_tree_tagged(struct radix_tree_root *root, unsigned int tag) |
805 | { | 810 | { |
806 | struct radix_tree_node *rnode; | 811 | struct radix_tree_node *rnode; |
807 | rnode = root->rnode; | 812 | rnode = root->rnode; |
diff --git a/mm/Kconfig b/mm/Kconfig index bd80460360db..332f5c29b53a 100644 --- a/mm/Kconfig +++ b/mm/Kconfig | |||
@@ -138,8 +138,8 @@ config SPLIT_PTLOCK_CPUS | |||
138 | # | 138 | # |
139 | config MIGRATION | 139 | config MIGRATION |
140 | bool "Page migration" | 140 | bool "Page migration" |
141 | def_bool y if NUMA || SPARSEMEM || DISCONTIGMEM | 141 | def_bool y if NUMA |
142 | depends on SWAP | 142 | depends on SWAP && NUMA |
143 | help | 143 | help |
144 | Allows the migration of the physical location of pages of processes | 144 | Allows the migration of the physical location of pages of processes |
145 | while the virtual addresses are not changed. This is useful for | 145 | while the virtual addresses are not changed. This is useful for |
@@ -1040,12 +1040,11 @@ munmap_back: | |||
1040 | * specific mapper. the address has already been validated, but | 1040 | * specific mapper. the address has already been validated, but |
1041 | * not unmapped, but the maps are removed from the list. | 1041 | * not unmapped, but the maps are removed from the list. |
1042 | */ | 1042 | */ |
1043 | vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); | 1043 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
1044 | if (!vma) { | 1044 | if (!vma) { |
1045 | error = -ENOMEM; | 1045 | error = -ENOMEM; |
1046 | goto unacct_error; | 1046 | goto unacct_error; |
1047 | } | 1047 | } |
1048 | memset(vma, 0, sizeof(*vma)); | ||
1049 | 1048 | ||
1050 | vma->vm_mm = mm; | 1049 | vma->vm_mm = mm; |
1051 | vma->vm_start = addr; | 1050 | vma->vm_start = addr; |
@@ -1896,12 +1895,11 @@ unsigned long do_brk(unsigned long addr, unsigned long len) | |||
1896 | /* | 1895 | /* |
1897 | * create a vma struct for an anonymous mapping | 1896 | * create a vma struct for an anonymous mapping |
1898 | */ | 1897 | */ |
1899 | vma = kmem_cache_alloc(vm_area_cachep, SLAB_KERNEL); | 1898 | vma = kmem_cache_zalloc(vm_area_cachep, GFP_KERNEL); |
1900 | if (!vma) { | 1899 | if (!vma) { |
1901 | vm_unacct_memory(len >> PAGE_SHIFT); | 1900 | vm_unacct_memory(len >> PAGE_SHIFT); |
1902 | return -ENOMEM; | 1901 | return -ENOMEM; |
1903 | } | 1902 | } |
1904 | memset(vma, 0, sizeof(*vma)); | ||
1905 | 1903 | ||
1906 | vma->vm_mm = mm; | 1904 | vma->vm_mm = mm; |
1907 | vma->vm_start = addr; | 1905 | vma->vm_start = addr; |
diff --git a/mm/page_alloc.c b/mm/page_alloc.c index a5c3f8bd98ae..338a02bb004d 100644 --- a/mm/page_alloc.c +++ b/mm/page_alloc.c | |||
@@ -2029,8 +2029,9 @@ static __meminit void zone_pcp_init(struct zone *zone) | |||
2029 | setup_pageset(zone_pcp(zone,cpu), batch); | 2029 | setup_pageset(zone_pcp(zone,cpu), batch); |
2030 | #endif | 2030 | #endif |
2031 | } | 2031 | } |
2032 | printk(KERN_DEBUG " %s zone: %lu pages, LIFO batch:%lu\n", | 2032 | if (zone->present_pages) |
2033 | zone->name, zone->present_pages, batch); | 2033 | printk(KERN_DEBUG " %s zone: %lu pages, LIFO batch:%lu\n", |
2034 | zone->name, zone->present_pages, batch); | ||
2034 | } | 2035 | } |
2035 | 2036 | ||
2036 | static __meminit void init_currently_empty_zone(struct zone *zone, | 2037 | static __meminit void init_currently_empty_zone(struct zone *zone, |
@@ -2701,8 +2702,7 @@ void *__init alloc_large_system_hash(const char *tablename, | |||
2701 | else | 2702 | else |
2702 | numentries <<= (PAGE_SHIFT - scale); | 2703 | numentries <<= (PAGE_SHIFT - scale); |
2703 | } | 2704 | } |
2704 | /* rounded up to nearest power of 2 in size */ | 2705 | numentries = roundup_pow_of_two(numentries); |
2705 | numentries = 1UL << (long_log2(numentries) + 1); | ||
2706 | 2706 | ||
2707 | /* limit allocation size to 1/16 total memory by default */ | 2707 | /* limit allocation size to 1/16 total memory by default */ |
2708 | if (max == 0) { | 2708 | if (max == 0) { |
@@ -204,7 +204,8 @@ | |||
204 | typedef unsigned int kmem_bufctl_t; | 204 | typedef unsigned int kmem_bufctl_t; |
205 | #define BUFCTL_END (((kmem_bufctl_t)(~0U))-0) | 205 | #define BUFCTL_END (((kmem_bufctl_t)(~0U))-0) |
206 | #define BUFCTL_FREE (((kmem_bufctl_t)(~0U))-1) | 206 | #define BUFCTL_FREE (((kmem_bufctl_t)(~0U))-1) |
207 | #define SLAB_LIMIT (((kmem_bufctl_t)(~0U))-2) | 207 | #define BUFCTL_ACTIVE (((kmem_bufctl_t)(~0U))-2) |
208 | #define SLAB_LIMIT (((kmem_bufctl_t)(~0U))-3) | ||
208 | 209 | ||
209 | /* Max number of objs-per-slab for caches which use off-slab slabs. | 210 | /* Max number of objs-per-slab for caches which use off-slab slabs. |
210 | * Needed to avoid a possible looping condition in cache_grow(). | 211 | * Needed to avoid a possible looping condition in cache_grow(). |
@@ -897,6 +898,30 @@ static struct array_cache *alloc_arraycache(int node, int entries, | |||
897 | return nc; | 898 | return nc; |
898 | } | 899 | } |
899 | 900 | ||
901 | /* | ||
902 | * Transfer objects in one arraycache to another. | ||
903 | * Locking must be handled by the caller. | ||
904 | * | ||
905 | * Return the number of entries transferred. | ||
906 | */ | ||
907 | static int transfer_objects(struct array_cache *to, | ||
908 | struct array_cache *from, unsigned int max) | ||
909 | { | ||
910 | /* Figure out how many entries to transfer */ | ||
911 | int nr = min(min(from->avail, max), to->limit - to->avail); | ||
912 | |||
913 | if (!nr) | ||
914 | return 0; | ||
915 | |||
916 | memcpy(to->entry + to->avail, from->entry + from->avail -nr, | ||
917 | sizeof(void *) *nr); | ||
918 | |||
919 | from->avail -= nr; | ||
920 | to->avail += nr; | ||
921 | to->touched = 1; | ||
922 | return nr; | ||
923 | } | ||
924 | |||
900 | #ifdef CONFIG_NUMA | 925 | #ifdef CONFIG_NUMA |
901 | static void *__cache_alloc_node(struct kmem_cache *, gfp_t, int); | 926 | static void *__cache_alloc_node(struct kmem_cache *, gfp_t, int); |
902 | static void *alternate_node_alloc(struct kmem_cache *, gfp_t); | 927 | static void *alternate_node_alloc(struct kmem_cache *, gfp_t); |
@@ -946,6 +971,13 @@ static void __drain_alien_cache(struct kmem_cache *cachep, | |||
946 | 971 | ||
947 | if (ac->avail) { | 972 | if (ac->avail) { |
948 | spin_lock(&rl3->list_lock); | 973 | spin_lock(&rl3->list_lock); |
974 | /* | ||
975 | * Stuff objects into the remote nodes shared array first. | ||
976 | * That way we could avoid the overhead of putting the objects | ||
977 | * into the free lists and getting them back later. | ||
978 | */ | ||
979 | transfer_objects(rl3->shared, ac, ac->limit); | ||
980 | |||
949 | free_block(cachep, ac->entry, ac->avail, node); | 981 | free_block(cachep, ac->entry, ac->avail, node); |
950 | ac->avail = 0; | 982 | ac->avail = 0; |
951 | spin_unlock(&rl3->list_lock); | 983 | spin_unlock(&rl3->list_lock); |
@@ -961,8 +993,8 @@ static void reap_alien(struct kmem_cache *cachep, struct kmem_list3 *l3) | |||
961 | 993 | ||
962 | if (l3->alien) { | 994 | if (l3->alien) { |
963 | struct array_cache *ac = l3->alien[node]; | 995 | struct array_cache *ac = l3->alien[node]; |
964 | if (ac && ac->avail) { | 996 | |
965 | spin_lock_irq(&ac->lock); | 997 | if (ac && ac->avail && spin_trylock_irq(&ac->lock)) { |
966 | __drain_alien_cache(cachep, ac, node); | 998 | __drain_alien_cache(cachep, ac, node); |
967 | spin_unlock_irq(&ac->lock); | 999 | spin_unlock_irq(&ac->lock); |
968 | } | 1000 | } |
@@ -1989,10 +2021,9 @@ kmem_cache_create (const char *name, size_t size, size_t align, | |||
1989 | align = ralign; | 2021 | align = ralign; |
1990 | 2022 | ||
1991 | /* Get cache's description obj. */ | 2023 | /* Get cache's description obj. */ |
1992 | cachep = kmem_cache_alloc(&cache_cache, SLAB_KERNEL); | 2024 | cachep = kmem_cache_zalloc(&cache_cache, SLAB_KERNEL); |
1993 | if (!cachep) | 2025 | if (!cachep) |
1994 | goto oops; | 2026 | goto oops; |
1995 | memset(cachep, 0, sizeof(struct kmem_cache)); | ||
1996 | 2027 | ||
1997 | #if DEBUG | 2028 | #if DEBUG |
1998 | cachep->obj_size = size; | 2029 | cachep->obj_size = size; |
@@ -2399,7 +2430,7 @@ static void slab_put_obj(struct kmem_cache *cachep, struct slab *slabp, | |||
2399 | /* Verify that the slab belongs to the intended node */ | 2430 | /* Verify that the slab belongs to the intended node */ |
2400 | WARN_ON(slabp->nodeid != nodeid); | 2431 | WARN_ON(slabp->nodeid != nodeid); |
2401 | 2432 | ||
2402 | if (slab_bufctl(slabp)[objnr] != BUFCTL_FREE) { | 2433 | if (slab_bufctl(slabp)[objnr] + 1 <= SLAB_LIMIT + 1) { |
2403 | printk(KERN_ERR "slab: double free detected in cache " | 2434 | printk(KERN_ERR "slab: double free detected in cache " |
2404 | "'%s', objp %p\n", cachep->name, objp); | 2435 | "'%s', objp %p\n", cachep->name, objp); |
2405 | BUG(); | 2436 | BUG(); |
@@ -2605,6 +2636,9 @@ static void *cache_free_debugcheck(struct kmem_cache *cachep, void *objp, | |||
2605 | */ | 2636 | */ |
2606 | cachep->dtor(objp + obj_offset(cachep), cachep, 0); | 2637 | cachep->dtor(objp + obj_offset(cachep), cachep, 0); |
2607 | } | 2638 | } |
2639 | #ifdef CONFIG_DEBUG_SLAB_LEAK | ||
2640 | slab_bufctl(slabp)[objnr] = BUFCTL_FREE; | ||
2641 | #endif | ||
2608 | if (cachep->flags & SLAB_POISON) { | 2642 | if (cachep->flags & SLAB_POISON) { |
2609 | #ifdef CONFIG_DEBUG_PAGEALLOC | 2643 | #ifdef CONFIG_DEBUG_PAGEALLOC |
2610 | if ((cachep->buffer_size % PAGE_SIZE)==0 && OFF_SLAB(cachep)) { | 2644 | if ((cachep->buffer_size % PAGE_SIZE)==0 && OFF_SLAB(cachep)) { |
@@ -2677,20 +2711,10 @@ retry: | |||
2677 | BUG_ON(ac->avail > 0 || !l3); | 2711 | BUG_ON(ac->avail > 0 || !l3); |
2678 | spin_lock(&l3->list_lock); | 2712 | spin_lock(&l3->list_lock); |
2679 | 2713 | ||
2680 | if (l3->shared) { | 2714 | /* See if we can refill from the shared array */ |
2681 | struct array_cache *shared_array = l3->shared; | 2715 | if (l3->shared && transfer_objects(ac, l3->shared, batchcount)) |
2682 | if (shared_array->avail) { | 2716 | goto alloc_done; |
2683 | if (batchcount > shared_array->avail) | 2717 | |
2684 | batchcount = shared_array->avail; | ||
2685 | shared_array->avail -= batchcount; | ||
2686 | ac->avail = batchcount; | ||
2687 | memcpy(ac->entry, | ||
2688 | &(shared_array->entry[shared_array->avail]), | ||
2689 | sizeof(void *) * batchcount); | ||
2690 | shared_array->touched = 1; | ||
2691 | goto alloc_done; | ||
2692 | } | ||
2693 | } | ||
2694 | while (batchcount > 0) { | 2718 | while (batchcount > 0) { |
2695 | struct list_head *entry; | 2719 | struct list_head *entry; |
2696 | struct slab *slabp; | 2720 | struct slab *slabp; |
@@ -2788,6 +2812,16 @@ static void *cache_alloc_debugcheck_after(struct kmem_cache *cachep, | |||
2788 | *dbg_redzone1(cachep, objp) = RED_ACTIVE; | 2812 | *dbg_redzone1(cachep, objp) = RED_ACTIVE; |
2789 | *dbg_redzone2(cachep, objp) = RED_ACTIVE; | 2813 | *dbg_redzone2(cachep, objp) = RED_ACTIVE; |
2790 | } | 2814 | } |
2815 | #ifdef CONFIG_DEBUG_SLAB_LEAK | ||
2816 | { | ||
2817 | struct slab *slabp; | ||
2818 | unsigned objnr; | ||
2819 | |||
2820 | slabp = page_get_slab(virt_to_page(objp)); | ||
2821 | objnr = (unsigned)(objp - slabp->s_mem) / cachep->buffer_size; | ||
2822 | slab_bufctl(slabp)[objnr] = BUFCTL_ACTIVE; | ||
2823 | } | ||
2824 | #endif | ||
2791 | objp += obj_offset(cachep); | 2825 | objp += obj_offset(cachep); |
2792 | if (cachep->ctor && cachep->flags & SLAB_POISON) { | 2826 | if (cachep->ctor && cachep->flags & SLAB_POISON) { |
2793 | unsigned long ctor_flags = SLAB_CTOR_CONSTRUCTOR; | 2827 | unsigned long ctor_flags = SLAB_CTOR_CONSTRUCTOR; |
@@ -3094,6 +3128,23 @@ void *kmem_cache_alloc(struct kmem_cache *cachep, gfp_t flags) | |||
3094 | EXPORT_SYMBOL(kmem_cache_alloc); | 3128 | EXPORT_SYMBOL(kmem_cache_alloc); |
3095 | 3129 | ||
3096 | /** | 3130 | /** |
3131 | * kmem_cache_alloc - Allocate an object. The memory is set to zero. | ||
3132 | * @cache: The cache to allocate from. | ||
3133 | * @flags: See kmalloc(). | ||
3134 | * | ||
3135 | * Allocate an object from this cache and set the allocated memory to zero. | ||
3136 | * The flags are only relevant if the cache has no available objects. | ||
3137 | */ | ||
3138 | void *kmem_cache_zalloc(struct kmem_cache *cache, gfp_t flags) | ||
3139 | { | ||
3140 | void *ret = __cache_alloc(cache, flags, __builtin_return_address(0)); | ||
3141 | if (ret) | ||
3142 | memset(ret, 0, obj_size(cache)); | ||
3143 | return ret; | ||
3144 | } | ||
3145 | EXPORT_SYMBOL(kmem_cache_zalloc); | ||
3146 | |||
3147 | /** | ||
3097 | * kmem_ptr_validate - check if an untrusted pointer might | 3148 | * kmem_ptr_validate - check if an untrusted pointer might |
3098 | * be a slab entry. | 3149 | * be a slab entry. |
3099 | * @cachep: the cache we're checking against | 3150 | * @cachep: the cache we're checking against |
@@ -3220,22 +3271,23 @@ static __always_inline void *__do_kmalloc(size_t size, gfp_t flags, | |||
3220 | return __cache_alloc(cachep, flags, caller); | 3271 | return __cache_alloc(cachep, flags, caller); |
3221 | } | 3272 | } |
3222 | 3273 | ||
3223 | #ifndef CONFIG_DEBUG_SLAB | ||
3224 | 3274 | ||
3225 | void *__kmalloc(size_t size, gfp_t flags) | 3275 | void *__kmalloc(size_t size, gfp_t flags) |
3226 | { | 3276 | { |
3277 | #ifndef CONFIG_DEBUG_SLAB | ||
3227 | return __do_kmalloc(size, flags, NULL); | 3278 | return __do_kmalloc(size, flags, NULL); |
3279 | #else | ||
3280 | return __do_kmalloc(size, flags, __builtin_return_address(0)); | ||
3281 | #endif | ||
3228 | } | 3282 | } |
3229 | EXPORT_SYMBOL(__kmalloc); | 3283 | EXPORT_SYMBOL(__kmalloc); |
3230 | 3284 | ||
3231 | #else | 3285 | #ifdef CONFIG_DEBUG_SLAB |
3232 | |||
3233 | void *__kmalloc_track_caller(size_t size, gfp_t flags, void *caller) | 3286 | void *__kmalloc_track_caller(size_t size, gfp_t flags, void *caller) |
3234 | { | 3287 | { |
3235 | return __do_kmalloc(size, flags, caller); | 3288 | return __do_kmalloc(size, flags, caller); |
3236 | } | 3289 | } |
3237 | EXPORT_SYMBOL(__kmalloc_track_caller); | 3290 | EXPORT_SYMBOL(__kmalloc_track_caller); |
3238 | |||
3239 | #endif | 3291 | #endif |
3240 | 3292 | ||
3241 | #ifdef CONFIG_SMP | 3293 | #ifdef CONFIG_SMP |
@@ -3366,63 +3418,86 @@ const char *kmem_cache_name(struct kmem_cache *cachep) | |||
3366 | EXPORT_SYMBOL_GPL(kmem_cache_name); | 3418 | EXPORT_SYMBOL_GPL(kmem_cache_name); |
3367 | 3419 | ||
3368 | /* | 3420 | /* |
3369 | * This initializes kmem_list3 for all nodes. | 3421 | * This initializes kmem_list3 or resizes varioius caches for all nodes. |
3370 | */ | 3422 | */ |
3371 | static int alloc_kmemlist(struct kmem_cache *cachep) | 3423 | static int alloc_kmemlist(struct kmem_cache *cachep) |
3372 | { | 3424 | { |
3373 | int node; | 3425 | int node; |
3374 | struct kmem_list3 *l3; | 3426 | struct kmem_list3 *l3; |
3375 | int err = 0; | 3427 | struct array_cache *new_shared; |
3428 | struct array_cache **new_alien; | ||
3376 | 3429 | ||
3377 | for_each_online_node(node) { | 3430 | for_each_online_node(node) { |
3378 | struct array_cache *nc = NULL, *new; | 3431 | |
3379 | struct array_cache **new_alien = NULL; | ||
3380 | #ifdef CONFIG_NUMA | ||
3381 | new_alien = alloc_alien_cache(node, cachep->limit); | 3432 | new_alien = alloc_alien_cache(node, cachep->limit); |
3382 | if (!new_alien) | 3433 | if (!new_alien) |
3383 | goto fail; | 3434 | goto fail; |
3384 | #endif | 3435 | |
3385 | new = alloc_arraycache(node, cachep->shared*cachep->batchcount, | 3436 | new_shared = alloc_arraycache(node, |
3437 | cachep->shared*cachep->batchcount, | ||
3386 | 0xbaadf00d); | 3438 | 0xbaadf00d); |
3387 | if (!new) | 3439 | if (!new_shared) { |
3440 | free_alien_cache(new_alien); | ||
3388 | goto fail; | 3441 | goto fail; |
3442 | } | ||
3443 | |||
3389 | l3 = cachep->nodelists[node]; | 3444 | l3 = cachep->nodelists[node]; |
3390 | if (l3) { | 3445 | if (l3) { |
3446 | struct array_cache *shared = l3->shared; | ||
3447 | |||
3391 | spin_lock_irq(&l3->list_lock); | 3448 | spin_lock_irq(&l3->list_lock); |
3392 | 3449 | ||
3393 | nc = cachep->nodelists[node]->shared; | 3450 | if (shared) |
3394 | if (nc) | 3451 | free_block(cachep, shared->entry, |
3395 | free_block(cachep, nc->entry, nc->avail, node); | 3452 | shared->avail, node); |
3396 | 3453 | ||
3397 | l3->shared = new; | 3454 | l3->shared = new_shared; |
3398 | if (!cachep->nodelists[node]->alien) { | 3455 | if (!l3->alien) { |
3399 | l3->alien = new_alien; | 3456 | l3->alien = new_alien; |
3400 | new_alien = NULL; | 3457 | new_alien = NULL; |
3401 | } | 3458 | } |
3402 | l3->free_limit = (1 + nr_cpus_node(node)) * | 3459 | l3->free_limit = (1 + nr_cpus_node(node)) * |
3403 | cachep->batchcount + cachep->num; | 3460 | cachep->batchcount + cachep->num; |
3404 | spin_unlock_irq(&l3->list_lock); | 3461 | spin_unlock_irq(&l3->list_lock); |
3405 | kfree(nc); | 3462 | kfree(shared); |
3406 | free_alien_cache(new_alien); | 3463 | free_alien_cache(new_alien); |
3407 | continue; | 3464 | continue; |
3408 | } | 3465 | } |
3409 | l3 = kmalloc_node(sizeof(struct kmem_list3), GFP_KERNEL, node); | 3466 | l3 = kmalloc_node(sizeof(struct kmem_list3), GFP_KERNEL, node); |
3410 | if (!l3) | 3467 | if (!l3) { |
3468 | free_alien_cache(new_alien); | ||
3469 | kfree(new_shared); | ||
3411 | goto fail; | 3470 | goto fail; |
3471 | } | ||
3412 | 3472 | ||
3413 | kmem_list3_init(l3); | 3473 | kmem_list3_init(l3); |
3414 | l3->next_reap = jiffies + REAPTIMEOUT_LIST3 + | 3474 | l3->next_reap = jiffies + REAPTIMEOUT_LIST3 + |
3415 | ((unsigned long)cachep) % REAPTIMEOUT_LIST3; | 3475 | ((unsigned long)cachep) % REAPTIMEOUT_LIST3; |
3416 | l3->shared = new; | 3476 | l3->shared = new_shared; |
3417 | l3->alien = new_alien; | 3477 | l3->alien = new_alien; |
3418 | l3->free_limit = (1 + nr_cpus_node(node)) * | 3478 | l3->free_limit = (1 + nr_cpus_node(node)) * |
3419 | cachep->batchcount + cachep->num; | 3479 | cachep->batchcount + cachep->num; |
3420 | cachep->nodelists[node] = l3; | 3480 | cachep->nodelists[node] = l3; |
3421 | } | 3481 | } |
3422 | return err; | 3482 | return 0; |
3483 | |||
3423 | fail: | 3484 | fail: |
3424 | err = -ENOMEM; | 3485 | if (!cachep->next.next) { |
3425 | return err; | 3486 | /* Cache is not active yet. Roll back what we did */ |
3487 | node--; | ||
3488 | while (node >= 0) { | ||
3489 | if (cachep->nodelists[node]) { | ||
3490 | l3 = cachep->nodelists[node]; | ||
3491 | |||
3492 | kfree(l3->shared); | ||
3493 | free_alien_cache(l3->alien); | ||
3494 | kfree(l3); | ||
3495 | cachep->nodelists[node] = NULL; | ||
3496 | } | ||
3497 | node--; | ||
3498 | } | ||
3499 | } | ||
3500 | return -ENOMEM; | ||
3426 | } | 3501 | } |
3427 | 3502 | ||
3428 | struct ccupdate_struct { | 3503 | struct ccupdate_struct { |
@@ -3899,6 +3974,159 @@ ssize_t slabinfo_write(struct file *file, const char __user * buffer, | |||
3899 | res = count; | 3974 | res = count; |
3900 | return res; | 3975 | return res; |
3901 | } | 3976 | } |
3977 | |||
3978 | #ifdef CONFIG_DEBUG_SLAB_LEAK | ||
3979 | |||
3980 | static void *leaks_start(struct seq_file *m, loff_t *pos) | ||
3981 | { | ||
3982 | loff_t n = *pos; | ||
3983 | struct list_head *p; | ||
3984 | |||
3985 | mutex_lock(&cache_chain_mutex); | ||
3986 | p = cache_chain.next; | ||
3987 | while (n--) { | ||
3988 | p = p->next; | ||
3989 | if (p == &cache_chain) | ||
3990 | return NULL; | ||
3991 | } | ||
3992 | return list_entry(p, struct kmem_cache, next); | ||
3993 | } | ||
3994 | |||
3995 | static inline int add_caller(unsigned long *n, unsigned long v) | ||
3996 | { | ||
3997 | unsigned long *p; | ||
3998 | int l; | ||
3999 | if (!v) | ||
4000 | return 1; | ||
4001 | l = n[1]; | ||
4002 | p = n + 2; | ||
4003 | while (l) { | ||
4004 | int i = l/2; | ||
4005 | unsigned long *q = p + 2 * i; | ||
4006 | if (*q == v) { | ||
4007 | q[1]++; | ||
4008 | return 1; | ||
4009 | } | ||
4010 | if (*q > v) { | ||
4011 | l = i; | ||
4012 | } else { | ||
4013 | p = q + 2; | ||
4014 | l -= i + 1; | ||
4015 | } | ||
4016 | } | ||
4017 | if (++n[1] == n[0]) | ||
4018 | return 0; | ||
4019 | memmove(p + 2, p, n[1] * 2 * sizeof(unsigned long) - ((void *)p - (void *)n)); | ||
4020 | p[0] = v; | ||
4021 | p[1] = 1; | ||
4022 | return 1; | ||
4023 | } | ||
4024 | |||
4025 | static void handle_slab(unsigned long *n, struct kmem_cache *c, struct slab *s) | ||
4026 | { | ||
4027 | void *p; | ||
4028 | int i; | ||
4029 | if (n[0] == n[1]) | ||
4030 | return; | ||
4031 | for (i = 0, p = s->s_mem; i < c->num; i++, p += c->buffer_size) { | ||
4032 | if (slab_bufctl(s)[i] != BUFCTL_ACTIVE) | ||
4033 | continue; | ||
4034 | if (!add_caller(n, (unsigned long)*dbg_userword(c, p))) | ||
4035 | return; | ||
4036 | } | ||
4037 | } | ||
4038 | |||
4039 | static void show_symbol(struct seq_file *m, unsigned long address) | ||
4040 | { | ||
4041 | #ifdef CONFIG_KALLSYMS | ||
4042 | char *modname; | ||
4043 | const char *name; | ||
4044 | unsigned long offset, size; | ||
4045 | char namebuf[KSYM_NAME_LEN+1]; | ||
4046 | |||
4047 | name = kallsyms_lookup(address, &size, &offset, &modname, namebuf); | ||
4048 | |||
4049 | if (name) { | ||
4050 | seq_printf(m, "%s+%#lx/%#lx", name, offset, size); | ||
4051 | if (modname) | ||
4052 | seq_printf(m, " [%s]", modname); | ||
4053 | return; | ||
4054 | } | ||
4055 | #endif | ||
4056 | seq_printf(m, "%p", (void *)address); | ||
4057 | } | ||
4058 | |||
4059 | static int leaks_show(struct seq_file *m, void *p) | ||
4060 | { | ||
4061 | struct kmem_cache *cachep = p; | ||
4062 | struct list_head *q; | ||
4063 | struct slab *slabp; | ||
4064 | struct kmem_list3 *l3; | ||
4065 | const char *name; | ||
4066 | unsigned long *n = m->private; | ||
4067 | int node; | ||
4068 | int i; | ||
4069 | |||
4070 | if (!(cachep->flags & SLAB_STORE_USER)) | ||
4071 | return 0; | ||
4072 | if (!(cachep->flags & SLAB_RED_ZONE)) | ||
4073 | return 0; | ||
4074 | |||
4075 | /* OK, we can do it */ | ||
4076 | |||
4077 | n[1] = 0; | ||
4078 | |||
4079 | for_each_online_node(node) { | ||
4080 | l3 = cachep->nodelists[node]; | ||
4081 | if (!l3) | ||
4082 | continue; | ||
4083 | |||
4084 | check_irq_on(); | ||
4085 | spin_lock_irq(&l3->list_lock); | ||
4086 | |||
4087 | list_for_each(q, &l3->slabs_full) { | ||
4088 | slabp = list_entry(q, struct slab, list); | ||
4089 | handle_slab(n, cachep, slabp); | ||
4090 | } | ||
4091 | list_for_each(q, &l3->slabs_partial) { | ||
4092 | slabp = list_entry(q, struct slab, list); | ||
4093 | handle_slab(n, cachep, slabp); | ||
4094 | } | ||
4095 | spin_unlock_irq(&l3->list_lock); | ||
4096 | } | ||
4097 | name = cachep->name; | ||
4098 | if (n[0] == n[1]) { | ||
4099 | /* Increase the buffer size */ | ||
4100 | mutex_unlock(&cache_chain_mutex); | ||
4101 | m->private = kzalloc(n[0] * 4 * sizeof(unsigned long), GFP_KERNEL); | ||
4102 | if (!m->private) { | ||
4103 | /* Too bad, we are really out */ | ||
4104 | m->private = n; | ||
4105 | mutex_lock(&cache_chain_mutex); | ||
4106 | return -ENOMEM; | ||
4107 | } | ||
4108 | *(unsigned long *)m->private = n[0] * 2; | ||
4109 | kfree(n); | ||
4110 | mutex_lock(&cache_chain_mutex); | ||
4111 | /* Now make sure this entry will be retried */ | ||
4112 | m->count = m->size; | ||
4113 | return 0; | ||
4114 | } | ||
4115 | for (i = 0; i < n[1]; i++) { | ||
4116 | seq_printf(m, "%s: %lu ", name, n[2*i+3]); | ||
4117 | show_symbol(m, n[2*i+2]); | ||
4118 | seq_putc(m, '\n'); | ||
4119 | } | ||
4120 | return 0; | ||
4121 | } | ||
4122 | |||
4123 | struct seq_operations slabstats_op = { | ||
4124 | .start = leaks_start, | ||
4125 | .next = s_next, | ||
4126 | .stop = s_stop, | ||
4127 | .show = leaks_show, | ||
4128 | }; | ||
4129 | #endif | ||
3902 | #endif | 4130 | #endif |
3903 | 4131 | ||
3904 | /** | 4132 | /** |
@@ -294,6 +294,16 @@ void *kmem_cache_alloc(struct kmem_cache *c, gfp_t flags) | |||
294 | } | 294 | } |
295 | EXPORT_SYMBOL(kmem_cache_alloc); | 295 | EXPORT_SYMBOL(kmem_cache_alloc); |
296 | 296 | ||
297 | void *kmem_cache_zalloc(struct kmem_cache *c, gfp_t flags) | ||
298 | { | ||
299 | void *ret = kmem_cache_alloc(c, flags); | ||
300 | if (ret) | ||
301 | memset(ret, 0, c->size); | ||
302 | |||
303 | return ret; | ||
304 | } | ||
305 | EXPORT_SYMBOL(kmem_cache_zalloc); | ||
306 | |||
297 | void kmem_cache_free(struct kmem_cache *c, void *b) | 307 | void kmem_cache_free(struct kmem_cache *c, void *b) |
298 | { | 308 | { |
299 | if (c->dtor) | 309 | if (c->dtor) |
@@ -5,18 +5,18 @@ | |||
5 | #include <asm/uaccess.h> | 5 | #include <asm/uaccess.h> |
6 | 6 | ||
7 | /** | 7 | /** |
8 | * kzalloc - allocate memory. The memory is set to zero. | 8 | * __kzalloc - allocate memory. The memory is set to zero. |
9 | * @size: how many bytes of memory are required. | 9 | * @size: how many bytes of memory are required. |
10 | * @flags: the type of memory to allocate. | 10 | * @flags: the type of memory to allocate. |
11 | */ | 11 | */ |
12 | void *kzalloc(size_t size, gfp_t flags) | 12 | void *__kzalloc(size_t size, gfp_t flags) |
13 | { | 13 | { |
14 | void *ret = kmalloc(size, flags); | 14 | void *ret = ____kmalloc(size, flags); |
15 | if (ret) | 15 | if (ret) |
16 | memset(ret, 0, size); | 16 | memset(ret, 0, size); |
17 | return ret; | 17 | return ret; |
18 | } | 18 | } |
19 | EXPORT_SYMBOL(kzalloc); | 19 | EXPORT_SYMBOL(__kzalloc); |
20 | 20 | ||
21 | /* | 21 | /* |
22 | * kstrdup - allocate space for and copy an existing string | 22 | * kstrdup - allocate space for and copy an existing string |
@@ -33,7 +33,7 @@ char *kstrdup(const char *s, gfp_t gfp) | |||
33 | return NULL; | 33 | return NULL; |
34 | 34 | ||
35 | len = strlen(s) + 1; | 35 | len = strlen(s) + 1; |
36 | buf = kmalloc(len, gfp); | 36 | buf = ____kmalloc(len, gfp); |
37 | if (buf) | 37 | if (buf) |
38 | memcpy(buf, s, len); | 38 | memcpy(buf, s, len); |
39 | return buf; | 39 | return buf; |
diff --git a/mm/vmscan.c b/mm/vmscan.c index fd572bbdc9f5..78865c849f8f 100644 --- a/mm/vmscan.c +++ b/mm/vmscan.c | |||
@@ -1356,7 +1356,9 @@ static int __init kswapd_init(void) | |||
1356 | 1356 | ||
1357 | pid = kernel_thread(kswapd, pgdat, CLONE_KERNEL); | 1357 | pid = kernel_thread(kswapd, pgdat, CLONE_KERNEL); |
1358 | BUG_ON(pid < 0); | 1358 | BUG_ON(pid < 0); |
1359 | read_lock(&tasklist_lock); | ||
1359 | pgdat->kswapd = find_task_by_pid(pid); | 1360 | pgdat->kswapd = find_task_by_pid(pid); |
1361 | read_unlock(&tasklist_lock); | ||
1360 | } | 1362 | } |
1361 | total_memory = nr_free_pagecache_pages(); | 1363 | total_memory = nr_free_pagecache_pages(); |
1362 | hotcpu_notifier(cpu_callback, 0); | 1364 | hotcpu_notifier(cpu_callback, 0); |
diff --git a/net/bluetooth/af_bluetooth.c b/net/bluetooth/af_bluetooth.c index fb031fe9be9e..469eda0f0dfd 100644 --- a/net/bluetooth/af_bluetooth.c +++ b/net/bluetooth/af_bluetooth.c | |||
@@ -238,6 +238,9 @@ unsigned int bt_sock_poll(struct file * file, struct socket *sock, poll_table *w | |||
238 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | 238 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) |
239 | mask |= POLLERR; | 239 | mask |= POLLERR; |
240 | 240 | ||
241 | if (sk->sk_shutdown & RCV_SHUTDOWN) | ||
242 | mask |= POLLRDHUP; | ||
243 | |||
241 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 244 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
242 | mask |= POLLHUP; | 245 | mask |= POLLHUP; |
243 | 246 | ||
diff --git a/net/core/datagram.c b/net/core/datagram.c index b8ce6bf81188..aecddcc30401 100644 --- a/net/core/datagram.c +++ b/net/core/datagram.c | |||
@@ -500,6 +500,8 @@ unsigned int datagram_poll(struct file *file, struct socket *sock, | |||
500 | /* exceptional events? */ | 500 | /* exceptional events? */ |
501 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | 501 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) |
502 | mask |= POLLERR; | 502 | mask |= POLLERR; |
503 | if (sk->sk_shutdown & RCV_SHUTDOWN) | ||
504 | mask |= POLLRDHUP; | ||
503 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 505 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
504 | mask |= POLLHUP; | 506 | mask |= POLLHUP; |
505 | 507 | ||
diff --git a/net/core/skbuff.c b/net/core/skbuff.c index c9f878454531..09464fa8d72f 100644 --- a/net/core/skbuff.c +++ b/net/core/skbuff.c | |||
@@ -149,7 +149,7 @@ struct sk_buff *__alloc_skb(unsigned int size, gfp_t gfp_mask, | |||
149 | 149 | ||
150 | /* Get the DATA. Size must match skb_add_mtu(). */ | 150 | /* Get the DATA. Size must match skb_add_mtu(). */ |
151 | size = SKB_DATA_ALIGN(size); | 151 | size = SKB_DATA_ALIGN(size); |
152 | data = kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); | 152 | data = ____kmalloc(size + sizeof(struct skb_shared_info), gfp_mask); |
153 | if (!data) | 153 | if (!data) |
154 | goto nodata; | 154 | goto nodata; |
155 | 155 | ||
diff --git a/net/dccp/proto.c b/net/dccp/proto.c index d4b293e16283..1ff7328b0e17 100644 --- a/net/dccp/proto.c +++ b/net/dccp/proto.c | |||
@@ -350,7 +350,7 @@ unsigned int dccp_poll(struct file *file, struct socket *sock, | |||
350 | if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == DCCP_CLOSED) | 350 | if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == DCCP_CLOSED) |
351 | mask |= POLLHUP; | 351 | mask |= POLLHUP; |
352 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 352 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
353 | mask |= POLLIN | POLLRDNORM; | 353 | mask |= POLLIN | POLLRDNORM | POLLRDHUP; |
354 | 354 | ||
355 | /* Connected? */ | 355 | /* Connected? */ |
356 | if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_RESPOND)) { | 356 | if ((1 << sk->sk_state) & ~(DCCPF_REQUESTING | DCCPF_RESPOND)) { |
diff --git a/net/ipv4/tcp.c b/net/ipv4/tcp.c index 8f5042bd8252..87f68e787d0c 100644 --- a/net/ipv4/tcp.c +++ b/net/ipv4/tcp.c | |||
@@ -366,7 +366,7 @@ unsigned int tcp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
366 | if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == TCP_CLOSE) | 366 | if (sk->sk_shutdown == SHUTDOWN_MASK || sk->sk_state == TCP_CLOSE) |
367 | mask |= POLLHUP; | 367 | mask |= POLLHUP; |
368 | if (sk->sk_shutdown & RCV_SHUTDOWN) | 368 | if (sk->sk_shutdown & RCV_SHUTDOWN) |
369 | mask |= POLLIN | POLLRDNORM; | 369 | mask |= POLLIN | POLLRDNORM | POLLRDHUP; |
370 | 370 | ||
371 | /* Connected? */ | 371 | /* Connected? */ |
372 | if ((1 << sk->sk_state) & ~(TCPF_SYN_SENT | TCPF_SYN_RECV)) { | 372 | if ((1 << sk->sk_state) & ~(TCPF_SYN_SENT | TCPF_SYN_RECV)) { |
diff --git a/net/rxrpc/main.c b/net/rxrpc/main.c index 36fdcbcd80d1..48cbd065bb45 100644 --- a/net/rxrpc/main.c +++ b/net/rxrpc/main.c | |||
@@ -79,8 +79,8 @@ static int __init rxrpc_initialise(void) | |||
79 | error_sysctl: | 79 | error_sysctl: |
80 | #ifdef CONFIG_SYSCTL | 80 | #ifdef CONFIG_SYSCTL |
81 | rxrpc_sysctl_cleanup(); | 81 | rxrpc_sysctl_cleanup(); |
82 | #endif | ||
83 | error_proc: | 82 | error_proc: |
83 | #endif | ||
84 | #ifdef CONFIG_PROC_FS | 84 | #ifdef CONFIG_PROC_FS |
85 | rxrpc_proc_cleanup(); | 85 | rxrpc_proc_cleanup(); |
86 | #endif | 86 | #endif |
diff --git a/net/sctp/socket.c b/net/sctp/socket.c index 0ea947eb6813..b6e4b89539b3 100644 --- a/net/sctp/socket.c +++ b/net/sctp/socket.c | |||
@@ -4894,6 +4894,8 @@ unsigned int sctp_poll(struct file *file, struct socket *sock, poll_table *wait) | |||
4894 | /* Is there any exceptional events? */ | 4894 | /* Is there any exceptional events? */ |
4895 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) | 4895 | if (sk->sk_err || !skb_queue_empty(&sk->sk_error_queue)) |
4896 | mask |= POLLERR; | 4896 | mask |= POLLERR; |
4897 | if (sk->sk_shutdown & RCV_SHUTDOWN) | ||
4898 | mask |= POLLRDHUP; | ||
4897 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 4899 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
4898 | mask |= POLLHUP; | 4900 | mask |= POLLHUP; |
4899 | 4901 | ||
diff --git a/net/unix/af_unix.c b/net/unix/af_unix.c index 2b4cc2eea5b3..d901465ce013 100644 --- a/net/unix/af_unix.c +++ b/net/unix/af_unix.c | |||
@@ -1878,6 +1878,8 @@ static unsigned int unix_poll(struct file * file, struct socket *sock, poll_tabl | |||
1878 | mask |= POLLERR; | 1878 | mask |= POLLERR; |
1879 | if (sk->sk_shutdown == SHUTDOWN_MASK) | 1879 | if (sk->sk_shutdown == SHUTDOWN_MASK) |
1880 | mask |= POLLHUP; | 1880 | mask |= POLLHUP; |
1881 | if (sk->sk_shutdown & RCV_SHUTDOWN) | ||
1882 | mask |= POLLRDHUP; | ||
1881 | 1883 | ||
1882 | /* readable? */ | 1884 | /* readable? */ |
1883 | if (!skb_queue_empty(&sk->sk_receive_queue) || | 1885 | if (!skb_queue_empty(&sk->sk_receive_queue) || |
diff --git a/scripts/kallsyms.c b/scripts/kallsyms.c index d591578bd3b2..22d281c6ec24 100644 --- a/scripts/kallsyms.c +++ b/scripts/kallsyms.c | |||
@@ -124,6 +124,11 @@ static int read_symbol(FILE *in, struct sym_entry *s) | |||
124 | * compressed together */ | 124 | * compressed together */ |
125 | s->len = strlen(str) + 1; | 125 | s->len = strlen(str) + 1; |
126 | s->sym = malloc(s->len + 1); | 126 | s->sym = malloc(s->len + 1); |
127 | if (!s->sym) { | ||
128 | fprintf(stderr, "kallsyms failure: " | ||
129 | "unable to allocate required amount of memory\n"); | ||
130 | exit(EXIT_FAILURE); | ||
131 | } | ||
127 | strcpy((char *)s->sym + 1, str); | 132 | strcpy((char *)s->sym + 1, str); |
128 | s->sym[0] = stype; | 133 | s->sym[0] = stype; |
129 | 134 | ||
@@ -272,7 +277,12 @@ static void write_src(void) | |||
272 | 277 | ||
273 | /* table of offset markers, that give the offset in the compressed stream | 278 | /* table of offset markers, that give the offset in the compressed stream |
274 | * every 256 symbols */ | 279 | * every 256 symbols */ |
275 | markers = (unsigned int *) malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256)); | 280 | markers = malloc(sizeof(unsigned int) * ((table_cnt + 255) / 256)); |
281 | if (!markers) { | ||
282 | fprintf(stderr, "kallsyms failure: " | ||
283 | "unable to allocate required memory\n"); | ||
284 | exit(EXIT_FAILURE); | ||
285 | } | ||
276 | 286 | ||
277 | output_label("kallsyms_names"); | 287 | output_label("kallsyms_names"); |
278 | off = 0; | 288 | off = 0; |
diff --git a/security/commoncap.c b/security/commoncap.c index 8a6e097f99ea..841eb4e5c62b 100644 --- a/security/commoncap.c +++ b/security/commoncap.c | |||
@@ -60,8 +60,8 @@ int cap_settime(struct timespec *ts, struct timezone *tz) | |||
60 | int cap_ptrace (struct task_struct *parent, struct task_struct *child) | 60 | int cap_ptrace (struct task_struct *parent, struct task_struct *child) |
61 | { | 61 | { |
62 | /* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */ | 62 | /* Derived from arch/i386/kernel/ptrace.c:sys_ptrace. */ |
63 | if (!cap_issubset (child->cap_permitted, current->cap_permitted) && | 63 | if (!cap_issubset(child->cap_permitted, parent->cap_permitted) && |
64 | !capable(CAP_SYS_PTRACE)) | 64 | !__capable(parent, CAP_SYS_PTRACE)) |
65 | return -EPERM; | 65 | return -EPERM; |
66 | return 0; | 66 | return 0; |
67 | } | 67 | } |
diff --git a/security/keys/key.c b/security/keys/key.c index 99781b798312..a057e3311aad 100644 --- a/security/keys/key.c +++ b/security/keys/key.c | |||
@@ -1,6 +1,6 @@ | |||
1 | /* key.c: basic authentication token and access key management | 1 | /* key.c: basic authentication token and access key management |
2 | * | 2 | * |
3 | * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved. | 3 | * Copyright (C) 2004-6 Red Hat, Inc. All Rights Reserved. |
4 | * Written by David Howells (dhowells@redhat.com) | 4 | * Written by David Howells (dhowells@redhat.com) |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or | 6 | * This program is free software; you can redistribute it and/or |
@@ -271,7 +271,7 @@ struct key *key_alloc(struct key_type *type, const char *desc, | |||
271 | * its description */ | 271 | * its description */ |
272 | if (!not_in_quota) { | 272 | if (!not_in_quota) { |
273 | spin_lock(&user->lock); | 273 | spin_lock(&user->lock); |
274 | if (user->qnkeys + 1 >= KEYQUOTA_MAX_KEYS && | 274 | if (user->qnkeys + 1 >= KEYQUOTA_MAX_KEYS || |
275 | user->qnbytes + quotalen >= KEYQUOTA_MAX_BYTES | 275 | user->qnbytes + quotalen >= KEYQUOTA_MAX_BYTES |
276 | ) | 276 | ) |
277 | goto no_quota; | 277 | goto no_quota; |
@@ -795,12 +795,16 @@ key_ref_t key_create_or_update(key_ref_t keyring_ref, | |||
795 | goto error_3; | 795 | goto error_3; |
796 | } | 796 | } |
797 | 797 | ||
798 | /* search for an existing key of the same type and description in the | 798 | /* if it's possible to update this type of key, search for an existing |
799 | * destination keyring | 799 | * key of the same type and description in the destination keyring and |
800 | * update that instead if possible | ||
800 | */ | 801 | */ |
801 | key_ref = __keyring_search_one(keyring_ref, ktype, description, 0); | 802 | if (ktype->update) { |
802 | if (!IS_ERR(key_ref)) | 803 | key_ref = __keyring_search_one(keyring_ref, ktype, description, |
803 | goto found_matching_key; | 804 | 0); |
805 | if (!IS_ERR(key_ref)) | ||
806 | goto found_matching_key; | ||
807 | } | ||
804 | 808 | ||
805 | /* decide on the permissions we want */ | 809 | /* decide on the permissions we want */ |
806 | perm = KEY_POS_VIEW | KEY_POS_SEARCH | KEY_POS_LINK | KEY_POS_SETATTR; | 810 | perm = KEY_POS_VIEW | KEY_POS_SEARCH | KEY_POS_LINK | KEY_POS_SETATTR; |
diff --git a/security/security.c b/security/security.c index f693e1f66b98..51ef509710b9 100644 --- a/security/security.c +++ b/security/security.c | |||
@@ -174,31 +174,8 @@ int mod_unreg_security(const char *name, struct security_operations *ops) | |||
174 | return security_ops->unregister_security(name, ops); | 174 | return security_ops->unregister_security(name, ops); |
175 | } | 175 | } |
176 | 176 | ||
177 | /** | ||
178 | * capable - calls the currently loaded security module's capable() function with the specified capability | ||
179 | * @cap: the requested capability level. | ||
180 | * | ||
181 | * This function calls the currently loaded security module's capable() | ||
182 | * function with a pointer to the current task and the specified @cap value. | ||
183 | * | ||
184 | * This allows the security module to implement the capable function call | ||
185 | * however it chooses to. | ||
186 | */ | ||
187 | int capable(int cap) | ||
188 | { | ||
189 | if (security_ops->capable(current, cap)) { | ||
190 | /* capability denied */ | ||
191 | return 0; | ||
192 | } | ||
193 | |||
194 | /* capability granted */ | ||
195 | current->flags |= PF_SUPERPRIV; | ||
196 | return 1; | ||
197 | } | ||
198 | |||
199 | EXPORT_SYMBOL_GPL(register_security); | 177 | EXPORT_SYMBOL_GPL(register_security); |
200 | EXPORT_SYMBOL_GPL(unregister_security); | 178 | EXPORT_SYMBOL_GPL(unregister_security); |
201 | EXPORT_SYMBOL_GPL(mod_reg_security); | 179 | EXPORT_SYMBOL_GPL(mod_reg_security); |
202 | EXPORT_SYMBOL_GPL(mod_unreg_security); | 180 | EXPORT_SYMBOL_GPL(mod_unreg_security); |
203 | EXPORT_SYMBOL(capable); | ||
204 | EXPORT_SYMBOL(security_ops); | 181 | EXPORT_SYMBOL(security_ops); |
diff --git a/sound/oss/au1000.c b/sound/oss/au1000.c index fe54de25aafc..eacb0aef21e1 100644 --- a/sound/oss/au1000.c +++ b/sound/oss/au1000.c | |||
@@ -100,7 +100,7 @@ | |||
100 | 100 | ||
101 | /* Boot options */ | 101 | /* Boot options */ |
102 | static int vra = 0; // 0 = no VRA, 1 = use VRA if codec supports it | 102 | static int vra = 0; // 0 = no VRA, 1 = use VRA if codec supports it |
103 | MODULE_PARM(vra, "i"); | 103 | module_param(vra, bool, 0); |
104 | MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); | 104 | MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); |
105 | 105 | ||
106 | 106 | ||
diff --git a/sound/oss/au1550_ac97.c b/sound/oss/au1550_ac97.c index 6a4956b8025d..c1168fae6be6 100644 --- a/sound/oss/au1550_ac97.c +++ b/sound/oss/au1550_ac97.c | |||
@@ -79,7 +79,7 @@ | |||
79 | * 0 = no VRA, 1 = use VRA if codec supports it | 79 | * 0 = no VRA, 1 = use VRA if codec supports it |
80 | */ | 80 | */ |
81 | static int vra = 1; | 81 | static int vra = 1; |
82 | MODULE_PARM(vra, "i"); | 82 | module_param(vra, bool, 0); |
83 | MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); | 83 | MODULE_PARM_DESC(vra, "if 1 use VRA if codec supports it"); |
84 | 84 | ||
85 | static struct au1550_state { | 85 | static struct au1550_state { |
diff --git a/sound/oss/awe_wave.c b/sound/oss/awe_wave.c index b3ea719d33db..d1a0eb294d6f 100644 --- a/sound/oss/awe_wave.c +++ b/sound/oss/awe_wave.c | |||
@@ -2944,7 +2944,7 @@ alloc_new_info(void) | |||
2944 | { | 2944 | { |
2945 | awe_voice_list *newlist; | 2945 | awe_voice_list *newlist; |
2946 | 2946 | ||
2947 | newlist = (awe_voice_list *)kmalloc(sizeof(*newlist), GFP_KERNEL); | 2947 | newlist = kmalloc(sizeof(*newlist), GFP_KERNEL); |
2948 | if (newlist == NULL) { | 2948 | if (newlist == NULL) { |
2949 | printk(KERN_ERR "AWE32: can't alloc info table\n"); | 2949 | printk(KERN_ERR "AWE32: can't alloc info table\n"); |
2950 | return NULL; | 2950 | return NULL; |
@@ -3547,8 +3547,10 @@ awe_load_guspatch(const char __user *addr, int offs, int size, int pmgr_flag) | |||
3547 | smp->checksum_flag = 0; | 3547 | smp->checksum_flag = 0; |
3548 | smp->checksum = 0; | 3548 | smp->checksum = 0; |
3549 | 3549 | ||
3550 | if ((rc = awe_write_wave_data(addr, sizeof_patch, smprec, -1)) < 0) | 3550 | if ((rc = awe_write_wave_data(addr, sizeof_patch, smprec, -1)) < 0) { |
3551 | kfree(vrec); | ||
3551 | return rc; | 3552 | return rc; |
3553 | } | ||
3552 | sf->mem_ptr += rc; | 3554 | sf->mem_ptr += rc; |
3553 | add_sf_sample(sf, smprec); | 3555 | add_sf_sample(sf, smprec); |
3554 | 3556 | ||
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c index c9302a1e515b..87bd3100aef3 100644 --- a/sound/oss/dmasound/dmasound_core.c +++ b/sound/oss/dmasound/dmasound_core.c | |||
@@ -195,18 +195,18 @@ | |||
195 | */ | 195 | */ |
196 | 196 | ||
197 | int dmasound_catchRadius = 0; | 197 | int dmasound_catchRadius = 0; |
198 | MODULE_PARM(dmasound_catchRadius, "i"); | 198 | module_param(dmasound_catchRadius, int, 0); |
199 | 199 | ||
200 | static unsigned int numWriteBufs = DEFAULT_N_BUFFERS; | 200 | static unsigned int numWriteBufs = DEFAULT_N_BUFFERS; |
201 | MODULE_PARM(numWriteBufs, "i"); | 201 | module_param(numWriteBufs, int, 0); |
202 | static unsigned int writeBufSize = DEFAULT_BUFF_SIZE ; /* in bytes */ | 202 | static unsigned int writeBufSize = DEFAULT_BUFF_SIZE ; /* in bytes */ |
203 | MODULE_PARM(writeBufSize, "i"); | 203 | module_param(writeBufSize, int, 0); |
204 | 204 | ||
205 | #ifdef HAS_RECORD | 205 | #ifdef HAS_RECORD |
206 | static unsigned int numReadBufs = DEFAULT_N_BUFFERS; | 206 | static unsigned int numReadBufs = DEFAULT_N_BUFFERS; |
207 | MODULE_PARM(numReadBufs, "i"); | 207 | module_param(numReadBufs, int, 0); |
208 | static unsigned int readBufSize = DEFAULT_BUFF_SIZE; /* in bytes */ | 208 | static unsigned int readBufSize = DEFAULT_BUFF_SIZE; /* in bytes */ |
209 | MODULE_PARM(readBufSize, "i"); | 209 | module_param(readBufSize, int, 0); |
210 | #endif | 210 | #endif |
211 | 211 | ||
212 | MODULE_LICENSE("GPL"); | 212 | MODULE_LICENSE("GPL"); |
diff --git a/sound/oss/ite8172.c b/sound/oss/ite8172.c index ffcb910f5c3e..00ac1c95a429 100644 --- a/sound/oss/ite8172.c +++ b/sound/oss/ite8172.c | |||
@@ -1968,9 +1968,9 @@ static int i2s_fmt[NR_DEVICE]; | |||
1968 | 1968 | ||
1969 | static unsigned int devindex; | 1969 | static unsigned int devindex; |
1970 | 1970 | ||
1971 | MODULE_PARM(spdif, "1-" __MODULE_STRING(NR_DEVICE) "i"); | 1971 | module_param_array(spdif, int, NULL, 0); |
1972 | MODULE_PARM_DESC(spdif, "if 1 the S/PDIF digital output is enabled"); | 1972 | MODULE_PARM_DESC(spdif, "if 1 the S/PDIF digital output is enabled"); |
1973 | MODULE_PARM(i2s_fmt, "1-" __MODULE_STRING(NR_DEVICE) "i"); | 1973 | module_param_array(i2s_fmt, int, NULL, 0); |
1974 | MODULE_PARM_DESC(i2s_fmt, "the format of I2S"); | 1974 | MODULE_PARM_DESC(i2s_fmt, "the format of I2S"); |
1975 | 1975 | ||
1976 | MODULE_AUTHOR("Monta Vista Software, stevel@mvista.com"); | 1976 | MODULE_AUTHOR("Monta Vista Software, stevel@mvista.com"); |
diff --git a/sound/oss/sb_mixer.c b/sound/oss/sb_mixer.c index f56898c3981e..ccb21d48d42c 100644 --- a/sound/oss/sb_mixer.c +++ b/sound/oss/sb_mixer.c | |||
@@ -273,14 +273,14 @@ int sb_common_mixer_set(sb_devc * devc, int dev, int left, int right) | |||
273 | int regoffs; | 273 | int regoffs; |
274 | unsigned char val; | 274 | unsigned char val; |
275 | 275 | ||
276 | if ((dev < 0) || (dev >= devc->iomap_sz)) | ||
277 | return -EINVAL; | ||
278 | |||
276 | regoffs = (*devc->iomap)[dev][LEFT_CHN].regno; | 279 | regoffs = (*devc->iomap)[dev][LEFT_CHN].regno; |
277 | 280 | ||
278 | if (regoffs == 0) | 281 | if (regoffs == 0) |
279 | return -EINVAL; | 282 | return -EINVAL; |
280 | 283 | ||
281 | if ((dev < 0) || (dev >= devc->iomap_sz)) | ||
282 | return -EINVAL; | ||
283 | |||
284 | val = sb_getmixer(devc, regoffs); | 284 | val = sb_getmixer(devc, regoffs); |
285 | change_bits(devc, &val, dev, LEFT_CHN, left); | 285 | change_bits(devc, &val, dev, LEFT_CHN, left); |
286 | 286 | ||
diff --git a/sound/oss/sequencer.c b/sound/oss/sequencer.c index 698614226c9a..347cd79c2502 100644 --- a/sound/oss/sequencer.c +++ b/sound/oss/sequencer.c | |||
@@ -709,11 +709,11 @@ static void seq_local_event(unsigned char *event_rec) | |||
709 | 709 | ||
710 | static void seq_sysex_message(unsigned char *event_rec) | 710 | static void seq_sysex_message(unsigned char *event_rec) |
711 | { | 711 | { |
712 | int dev = event_rec[1]; | 712 | unsigned int dev = event_rec[1]; |
713 | int i, l = 0; | 713 | int i, l = 0; |
714 | unsigned char *buf = &event_rec[2]; | 714 | unsigned char *buf = &event_rec[2]; |
715 | 715 | ||
716 | if ((int) dev > max_synthdev) | 716 | if (dev > max_synthdev) |
717 | return; | 717 | return; |
718 | if (!(synth_open_mask & (1 << dev))) | 718 | if (!(synth_open_mask & (1 << dev))) |
719 | return; | 719 | return; |
diff --git a/sound/oss/swarm_cs4297a.c b/sound/oss/swarm_cs4297a.c index dce9016cbcfd..eb5ea32fd1b0 100644 --- a/sound/oss/swarm_cs4297a.c +++ b/sound/oss/swarm_cs4297a.c | |||
@@ -154,8 +154,8 @@ static void start_adc(struct cs4297a_state *s); | |||
154 | #if CSDEBUG | 154 | #if CSDEBUG |
155 | static unsigned long cs_debuglevel = 4; // levels range from 1-9 | 155 | static unsigned long cs_debuglevel = 4; // levels range from 1-9 |
156 | static unsigned long cs_debugmask = CS_INIT /*| CS_IOCTL*/; | 156 | static unsigned long cs_debugmask = CS_INIT /*| CS_IOCTL*/; |
157 | MODULE_PARM(cs_debuglevel, "i"); | 157 | module_param(cs_debuglevel, int, 0); |
158 | MODULE_PARM(cs_debugmask, "i"); | 158 | module_param(cs_debugmask, int, 0); |
159 | #endif | 159 | #endif |
160 | #define CS_TRUE 1 | 160 | #define CS_TRUE 1 |
161 | #define CS_FALSE 0 | 161 | #define CS_FALSE 0 |
diff --git a/sound/oss/waveartist.c b/sound/oss/waveartist.c index 99d04ad3ca13..afcb524a40eb 100644 --- a/sound/oss/waveartist.c +++ b/sound/oss/waveartist.c | |||
@@ -2028,8 +2028,8 @@ __setup("waveartist=", setup_waveartist); | |||
2028 | #endif | 2028 | #endif |
2029 | 2029 | ||
2030 | MODULE_DESCRIPTION("Rockwell WaveArtist RWA-010 sound driver"); | 2030 | MODULE_DESCRIPTION("Rockwell WaveArtist RWA-010 sound driver"); |
2031 | MODULE_PARM(io, "i"); /* IO base */ | 2031 | module_param(io, int, 0); /* IO base */ |
2032 | MODULE_PARM(irq, "i"); /* IRQ */ | 2032 | module_param(irq, int, 0); /* IRQ */ |
2033 | MODULE_PARM(dma, "i"); /* DMA */ | 2033 | module_param(dma, int, 0); /* DMA */ |
2034 | MODULE_PARM(dma2, "i"); /* DMA2 */ | 2034 | module_param(dma2, int, 0); /* DMA2 */ |
2035 | MODULE_LICENSE("GPL"); | 2035 | MODULE_LICENSE("GPL"); |