]> git.neil.brown.name Git - history.git/commitdiff
v2.4.4.6 -> v2.4.5
authorLinus Torvalds <torvalds@athlon.transmeta.com>
Tue, 5 Feb 2002 02:35:03 +0000 (18:35 -0800)
committerLinus Torvalds <torvalds@athlon.transmeta.com>
Tue, 5 Feb 2002 02:35:03 +0000 (18:35 -0800)
  - Alan Cox: camera conversion missed parts
  - Neil Brown: md graceful alloc failure
  - Andrea Arkangeli: more alpha fixups, bounce buffer deadlock avoidance
  - Adam Fritzler: tms380tr driver update
  - Al Viro: VFS layer cleanups

37 files changed:
Makefile
arch/alpha/config.in
arch/alpha/kernel/alpha_ksyms.c
arch/alpha/kernel/pci_impl.h
arch/alpha/kernel/pci_iommu.c
arch/alpha/kernel/sys_dp264.c
arch/i386/kernel/setup.c
arch/ppc/kernel/feature.c
drivers/ide/ide-cd.c
drivers/md/md.c
drivers/net/tokenring/abyss.c
drivers/net/tokenring/madgemc.c
drivers/net/tokenring/tms380tr.h
drivers/net/tokenring/tmspci.c
drivers/usb/Makefile
drivers/usb/ccvt.h [deleted file]
drivers/usb/ccvt_c.c [deleted file]
drivers/usb/ccvt_i386.S [deleted file]
drivers/usb/kiara.inc [deleted file]
drivers/usb/nala.inc [deleted file]
drivers/usb/pwc-ctrl.c
drivers/usb/pwc-if.c
drivers/usb/pwc-uncompress.c
drivers/usb/pwc.h
drivers/usb/pwc_kiara.h [new file with mode: 0644]
drivers/usb/pwc_nala.h [new file with mode: 0644]
drivers/usb/pwc_timon.h [new file with mode: 0644]
drivers/usb/timon.inc [deleted file]
drivers/video/matrox/matroxfb_crtc2.c
fs/buffer.c
fs/proc/generic.c
fs/super.c
include/linux/mount.h
include/linux/pci.h
mm/highmem.c
mm/page_alloc.c
mm/vmscan.c

index e1af6fc7d7363e56cbb026a38e2b46a85e9b3cb7..13b253897e220a4ad5c2a276aefa823f09cc0cbf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 4
 SUBLEVEL = 5
-EXTRAVERSION =-pre6
+EXTRAVERSION =
 
 KERNELRELEASE=$(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION)
 
index f36050a42e7aca8005237782cc3b2d452106bc85..9acc82c348115212b6de65622d2dd06f8602a87e 100644 (file)
@@ -213,15 +213,8 @@ if [ "$CONFIG_EXPERIMENTAL" = "y" ]; then
    fi
 fi
 
-# The machine must be able to support more than 8GB physical memory
-# before large vmalloc might even pretend to be an issue.
-if [ "$CONFIG_ALPHA_GENERIC" = "y" -o "$CONFIG_ALPHA_DP264" = "y" \
-       -o "$CONFIG_ALPHA_WILDFIRE" = "y" -o "$CONFIG_ALPHA_TITAN" = "y" ]
-then
-       bool 'Large VMALLOC support' CONFIG_ALPHA_LARGE_VMALLOC
-else
-       define_bool CONFIG_ALPHA_LARGE_VMALLOC n
-fi
+# LARGE_VMALLOC is racy, if you *really* need it then fix it first
+define_bool CONFIG_ALPHA_LARGE_VMALLOC n
 
 source drivers/pci/Config.in
 
index e427a26b044f11648b8d3518aacb3859c76a500f..c96e06cf5e11c70c6f931996783832bc052fe1b4 100644 (file)
@@ -207,6 +207,7 @@ EXPORT_SYMBOL(debug_spin_trylock);
 EXPORT_SYMBOL(write_lock);
 EXPORT_SYMBOL(read_lock);
 #endif
+EXPORT_SYMBOL(cpu_present_mask);
 #endif /* CONFIG_SMP */
 
 EXPORT_SYMBOL(rtc_lock);
@@ -230,5 +231,6 @@ EXPORT_SYMBOL_NOVERS(__remq);
 EXPORT_SYMBOL_NOVERS(__remqu);
 EXPORT_SYMBOL_NOVERS(memcpy);
 EXPORT_SYMBOL_NOVERS(memset);
+EXPORT_SYMBOL_NOVERS(memchr);
 
 EXPORT_SYMBOL(get_wchan);
index 19fe6eea4166ab36b49b35a85bc092a24829f4dc..02bebf9463a43b18dd308a244b7206eee929cec0 100644 (file)
@@ -135,6 +135,7 @@ struct pci_iommu_arena
 {
        spinlock_t lock;
        struct pci_controller *hose;
+#define IOMMU_INVALID_PTE 0x2 /* 32:63 bits MBZ */
        unsigned long *ptes;
        dma_addr_t dma_base;
        unsigned int size;
index a63e163102527a94a976abd9fce6323a2ff2fe10..cda9042351aa617c42f357f3064e9c55b7e3547c 100644 (file)
@@ -42,6 +42,25 @@ calc_npages(long bytes)
        return (bytes + PAGE_SIZE - 1) >> PAGE_SHIFT;
 }
 \f
+static void __init
+iommu_arena_fixup(struct pci_iommu_arena * arena)
+{
+       unsigned long base, size;
+
+       /*
+        * The Cypress chip has a quirk, it get confused by addresses
+        * above -1M so reserve the pagetables that maps pci addresses
+        * above -1M.
+        */
+       base = arena->dma_base;
+       size = arena->size;
+       if (base + size > 0xfff00000) {
+               int i = (0xfff00000 - base) >> PAGE_SHIFT;
+               for (; i < (0x100000 >> PAGE_SHIFT); i++)
+                       arena->ptes[i] = IOMMU_INVALID_PTE;
+       }
+}
+
 struct pci_iommu_arena *
 iommu_arena_new(struct pci_controller *hose, dma_addr_t base,
                unsigned long window_size, unsigned long align)
@@ -71,6 +90,8 @@ iommu_arena_new(struct pci_controller *hose, dma_addr_t base,
           unless there are chip bugs.  */
        arena->align_entry = 1;
 
+       iommu_arena_fixup(arena);
+
        return arena;
 }
 
@@ -115,12 +136,12 @@ iommu_arena_alloc(struct pci_iommu_arena *arena, long n)
                }
        }
 
-       /* Success.  Mark them all in use, ie not zero.  Typically
-          bit zero is the valid bit, so write ~1 into everything.
+       /* Success.  Mark them all in use, ie not zero and invalid
+          for the iommu tlb that could load them from under us.
           The chip specific bits will fill this in with something
           kosher when we return.  */
        for (i = 0; i < n; ++i)
-               ptes[p+i] = ~1UL;
+               ptes[p+i] = IOMMU_INVALID_PTE;
 
        arena->next_entry = p + n;
        spin_unlock_irqrestore(&arena->lock, flags);
index c41daf689316ae68b3447f0ba19fe7dce053923b..2076fe47cb8fb1243b77f36d2601f8028d280a05 100644 (file)
 #include <linux/pci.h>
 #include <linux/init.h>
 
+#define __EXTERN_INLINE inline
+#include <asm/io.h>
+#include <asm/core_tsunami.h>
+#undef  __EXTERN_INLINE
+
 #include <asm/ptrace.h>
 #include <asm/system.h>
 #include <asm/dma.h>
 #include <asm/irq.h>
 #include <asm/bitops.h>
 #include <asm/mmu_context.h>
-#include <asm/io.h>
 #include <asm/pgtable.h>
-#include <asm/core_tsunami.h>
 #include <asm/hwrpb.h>
 
 #include "proto.h"
index 429a354371b0b1a14de1c59b477e3f68699110c0..2b24458f5cc742033cd0bd1dd3a320f7f8d24648 100644 (file)
@@ -767,7 +767,7 @@ static inline void parse_mem_cmdline (char ** cmdline_p)
 
 void __init setup_arch(char **cmdline_p)
 {
-       unsigned long bootmap_size;
+       unsigned long bootmap_size, low_mem_size;
        unsigned long start_pfn, max_pfn, max_low_pfn;
        int i;
 
@@ -1013,7 +1013,9 @@ void __init setup_arch(char **cmdline_p)
                request_resource(&ioport_resource, standard_io_resources+i);
 
        /* Tell the PCI layer not to allocate too close to the RAM area.. */
-       pci_mem_start = ((max_low_pfn << PAGE_SHIFT) + 0xfffff) & ~0xfffff;
+       low_mem_size = ((max_low_pfn << PAGE_SHIFT) + 0xfffff) & ~0xfffff;
+       if (low_mem_size > pci_mem_start)
+               pci_mem_start = low_mem_size;
 
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
index 02ecadf2cb353fde6dc8461883096f4e019e9b50..7a43307764a74e4e46066ee12b87647d8df10662 100644 (file)
@@ -270,7 +270,7 @@ static struct device_node*          airport_dev;
 static struct board_features_t {
        char*   compatible;
        u32     features;
-} board_features_datas[] __init = 
+} board_features_datas[] __initdata = 
 {
   {    "AAPL,PowerMac G3",     0                               }, /* Beige G3 */
   {    "iMac,1",               0                               }, /* First iMac (gossamer) */
index 16b0ade47f3c4753aa9c1c4adf8ae5de61d9d392..30bd76c6894629285a26689dc8763381e9d033bf 100644 (file)
@@ -2780,12 +2780,12 @@ static
 int ide_cdrom_open (struct inode *ip, struct file *fp, ide_drive_t *drive)
 {
        struct cdrom_info *info = drive->driver_data;
-       int rc;
+       int rc = -ENOMEM;
 
        MOD_INC_USE_COUNT;
        if (info->buffer == NULL)
                info->buffer = (char *) kmalloc(SECTOR_BUFFER_SIZE, GFP_KERNEL);
-       if ((rc = cdrom_fops.open(ip, fp))) {
+       if ((info->buffer == NULL) || (rc = cdrom_fops.open(ip, fp))) {
                drive->usage--;
                MOD_DEC_USE_COUNT;
        }
index 75eebe40a746dc68e9d38c7cf304641938fa5822..8b0481b61db370724c99b34a0813902e85ef85ad 100644 (file)
@@ -3754,6 +3754,10 @@ void md__init md_setup_drive(void)
                        continue;
                }
                mddev = alloc_mddev(MKDEV(MD_MAJOR,minor));
+               if (mddev == NULL) {
+                       printk("md: kmalloc failed - cannot start array %d\n", minor);
+                       continue;
+               }
                if (md_setup_args.pers[minor]) {
                        /* non-persistent */
                        mdu_array_info_t ainfo;
index dd1becfc48ce4749bd13b6c97c2751ed64643d1c..7ebd99955d43adb37d066a1d7fe85f70f49889f4 100644 (file)
@@ -137,8 +137,7 @@ static int __init abyss_attach(struct pci_dev *pdev, const struct pci_device_id
         */
        dev->base_addr += 0x10;
                
-       ret = tmsdev_init(dev,0,pdev);
-       /* XXX: should be the max PCI32 DMA max */
+       ret = tmsdev_init(dev, PCI_MAX_ADDRESS, pdev);
        if (ret) {
                printk("%s: unable to get memory for dev->priv.\n", 
                       dev->name);
index 4cde439a8dbcf60c31a79c320c9257886a317b75..9cb8477e13a72b901868cf272b628068d28486e5 100644 (file)
@@ -349,6 +349,7 @@ int __init madgemc_probe(void)
                        printk(":%2.2x", dev->dev_addr[i]);
                printk("\n");
 
+               /* XXX is ISA_MAX_ADDRESS correct here? */
                if (tmsdev_init(dev, ISA_MAX_ADDRESS, NULL)) {
                        printk("%s: unable to get memory for dev->priv.\n", 
                               dev->name);
index 4dc1a37a142c6ccb225f6f2551462c2eab224fc3..f0fe5f21ed1e967b8a3ecfe5f9b297b4b7685b59 100644 (file)
@@ -461,7 +461,9 @@ typedef struct {
                                  * fragments following.
                                  */
 
+/* XXX is there some better way to do this? */
 #define ISA_MAX_ADDRESS        0x00ffffff
+#define PCI_MAX_ADDRESS                0xffffffff
 
 #pragma pack(1)
 typedef struct {
index e0749e50e08de25c67b23f71b59f929523cc9248..063f241aae2964fded7e107164b7866859261208 100644 (file)
@@ -142,8 +142,7 @@ static int __init tms_pci_attach(struct pci_dev *pdev, const struct pci_device_i
                printk(":%2.2x", dev->dev_addr[i]);
        printk("\n");
                
-       ret = tmsdev_init(dev,0, pdev);
-       /* XXX: should be the max PCI32 DMA max */
+       ret = tmsdev_init(dev, PCI_MAX_ADDRESS, pdev);
        if (ret) {
                printk("%s: unable to get memory for dev->priv.\n", dev->name);
                goto err_out_irq;
@@ -165,7 +164,7 @@ static int __init tms_pci_attach(struct pci_dev *pdev, const struct pci_device_i
        dev->stop = tms380tr_close;
 
        ret = register_trdev(dev);
-       if (!ret)
+       if (ret)
                goto err_out_tmsdev;
        
        pci_set_drvdata(pdev, dev);
index 7fa9b6a4aed43cc424477166b7af07f41a168be4..562c676d8d105b683aa1785491a0fda6f0e73c69 100644 (file)
@@ -18,18 +18,11 @@ list-multi          := usbcore.o
 usbcore-objs           := usb.o usb-debug.o hub.o
 
 ifneq ($(CONFIG_USB_PWC),n)
-       # By default we use the C colour conversion functions unless we
-       # detect an Intel CPU, for which there is assembly available
-       ccvt-objs               := ccvt_c.o vcvt_c.o
-       ifeq ($(CONFIG_X86),y)
-               ccvt-objs               := ccvt_i386.o vcvt_i386.o
-       endif
-
        export-objs             += pwc-uncompress.o
        list-multi              += pwc.o
 endif
 
-pwc-objs               := pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o $(ccvt-objs)
+pwc-objs               := pwc-if.o pwc-misc.o pwc-ctrl.o pwc-uncompress.o
 
 
 # Optional parts of multipart objects.
diff --git a/drivers/usb/ccvt.h b/drivers/usb/ccvt.h
deleted file mode 100644 (file)
index d94d07e..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/* 
-   (C) 2000 Nemosoft Unv.    nemosoft@smcc.demon.nl
-   
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-
-*/
-
-#ifndef CCVT_H
-#define CCVT_H
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-/* Colour ConVerT: going from one colour space to another
-
-   Format descriptions:
-   420i = "4:2:0 interlaced"
-           YYYY UU YYYY UU   even lines
-           YYYY VV YYYY VV   odd lines
-           U/V data is subsampled by 2 both in horizontal 
-           and vertical directions, and intermixed with the Y values.
-   
-   420p = "4:2:0 planar"
-           YYYYYYYY      N lines
-           UUUU          N/2 lines
-           VVVV          N/2 lines
-           U/V is again subsampled, but all the Ys, Us and Vs are placed 
-           together in separate buffers. The buffers may be placed in
-           one piece of contiguous memory though, with Y buffer first,
-           followed by U, followed by V.
-
-   yuyv = "4:2:2 interlaced"
-           YUYV YUYV YUYV ...   N lines
-           The U/V data is subsampled by 2 in horizontal direction only.
-
-   bgr24 = 3 bytes per pixel, in the order Blue Green Red (whoever came up
-           with that idea...)
-   rgb24 = 3 bytes per pixel, in the order Red Green Blue (which is sensible)
-   rgb32 = 4 bytes per pixel, in the order Red Green Blue Alpha, with 
-           Alpha really being a filler byte (0)
-   bgr32 = last but not least, 4 bytes per pixel, in the order Blue Green Red
-           Alpha, Alpha again a filler byte (0)
- */
-
-/* Functions in ccvt_i386.S/ccvt_c.c */
-/* 4:2:0 YUV interlaced to RGB/BGR */
-void ccvt_420i_bgr24(int width, int height, void *src, void *dst);
-void ccvt_420i_rgb24(int width, int height, void *src, void *dst);
-void ccvt_420i_bgr32(int width, int height, void *src, void *dst);
-void ccvt_420i_rgb32(int width, int height, void *src, void *dst);
-
-/* 4:2:2 YUYV interlaced to RGB/BGR */
-void ccvt_yuyv_rgb32(int width, int height, void *src, void *dst);
-void ccvt_yuyv_bgr32(int width, int height, void *src, void *dst);
-
-/* 4:2:0 YUV planar to RGB/BGR     */
-void ccvt_420p_rgb32(int width, int height, void *srcy, void *srcu, void *srcv, void *dst);
-void ccvt_420p_bgr32(int width, int height, void *srcy, void *srcu, void *srcv, void *dst);
-
-/* RGB/BGR to 4:2:0 YUV interlaced */
-
-/* RGB/BGR to 4:2:0 YUV planar     */
-void ccvt_rgb24_420p(int width, int height, void *src, void *dsty, void *dstu, void *dstv);
-void ccvt_bgr24_420p(int width, int height, void *src, void *dsty, void *dstu, void *dstv);
-
-/* Go from 420i to other yuv formats */
-void ccvt_420i_420p(int width, int height, void *src, void *dsty, void *dstu, void *dstv);
-void ccvt_420i_yuyv(int width, int height, void *src, void *dst);
-
-#ifdef __cplusplus
-}
-#endif
-
-#endif
diff --git a/drivers/usb/ccvt_c.c b/drivers/usb/ccvt_c.c
deleted file mode 100644 (file)
index ec71d98..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/*
-   Colour conversion routines (RGB <-> YUV) in plain C
-   (C) 2000-2001 Nemosoft Unv.    nemosoft@smcc.demon.nl
-   
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
-*/
-
-
-#include "ccvt.h"
-#include "vcvt.h"
-
-/* We use the viewport routines, with a viewport width that is exactly
-   the same as the image width. The overhead for computing the view/image
-   offsets is very small anyway.
-   
-   The assembly routines are still different, since they are quite optimized.
- */
-void ccvt_420i_rgb24(int width, int height, void *src, void *dst)
-{
-       vcvt_420i_rgb24(width, height, width, src, dst);
-}
-
-void ccvt_420i_bgr24(int width, int height, void *src, void *dst)
-{
-       vcvt_420i_bgr24(width, height, width, src, dst);
-}
-
-void ccvt_420i_rgb32(int width, int height, void *src, void *dst)
-{
-       vcvt_420i_rgb32(width, height, width, src, dst);
-}
-
-void ccvt_420i_bgr32(int width, int height, void *src, void *dst)
-{
-       vcvt_420i_bgr32(width, height, width, src, dst);
-}
-
-
-void ccvt_420i_420p(int width, int height, void *src, void *dsty, void *dstu, void *dstv)
-{
-       vcvt_420i_420p(width, height, width, src, dsty, dstu, dstv);
-}
-
-void ccvt_420i_yuyv(int width, int height, void *src, void *dst)
-{
-       vcvt_420i_yuyv(width, height, width, src, dst);
-}
diff --git a/drivers/usb/ccvt_i386.S b/drivers/usb/ccvt_i386.S
deleted file mode 100644 (file)
index 56addb4..0000000
+++ /dev/null
@@ -1,1144 +0,0 @@
-/*
-Colour conversion routines (RGB <-> YUV) in x86 assembly
-(C) 2000 Nemosoft Unv.    nemosoft@smcc.demon.nl
-   
-This program is free software; you can redistribute it and/or
-modify it under the terms of the GNU General Public License
-as published by the Free Software Foundation; either version 2
-of the License, or (at your option) any later version.
-
-This program is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; if not, write to the Free Software
-Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.   
-
-*/
-
-
-/* The ccvt_* functions always start with width and height, so these
-   parameters are in 8(%ebp) and 12 (%ebp). The other parameters can be
-   2 to 4 pointers, and one of these combinations:
-   *src, *dst
-   *srcy, *srcu, *srv, *dst
-   *src, *dsty, *dstu, *dstv
- */   
-
-#define __ASSEMBLY__
-#include <linux/linkage.h>
-
-#define Width   8(%ebp)
-#define Height 12(%ebp)
-
-/* 2 parameters, 1 in, 1 out */
-#define Src2 16(%ebp)
-#define Dst2 20(%ebp)
-
-/* 4 parameters, 3 in, 1 out */
-#define SrcY 16(%ebp)
-#define SrcU 20(%ebp)
-#define SrcV 24(%ebp)
-#define Dst4 28(%ebp)
-
-/* 4 parameters, 1 in, 3 out */
-#define Src4 16(%ebp)
-#define DstY 20(%ebp)
-#define DstU 24(%ebp)
-#define DstV 28(%ebp)
-
-/* This buffer space used to be staticly allocted, but this is going to
-   give problems with multiple cams (though I have yet to see it).
-   Therefor, we reserve at least 64 + 8 = 72 bytes on the stack with 
-   `enter'.
- */
-
-#define PixelBuffer -64(%ebp)
-#define Uptr        -68(%ebp)
-#define Vptr        -72(%ebp)
-
-       .text
-
-/* This function will load the src and destination pointers, including
-   Uptr/Vptr when necessary, and test the width/height parameters.
-   - %esi will be set to Src or SrcY
-   - %edi will be set to Dst or DstY
-   the carry flag will be set if any of these tests fail. 
-   It assumes %ebp has been set.
- */
-/* 2 parameters, src & dst */
-test_param_2:
-       mov Src2, %esi
-       mov Dst2, %edi
-       
-       cmp $0, %esi            # NULL pointers?
-       je param_fail
-       cmp $0, %edi
-       je param_fail
-
-       jmp test_width_height
-
-/* 3 inputs, 1 output */
-test_param_31:
-       mov Dst4, %edi          # NULL pointers
-       cmp $0, %edi
-       je param_fail
-       
-       mov SrcV, %esi
-       cmp $0, %esi
-       je param_fail
-       mov %esi, Vptr
-
-       mov SrcU, %esi
-       cmp $0, %esi
-       je param_fail
-       mov %esi, Uptr
-       
-       mov SrcY, %esi
-       cmp $0, %esi
-       je param_fail
-       
-       jmp test_width_height
-
-/* 1 input, 3 output */        
-test_param_13:
-       mov Src4, %esi          # NULL pointers
-       cmp $0, %esi
-       je param_fail
-       
-       mov DstV, %edi
-       cmp $0, %edi
-       je param_fail
-       mov %edi, Vptr
-       
-       mov DstU, %edi
-       cmp $0, %edi
-       je param_fail
-       mov %edi, Uptr
-       
-       mov DstY, %edi
-       cmp $0, %edi
-       je param_fail
-       
-       jmp test_width_height
-       
-       nop
-
-test_width_height:
-       cmpl $0, Width
-       jbe param_fail
-       testl $3, Width         # multiple of 4?
-       jnz param_fail          # Nope...
-
-       cmp $0, Height          # check illegal height
-       jbe param_fail
-       testl $1, Height        # Odd no. of lines?
-       jnz param_fail          # Aye
-
-       /* fall through */
-
-/* exit points */
-param_ok:
-       clc                     # Success: clear carry
-       ret
-
-param_fail:
-       stc                     # Fail: set carry
-       ret
-
-
-
-# This will fill PixelBuffer with 4 grey scale pixels (Y)
-# In:          %eax = Value (Y3Y2Y1Y0)
-# Out:
-# Modifies:    %ecx (-4)
-# Destroys:    %edx
-expand_4_y:
-       mov %eax, %edx          # Keep in edx (we need eax)
-       lea PixelBuffer, %edi   
-       
-0:     # This code is executed 4 times
-       movzbl %dl, %eax        # move, zero extending byte-to-long
-       shl $8, %eax            # 8 digit precision
-       
-       stosl                   # Expand into PixelBuffer
-       stosl
-       stosl
-       add $4, %edi            # Skip alpha
-
-       shr $8, %edx            # next Y
-
-       dec %ecx
-       test $3, %ecx
-       jnz 0b
-
-       ret                     # from expand_4_y
-       
-# This will add the color factors to the (grey) values in PixelBuffer
-# In:          %ebx (U1U0V1V0)
-# Out:
-# Modifies:
-# Destroys:    %edi, %ebx, %eax, %edx
-expand_4_uv:
-       lea PixelBuffer, %edi   # reset pointer
-
-       # V0
-       sub $128, %bl
-       movsbl %bl, %eax
-       mov $359, %edx          # Vr
-       mul %edx
-       add %eax, 0x00(%edi)
-       add %eax, 0x10(%edi)
-       
-       movsbl %bl, %eax
-       mov $183, %edx          # Vg
-       mul %edx
-       sub %eax, 0x04(%edi)
-       sub %eax, 0x14(%edi)
-       
-       # V1
-       sub $128, %bh
-       movsbl %bh, %eax
-       mov $359, %edx          # Vr
-       mul %edx
-       add %eax, 0x20(%edi)
-       add %eax, 0x30(%edi)
-       
-       movsbl %bh, %eax
-       mov $183, %edx          # Vg
-       mul %edx
-       sub %eax, 0x24(%edi)
-       sub %eax, 0x34(%edi)
-       
-       # U0
-       bswap %ebx              # Get U values in lower half
-       sub $128, %bh
-       movsbl %bh, %eax
-       mov $88, %edx           # Ug
-       mul %edx
-       sub %eax, 0x04(%edi)
-       sub %eax, 0x14(%edi)
-
-       movsbl %bh, %eax
-       mov $454, %edx          # Ub
-       mul %edx
-       add %eax, 0x08(%edi)
-       add %eax, 0x18(%edi)
-       
-       # U1
-       sub $128, %bl
-       movsbl %bl, %eax
-       mov $88, %edx           # Ug
-       mul %edx
-       sub %eax, 0x24(%edi)
-       sub %eax, 0x34(%edi)
-       
-       movsbl %bl, %eax
-       mov $454, %edx          # Ub
-       mul %edx
-       add %eax, 0x28(%edi)
-       add %eax, 0x38(%edi)
-       ret                     # expand_4_uv
-
-
-/* This function expands 4 420i pixels into PixelBuffer */
-do_four_yuvi:
-       push %edi
-
-       lodsl                   # 4 bytes at a time
-       
-       call expand_4_y
-       
-       # now do UV values. on even lines, Y is followed by U values; on 
-       # odd lines V values follow. The U and V values are always pushed
-       # on the stack in this order:
-       # U V
-       
-       # First, calculate offset per line (1.5 * width)
-       mov Width, %ebx # width
-       shl %ebx                # 2 *
-       add Width, %ebx # 3 * 
-       shr %ebx                # 1.5 *
-
-       # even or odd lines     
-       testl $1, Height
-       jz 2f
-
-       # odd line; we are at V data, but do U data first
-       neg %ebx                # make ebx offset negative
-       mov (%esi,%ebx),%ax     # U
-       push %ax
-       lodsw                   # V
-       push %ax
-       jmp 3f  
-       
-2:     # even line
-       lodsw                   # U
-       push %ax
-       sub $2, %ebx
-       mov (%esi,%ebx), %ax    # V
-       push %ax
-
-3:     # Okay, so we now have the U and V values... expand into PixelBuffer
-
-       pop %ebx
-       call expand_4_uv
-
-       pop %edi
-       ret                     # from do_four_yuvi
-
-
-# Do four pixels, in planar format
-do_four_yuvp:
-       push %edi
-
-       # The first part is the same as for interlaced (4 bytes Y)
-       lodsl                   # 4 bytes at a time
-       call expand_4_y
-       
-       # now gather U and V values... 
-       mov Uptr, %ebx          # Use Uptr/Vptr
-       mov (%ebx), %ax
-       push %ax
-       add $2, %ebx
-       mov %ebx, Uptr
-
-       mov Vptr, %ebx
-       mov (%ebx), %ax
-       push %ax
-       add $2, %ebx
-       mov %ebx, Vptr
-       
-       pop %ebx
-       call expand_4_uv
-       
-       pop %edi
-       ret
-
-
-# Do four pixels, in yuyv interlaced format
-do_four_yuyv:
-       push %edi
-
-       lodsl                   # v0y1u0y0
-       mov %eax, %ebx
-       bswap %ebx              # y0u0y1v0
-       mov %bh, %ah            # v0y1y1y0
-       and $0x00ff00ff, %ebx   # __u0__v0
-       push %ax                # y1y0
-
-       lodsl                   # v1y3u1y2      # mix register instructions
-       mov %eax, %edx                          # so CPU pipeline doesnt stall
-       rol $16, %eax           # u1y2v1y3      
-       mov %dl, %dh            # v1y3y2y2
-       and $0xff00ff00, %eax   # u1__v1__
-       mov $0, %dl             # v1y3y2__
-       or %eax, %ebx           # u1u0v1v0
-       shl $8, %edx            # y3y2____
-       pop %dx                 # y3y2y1y0
-       mov %edx, %eax
-       call expand_4_y
-       call expand_4_uv
-       
-       pop %edi
-       ret
-
-limit_pixels:
-       # Limit all values in PixelBuffer
-       push %esi
-       push %edi
-       push %ecx
-       lea PixelBuffer, %esi
-       mov %esi, %edi
-       mov $16, %ecx
-0:     lodsl
-       cmp $0, %eax            # this would have been a perfect spot for CMOVxx instructions...
-       jl 2f                   #  except they only work on Pentium Pro processors,
-       cmp $0xff00, %eax       #  and not even all of them
-       jg 3f
-       add $4, %edi            # no use for stosl here
-       loop 0b
-       jmp 9f
-2:     mov $0, %eax
-       stosl
-       loop 0b
-       jmp 9f
-3:     mov $0xff00, %eax
-       stosl
-       loop 0b
-       jmp 9f
-
-9:     pop %ecx
-       pop %edi
-       pop %esi
-       ret                     # from limit_pixels
-
-/* Copy RGB values from PixelBuffer into destination buffer, 4 bytes
-   with alpha 
- */
-
-/* Push 3 pixel (12 bytes), in correct order */
-push_rgb24:
-       push %ecx
-       push %esi
-       lea PixelBuffer, %esi
-       mov $4, %ecx
-0:     lodsl
-       shr $8, %eax
-       mov %al, (%edi)         # Red
-       lodsl
-       shr $8, %eax
-       mov %al, 1(%edi)        # Green
-       lodsl
-       shr $8, %eax
-       mov %al, 2(%edi)        # Blue
-       add $3, %edi
-       lodsl                   # dummy
-       loop 0b
-       pop %esi
-       pop %ecx
-       ret
-
-/* Push 3 pixels (12 bytes), in wrong order */
-push_bgr24:
-       push %ecx
-       push %esi
-       lea PixelBuffer, %esi
-       mov $4, %ecx
-0:     lodsl
-       shr $8, %eax
-       mov %al, 2(%edi)        # Red
-       lodsl
-       shr $8, %eax
-       mov %al, 1(%edi)        # Green
-       lodsl
-       shr $8, %eax
-       mov %al, (%edi)         # Blue
-       add $3, %edi
-       lodsl                   # dummy
-       loop 0b
-       pop %esi
-       pop %ecx
-       ret
-
-/* The simplest format: push 4 bytes, RGBa */
-push_rgb32:
-       push %ecx
-       push %esi
-       mov $16, %ecx
-       lea PixelBuffer, %esi
-0:     lodsl                   # red
-       shr $8, %eax            # 8 bit precision
-       stosb
-       loop 0b
-       pop %esi
-       pop %ecx
-       ret
-
-
-/* Gosh. Would you believe it. They even made this format... (Qt 2.*) */
-push_bgr32:
-       # copy all 4 values to output buffer
-       push %ecx
-       push %esi
-       mov $4, %ecx
-       lea PixelBuffer, %esi
-0:     lodsl                   # red
-       shr $8, %eax            # 8 bit precision
-       mov %al, 2(%edi)
-       lodsl                   # green
-       shr $8, %eax
-       mov %al, 1(%edi)
-       lodsl                   # blue
-       shr $8, %eax
-       mov %al, (%edi)
-       add $4, %edi
-       lodsl                   # dummy
-       loop 0b 
-       pop %esi
-       pop %ecx
-       ret
-
-/*************************************/
-
-/* Functions to go from YUV interlaced formats to RGB */
-
-/* Go from interlaced to RGB, red first */
-
-ENTRY(ccvt_420i_rgb24)
-       enter $72, $0           # no extra space, no stackframes
-       push %ebx
-       push %esi
-       push %edi
-
-       call test_param_2
-       jc 9f
-       
-0:     mov Width, %ecx         # width
-1:     call do_four_yuvi
-       call limit_pixels
-       call push_rgb24
-                       
-       cmp $0, %ecx
-       jnz 1b                  # end of line?
-       decl Height             # yes; decrement line counter
-       jnz 0b
-
-9:     pop %edi
-       pop %esi
-       pop %ebx
-       leave
-       ret
-
-/* Go from interlaced to BGR, blue first */
-
-ENTRY(ccvt_420i_bgr24)
-       enter $72, $0           # no extra space, no stackframes
-       push %ebx
-       push %esi
-       push %edi
-
-       call test_param_2
-       jc 9f
-       
-0:     mov Width, %ecx # width
-1:     call do_four_yuvi
-       call limit_pixels
-       call push_bgr24
-                       
-       cmp $0, %ecx
-       jnz 1b                  # end of line?
-       decl Height             # yes; decrement line counter
-       jnz 0b
-
-9:     pop %edi
-       pop %esi
-       pop %ebx
-       leave
-       ret
-
-
-/* From interlaced to RGBa */
-
-ENTRY(ccvt_420i_rgb32)
-       enter $72, $0           # no extra space, no stackframes
-       push %ebx
-       push %esi
-       push %edi
-
-       call test_param_2
-       jc 9f
-
-0:     mov Width, %ecx         # width
-1:     call do_four_yuvi
-       call limit_pixels
-       call push_rgb32
-               
-       cmp $0, %ecx            # end of line?
-       jnz 1b
-       decl Height             # yes; decrement line counter
-       jnz 0b
-
-9:     pop %edi
-       pop %esi
-       pop %ebx
-       leave
-       ret
-
-/* Guess what? Go from interlaced to BGRa */
-
-ENTRY(ccvt_420i_bgr32)
-       enter $72, $0           # no extra space, no stackframes
-       push %ebx
-       push %esi
-       push %edi
-
-       call test_param_2
-       jc 9f
-
-0:     mov Width, %ecx         # width
-1:     call do_four_yuvi
-       call limit_pixels
-       call push_bgr32
-               
-       cmp $0, %ecx            # end of line?
-       jnz 1b
-       decl Height             # yes; decrement line counter
-       jnz 0b
-
-9:     pop %edi
-       pop %esi
-       pop %ebx
-       leave
-       ret
-
-
-
-
-/* From YUYV to RGBa */
-
-ENTRY(ccvt_yuyv_rgb32)
-       enter $72, $0           # no extra space, no stackframes
-       push %ebx
-       push %esi
-       push %edi
-
-       call test_param_2
-       jc 9f
-       
-0:     mov Width, %ecx         # width
-1:     call do_four_yuyv
-       call limit_pixels
-       call push_rgb32
-               
-       cmp $0, %ecx            # end of line?
-       jnz 1b
-
-8:     decl Height             # yes; decrement line counter
-       jnz 0b
-
-9:     pop %edi
-       pop %esi
-       pop %ebx
-       leave
-       ret
-
-/* From YUYV to BGRa */
-ENTRY(ccvt_yuyv_bgr32)
-       enter $72, $0           # no extra space, no stackframes
-       push %ebx
-       push %esi
-       push %edi
-
-       call test_param_2
-       jc 9f
-       
-       # YUYV -> RGBa RGBa
-
-0:     mov Width, %ecx         # width
-1:     call do_four_yuyv
-       call limit_pixels
-       call push_bgr32
-               
-       cmp $0, %ecx            # end of line?
-       jnz 1b
-
-8:     decl Height             # yes; decrement line counter
-       jnz 0b
-
-9:     pop %edi
-       pop %esi
-       pop %ebx
-       leave
-       ret
-
-
-
-
-/* Planar to RGBa */
-
-ENTRY(ccvt_420p_rgb32)
-       enter $72, $0
-       push %ebx
-       push %esi
-       push %edi
-       
-       call test_param_31
-       jc 9f
-
-       mov Width, %eax         # width
-       mull Height             # * height
-       mov SrcU, %eax          # Copy U/V pointers
-       mov %eax, Uptr
-       mov SrcV, %eax
-       mov %eax, Vptr
-
-0:     mov Width, %ecx         # width
-1:     call do_four_yuvp
-       call limit_pixels
-       call push_rgb32 
-               
-       cmp $0, %ecx            # end of line?
-       jnz 1b
-
-       testl $1, Height        # odd/even line
-       jnz 8f
-       
-       mov Width, %eax         # Even: rewind U/V pointers
-       shr %eax
-       sub %eax, Uptr
-       sub %eax, Vptr
-
-8:     decl Height             # yes; decrement line counter
-       jnz 0b
-
-9:     pop %edi
-       pop %esi
-       pop %ebx
-       leave
-       ret
-
-/* Okay... eventually, you end up with a very complete set of conversion
-   routines. I just wished things were a bit simpler. */
-
-ENTRY(ccvt_420p_bgr32)
-       enter $72, $0
-       push %ebx
-       push %esi
-       push %edi
-       
-       call test_param_31
-       jc 9f
-       
-       mov Width, %eax         # width
-       mull Height             # * height
-       mov SrcU, %eax          # Copy U/V pointers
-       mov %eax, Uptr
-       mov SrcV, %eax
-       mov %eax, Vptr
-
-0:     mov Width, %ecx         # width
-1:     call do_four_yuvp
-       call limit_pixels
-       call push_bgr32
-               
-       cmp $0, %ecx            # end of line?
-       jnz 1b
-
-       testl $1, Height        # odd/even line
-       jnz 8f
-       
-       mov Width, %eax         # Even: rewind U/V pointers
-       shr %eax
-       sub %eax, Uptr
-       sub %eax, Vptr
-
-8:     decl Height             # yes; decrement line counter
-       jnz 0b
-
-9:     pop %edi
-       pop %esi
-       pop %ebx
-       leave
-       ret
-
-
-
-
-/* Go from RGB (red first) to 4:2:0 planar.
- * Note: this requires decimation of the U/V space by 2 in both directions 
- * Also, a matrix multiply would be QUITE convenient...
-
-   This is the matrix:
-     (Y )   ( 77  150   29)   (R)
-     (Cb) = (-43  -85  128) * (G)
-     (Cr)   (128 -107  -21)   (B)
- */
-
-ENTRY(ccvt_rgb24_420p)
-       enter $96, $0           # 24 bytes extra stack, no stackframes
-       push %ebx               #  -76: line width in bytes
-       push %esi               #  -80: height (copy)
-       push %edi               #  -84: width (copy)
-                               #  -88: red factor
-                               #  -92: green factor
-                               #  -96: blue factor
-       call test_param_13
-       jc 9f
-
-       mov Width, %eax
-       shl %eax
-       add Width, %eax         # 3 * width = line increment
-       mov %eax, -76(%ebp)
-
-       mov Height, %eax
-       mov %eax, -80(%ebp)     # copy height into stackframe
-       
-       /*
-         This is a bit complicated... since U/V decimation is taking 
-         place both in horizontal and vertical direction, we have to
-         process 2 lines in parallel. Also, 2 adjacent pixels are
-         considered. We average the U/V values over these 4 pixels
-         (of course, we could have just taken the U/V value of the first
-         pixel and be done with it, but that's not how we do things around
-         here)
-        */
-       
-       # 1st pass: Y values. Set factors       
-       movl $77 , -88(%ebp)    # 0.299
-       movl $150, -92(%ebp)    # 0.587
-       movl $29 , -96(%ebp)    # 0.114
-
-0:     mov Width, %ecx         # width
-1:     xor %ebx, %ebx          # 0
-       call rgb_multiply
-       shr $8, %ebx            # divide by 256 (no need for limitor, since 77 + 150 + 29 = 256)
-       mov %bl, %al
-       stosb                   # store it into Y buffer
-       
-       dec %ecx                # end of line?
-       jnz 1b
-       decl -80(%ebp)          # end of image?
-       jnz 0b
-
-       # Okay, now the U/V pointers... 
-       # The following code is passed twice, with different factors
-       # Note that the %esi pointer jumps around quite a bit
-
-       # factors for U
-       movl $-43, -88(%ebp)    # -0.1687
-       movl $-85, -92(%ebp)    # -0.3313
-       movl $128, -96(%ebp)    # 0.5
-       mov DstU, %edi          # Set %edi register now
-               
-7:     mov Src4, %esi          # Rewind source pointer
-
-       mov Height, %eax        # height
-       shr %eax                #  / 2
-       mov %eax, -80(%ebp)     #   copy
-
-2:     mov Width, %eax         # width
-       shr %eax                #  / 2
-       mov %eax, -84(%ebp)     #   copy
-
-3:     xor %ebx, %ebx          # 0
-       mov $4, %ecx            # average over 4 pixels
-
-4:     call rgb_multiply
-
-       dec %ecx
-       jz 5f                   # done?
-       cmp $2, %ecx            # 3rd pixel.. move %esi to next line, with offset
-       jne 4b
-       sub $6, %esi            # backup to where we started
-       add -76(%ebp), %esi     # add line increment
-       jmp 4b
-
-5:     # okay, 4 pixels done... 
-       sub -76(%ebp), %esi     # Get %esi back to its proper place
-
-       add $0x20000, %ebx      # add 0.5 factor
-       shr $10, %ebx           # Divide by 4 * 256
-       mov %bl, %al
-       stosb                   # store it!
-
-       decl -84(%ebp)          # end of line?
-       jnz 3b
-       add -76(%ebp), %esi     # %esi to next line (actually, 2 lines further)
-       decl -80(%ebp)          # end of image?
-       jnz 2b
-
-       # check if 3rd pass has been done
-       cmpl $128, -88(%ebp)
-       je 9f                   # Done!
-       # Set factors for V pass
-       movl $128 , -88(%ebp)   # 0.5
-       movl $-107, -92(%ebp)   # -0.4187
-       movl $-21 , -96(%ebp)   # -0.0813
-       mov DstV, %edi          # %edi to V buffer
-       jmp 7b                  # "Do it to me one more time..."
-
-9:     pop %edi
-       pop %esi
-       pop %ebx
-       leave
-       ret
-
-
-
-
-ENTRY(ccvt_bgr24_420p)
-       enter $96, $0           # 24 bytes extra stack, no stackframes
-       push %ebx               #   -4: line width in bytes
-       push %esi               #   -8: height (copy)
-       push %edi               #  -12: width (copy)
-                               #  -16: red factor
-                               #  -20: green factor
-                               #  -24: blue factor
-       call test_param_13
-       jc 9f
-
-       /* No surprise, this code looks just like rgb24_420p, but with swapped factors */
-        
-       mov Width, %eax
-       shl %eax
-       add Width, %eax         # 3 * width = line increment
-       mov %eax, -76(%ebp)
-
-       mov Height, %eax
-       mov %eax, -80(%ebp)     # copy height into stackframe
-       
-       # 1st pass: Y values. Set factors       
-       movl $29 , -88(%ebp)    # 0.114
-       movl $150, -92(%ebp)    # 0.587
-       movl $77 , -96(%ebp)    # 0.299
-
-0:     mov Width, %ecx         # width
-1:     xor %ebx, %ebx          # 0
-       call rgb_multiply
-       shr $8, %ebx            # divide by 256 (no need for limitor, since 77 + 150 + 29 = 256)
-       mov %bl, %al
-       stosb                   # store it into Y buffer
-       
-       dec %ecx                # end of line?
-       jnz 1b
-       decl -80(%ebp)          # end of image?
-       jnz 0b
-
-       # Okay, now the U/V pointers... 
-       # The following code is passed twice, with different factors
-       # Note that the %esi pointer jumps around quite a bit
-
-       # factors for U
-       movl $123, -88(%ebp)    #  0.5
-       movl $-85, -92(%ebp)    # -0.3313
-       movl $-43, -96(%ebp)    # -0.1687
-       mov DstU, %edi          # Set %edi register now
-               
-7:     mov Src4, %esi          # Rewind source pointer
-
-       mov Height, %eax        # height
-       shr %eax                #  / 2
-       mov %eax, -80(%ebp)     #   copy
-
-2:     mov Width, %eax         # width
-       shr %eax                #  / 2
-       mov %eax, -84(%ebp)     #   copy
-
-3:     xor %ebx, %ebx          # 0
-       mov $4, %ecx            # average over 4 pixels
-
-4:     call rgb_multiply
-
-       dec %ecx
-       jz 5f                   # done?
-       cmp $2, %ecx            # 3rd pixel.. move %esi to next line, with offset
-       jne 4b
-       sub $6, %esi            # backup to where we started
-       add -76(%ebp), %esi     # add line increment
-       jmp 4b
-
-5:     # okay, 4 pixels done... 
-       sub -76(%ebp), %esi     # Get %esi back to its proper place
-
-       add $0x20000, %ebx      # add 0.5 factor
-       shr $10, %ebx           # Divide by 4 * 256
-       mov %bl, %al
-       stosb                   # store it!
-
-       decl -84(%ebp)          # end of line?
-       jnz 3b
-       add -76(%ebp), %esi     # %esi to next line (actually, 2 lines further)
-       decl -80(%ebp)          # end of image?
-       jnz 2b
-
-       # check if 3rd pass has been done
-       cmpl $-21, -88(%ebp)
-       je 9f                   # Done!
-       # Set factors for V pass
-       movl $-21 , -88(%ebp)   # -0.0813
-       movl $-107, -92(%ebp)   # -0.4187
-       movl $128 , -96(%ebp)   #  0.5
-       mov DstV, %edi          # %edi to V buffer
-       jmp 7b                  # "Do it to me one more time..."
-
-9:     pop %edi
-       pop %esi
-       pop %ebx
-       leave
-       ret
-
-
-/* RGB-to-YUV helper functions */
-
-rgb_multiply:
-       # do one RGB vector multiplication; its assumed the RGB factors
-       # are set on the stack. The data is accumulated in ebx.
-       lodsb                   # red byte
-       and $0xff, %eax
-       mov -88(%ebp), %edx     # red factor
-       mul %edx
-       add %eax, %ebx
-       lodsb                   # green byte
-       and $0xff, %eax
-       mov -92(%ebp), %edx     # green factor
-       mul %edx
-       add %eax, %ebx
-       lodsb                   # blue byte
-       and $0xff, %eax
-       mov -96(%ebp), %edx     # blue factor
-       mul %edx
-       add %eax, %ebx          # ebx now contains sum
-       ret
-
-
-
-/**************************************************************************/
-
-
-/* Go from 'interlaced' (YYYY UU/VV) format to planar */
-
-ENTRY(ccvt_420i_420p)
-       enter $76, $0           # 4 bytes extra space, no stackframes
-       push %ebx               # -4: width / 4
-       push %esi
-       push %edi
-
-       call test_param_13
-       jc 9f
-
-       # Okay, this is fairly easy... we first grab the Y values (4 bytes
-       #  at a time), then rewind and do the U values, and repeat for V.
-       #  This leaves us with a nice planar format
-
-       mov Width, %eax
-       shr %eax
-       shr %eax                # width / 4
-       mov %eax, -76(%ebp)     # Store
-
-       # Y
-       mov Height, %edx        # line counter
-0:     mov -76(%ebp), %ecx
-1:     lodsl                   # get 4 bytes...
-       stosl                   # ...push 4 bytes
-       add $2, %esi            # Skip U or V
-       loop 1b
-       dec %edx
-       jnz 0b
-
-       # U
-       mov Src4, %esi          # rewind source pointer
-       mov DstU, %edi
-       add $4, %esi            # set to U 
-       mov Height, %edx
-       shr %edx                # height / 2
-       mov Width, %ebx
-       shl %ebx
-       add Width, %ebx
-       shr %ebx                # Width * 1.5 (line offset)
-
-2:     mov -76(%ebp), %ecx     # width / 4
-3:     lodsw                   # 2 bytes at a time
-       stosw
-       add $4, %esi            # skip Y
-       loop 3b
-       add %ebx, %esi          # Skip line (U is on even lines)
-       dec %edx
-       jnz 2b
-       
-       # V
-       mov Src4, %esi          # rewind, set to V in first odd line
-       add $4, %esi
-       add %ebx, %esi          # register re-use; no compiler can beat that :)
-       mov DstV, %edi          # V ptr
-       mov Height, %edx
-       shr %edx                # height / 2
-       
-4:     mov -76(%ebp), %ecx     # Get width/4
-5:     lodsw
-       stosw
-       add $4, %esi            # Skip Y
-       loop 5b
-       add %ebx, %esi          # Skip line (V is on odd lines)
-       dec %edx
-       jnz 4b
-       
-       /* That's it! */
-       
-9:     pop %edi
-       pop %esi
-       pop %ebx
-       leave
-       ret
-
-
-/* Go from 4:2:0 interlaced to 'normal' YUYV */
-
-ENTRY(ccvt_420i_yuyv)
-       enter $80, $0           # 8 bytes extra space, no stackframes
-       push %ebx
-       push %esi
-       push %edi
-
-       call test_param_2
-       jc 9f
-       
-       mov Width, %ecx         # -4: width / 4 = no. loops per line
-       shr %ecx
-       shr %ecx
-       mov %ecx, -76(%ebp)
-
-       mov Width, %ebx         # -8: width * 1.5 = line offset
-       shl %ebx
-       add Width, %ebx
-       shr %ebx
-       mov %ebx, -80(%ebp)
-       
-       # Okay, this requires a bit of byte shuffling... we go from
-       #  YYYY UU
-       #  YYYY VV
-       # to
-       #  YUYV YUYV
-       #  YUYV YUYV
-       # which indeed takes up more space
-
-       # 
-       
-0:     mov -76(%ebp), %ecx
-
-1:     lodsl                   # 4 Y in eax
-       testl $1, Height        # even or odd line?
-       jnz 2f
-       
-       # Even
-       mov -80(%ebp), %ebx
-       mov (%ebx, %esi), %dx   # 16 bits V 
-       shl $16, %edx           # store in high word
-       mov (%esi), %dx         # 16 bits U 
-       add $2, %esi
-       jmp 3f
-       
-2:     # Odd
-       mov -80(%ebp), %ebx
-       neg %ebx                # negative offset
-       mov (%esi), %dx         # 16 bits V
-       shl $16, %edx           # store in high word
-       mov (%ebx, %esi), %dx   # 16 bits U
-       add $2, %esi
-
-3:     # eax = Y3Y2Y1Y0, edx = V1V0U1U0, ebx is free
-       push %eax
-
-       movzbl %al, %ebx        # ______y0
-       and $0xFF00, %eax       # ____y1__
-       shl $8, %eax            # __y1____
-       or %ebx, %eax           # __y1__y0
-       mov %edx, %ebx          # v1v0u1u0
-       shl $8, %ebx            # v0u1u0__
-       and $0xff00ff00, %ebx   # v0__u0__
-       or %ebx, %eax           # v0y1u0y0
-       stosl   
-
-       pop %eax                # y3y2y1y0
-       # Second half
-       shr $8, %eax            # __y3y2y1
-       shr $8, %ax             # __y3__y2
-       and $0xff00ff00, %edx   # v1__u1__
-       or %edx, %eax           # v1y3u1y2
-       stosl
-       
-       loop 1b
-
-
-       decl Height             # height--
-       jnz 0b
-       # Done
-
-9:     pop %edi
-       pop %esi
-       pop %ebx
-       leave
-       ret
diff --git a/drivers/usb/kiara.inc b/drivers/usb/kiara.inc
deleted file mode 100644 (file)
index 0b13422..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-   /* SQCIF */
-   {
-      /* 5 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 10 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 15 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 20 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 25 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 30 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-   },
-   /* QSIF */
-   {
-      /* 5 fps */
-      {
-         {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
-         {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
-         {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
-         {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
-      },
-      /* 10 fps */
-      {
-         {2, 291,    0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}},
-         {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
-         {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
-         {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
-      },
-      /* 15 fps */
-      {
-         {3, 437,    0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}},
-         {2, 292,  640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}},
-         {2, 292,  640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}},
-         {1, 192,  420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}},
-      },
-      /* 20 fps */
-      {
-         {4, 589,    0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}},
-         {3, 448,  730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}},
-         {2, 292,  476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}},
-         {1, 192,  312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}},
-      },
-      /* 25 fps */
-      {
-         {5, 703,    0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}},
-         {3, 447,  610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}},
-         {2, 292,  398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}},
-         {1, 193,  262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}},
-      },
-      /* 30 fps */
-      {
-         {8, 874,    0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}},
-         {5, 704,  730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}},
-         {3, 448,  492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}},
-         {2, 292,  320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}},
-      },
-   },
-   /* QCIF */
-   {
-      /* 5 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 10 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 15 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 20 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 25 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 30 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-   },
-   /* SIF */
-   {
-      /* 5 fps */
-      {
-         {4, 582,    0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}},
-         {3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}},
-         {2, 291,  960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}},
-         {1, 191,  630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}},
-      },
-      /* 10 fps */
-      {
-         {0, },
-         {6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}},
-         {3, 447,  736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}},
-         {2, 292,  480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}},
-      },
-      /* 15 fps */
-      {
-         {0, },
-         {9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}},
-         {4, 592,  650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}},
-         {3, 448,  492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}},
-      },
-      /* 20 fps */
-      {
-         {0, },
-         {9, 958,  782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}},
-         {5, 703,  574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}},
-         {3, 446,  364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}},
-      },
-      /* 25 fps */
-      {
-         {0, },
-         {9, 958,  654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}},
-         {6, 776,  530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}},
-         {4, 592,  404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}},
-      },
-      /* 30 fps */
-      {
-         {0, },
-         {9, 957,  526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}},
-         {6, 775,  426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}},
-         {4, 590,  324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}},
-      },
-   },
-   /* CIF */
-   {
-      /* 5 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 10 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 15 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 20 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 25 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 30 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-   },
-   /* VGA */
-   {
-      /* 5 fps */
-      {
-         {0, },
-         {6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}},
-         {4, 592,  976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}},
-         {3, 448,  738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}},
-      },
-      /* 10 fps */
-      {
-         {0, },
-         {9, 956,  788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}},
-         {6, 776,  640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}},
-         {4, 592,  488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}},
-      },
-      /* 15 fps */
-      {
-         {0, },
-         {9, 957,  526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}},
-         {9, 957,  526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}},
-         {8, 895,  492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}},
-      },
-      /* 20 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 25 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 30 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-   },
diff --git a/drivers/usb/nala.inc b/drivers/usb/nala.inc
deleted file mode 100644 (file)
index e6c5cb6..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-   /* SQCIF */
-   {
-      {0, 0, {0x04, 0x01, 0x03}},
-      {8, 0, {0x05, 0x01, 0x03}},
-      {7, 0, {0x08, 0x01, 0x03}},
-      {7, 0, {0x0A, 0x01, 0x03}},
-      {6, 0, {0x0C, 0x01, 0x03}},
-      {5, 0, {0x0F, 0x01, 0x03}},
-      {4, 0, {0x14, 0x01, 0x03}},
-      {3, 0, {0x18, 0x01, 0x03}},
-   },
-   /* QSIF */
-   {
-      {0},
-      {0},
-      {0},
-      {0},
-      {0},
-      {0},
-      {0},
-      {0},
-   },
-   /* QCIF */
-   {
-      {0, 0, {0x04, 0x01, 0x02}},
-      {8, 0, {0x05, 0x01, 0x02}},
-      {7, 0, {0x08, 0x01, 0x02}},
-      {6, 0, {0x0A, 0x01, 0x02}},
-      {5, 0, {0x0C, 0x01, 0x02}},
-      {4, 0, {0x0F, 0x01, 0x02}},
-      {1, 0, {0x14, 0x01, 0x02}},
-      {1, 0, {0x18, 0x01, 0x02}},
-   },
-   /* SIF */
-   {
-      {0},
-      {0},
-      {0},
-      {0},
-      {0},
-      {0},
-      {0},
-      {0},
-   },
-   /* CIF */
-   {
-      {4, 0, {0x04, 0x01, 0x01}},
-      {7, 1, {0x05, 0x03, 0x01}},
-      {6, 1, {0x08, 0x03, 0x01}},
-      {4, 1, {0x0A, 0x03, 0x01}},
-      {3, 1, {0x0C, 0x03, 0x01}},
-      {2, 1, {0x0F, 0x03, 0x01}},
-      {0},
-      {0},
-   },
-   /* VGA */
-   {  
-      {0},
-      {0},
-      {0},
-      {0},
-      {0},
-      {0},
-      {0},
-      {0},
-   },
index e6e8bcb5362da4a261870d7e213ca6aeadda4089..2ece2e53d0cd6baf170df63fd45efa679c28a64b 100644 (file)
@@ -107,7 +107,7 @@ struct Nala_table_entry {
 
 static struct Nala_table_entry Nala_table[PSZ_MAX][8] =
 {
-#include "nala.inc"
+#include "pwc_nala.h"
 };
 
 /* This tables contains entries for the 675/680/690 (Timon) camera, with
@@ -134,7 +134,7 @@ struct Timon_table_entry
 
 static struct Timon_table_entry Timon_table[PSZ_MAX][6][4] = 
 {
-#include "timon.inc"
+#include "pwc_timon.h"
 };
 
 /* Entries for the Kiara (730/740) camera */
@@ -149,7 +149,7 @@ struct Kiara_table_entry
 
 static struct Kiara_table_entry Kiara_table[PSZ_MAX][6][4] =
 {
-#include "kiara.inc"
+#include "pwc_kiara.h"
 };
 
 
@@ -184,7 +184,6 @@ void pwc_hexdump(void *p, int len)
 
 static inline int send_video_command(struct usb_device *udev, int index, void *buf, int buflen)
 {
-#ifdef __KERNEL__
        return usb_control_msg(udev,
                usb_sndctrlpipe(udev, 0),
                SET_EP_STREAM_CTL,
@@ -192,9 +191,6 @@ static inline int send_video_command(struct usb_device *udev, int index, void *b
                VIDEO_OUTPUT_CONTROL_FORMATTER,
                index,
                buf, buflen, HZ);
-#else
-       return 0;
-#endif 
 }
 
 
index 931dc71f118321bae064f7303f2372c9f7abb9fc..825eccf6ac1886577a3c585648c3d7aa58626a05 100644 (file)
@@ -55,7 +55,6 @@
 #endif
 
 /* Function prototypes and driver templates */
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 
 /* hotplug device table support */
 static __devinitdata struct usb_device_id pwc_device_table [] = {
@@ -83,20 +82,6 @@ static struct usb_driver pwc_driver =
        disconnect:             usb_pwc_disconnect,     /* disconnect() */
 };
 
-#else
-
-static void *usb_pwc_probe(struct usb_device *udev, unsigned int ifnum);
-static void usb_pwc_disconnect(struct usb_device *udev, void *ptr);
-
-static struct usb_driver pwc_driver =
-{
-       name:                   "Philips webcam",       /* name */
-       probe:                  usb_pwc_probe,          /* probe() */
-       disconnect:             usb_pwc_disconnect,     /* disconnect() */
-};
-#endif
-
 static int default_size = PSZ_QCIF;
 static int default_fps = 10;
 static int default_palette = VIDEO_PALETTE_RGB24; /* This is normal for webcams */
@@ -122,16 +107,10 @@ static int  pwc_video_ioctl(struct video_device *vdev, unsigned int cmd, void *a
 static int  pwc_video_mmap(struct video_device *dev, const char *adr, unsigned long size);
 
 static struct video_device pwc_template = {
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,3)
-       owner:          NULL,
-#endif
+       owner:          THIS_MODULE,
        name:           "Philips Webcam",       /* Filled in later */
        type:           VID_TYPE_CAPTURE,
-#ifdef VID_HARDWARE_PWC
        hardware:       VID_HARDWARE_PWC,       /* Let's pretend for now */
-#else
-       hardware:       0,                      /* 2.2.14 backport (?) */
-#endif         
        open:           pwc_video_open,
        close:          pwc_video_close,
        read:           pwc_video_read,
@@ -612,14 +591,8 @@ static inline void pwc_next_image(struct pwc_device *pdev)
 
 static int pwc_set_palette(struct pwc_device *pdev, int pal)
 {
-       if (   pal == VIDEO_PALETTE_RGB24 
-           || pal == VIDEO_PALETTE_RGB32 
-            || pal == (VIDEO_PALETTE_RGB24 | 0x80)
-            || pal == (VIDEO_PALETTE_RGB32 | 0x80)
-            || pal == VIDEO_PALETTE_YUYV
-            || pal == VIDEO_PALETTE_YUV422
-            || pal == VIDEO_PALETTE_YUV420
-            || pal == VIDEO_PALETTE_YUV420P
+       if (
+            pal == VIDEO_PALETTE_YUV420
 #if PWC_DEBUG
             || pal == VIDEO_PALETTE_RAW
 #endif
@@ -949,17 +922,12 @@ static int pwc_video_open(struct video_device *vdev, int mode)
 
        Trace(TRACE_OPEN, "video_open called(0x%p, 0%o).\n", vdev, mode);
        
-       if (vdev == NULL) {
-               Err("video_open() called with NULL structure?\n");
-               return -EFAULT;
-       }
+       if (vdev == NULL)
+               BUG();
        pdev = (struct pwc_device *)vdev->priv;
-       if (pdev == NULL) {
-               Err("video_open() called with NULL pwc_device.\n");
-               return -EFAULT;
-       }
+       if (pdev == NULL)
+               BUG();
        
-       MOD_INC_USE_COUNT;
        down(&pdev->modlock);
        if (!pdev->usb_init) {
                Trace(TRACE_OPEN, "Doing first time initialization.\n");
@@ -981,7 +949,6 @@ static int pwc_video_open(struct video_device *vdev, int mode)
        i = pwc_allocate_buffers(pdev);
        if (i < 0) {
                Trace(TRACE_OPEN, "Failed to allocate memory.\n");
-               MOD_DEC_USE_COUNT;
                up(&pdev->modlock);
                return i;
        }
@@ -1026,14 +993,12 @@ static int pwc_video_open(struct video_device *vdev, int mode)
        }
        if (i) {
                Trace(TRACE_OPEN, "Second attempt at set_video_mode failed.\n");
-               MOD_DEC_USE_COUNT;
                up(&pdev->modlock);
                return i;
        }
        i = usb_set_interface(pdev->udev, 0, pdev->valternate);
        if (i) {
                Trace(TRACE_OPEN, "Failed to set alternate interface = %d.\n", i);
-               MOD_DEC_USE_COUNT;
                up(&pdev->modlock);
                return -EINVAL;
        }
@@ -1064,15 +1029,8 @@ static void pwc_video_close(struct video_device *vdev)
        int i;
 
        Trace(TRACE_OPEN, "video_close called(0x%p).\n", vdev);
-       if (vdev == NULL) {
-               Err("video_close() called with NULL structure?\n");
-               return;
-       }
+
        pdev = (struct pwc_device *)vdev->priv;
-       if (pdev == NULL) {
-               Err("video_close() called with NULL pwc_device.\n");
-               return;
-       }
        if (pdev->vopen == 0)
                Info("video_close() called on closed device?\n");
 
@@ -1116,10 +1074,12 @@ static void pwc_video_close(struct video_device *vdev)
        /* wake up _disconnect() routine */
        if (pdev->unplugged)
                wake_up(&pdev->remove_ok);
-
-       MOD_DEC_USE_COUNT;
 }
 
+/*
+ *     FIXME: what about two parallel reads ????
+ */
 static long pwc_video_read(struct video_device *vdev, char *buf, unsigned long count, int noblock)
 {
        struct pwc_device *pdev;
@@ -1309,6 +1269,9 @@ static int pwc_video_ioctl(struct video_device *vdev, unsigned int cmd, void *ar
                        if (copy_from_user(&p, arg, sizeof(p)))
                                return -EFAULT;
 
+                       /*
+                        *      FIXME:  Suppose we are mid read
+                        */
                        pwc_set_brightness(pdev, p.brightness);
                        pwc_set_contrast(pdev, p.contrast);
                        pwc_set_gamma(pdev, p.whiteness);
@@ -1482,6 +1445,8 @@ static int pwc_video_ioctl(struct video_device *vdev, unsigned int cmd, void *ar
                           conflict with read(), but any programmer that uses
                           read() and mmap() simultaneously should be given 
                           a job at Micro$oft. As janitor.
+                          
+                          FIXME: needs auditing for safety.
                         */
                        while (pdev->full_frames == NULL) {
                                interruptible_sleep_on(&pdev->frameq);
@@ -1521,11 +1486,9 @@ static int pwc_video_mmap(struct video_device *vdev, const char *adr, unsigned l
        unsigned long page, pos;
        
        Trace(TRACE_READ, "mmap(0x%p, 0x%p, %lu) called.\n", vdev, adr, size);
-       if (vdev == NULL)
-               return -EFAULT;
        pdev = vdev->priv;
-       if (pdev == NULL)
-               return -EFAULT;
+
+       /* FIXME - audit mmap during a read */          
 
        pos = (unsigned long)pdev->image_data;
        while (size > 0) {
@@ -1551,11 +1514,7 @@ static int pwc_video_mmap(struct video_device *vdev, const char *adr, unsigned l
  * is loaded.
  */
 
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,0)
 static void *usb_pwc_probe(struct usb_device *udev, unsigned int ifnum, const struct usb_device_id *id)
-#else
-static void *usb_pwc_probe(struct usb_device *udev, unsigned int ifnum)
-#endif
 {
        struct pwc_device *pdev = NULL;
        struct video_device *vdev;
@@ -1579,8 +1538,6 @@ static void *usb_pwc_probe(struct usb_device *udev, unsigned int ifnum)
        vendor_id = udev->descriptor.idVendor;
        product_id = udev->descriptor.idProduct;
        
-       if (vendor_id != 0x0471 && vendor_id != 0x069A)
-               return NULL; /* Not Philips or Askey, for sure. */
 
        if (vendor_id == 0x0471) {
                switch (product_id) {
@@ -1621,7 +1578,7 @@ static void *usb_pwc_probe(struct usb_device *udev, unsigned int ifnum)
                        break;
                }
        }
-       if (vendor_id == 0x069A) {
+       else if (vendor_id == 0x069A) {
                switch(product_id) {
                case 0x0001:
                        Info("Askey VC010 type 1 USB webcam detected.\n");
@@ -1632,6 +1589,8 @@ static void *usb_pwc_probe(struct usb_device *udev, unsigned int ifnum)
                        break;
                }
        }
+       else return NULL; /* Not Philips or Askey, for sure. */
+
        if (udev->descriptor.bNumConfigurations > 1)
                Info("Warning: more than 1 configuration available.\n");
 
@@ -1665,9 +1624,7 @@ static void *usb_pwc_probe(struct usb_device *udev, unsigned int ifnum)
        }
        memcpy(vdev, &pwc_template, sizeof(pwc_template));
        sprintf(vdev->name, "Philips %d webcam", pdev->type);
-#if LINUX_VERSION_CODE >= KERNEL_VERSION(2,4,3)
        SET_MODULE_OWNER(vdev);
-#endif 
        pdev->vdev = vdev;
        vdev->priv = pdev;
 
@@ -1827,22 +1784,10 @@ static int __init usb_pwc_init(void)
        }
        if (palette) {
                /* Determine default palette */
-               if (!strcmp(palette, "bgr24"))
-                       default_palette = VIDEO_PALETTE_RGB24;
-               else if (!strcmp(palette, "rgb24"))
-                       default_palette = VIDEO_PALETTE_RGB24 | 0x80;
-               else if (!strcmp(palette, "bgr32"))
-                       default_palette = VIDEO_PALETTE_RGB32;
-               else if (!strcmp(palette, "rgb32"))
-                       default_palette = VIDEO_PALETTE_RGB32 | 0x80;
-               else if (!strcmp(palette, "yuyv"))
-                       default_palette = VIDEO_PALETTE_YUYV;
-               else if (!strcmp(palette, "yuv420"))
+               if (!strcmp(palette, "yuv420"))
                        default_palette = VIDEO_PALETTE_YUV420;
-               else if (!strcmp(palette, "yuv420p"))
-                       default_palette = VIDEO_PALETTE_YUV420P;
                else {
-                       Err("Palette not recognized: try palette=[bgr24 | rgb24 | bgr32 | rgb32 | yuyv | yuv420 | yuv420p].\n");
+                       Err("Palette not recognized: try palette=yuv420.\n");
                        return -EINVAL;
                }
                Info("Default palette set to %d.\n", default_palette);
index 6cabcb384f980c62d3878a6de56695b01afb91f7..2bb9749f224cca2c89ec65f3d5db700724e30d91 100644 (file)
    themselves. It also has a decompressor wrapper function.
 */
 
-#include "ccvt.h"
-#include "vcvt.h"
 #include "pwc.h"
 #include "pwc-uncompress.h"
 
 
 /* This contains a list of all registered decompressors */
-LIST_HEAD(pwc_decompressor_list);
+static LIST_HEAD(pwc_decompressor_list);
 
 /* Should the pwc_decompress structure ever change, we increase the 
    version number so that we don't get nasty surprises, or can 
@@ -126,50 +124,14 @@ int pwc_decompress(struct pwc_device *pdev)
        if (pdev->image.x == pdev->view.x && pdev->image.y == pdev->view.y) {
                /* Sizes matches; make it quick */
                switch(pdev->vpalette) {
-               case VIDEO_PALETTE_RGB24 | 0x80:
-                       ccvt_420i_rgb24(pdev->image.x, pdev->image.y, yuv, image);
-                       break;
-               case VIDEO_PALETTE_RGB24:
-                       ccvt_420i_bgr24(pdev->image.x, pdev->image.y, yuv, image);
-                       break;
-               case VIDEO_PALETTE_RGB32 | 0x80:
-                       ccvt_420i_rgb32(pdev->image.x, pdev->image.y, yuv, image);
-                       break;
-               case VIDEO_PALETTE_RGB32:
-                       ccvt_420i_bgr32(pdev->image.x, pdev->image.y, yuv, image);
-                       break;
-               case VIDEO_PALETTE_YUYV:
-               case VIDEO_PALETTE_YUV422:
-                       ccvt_420i_yuyv(pdev->image.x, pdev->image.y, yuv, image); 
-                       break;
                case VIDEO_PALETTE_YUV420:
                        memcpy(image, yuv, pdev->image.size);
                        break;
-               case VIDEO_PALETTE_YUV420P:
-                       n = pdev->image.x * pdev->image.y;
-                       ccvt_420i_420p(pdev->image.x, pdev->image.y, yuv, image, image + n, image + n + (n / 4));
-                       break;
                }
        }
        else {
                /* Size mismatch; use viewport conversion routines */
                switch(pdev->vpalette) {
-               case VIDEO_PALETTE_RGB24 | 0x80:
-                       vcvt_420i_rgb24(pdev->image.x, pdev->image.y, pdev->view.x, yuv, image + pdev->offset.size);
-                       break;
-               case VIDEO_PALETTE_RGB24:
-                       vcvt_420i_bgr24(pdev->image.x, pdev->image.y, pdev->view.x, yuv, image + pdev->offset.size);
-                       break;
-               case VIDEO_PALETTE_RGB32 | 0x80:
-                       vcvt_420i_rgb32(pdev->image.x, pdev->image.y, pdev->view.x, yuv, image + pdev->offset.size);
-                       break;
-               case VIDEO_PALETTE_RGB32:
-                       vcvt_420i_bgr32(pdev->image.x, pdev->image.y, pdev->view.x, yuv, image + pdev->offset.size);
-                       break;
-               case VIDEO_PALETTE_YUYV:
-               case VIDEO_PALETTE_YUV422:
-                       vcvt_420i_yuyv(pdev->image.x, pdev->image.y, pdev->view.x, yuv, image + pdev->offset.size);
-                       break;
                case VIDEO_PALETTE_YUV420:
                        dst = image + pdev->offset.size;
                        w = pdev->view.x * 6;
@@ -180,41 +142,16 @@ int pwc_decompress(struct pwc_device *pdev)
                                yuv += c;
                        }
                        break;
-               case VIDEO_PALETTE_YUV420P:
-                       n = pdev->view.x * pdev->view.y;
-                       vcvt_420i_420p(pdev->image.x, pdev->image.y, pdev->view.x, yuv,
-                                       image +             pdev->offset.size,
-                                       image + n +         pdev->offset.size / 4,
-                                       image + n + n / 4 + pdev->offset.size / 4);
-                       break;
                }
        }
        return 0;
 }
 
-
-/* wrapper functions.
-   By using these wrapper functions and exporting them with no VERSIONING,
-   I can be sure the pwcx.o module will load on all systems.
-*/
-
-void *pwc_kmalloc(size_t size, int priority)
-{
-       return kmalloc(size, priority);
-}
-
-void pwc_kfree(const void *pointer)
-{
-       kfree(pointer);
-}
-
 /* Make sure these functions are available for the decompressor plugin
    both when this code is compiled into the kernel or as as module.
-   We are using unversioned names!
  */
+
 EXPORT_SYMBOL_NOVERS(pwc_decompressor_version);
-EXPORT_SYMBOL_NOVERS(pwc_register_decompressor);
-EXPORT_SYMBOL_NOVERS(pwc_unregister_decompressor);
-EXPORT_SYMBOL_NOVERS(pwc_find_decompressor);
-EXPORT_SYMBOL_NOVERS(pwc_kmalloc);
-EXPORT_SYMBOL_NOVERS(pwc_kfree);
+EXPORT_SYMBOL(pwc_register_decompressor);
+EXPORT_SYMBOL(pwc_unregister_decompressor);
+EXPORT_SYMBOL(pwc_find_decompressor);
index 3802535961d6c6bd15122978ee337be6fbcc70e5..0e9a5566c2e11bae245e081544529417d44fb5a4 100644 (file)
 #ifndef PWC_H
 #define PWC_H
 
-#ifdef __KERNEL__
+#include <linux/config.h>
 #include <linux/module.h>
-#include <asm/semaphore.h>
-#include <asm/errno.h>
 #include <linux/usb.h>
 #include <linux/spinlock.h>
-#include <linux/slab.h>
-#else
-#include <errno.h>
-#include <sys/types.h>
-
-#define printk printf
-#define KERN_DEBUG "<7>"
-#define KERN_INFO  "<6>"
-#define KERN_ERR   "<3>"
-#endif
-
-#include <linux/config.h>
 #include <linux/videodev.h>
 #include <linux/wait.h>
 
+#include <asm/semaphore.h>
+#include <asm/errno.h>
+
 /* Defines and structures for the Philips webcam */
 /* Used for checking memory corruption/pointer validation */
 #define PWC_MAGIC 0x89DC10ABUL
 #define TRACE_SIZE     0x0040
 #define TRACE_SEQUENCE 0x1000
 
-#define Trace(R, A...) if (pwc_trace & R) printk(KERN_DEBUG PWC_NAME " " ##A)
-#define Debug(A...) printk(KERN_DEBUG PWC_NAME " " ##A)
-#define Info(A...)  printk(KERN_INFO  PWC_NAME " " ##A)
-#define Err(A...)   printk(KERN_ERR   PWC_NAME " " ##A)
+#define Trace(R, A...) if (pwc_trace & R) printk(KERN_DEBUG PWC_NAME " " A)
+#define Debug(A...) printk(KERN_DEBUG PWC_NAME " " A)
+#define Info(A...)  printk(KERN_INFO  PWC_NAME " " A)
+#define Err(A...)   printk(KERN_ERR   PWC_NAME " " A)
 
 
 /* Defines for ToUCam cameras */
@@ -122,9 +111,7 @@ struct pwc_iso_buf
        void *data;
        int  length;
        int  read;
-#ifdef __KERNEL__
        purb_t urb;
-#endif
 };
 
 /* intermediate buffers with raw data from the USB cam */
@@ -218,7 +205,6 @@ struct pwc_device
    int image_read_pos;                 /* In case we read data in pieces, keep track of were we are in the imagebuffer */
    int image_used[MAX_IMAGES];         /* For MCAPTURE and SYNC */
 
-#ifdef __KERNEL__
    /* Kernel specific structures. These were once moved to the end 
       of the structure and padded with bytes after I found out
       some of these have different sizes in different kernel versions.
@@ -237,7 +223,6 @@ struct pwc_device
 #if PWC_INT_PIPE
    void *usb_int_handler;              /* for the interrupt endpoint */
 #endif   
-#endif   
 };
 
 /* Enumeration of image sizes */
diff --git a/drivers/usb/pwc_kiara.h b/drivers/usb/pwc_kiara.h
new file mode 100644 (file)
index 0000000..0b13422
--- /dev/null
@@ -0,0 +1,270 @@
+   /* SQCIF */
+   {
+      /* 5 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 10 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 15 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 20 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 25 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 30 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+   },
+   /* QSIF */
+   {
+      /* 5 fps */
+      {
+         {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
+         {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
+         {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
+         {1, 146,    0, {0x1D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0x00, 0x80}},
+      },
+      /* 10 fps */
+      {
+         {2, 291,    0, {0x1C, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0x01, 0x80}},
+         {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
+         {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
+         {1, 192,  630, {0x14, 0xF4, 0x30, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xC0, 0x00, 0x80}},
+      },
+      /* 15 fps */
+      {
+         {3, 437,    0, {0x1B, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x01, 0x80}},
+         {2, 292,  640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}},
+         {2, 292,  640, {0x13, 0xF4, 0x30, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x20, 0x24, 0x01, 0x80}},
+         {1, 192,  420, {0x13, 0xF4, 0x30, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x18, 0xC0, 0x00, 0x80}},
+      },
+      /* 20 fps */
+      {
+         {4, 589,    0, {0x1A, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4D, 0x02, 0x80}},
+         {3, 448,  730, {0x12, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xC0, 0x01, 0x80}},
+         {2, 292,  476, {0x12, 0xF4, 0x30, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0x01, 0x80}},
+         {1, 192,  312, {0x12, 0xF4, 0x50, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0x00, 0x80}},
+      },
+      /* 25 fps */
+      {
+         {5, 703,    0, {0x19, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x02, 0x80}},
+         {3, 447,  610, {0x11, 0xF4, 0x30, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x28, 0xBF, 0x01, 0x80}},
+         {2, 292,  398, {0x11, 0xF4, 0x50, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x28, 0x24, 0x01, 0x80}},
+         {1, 193,  262, {0x11, 0xF4, 0x50, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x28, 0xC1, 0x00, 0x80}},
+      },
+      /* 30 fps */
+      {
+         {8, 874,    0, {0x18, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x6A, 0x03, 0x80}},
+         {5, 704,  730, {0x10, 0xF4, 0x30, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x28, 0xC0, 0x02, 0x80}},
+         {3, 448,  492, {0x10, 0xF4, 0x30, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x28, 0xC0, 0x01, 0x80}},
+         {2, 292,  320, {0x10, 0xF4, 0x50, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x28, 0x24, 0x01, 0x80}},
+      },
+   },
+   /* QCIF */
+   {
+      /* 5 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 10 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 15 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 20 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 25 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 30 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+   },
+   /* SIF */
+   {
+      /* 5 fps */
+      {
+         {4, 582,    0, {0x0D, 0xF4, 0x30, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x02, 0x80}},
+         {3, 387, 1276, {0x05, 0xF4, 0x30, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x01, 0x80}},
+         {2, 291,  960, {0x05, 0xF4, 0x30, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0x01, 0x80}},
+         {1, 191,  630, {0x05, 0xF4, 0x50, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x18, 0xBF, 0x00, 0x80}},
+      },
+      /* 10 fps */
+      {
+         {0, },
+         {6, 775, 1278, {0x04, 0xF4, 0x30, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x03, 0x80}},
+         {3, 447,  736, {0x04, 0xF4, 0x30, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x28, 0xBF, 0x01, 0x80}},
+         {2, 292,  480, {0x04, 0xF4, 0x70, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x28, 0x24, 0x01, 0x80}},
+      },
+      /* 15 fps */
+      {
+         {0, },
+         {9, 955, 1050, {0x03, 0xF4, 0x30, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x03, 0x80}},
+         {4, 592,  650, {0x03, 0xF4, 0x30, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x50, 0x02, 0x80}},
+         {3, 448,  492, {0x03, 0xF4, 0x50, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x38, 0xC0, 0x01, 0x80}},
+      },
+      /* 20 fps */
+      {
+         {0, },
+         {9, 958,  782, {0x02, 0xF4, 0x30, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x03, 0x80}},
+         {5, 703,  574, {0x02, 0xF4, 0x50, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x02, 0x80}},
+         {3, 446,  364, {0x02, 0xF4, 0x90, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x38, 0xBE, 0x01, 0x80}},
+      },
+      /* 25 fps */
+      {
+         {0, },
+         {9, 958,  654, {0x01, 0xF4, 0x30, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x03, 0x80}},
+         {6, 776,  530, {0x01, 0xF4, 0x50, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x03, 0x80}},
+         {4, 592,  404, {0x01, 0xF4, 0x70, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x48, 0x50, 0x02, 0x80}},
+      },
+      /* 30 fps */
+      {
+         {0, },
+         {9, 957,  526, {0x00, 0xF4, 0x50, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x03, 0x80}},
+         {6, 775,  426, {0x00, 0xF4, 0x70, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x03, 0x80}},
+         {4, 590,  324, {0x00, 0x7A, 0x88, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x50, 0x4E, 0x02, 0x80}},
+      },
+   },
+   /* CIF */
+   {
+      /* 5 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 10 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 15 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 20 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 25 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 30 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+   },
+   /* VGA */
+   {
+      /* 5 fps */
+      {
+         {0, },
+         {6, 773, 1272, {0x25, 0xF4, 0x30, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x03, 0x80}},
+         {4, 592,  976, {0x25, 0xF4, 0x50, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x02, 0x80}},
+         {3, 448,  738, {0x25, 0xF4, 0x90, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x01, 0x80}},
+      },
+      /* 10 fps */
+      {
+         {0, },
+         {9, 956,  788, {0x24, 0xF4, 0x70, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x03, 0x80}},
+         {6, 776,  640, {0x24, 0xF4, 0xB0, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x03, 0x80}},
+         {4, 592,  488, {0x24, 0x7A, 0xE8, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x02, 0x80}},
+      },
+      /* 15 fps */
+      {
+         {0, },
+         {9, 957,  526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}},
+         {9, 957,  526, {0x23, 0x7A, 0xE8, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x03, 0x80}},
+         {8, 895,  492, {0x23, 0x7A, 0xE8, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x03, 0x80}},
+      },
+      /* 20 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 25 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 30 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+   },
diff --git a/drivers/usb/pwc_nala.h b/drivers/usb/pwc_nala.h
new file mode 100644 (file)
index 0000000..e6c5cb6
--- /dev/null
@@ -0,0 +1,66 @@
+   /* SQCIF */
+   {
+      {0, 0, {0x04, 0x01, 0x03}},
+      {8, 0, {0x05, 0x01, 0x03}},
+      {7, 0, {0x08, 0x01, 0x03}},
+      {7, 0, {0x0A, 0x01, 0x03}},
+      {6, 0, {0x0C, 0x01, 0x03}},
+      {5, 0, {0x0F, 0x01, 0x03}},
+      {4, 0, {0x14, 0x01, 0x03}},
+      {3, 0, {0x18, 0x01, 0x03}},
+   },
+   /* QSIF */
+   {
+      {0},
+      {0},
+      {0},
+      {0},
+      {0},
+      {0},
+      {0},
+      {0},
+   },
+   /* QCIF */
+   {
+      {0, 0, {0x04, 0x01, 0x02}},
+      {8, 0, {0x05, 0x01, 0x02}},
+      {7, 0, {0x08, 0x01, 0x02}},
+      {6, 0, {0x0A, 0x01, 0x02}},
+      {5, 0, {0x0C, 0x01, 0x02}},
+      {4, 0, {0x0F, 0x01, 0x02}},
+      {1, 0, {0x14, 0x01, 0x02}},
+      {1, 0, {0x18, 0x01, 0x02}},
+   },
+   /* SIF */
+   {
+      {0},
+      {0},
+      {0},
+      {0},
+      {0},
+      {0},
+      {0},
+      {0},
+   },
+   /* CIF */
+   {
+      {4, 0, {0x04, 0x01, 0x01}},
+      {7, 1, {0x05, 0x03, 0x01}},
+      {6, 1, {0x08, 0x03, 0x01}},
+      {4, 1, {0x0A, 0x03, 0x01}},
+      {3, 1, {0x0C, 0x03, 0x01}},
+      {2, 1, {0x0F, 0x03, 0x01}},
+      {0},
+      {0},
+   },
+   /* VGA */
+   {  
+      {0},
+      {0},
+      {0},
+      {0},
+      {0},
+      {0},
+      {0},
+      {0},
+   },
diff --git a/drivers/usb/pwc_timon.h b/drivers/usb/pwc_timon.h
new file mode 100644 (file)
index 0000000..0cc20b8
--- /dev/null
@@ -0,0 +1,270 @@
+   /* SQCIF */
+   {
+      /* 5 fps */
+      {
+         {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
+         {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
+         {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
+         {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
+      },
+      /* 10 fps */
+      {
+         {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
+         {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
+         {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
+         {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
+      },
+      /* 15 fps */
+      {
+         {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
+         {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
+         {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
+         {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
+      },
+      /* 20 fps */
+      {
+         {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
+         {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
+         {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
+         {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
+      },
+      /* 25 fps */
+      {
+         {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
+         {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
+         {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
+         {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
+      },
+      /* 30 fps */
+      {
+         {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
+         {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
+         {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
+         {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
+      },
+   },
+   /* QSIF */
+   {
+      /* 5 fps */
+      {
+         {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
+         {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
+         {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
+         {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
+      },
+      /* 10 fps */
+      {
+         {2, 291,    0, {0x2C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0xA1, 0xC0, 0x02}},
+         {1, 191,  630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
+         {1, 191,  630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
+         {1, 191,  630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
+      },
+      /* 15 fps */
+      {
+         {3, 437,    0, {0x2B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x6D, 0xC0, 0x02}},
+         {2, 291,  640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
+         {2, 291,  640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
+         {1, 191,  420, {0x2B, 0xF4, 0x0D, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
+      },
+      /* 20 fps */
+      {
+         {4, 588,    0, {0x2A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4C, 0x52, 0xC0, 0x02}},
+         {3, 447,  730, {0x2A, 0xF4, 0x05, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
+         {2, 292,  476, {0x2A, 0xF4, 0x0D, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0xA1, 0xC0, 0x02}},
+         {1, 192,  312, {0x2A, 0xF4, 0x1D, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}},
+      },
+      /* 25 fps */
+      {
+         {5, 703,    0, {0x29, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x42, 0xC0, 0x02}},
+         {3, 447,  610, {0x29, 0xF4, 0x05, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
+         {2, 292,  398, {0x29, 0xF4, 0x0D, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}},
+         {1, 192,  262, {0x29, 0xF4, 0x25, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}},
+      },
+      /* 30 fps */
+      {
+         {8, 873,    0, {0x28, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x69, 0x37, 0xC0, 0x02}},
+         {5, 704,  774, {0x28, 0xF4, 0x05, 0x18, 0x21, 0x17, 0x59, 0x0F, 0x18, 0xC0, 0x42, 0xC0, 0x02}},
+         {3, 448,  492, {0x28, 0xF4, 0x05, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x18, 0xC0, 0x69, 0xC0, 0x02}},
+         {2, 291,  320, {0x28, 0xF4, 0x1D, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}},
+      },
+   },
+   /* QCIF */
+   {
+      /* 5 fps */
+      {
+         {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
+         {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
+         {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
+         {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
+      },
+      /* 10 fps */
+      {
+         {3, 385,    0, {0x0C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x81, 0x79, 0xC0, 0x02}},
+         {2, 291,  800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
+         {2, 291,  800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
+         {1, 194,  532, {0x0C, 0xF4, 0x05, 0x10, 0x9A, 0x0F, 0xBE, 0x1B, 0x08, 0xC2, 0xF0, 0xC0, 0x02}},
+      },
+      /* 15 fps */
+      {
+         {4, 577,    0, {0x0B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x41, 0x52, 0xC0, 0x02}},
+         {3, 447,  818, {0x0B, 0xF4, 0x05, 0x19, 0x89, 0x18, 0xAD, 0x0F, 0x10, 0xBF, 0x69, 0xC0, 0x02}},
+         {2, 292,  534, {0x0B, 0xF4, 0x05, 0x10, 0xA3, 0x0F, 0xC7, 0x19, 0x10, 0x24, 0xA1, 0xC0, 0x02}},
+         {1, 195,  356, {0x0B, 0xF4, 0x15, 0x0B, 0x11, 0x0A, 0x35, 0x1E, 0x10, 0xC3, 0xF0, 0xC0, 0x02}},
+      },
+      /* 20 fps */
+      {
+         {6, 776,    0, {0x0A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x3F, 0xC0, 0x02}},
+         {4, 591,  804, {0x0A, 0xF4, 0x05, 0x19, 0x1E, 0x18, 0x42, 0x0F, 0x18, 0x4F, 0x4E, 0xC0, 0x02}},
+         {3, 447,  608, {0x0A, 0xF4, 0x05, 0x12, 0xFD, 0x12, 0x21, 0x15, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
+         {2, 291,  396, {0x0A, 0xF4, 0x15, 0x0C, 0x5E, 0x0B, 0x82, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}},
+      },
+      /* 25 fps */
+      {
+         {9, 928,    0, {0x09, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xA0, 0x33, 0xC0, 0x02}},
+         {5, 703,  800, {0x09, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x10, 0x18, 0xBF, 0x42, 0xC0, 0x02}},
+         {3, 447,  508, {0x09, 0xF4, 0x0D, 0x0F, 0xD2, 0x0E, 0xF6, 0x1B, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
+         {2, 292,  332, {0x09, 0xF4, 0x1D, 0x0A, 0x5A, 0x09, 0x7E, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}},
+      },
+      /* 30 fps */
+      {
+         {0, },
+         {9, 956,  876, {0x08, 0xF4, 0x05, 0x1B, 0x58, 0x1A, 0x7C, 0x0E, 0x20, 0xBC, 0x33, 0x10, 0x02}},
+         {4, 592,  542, {0x08, 0xF4, 0x05, 0x10, 0xE4, 0x10, 0x08, 0x17, 0x20, 0x50, 0x4E, 0x10, 0x02}},
+         {2, 291,  266, {0x08, 0xF4, 0x25, 0x08, 0x48, 0x07, 0x6C, 0x1E, 0x20, 0x23, 0xA1, 0x10, 0x02}},
+      },
+   },
+   /* SIF */
+   {
+      /* 5 fps */
+      {
+         {4, 582,    0, {0x35, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x52, 0x60, 0x02}},
+         {3, 387, 1276, {0x35, 0xF4, 0x05, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x79, 0x60, 0x02}},
+         {2, 291,  960, {0x35, 0xF4, 0x0D, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0xA1, 0x60, 0x02}},
+         {1, 191,  630, {0x35, 0xF4, 0x1D, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x08, 0xBF, 0xF4, 0x60, 0x02}},
+      },
+      /* 10 fps */
+      {
+         {0, },
+         {6, 775, 1278, {0x34, 0xF4, 0x05, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x3F, 0x10, 0x02}},
+         {3, 447,  736, {0x34, 0xF4, 0x15, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x18, 0xBF, 0x69, 0x10, 0x02}},
+         {2, 291,  480, {0x34, 0xF4, 0x2D, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x18, 0x23, 0xA1, 0x10, 0x02}},
+      },
+      /* 15 fps */
+      {
+         {0, },
+         {9, 955, 1050, {0x33, 0xF4, 0x05, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x33, 0x10, 0x02}},
+         {4, 591,  650, {0x33, 0xF4, 0x15, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x4F, 0x4E, 0x10, 0x02}},
+         {3, 448,  492, {0x33, 0xF4, 0x25, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x28, 0xC0, 0x69, 0x10, 0x02}},
+      },
+      /* 20 fps */
+      {
+         {0, },
+         {9, 958,  782, {0x32, 0xF4, 0x0D, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x33, 0xD0, 0x02}},
+         {5, 703,  574, {0x32, 0xF4, 0x1D, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x42, 0xD0, 0x02}},
+         {3, 446,  364, {0x32, 0xF4, 0x3D, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x30, 0xBE, 0x69, 0xD0, 0x02}},
+      },
+      /* 25 fps */
+      {
+         {0, },
+         {9, 958,  654, {0x31, 0xF4, 0x15, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x33, 0x90, 0x02}},
+         {6, 776,  530, {0x31, 0xF4, 0x25, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x3F, 0x90, 0x02}},
+         {4, 592,  404, {0x31, 0xF4, 0x35, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x38, 0x50, 0x4E, 0x90, 0x02}},
+      },
+      /* 30 fps */
+      {
+         {0, },
+         {9, 957,  526, {0x30, 0xF4, 0x25, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x33, 0x60, 0x02}},
+         {6, 775,  426, {0x30, 0xF4, 0x35, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x3F, 0x60, 0x02}},
+         {4, 590,  324, {0x30, 0x7A, 0x4B, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x40, 0x4E, 0x52, 0x60, 0x02}},
+      },
+   },
+   /* CIF */
+   {
+      /* 5 fps */
+      {
+         {6, 771,    0, {0x15, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x3F, 0x80, 0x02}},
+         {4, 465, 1278, {0x15, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x03, 0x18, 0xD1, 0x65, 0x80, 0x02}},
+         {2, 291,  800, {0x15, 0xF4, 0x15, 0x18, 0xF4, 0x17, 0x3C, 0x05, 0x18, 0x23, 0xA1, 0x80, 0x02}},
+         {1, 193,  528, {0x15, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x18, 0xC1, 0xF4, 0x80, 0x02}},
+      },
+      /* 10 fps */
+      {
+         {0, },
+         {9, 932, 1278, {0x14, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x04, 0x30, 0xA4, 0x33, 0x10, 0x02}},
+         {4, 591,  812, {0x14, 0xF4, 0x15, 0x19, 0x56, 0x17, 0x9E, 0x06, 0x28, 0x4F, 0x4E, 0x10, 0x02}},
+         {2, 291,  400, {0x14, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x28, 0x23, 0xA1, 0x10, 0x02}},
+      },
+      /* 15 fps */
+      {
+         {0, },
+         {9, 956,  876, {0x13, 0xF4, 0x0D, 0x1B, 0x58, 0x19, 0xA0, 0x05, 0x38, 0xBC, 0x33, 0x60, 0x02}},
+         {5, 703,  644, {0x13, 0xF4, 0x1D, 0x14, 0x1C, 0x12, 0x64, 0x08, 0x38, 0xBF, 0x42, 0x60, 0x02}},
+         {3, 448,  410, {0x13, 0xF4, 0x3D, 0x0C, 0xC4, 0x0B, 0x0C, 0x0E, 0x38, 0xC0, 0x69, 0x60, 0x02}},
+      },
+      /* 20 fps */
+      {
+         {0, },
+         {9, 956,  650, {0x12, 0xF4, 0x1D, 0x14, 0x4A, 0x12, 0x92, 0x09, 0x48, 0xBC, 0x33, 0x10, 0x03}},
+         {6, 776,  528, {0x12, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x40, 0x08, 0x3F, 0x10, 0x03}},
+         {4, 591,  402, {0x12, 0xF4, 0x3D, 0x0C, 0x8F, 0x0A, 0xD7, 0x0E, 0x40, 0x4F, 0x4E, 0x10, 0x03}},
+      },
+      /* 25 fps */
+      {
+         {0, },
+         {9, 956,  544, {0x11, 0xF4, 0x25, 0x10, 0xF4, 0x0F, 0x3C, 0x0A, 0x48, 0xBC, 0x33, 0xC0, 0x02}},
+         {7, 840,  478, {0x11, 0xF4, 0x2D, 0x0E, 0xEB, 0x0D, 0x33, 0x0B, 0x48, 0x48, 0x3B, 0xC0, 0x02}},
+         {5, 703,  400, {0x11, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x48, 0xBF, 0x42, 0xC0, 0x02}},
+      },
+      /* 30 fps */
+      {
+         {0, },
+         {9, 956,  438, {0x10, 0xF4, 0x35, 0x0D, 0xAC, 0x0B, 0xF4, 0x0D, 0x50, 0xBC, 0x33, 0x10, 0x02}},
+         {7, 838,  384, {0x10, 0xF4, 0x45, 0x0B, 0xFD, 0x0A, 0x45, 0x0F, 0x50, 0x46, 0x3B, 0x10, 0x02}},
+         {6, 773,  354, {0x10, 0x7A, 0x4B, 0x0B, 0x0C, 0x09, 0x80, 0x10, 0x50, 0x05, 0x3F, 0x10, 0x02}},
+      },
+   },
+   /* VGA */
+   {
+      /* 5 fps */
+      {
+         {0, },
+         {6, 773, 1272, {0x1D, 0xF4, 0x15, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x3F, 0x10, 0x02}},
+         {4, 592,  976, {0x1D, 0xF4, 0x25, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x4E, 0x10, 0x02}},
+         {3, 448,  738, {0x1D, 0xF4, 0x3D, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x69, 0x10, 0x02}},
+      },
+      /* 10 fps */
+      {
+         {0, },
+         {9, 956,  788, {0x1C, 0xF4, 0x35, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x33, 0x10, 0x02}},
+         {6, 776,  640, {0x1C, 0x7A, 0x53, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x3F, 0x10, 0x02}},
+         {4, 592,  488, {0x1C, 0x7A, 0x6B, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x4E, 0x10, 0x02}},
+      },
+      /* 15 fps */
+      {
+         {0, },
+         {9, 957,  526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}},
+         {9, 957,  526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}},
+         {8, 895,  492, {0x1B, 0x7A, 0x6B, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x37, 0x80, 0x02}},
+      },
+      /* 20 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 25 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+      /* 30 fps */
+      {
+         {0, },
+         {0, },
+         {0, },
+         {0, },
+      },
+   },
diff --git a/drivers/usb/timon.inc b/drivers/usb/timon.inc
deleted file mode 100644 (file)
index 0cc20b8..0000000
+++ /dev/null
@@ -1,270 +0,0 @@
-   /* SQCIF */
-   {
-      /* 5 fps */
-      {
-         {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
-         {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
-         {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
-         {1, 140,    0, {0x05, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x8C, 0xFC, 0x80, 0x02}},
-      },
-      /* 10 fps */
-      {
-         {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
-         {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
-         {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
-         {2, 280,    0, {0x04, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x18, 0xA9, 0x80, 0x02}},
-      },
-      /* 15 fps */
-      {
-         {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
-         {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
-         {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
-         {3, 410,    0, {0x03, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x9A, 0x71, 0x80, 0x02}},
-      },
-      /* 20 fps */
-      {
-         {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
-         {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
-         {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
-         {4, 559,    0, {0x02, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x2F, 0x56, 0x80, 0x02}},
-      },
-      /* 25 fps */
-      {
-         {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
-         {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
-         {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
-         {5, 659,    0, {0x01, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x93, 0x46, 0x80, 0x02}},
-      },
-      /* 30 fps */
-      {
-         {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
-         {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
-         {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
-         {7, 838,    0, {0x00, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x13, 0x00, 0x46, 0x3B, 0x80, 0x02}},
-      },
-   },
-   /* QSIF */
-   {
-      /* 5 fps */
-      {
-         {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
-         {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
-         {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
-         {1, 146,    0, {0x2D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x92, 0xFC, 0xC0, 0x02}},
-      },
-      /* 10 fps */
-      {
-         {2, 291,    0, {0x2C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x23, 0xA1, 0xC0, 0x02}},
-         {1, 191,  630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
-         {1, 191,  630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
-         {1, 191,  630, {0x2C, 0xF4, 0x05, 0x13, 0xA9, 0x12, 0xE1, 0x17, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
-      },
-      /* 15 fps */
-      {
-         {3, 437,    0, {0x2B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xB5, 0x6D, 0xC0, 0x02}},
-         {2, 291,  640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
-         {2, 291,  640, {0x2B, 0xF4, 0x05, 0x13, 0xF7, 0x13, 0x2F, 0x13, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
-         {1, 191,  420, {0x2B, 0xF4, 0x0D, 0x0D, 0x1B, 0x0C, 0x53, 0x1E, 0x08, 0xBF, 0xF4, 0xC0, 0x02}},
-      },
-      /* 20 fps */
-      {
-         {4, 588,    0, {0x2A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x4C, 0x52, 0xC0, 0x02}},
-         {3, 447,  730, {0x2A, 0xF4, 0x05, 0x16, 0xC9, 0x16, 0x01, 0x0E, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
-         {2, 292,  476, {0x2A, 0xF4, 0x0D, 0x0E, 0xD8, 0x0E, 0x10, 0x19, 0x18, 0x24, 0xA1, 0xC0, 0x02}},
-         {1, 192,  312, {0x2A, 0xF4, 0x1D, 0x09, 0xB3, 0x08, 0xEB, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}},
-      },
-      /* 25 fps */
-      {
-         {5, 703,    0, {0x29, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0xBF, 0x42, 0xC0, 0x02}},
-         {3, 447,  610, {0x29, 0xF4, 0x05, 0x13, 0x0B, 0x12, 0x43, 0x14, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
-         {2, 292,  398, {0x29, 0xF4, 0x0D, 0x0C, 0x6C, 0x0B, 0xA4, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}},
-         {1, 192,  262, {0x29, 0xF4, 0x25, 0x08, 0x23, 0x07, 0x5B, 0x1E, 0x18, 0xC0, 0xF4, 0xC0, 0x02}},
-      },
-      /* 30 fps */
-      {
-         {8, 873,    0, {0x28, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x18, 0x00, 0x69, 0x37, 0xC0, 0x02}},
-         {5, 704,  774, {0x28, 0xF4, 0x05, 0x18, 0x21, 0x17, 0x59, 0x0F, 0x18, 0xC0, 0x42, 0xC0, 0x02}},
-         {3, 448,  492, {0x28, 0xF4, 0x05, 0x0F, 0x5D, 0x0E, 0x95, 0x15, 0x18, 0xC0, 0x69, 0xC0, 0x02}},
-         {2, 291,  320, {0x28, 0xF4, 0x1D, 0x09, 0xFB, 0x09, 0x33, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}},
-      },
-   },
-   /* QCIF */
-   {
-      /* 5 fps */
-      {
-         {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
-         {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
-         {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
-         {1, 193,    0, {0x0D, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xC1, 0xF4, 0xC0, 0x02}},
-      },
-      /* 10 fps */
-      {
-         {3, 385,    0, {0x0C, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x81, 0x79, 0xC0, 0x02}},
-         {2, 291,  800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
-         {2, 291,  800, {0x0C, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x11, 0x08, 0x23, 0xA1, 0xC0, 0x02}},
-         {1, 194,  532, {0x0C, 0xF4, 0x05, 0x10, 0x9A, 0x0F, 0xBE, 0x1B, 0x08, 0xC2, 0xF0, 0xC0, 0x02}},
-      },
-      /* 15 fps */
-      {
-         {4, 577,    0, {0x0B, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x41, 0x52, 0xC0, 0x02}},
-         {3, 447,  818, {0x0B, 0xF4, 0x05, 0x19, 0x89, 0x18, 0xAD, 0x0F, 0x10, 0xBF, 0x69, 0xC0, 0x02}},
-         {2, 292,  534, {0x0B, 0xF4, 0x05, 0x10, 0xA3, 0x0F, 0xC7, 0x19, 0x10, 0x24, 0xA1, 0xC0, 0x02}},
-         {1, 195,  356, {0x0B, 0xF4, 0x15, 0x0B, 0x11, 0x0A, 0x35, 0x1E, 0x10, 0xC3, 0xF0, 0xC0, 0x02}},
-      },
-      /* 20 fps */
-      {
-         {6, 776,    0, {0x0A, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0x08, 0x3F, 0xC0, 0x02}},
-         {4, 591,  804, {0x0A, 0xF4, 0x05, 0x19, 0x1E, 0x18, 0x42, 0x0F, 0x18, 0x4F, 0x4E, 0xC0, 0x02}},
-         {3, 447,  608, {0x0A, 0xF4, 0x05, 0x12, 0xFD, 0x12, 0x21, 0x15, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
-         {2, 291,  396, {0x0A, 0xF4, 0x15, 0x0C, 0x5E, 0x0B, 0x82, 0x1E, 0x18, 0x23, 0xA1, 0xC0, 0x02}},
-      },
-      /* 25 fps */
-      {
-         {9, 928,    0, {0x09, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x12, 0x00, 0xA0, 0x33, 0xC0, 0x02}},
-         {5, 703,  800, {0x09, 0xF4, 0x05, 0x18, 0xF4, 0x18, 0x18, 0x10, 0x18, 0xBF, 0x42, 0xC0, 0x02}},
-         {3, 447,  508, {0x09, 0xF4, 0x0D, 0x0F, 0xD2, 0x0E, 0xF6, 0x1B, 0x18, 0xBF, 0x69, 0xC0, 0x02}},
-         {2, 292,  332, {0x09, 0xF4, 0x1D, 0x0A, 0x5A, 0x09, 0x7E, 0x1E, 0x18, 0x24, 0xA1, 0xC0, 0x02}},
-      },
-      /* 30 fps */
-      {
-         {0, },
-         {9, 956,  876, {0x08, 0xF4, 0x05, 0x1B, 0x58, 0x1A, 0x7C, 0x0E, 0x20, 0xBC, 0x33, 0x10, 0x02}},
-         {4, 592,  542, {0x08, 0xF4, 0x05, 0x10, 0xE4, 0x10, 0x08, 0x17, 0x20, 0x50, 0x4E, 0x10, 0x02}},
-         {2, 291,  266, {0x08, 0xF4, 0x25, 0x08, 0x48, 0x07, 0x6C, 0x1E, 0x20, 0x23, 0xA1, 0x10, 0x02}},
-      },
-   },
-   /* SIF */
-   {
-      /* 5 fps */
-      {
-         {4, 582,    0, {0x35, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x04, 0x00, 0x46, 0x52, 0x60, 0x02}},
-         {3, 387, 1276, {0x35, 0xF4, 0x05, 0x27, 0xD8, 0x26, 0x48, 0x03, 0x10, 0x83, 0x79, 0x60, 0x02}},
-         {2, 291,  960, {0x35, 0xF4, 0x0D, 0x1D, 0xF2, 0x1C, 0x62, 0x04, 0x10, 0x23, 0xA1, 0x60, 0x02}},
-         {1, 191,  630, {0x35, 0xF4, 0x1D, 0x13, 0xA9, 0x12, 0x19, 0x05, 0x08, 0xBF, 0xF4, 0x60, 0x02}},
-      },
-      /* 10 fps */
-      {
-         {0, },
-         {6, 775, 1278, {0x34, 0xF4, 0x05, 0x27, 0xE8, 0x26, 0x58, 0x05, 0x30, 0x07, 0x3F, 0x10, 0x02}},
-         {3, 447,  736, {0x34, 0xF4, 0x15, 0x16, 0xFB, 0x15, 0x6B, 0x05, 0x18, 0xBF, 0x69, 0x10, 0x02}},
-         {2, 291,  480, {0x34, 0xF4, 0x2D, 0x0E, 0xF9, 0x0D, 0x69, 0x09, 0x18, 0x23, 0xA1, 0x10, 0x02}},
-      },
-      /* 15 fps */
-      {
-         {0, },
-         {9, 955, 1050, {0x33, 0xF4, 0x05, 0x20, 0xCF, 0x1F, 0x3F, 0x06, 0x48, 0xBB, 0x33, 0x10, 0x02}},
-         {4, 591,  650, {0x33, 0xF4, 0x15, 0x14, 0x44, 0x12, 0xB4, 0x08, 0x30, 0x4F, 0x4E, 0x10, 0x02}},
-         {3, 448,  492, {0x33, 0xF4, 0x25, 0x0F, 0x52, 0x0D, 0xC2, 0x09, 0x28, 0xC0, 0x69, 0x10, 0x02}},
-      },
-      /* 20 fps */
-      {
-         {0, },
-         {9, 958,  782, {0x32, 0xF4, 0x0D, 0x18, 0x6A, 0x16, 0xDA, 0x0B, 0x58, 0xBE, 0x33, 0xD0, 0x02}},
-         {5, 703,  574, {0x32, 0xF4, 0x1D, 0x11, 0xE7, 0x10, 0x57, 0x0B, 0x40, 0xBF, 0x42, 0xD0, 0x02}},
-         {3, 446,  364, {0x32, 0xF4, 0x3D, 0x0B, 0x5C, 0x09, 0xCC, 0x0E, 0x30, 0xBE, 0x69, 0xD0, 0x02}},
-      },
-      /* 25 fps */
-      {
-         {0, },
-         {9, 958,  654, {0x31, 0xF4, 0x15, 0x14, 0x66, 0x12, 0xD6, 0x0B, 0x50, 0xBE, 0x33, 0x90, 0x02}},
-         {6, 776,  530, {0x31, 0xF4, 0x25, 0x10, 0x8C, 0x0E, 0xFC, 0x0C, 0x48, 0x08, 0x3F, 0x90, 0x02}},
-         {4, 592,  404, {0x31, 0xF4, 0x35, 0x0C, 0x96, 0x0B, 0x06, 0x0B, 0x38, 0x50, 0x4E, 0x90, 0x02}},
-      },
-      /* 30 fps */
-      {
-         {0, },
-         {9, 957,  526, {0x30, 0xF4, 0x25, 0x10, 0x68, 0x0E, 0xD8, 0x0D, 0x58, 0xBD, 0x33, 0x60, 0x02}},
-         {6, 775,  426, {0x30, 0xF4, 0x35, 0x0D, 0x48, 0x0B, 0xB8, 0x0F, 0x50, 0x07, 0x3F, 0x60, 0x02}},
-         {4, 590,  324, {0x30, 0x7A, 0x4B, 0x0A, 0x1C, 0x08, 0xB4, 0x0E, 0x40, 0x4E, 0x52, 0x60, 0x02}},
-      },
-   },
-   /* CIF */
-   {
-      /* 5 fps */
-      {
-         {6, 771,    0, {0x15, 0xF4, 0x04, 0x00, 0x00, 0x00, 0x00, 0x03, 0x00, 0x03, 0x3F, 0x80, 0x02}},
-         {4, 465, 1278, {0x15, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x03, 0x18, 0xD1, 0x65, 0x80, 0x02}},
-         {2, 291,  800, {0x15, 0xF4, 0x15, 0x18, 0xF4, 0x17, 0x3C, 0x05, 0x18, 0x23, 0xA1, 0x80, 0x02}},
-         {1, 193,  528, {0x15, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x18, 0xC1, 0xF4, 0x80, 0x02}},
-      },
-      /* 10 fps */
-      {
-         {0, },
-         {9, 932, 1278, {0x14, 0xF4, 0x05, 0x27, 0xEE, 0x26, 0x36, 0x04, 0x30, 0xA4, 0x33, 0x10, 0x02}},
-         {4, 591,  812, {0x14, 0xF4, 0x15, 0x19, 0x56, 0x17, 0x9E, 0x06, 0x28, 0x4F, 0x4E, 0x10, 0x02}},
-         {2, 291,  400, {0x14, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x28, 0x23, 0xA1, 0x10, 0x02}},
-      },
-      /* 15 fps */
-      {
-         {0, },
-         {9, 956,  876, {0x13, 0xF4, 0x0D, 0x1B, 0x58, 0x19, 0xA0, 0x05, 0x38, 0xBC, 0x33, 0x60, 0x02}},
-         {5, 703,  644, {0x13, 0xF4, 0x1D, 0x14, 0x1C, 0x12, 0x64, 0x08, 0x38, 0xBF, 0x42, 0x60, 0x02}},
-         {3, 448,  410, {0x13, 0xF4, 0x3D, 0x0C, 0xC4, 0x0B, 0x0C, 0x0E, 0x38, 0xC0, 0x69, 0x60, 0x02}},
-      },
-      /* 20 fps */
-      {
-         {0, },
-         {9, 956,  650, {0x12, 0xF4, 0x1D, 0x14, 0x4A, 0x12, 0x92, 0x09, 0x48, 0xBC, 0x33, 0x10, 0x03}},
-         {6, 776,  528, {0x12, 0xF4, 0x2D, 0x10, 0x7E, 0x0E, 0xC6, 0x0A, 0x40, 0x08, 0x3F, 0x10, 0x03}},
-         {4, 591,  402, {0x12, 0xF4, 0x3D, 0x0C, 0x8F, 0x0A, 0xD7, 0x0E, 0x40, 0x4F, 0x4E, 0x10, 0x03}},
-      },
-      /* 25 fps */
-      {
-         {0, },
-         {9, 956,  544, {0x11, 0xF4, 0x25, 0x10, 0xF4, 0x0F, 0x3C, 0x0A, 0x48, 0xBC, 0x33, 0xC0, 0x02}},
-         {7, 840,  478, {0x11, 0xF4, 0x2D, 0x0E, 0xEB, 0x0D, 0x33, 0x0B, 0x48, 0x48, 0x3B, 0xC0, 0x02}},
-         {5, 703,  400, {0x11, 0xF4, 0x3D, 0x0C, 0x7A, 0x0A, 0xC2, 0x0E, 0x48, 0xBF, 0x42, 0xC0, 0x02}},
-      },
-      /* 30 fps */
-      {
-         {0, },
-         {9, 956,  438, {0x10, 0xF4, 0x35, 0x0D, 0xAC, 0x0B, 0xF4, 0x0D, 0x50, 0xBC, 0x33, 0x10, 0x02}},
-         {7, 838,  384, {0x10, 0xF4, 0x45, 0x0B, 0xFD, 0x0A, 0x45, 0x0F, 0x50, 0x46, 0x3B, 0x10, 0x02}},
-         {6, 773,  354, {0x10, 0x7A, 0x4B, 0x0B, 0x0C, 0x09, 0x80, 0x10, 0x50, 0x05, 0x3F, 0x10, 0x02}},
-      },
-   },
-   /* VGA */
-   {
-      /* 5 fps */
-      {
-         {0, },
-         {6, 773, 1272, {0x1D, 0xF4, 0x15, 0x27, 0xB6, 0x24, 0x96, 0x02, 0x30, 0x05, 0x3F, 0x10, 0x02}},
-         {4, 592,  976, {0x1D, 0xF4, 0x25, 0x1E, 0x78, 0x1B, 0x58, 0x03, 0x30, 0x50, 0x4E, 0x10, 0x02}},
-         {3, 448,  738, {0x1D, 0xF4, 0x3D, 0x17, 0x0C, 0x13, 0xEC, 0x04, 0x30, 0xC0, 0x69, 0x10, 0x02}},
-      },
-      /* 10 fps */
-      {
-         {0, },
-         {9, 956,  788, {0x1C, 0xF4, 0x35, 0x18, 0x9C, 0x15, 0x7C, 0x03, 0x48, 0xBC, 0x33, 0x10, 0x02}},
-         {6, 776,  640, {0x1C, 0x7A, 0x53, 0x13, 0xFC, 0x11, 0x2C, 0x04, 0x48, 0x08, 0x3F, 0x10, 0x02}},
-         {4, 592,  488, {0x1C, 0x7A, 0x6B, 0x0F, 0x3C, 0x0C, 0x6C, 0x06, 0x48, 0x50, 0x4E, 0x10, 0x02}},
-      },
-      /* 15 fps */
-      {
-         {0, },
-         {9, 957,  526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}},
-         {9, 957,  526, {0x1B, 0x7A, 0x63, 0x10, 0x68, 0x0D, 0x98, 0x06, 0x58, 0xBD, 0x33, 0x80, 0x02}},
-         {8, 895,  492, {0x1B, 0x7A, 0x6B, 0x0F, 0x5D, 0x0C, 0x8D, 0x06, 0x58, 0x7F, 0x37, 0x80, 0x02}},
-      },
-      /* 20 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 25 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-      /* 30 fps */
-      {
-         {0, },
-         {0, },
-         {0, },
-         {0, },
-      },
-   },
index 6119dbbb83f6cfa2a789524d181314d45cac7d49..415deeb3b4c63f82ca46fa6a58004289843e59ad 100644 (file)
@@ -1,3 +1,13 @@
+/*
+ *
+ * Hardware accelerated Matrox Millennium I, II, Mystique, G100, G200, G400 and G450.
+ *
+ * (c) 1998-2001 Petr Vandrovec <vandrove@vc.cvut.cz>
+ *
+ * Version: 1.52 2001/05/25
+ *
+ */
+
 #include "matroxfb_maven.h"
 #include "matroxfb_crtc2.h"
 #include "matroxfb_misc.h"
@@ -649,6 +659,9 @@ static int matroxfb_dh_regit(CPMINFO struct matroxfb_dh_fb_info* m2info) {
        void* oldcrtc2;
 
        d = kmalloc(sizeof(*d), GFP_KERNEL);
+       if (!d) {
+               return -ENOMEM;
+       }
 
        memset(d, 0, sizeof(*d));
 
@@ -800,7 +813,7 @@ static void matroxfb_crtc2_exit(void) {
        matroxfb_unregister_driver(&crtc2);
 }
 
-MODULE_AUTHOR("(c) 1999,2000 Petr Vandrovec <vandrove@vc.cvut.cz>");
+MODULE_AUTHOR("(c) 1999-2001 Petr Vandrovec <vandrove@vc.cvut.cz>");
 MODULE_DESCRIPTION("Matrox G400 CRTC2 driver");
 module_init(matroxfb_crtc2_init);
 module_exit(matroxfb_crtc2_exit);
index 513f18786f3a33e27e183f4f4ab6e5ed40acffb5..036d0d4291418bcf18e3fd07cb6c83890c4f48b0 100644 (file)
@@ -626,7 +626,7 @@ int inode_has_buffers(struct inode *inode)
    to do in order to release the ramdisk memory is to destroy dirty buffers.
 
    These are two special cases. Normal usage imply the device driver
-   to issue a sync on the device (without waiting I/O completation) and
+   to issue a sync on the device (without waiting I/O completion) and
    then an invalidate_buffers call that doesn't trash dirty buffers. */
 void __invalidate_buffers(kdev_t dev, int destroy_dirty_buffers)
 {
@@ -760,7 +760,12 @@ static void refill_freelist(int size)
        balance_dirty(NODEV);
        if (free_shortage())
                page_launder(GFP_BUFFER, 0);
-       grow_buffers(size);
+       if (!grow_buffers(size)) {
+               wakeup_bdflush(1);
+               current->policy |= SCHED_YIELD;
+               __set_current_state(TASK_RUNNING);
+               schedule();
+       }
 }
 
 void init_buffer(struct buffer_head *bh, bh_end_io_t *handler, void *private)
@@ -1025,12 +1030,13 @@ repeat:
        write_unlock(&hash_table_lock);
        spin_unlock(&lru_list_lock);
        refill_freelist(size);
+       /* FIXME: getblk should fail if there's no enough memory */
        goto repeat;
 }
 
 /* -1 -> no need to flush
     0 -> async flush
-    1 -> sync flush (wait for I/O completation) */
+    1 -> sync flush (wait for I/O completion) */
 int balance_dirty_state(kdev_t dev)
 {
        unsigned long dirty, tot, hard_dirty_limit, soft_dirty_limit;
@@ -1419,6 +1425,7 @@ static void create_empty_buffers(struct page *page, kdev_t dev, unsigned long bl
 {
        struct buffer_head *bh, *head, *tail;
 
+       /* FIXME: create_buffers should fail if there's no enough memory */
        head = create_buffers(page, blocksize, 1);
        if (page->buffers)
                BUG();
@@ -2341,11 +2348,9 @@ cleaned_buffers_try_again:
        spin_lock(&free_list[index].lock);
        tmp = bh;
        do {
-               struct buffer_head *p = tmp;
-
-               tmp = tmp->b_this_page;
-               if (buffer_busy(p))
+               if (buffer_busy(tmp))
                        goto busy_buffer_page;
+               tmp = tmp->b_this_page;
        } while (tmp != bh);
 
        spin_lock(&unused_list_lock);
index fe7ce7a43d57e9bbfb556356c4ae520792b38fc0..ff6918ce1786b5ed2ae5c26c456656fcef603f8e 100644 (file)
@@ -405,133 +405,110 @@ static void proc_kill_inodes(struct proc_dir_entry *de)
        file_list_unlock();
 }
 
-struct proc_dir_entry *proc_symlink(const char *name,
-               struct proc_dir_entry *parent, const char *dest)
+static struct proc_dir_entry *proc_create(struct proc_dir_entry **parent,
+                                         const char *name,
+                                         mode_t mode,
+                                         nlink_t nlink)
 {
        struct proc_dir_entry *ent = NULL;
        const char *fn = name;
        int len;
 
-       if (!parent && xlate_proc_name(name, &parent, &fn) != 0)
+       /* make sure name is valid */
+       if (!name || !strlen(name)) goto out;
+
+       if (!(*parent) && xlate_proc_name(name, parent, &fn) != 0)
                goto out;
        len = strlen(fn);
 
        ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
-       if (!ent)
-               goto out;
+       if (!ent) goto out;
+
        memset(ent, 0, sizeof(struct proc_dir_entry));
-       memcpy(((char *) ent) + sizeof(*ent), fn, len + 1);
+       memcpy(((char *) ent) + sizeof(struct proc_dir_entry), fn, len + 1);
        ent->name = ((char *) ent) + sizeof(*ent);
        ent->namelen = len;
-       ent->nlink = 1;
-       ent->mode = S_IFLNK|S_IRUGO|S_IWUGO|S_IXUGO;
-       ent->data = kmalloc((ent->size=strlen(dest))+1, GFP_KERNEL);
-       if (!ent->data) {
-               kfree(ent);
-               ent = NULL;
-               goto out;
-       }
-       strcpy((char*)ent->data,dest);
+       ent->mode = mode;
+       ent->nlink = nlink;
+ out:
+       return ent;
+}
 
-       proc_register(parent, ent);
-       
-out:
+struct proc_dir_entry *proc_symlink(const char *name,
+               struct proc_dir_entry *parent, const char *dest)
+{
+       struct proc_dir_entry *ent;
+
+       ent = proc_create(&parent,name,
+                         (S_IFLNK | S_IRUGO | S_IWUGO | S_IXUGO),1);
+
+       if (ent) {
+               ent->data = kmalloc((ent->size=strlen(dest))+1, GFP_KERNEL);
+               if (ent->data) {
+                       strcpy((char*)ent->data,dest);
+                       proc_register(parent, ent);
+               } else {
+                       kfree(ent);
+                       ent = NULL;
+               }
+       }
        return ent;
 }
 
 struct proc_dir_entry *proc_mknod(const char *name, mode_t mode,
                struct proc_dir_entry *parent, kdev_t rdev)
 {
-       struct proc_dir_entry *ent = NULL;
-       const char *fn = name;
-       int len;
-
-       if (!parent && xlate_proc_name(name, &parent, &fn) != 0)
-               goto out;
-       len = strlen(fn);
-
-       ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
-       if (!ent)
-               goto out;
-       memset(ent, 0, sizeof(struct proc_dir_entry));
-       memcpy(((char *) ent) + sizeof(*ent), fn, len + 1);
-       ent->name = ((char *) ent) + sizeof(*ent);
-       ent->namelen = len;
-       ent->nlink = 1;
-       ent->mode = mode;
-       ent->rdev = rdev;
+       struct proc_dir_entry *ent;
 
-       proc_register(parent, ent);
-       
-out:
+       ent = proc_create(&parent,name,mode,1);
+       if (ent) {
+               ent->rdev = rdev;
+               proc_register(parent, ent);
+       }
        return ent;
 }
 
 struct proc_dir_entry *proc_mkdir(const char *name, struct proc_dir_entry *parent)
 {
-       struct proc_dir_entry *ent = NULL;
-       const char *fn = name;
-       int len;
+       struct proc_dir_entry *ent;
 
-       if (!parent && xlate_proc_name(name, &parent, &fn) != 0)
-               goto out;
-       len = strlen(fn);
-
-       ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
-       if (!ent)
-               goto out;
-       memset(ent, 0, sizeof(struct proc_dir_entry));
-       memcpy(((char *) ent) + sizeof(*ent), fn, len + 1);
-       ent->name = ((char *) ent) + sizeof(*ent);
-       ent->namelen = len;
-       ent->proc_fops = &proc_dir_operations;
-       ent->proc_iops = &proc_dir_inode_operations;
-       ent->nlink = 2;
-       ent->mode = S_IFDIR | S_IRUGO | S_IXUGO;
+       ent = proc_create(&parent,name,
+                         (S_IFDIR | S_IRUGO | S_IXUGO),2);
+       if (ent) {
+               ent->proc_fops = &proc_dir_operations;
+               ent->proc_iops = &proc_dir_inode_operations;
 
-       proc_register(parent, ent);
-       
-out:
+               proc_register(parent, ent);
+       }
        return ent;
 }
 
 struct proc_dir_entry *create_proc_entry(const char *name, mode_t mode,
                                         struct proc_dir_entry *parent)
 {
-       struct proc_dir_entry *ent = NULL;
-       const char *fn = name;
-       int len;
-
-       if (!parent && xlate_proc_name(name, &parent, &fn) != 0)
-               goto out;
-       len = strlen(fn);
-
-       ent = kmalloc(sizeof(struct proc_dir_entry) + len + 1, GFP_KERNEL);
-       if (!ent)
-               goto out;
-       memset(ent, 0, sizeof(struct proc_dir_entry));
-       memcpy(((char *) ent) + sizeof(*ent), fn, len + 1);
-       ent->name = ((char *) ent) + sizeof(*ent);
-       ent->namelen = len;
+       struct proc_dir_entry *ent;
+       nlink_t nlink;
 
        if (S_ISDIR(mode)) {
                if ((mode & S_IALLUGO) == 0)
-               mode |= S_IRUGO | S_IXUGO;
-               ent->proc_fops = &proc_dir_operations;
-               ent->proc_iops = &proc_dir_inode_operations;
-               ent->nlink = 2;
+                       mode |= S_IRUGO | S_IXUGO;
+               nlink = 2;
        } else {
                if ((mode & S_IFMT) == 0)
                        mode |= S_IFREG;
                if ((mode & S_IALLUGO) == 0)
                        mode |= S_IRUGO;
-               ent->nlink = 1;
+               nlink = 1;
        }
-       ent->mode = mode;
 
-       proc_register(parent, ent);
-       
-out:
+       ent = proc_create(&parent,name,mode,nlink);
+       if (ent) {
+               if (S_ISDIR(mode)) {
+                       ent->proc_fops = &proc_dir_operations;
+                       ent->proc_iops = &proc_dir_inode_operations;
+               }
+               proc_register(parent, ent);
+       }
        return ent;
 }
 
index 66212fdf2f46da0581d89731dae0ad7a511c43aa..59342c6a01f6a98fda4d3b0992eb8d8e927fac0c 100644 (file)
@@ -282,6 +282,21 @@ struct file_system_type *get_fs_type(const char *name)
 
 static LIST_HEAD(vfsmntlist);
 
+struct vfsmount *alloc_vfsmnt(void)
+{
+       struct vfsmount *mnt = kmalloc(sizeof(struct vfsmount), GFP_KERNEL); 
+       if (mnt) {
+               memset(mnt, 0, sizeof(struct vfsmount));
+               atomic_set(&mnt->mnt_count,1);
+               INIT_LIST_HEAD(&mnt->mnt_clash);
+               INIT_LIST_HEAD(&mnt->mnt_child);
+               INIT_LIST_HEAD(&mnt->mnt_mounts);
+               INIT_LIST_HEAD(&mnt->mnt_list);
+               mnt->mnt_owner = current->uid;
+       }
+       return mnt;
+}
+
 static void detach_mnt(struct vfsmount *mnt, struct nameidata *old_nd)
 {
        old_nd->dentry = mnt->mnt_mountpoint;
@@ -314,13 +329,6 @@ static void attach_mnt(struct vfsmount *mnt, struct nameidata *nd)
  *     Potential reason for failure (aside of trivial lack of memory) is a
  *     deleted mountpoint. Caller must hold ->i_zombie on mountpoint
  *     dentry (if any).
- *
- *     Node is marked as MNT_VISIBLE (visible in /proc/mounts) unless both
- *     @nd and @devname are %NULL. It works since we pass non-%NULL @devname
- *     when we are mounting root and kern_mount() filesystems are deviceless.
- *     If we will get a kern_mount() filesystem with nontrivial @devname we
- *     will have to pass the visibility flag explicitly, so if we will add
- *     support for such beasts we'll have to change prototype.
  */
 
 static struct vfsmount *add_vfsmnt(struct nameidata *nd,
@@ -331,13 +339,9 @@ static struct vfsmount *add_vfsmnt(struct nameidata *nd,
        struct super_block *sb = root->d_inode->i_sb;
        char *name;
 
-       mnt = kmalloc(sizeof(struct vfsmount), GFP_KERNEL);
+       mnt = alloc_vfsmnt();
        if (!mnt)
                goto out;
-       memset(mnt, 0, sizeof(struct vfsmount));
-
-       if (nd || dev_name)
-               mnt->mnt_flags = MNT_VISIBLE;
 
        /* It may be NULL, but who cares? */
        if (dev_name) {
@@ -347,8 +351,6 @@ static struct vfsmount *add_vfsmnt(struct nameidata *nd,
                        mnt->mnt_devname = name;
                }
        }
-       mnt->mnt_owner = current->uid;
-       atomic_set(&mnt->mnt_count,1);
        mnt->mnt_sb = sb;
 
        spin_lock(&dcache_lock);
@@ -361,13 +363,12 @@ static struct vfsmount *add_vfsmnt(struct nameidata *nd,
        } else {
                mnt->mnt_mountpoint = mnt->mnt_root;
                mnt->mnt_parent = mnt;
-               INIT_LIST_HEAD(&mnt->mnt_child);
-               INIT_LIST_HEAD(&mnt->mnt_clash);
        }
-       INIT_LIST_HEAD(&mnt->mnt_mounts);
        list_add(&mnt->mnt_instances, &sb->s_mounts);
        list_add(&mnt->mnt_list, vfsmntlist.prev);
        spin_unlock(&dcache_lock);
+       if (sb->s_type->fs_flags & FS_SINGLE)
+               get_filesystem(sb->s_type);
 out:
        return mnt;
 fail:
@@ -500,8 +501,6 @@ int get_filesystem_info( char *buf )
 
        for (p = vfsmntlist.next; p != &vfsmntlist; p = p->next) {
                struct vfsmount *tmp = list_entry(p, struct vfsmount, mnt_list);
-               if (!(tmp->mnt_flags & MNT_VISIBLE))
-                       continue;
                path = d_path(tmp->mnt_root, tmp, buffer, PAGE_SIZE);
                if (!path)
                        continue;
@@ -855,7 +854,6 @@ static struct super_block *get_sb_single(struct file_system_type *fs_type,
        sb = fs_type->kern_mnt->mnt_sb;
        if (!sb)
                BUG();
-       get_filesystem(fs_type);
        do_remount_sb(sb, flags, data);
        return sb;
 }
@@ -947,21 +945,31 @@ static int do_remount_sb(struct super_block *sb, int flags, char *data)
 
 struct vfsmount *kern_mount(struct file_system_type *type)
 {
-       kdev_t dev = get_unnamed_dev();
        struct super_block *sb;
-       struct vfsmount *mnt;
-       if (!dev)
+       struct vfsmount *mnt = alloc_vfsmnt();
+       kdev_t dev;
+
+       if (!mnt)
+               return ERR_PTR(-ENOMEM);
+
+       dev = get_unnamed_dev();
+       if (!dev) {
+               kfree(mnt);
                return ERR_PTR(-EMFILE);
+       }
        sb = read_super(dev, NULL, type, 0, NULL, 0);
        if (!sb) {
                put_unnamed_dev(dev);
+               kfree(mnt);
                return ERR_PTR(-EINVAL);
        }
-       mnt = add_vfsmnt(NULL, sb->s_root, NULL);
-       if (!mnt) {
-               kill_super(sb);
-               return ERR_PTR(-ENOMEM);
-       }
+       mnt->mnt_sb = sb;
+       mnt->mnt_root = dget(sb->s_root);
+       mnt->mnt_mountpoint = mnt->mnt_root;
+       mnt->mnt_parent = mnt;
+       spin_lock(&dcache_lock);
+       list_add(&mnt->mnt_instances, &sb->s_mounts);
+       spin_unlock(&dcache_lock);
        type->kern_mnt = mnt;
        return mnt;
 }
@@ -1158,8 +1166,6 @@ static int do_loopback(char *old_name, char *new_name)
                goto out2;
 
        err = -ENOMEM;
-       if (old_nd.mnt->mnt_sb->s_type->fs_flags & FS_SINGLE)
-               get_filesystem(old_nd.mnt->mnt_sb->s_type);
                
        down(&mount_sem);
        /* there we go */
@@ -1170,8 +1176,6 @@ static int do_loopback(char *old_name, char *new_name)
                err = 0;
        up(&new_nd.dentry->d_inode->i_zombie);
        up(&mount_sem);
-       if (err && old_nd.mnt->mnt_sb->s_type->fs_flags & FS_SINGLE)
-               put_filesystem(old_nd.mnt->mnt_sb->s_type);
 out2:
        path_release(&new_nd);
 out1:
@@ -1362,8 +1366,6 @@ fs_out:
        return retval;
 
 fail:
-       if (fstype->fs_flags & FS_SINGLE)
-               put_filesystem(fstype);
        kill_super(sb);
        goto unlock_out;
 }
index 3b41b99cf1aa12adcd992a87f3dc4e686e4b59c3..e2e6ddbd3db39c7482a1bc07928536843f272064 100644 (file)
@@ -12,8 +12,6 @@
 #define _LINUX_MOUNT_H
 #ifdef __KERNEL__
 
-#define MNT_VISIBLE    1
-
 struct vfsmount
 {
        struct dentry *mnt_mountpoint;  /* dentry of mountpoint */
index 89a20fcd43c55c1d25b3d4146baa88444204d878..d69cc5182cd86c9d0135eb567e115ff847d36ae8 100644 (file)
 
 /* Power Management Registers */
 
+#define PCI_PM_PMC              2       /* PM Capabilities Register */
 #define  PCI_PM_CAP_VER_MASK   0x0007  /* Version */
 #define  PCI_PM_CAP_PME_CLOCK  0x0008  /* PME clock required */
-#define  PCI_PM_CAP_AUX_POWER  0x0010  /* Auxilliary power support */
+#define  PCI_PM_CAP_RESERVED    0x0010  /* Reserved field */
 #define  PCI_PM_CAP_DSI                0x0020  /* Device specific initialization */
+#define  PCI_PM_CAP_AUX_POWER  0x01C0  /* Auxilliary power support mask */
 #define  PCI_PM_CAP_D1         0x0200  /* D1 power state support */
 #define  PCI_PM_CAP_D2         0x0400  /* D2 power state support */
 #define  PCI_PM_CAP_PME                0x0800  /* PME pin supported */
+#define  PCI_PM_CAP_PME_MASK    0xF800  /* PME Mask of all supported states */
+#define  PCI_PM_CAP_PME_D0      0x0800  /* PME# from D0 */
+#define  PCI_PM_CAP_PME_D1      0x1000  /* PME# from D1 */
+#define  PCI_PM_CAP_PME_D2      0x2000  /* PME# from D2 */
+#define  PCI_PM_CAP_PME_D3      0x4000  /* PME# from D3 (hot) */
+#define  PCI_PM_CAP_PME_D3cold  0x8000  /* PME# from D3 (cold) */
 #define PCI_PM_CTRL            4       /* PM control and status register */
 #define  PCI_PM_CTRL_STATE_MASK        0x0003  /* Current power state (D0 to D3) */
 #define  PCI_PM_CTRL_PME_ENABLE        0x0100  /* PME pin enable */
index f093fb67e2c564c98a8da36a322aba77547017ff..8bbb0c597b77830bebcfbe0e6fb929e276627fff 100644 (file)
@@ -159,6 +159,19 @@ void kunmap_high(struct page *page)
        spin_unlock(&kmap_lock);
 }
 
+#define POOL_SIZE 32
+
+/*
+ * This lock gets no contention at all, normally.
+ */
+static spinlock_t emergency_lock = SPIN_LOCK_UNLOCKED;
+
+int nr_emergency_pages;
+static LIST_HEAD(emergency_pages);
+
+int nr_emergency_bhs;
+static LIST_HEAD(emergency_bhs);
+
 /*
  * Simple bounce buffer support for highmem pages.
  * This will be moved to the block layer in 2.5.
@@ -203,17 +216,72 @@ static inline void copy_to_high_bh_irq (struct buffer_head *to,
 
 static inline void bounce_end_io (struct buffer_head *bh, int uptodate)
 {
+       struct page *page;
        struct buffer_head *bh_orig = (struct buffer_head *)(bh->b_private);
+       unsigned long flags;
 
        bh_orig->b_end_io(bh_orig, uptodate);
-       __free_page(bh->b_page);
+
+       page = bh->b_page;
+
+       spin_lock_irqsave(&emergency_lock, flags);
+       if (nr_emergency_pages >= POOL_SIZE)
+               __free_page(page);
+       else {
+               /*
+                * We are abusing page->list to manage
+                * the highmem emergency pool:
+                */
+               list_add(&page->list, &emergency_pages);
+               nr_emergency_pages++;
+       }
+       
+       if (nr_emergency_bhs >= POOL_SIZE) {
 #ifdef HIGHMEM_DEBUG
-       /* Don't clobber the constructed slab cache */
-       init_waitqueue_head(&bh->b_wait);
+               /* Don't clobber the constructed slab cache */
+               init_waitqueue_head(&bh->b_wait);
 #endif
-       kmem_cache_free(bh_cachep, bh);
+               kmem_cache_free(bh_cachep, bh);
+       } else {
+               /*
+                * Ditto in the bh case, here we abuse b_inode_buffers:
+                */
+               list_add(&bh->b_inode_buffers, &emergency_bhs);
+               nr_emergency_bhs++;
+       }
+       spin_unlock_irqrestore(&emergency_lock, flags);
+}
+
+static __init int init_emergency_pool(void)
+{
+       spin_lock_irq(&emergency_lock);
+       while (nr_emergency_pages < POOL_SIZE) {
+               struct page * page = alloc_page(GFP_ATOMIC);
+               if (!page) {
+                       printk("couldn't refill highmem emergency pages");
+                       break;
+               }
+               list_add(&page->list, &emergency_pages);
+               nr_emergency_pages++;
+       }
+       while (nr_emergency_bhs < POOL_SIZE) {
+               struct buffer_head * bh = kmem_cache_alloc(bh_cachep, SLAB_ATOMIC);
+               if (!bh) {
+                       printk("couldn't refill highmem emergency bhs");
+                       break;
+               }
+               list_add(&bh->b_inode_buffers, &emergency_bhs);
+               nr_emergency_bhs++;
+       }
+       spin_unlock_irq(&emergency_lock);
+       printk("allocated %d pages and %d bhs reserved for the highmem bounces\n",
+              nr_emergency_pages, nr_emergency_bhs);
+
+       return 0;
 }
 
+__initcall(init_emergency_pool);
+
 static void bounce_end_io_write (struct buffer_head *bh, int uptodate)
 {
        bounce_end_io(bh, uptodate);
@@ -228,6 +296,82 @@ static void bounce_end_io_read (struct buffer_head *bh, int uptodate)
        bounce_end_io(bh, uptodate);
 }
 
+struct page *alloc_bounce_page (void)
+{
+       struct list_head *tmp;
+       struct page *page;
+
+repeat_alloc:
+       page = alloc_page(GFP_BUFFER);
+       if (page)
+               return page;
+       /*
+        * No luck. First, kick the VM so it doesnt idle around while
+        * we are using up our emergency rations.
+        */
+       wakeup_bdflush(0);
+
+       /*
+        * Try to allocate from the emergency pool.
+        */
+       tmp = &emergency_pages;
+       spin_lock_irq(&emergency_lock);
+       if (!list_empty(tmp)) {
+               page = list_entry(tmp->next, struct page, list);
+               list_del(tmp->next);
+               nr_emergency_pages--;
+       }
+       spin_unlock_irq(&emergency_lock);
+       if (page)
+               return page;
+
+       /* we need to wait I/O completion */
+       run_task_queue(&tq_disk);
+
+       current->policy |= SCHED_YIELD;
+       __set_current_state(TASK_RUNNING);
+       schedule();
+       goto repeat_alloc;
+}
+
+struct buffer_head *alloc_bounce_bh (void)
+{
+       struct list_head *tmp;
+       struct buffer_head *bh;
+
+repeat_alloc:
+       bh = kmem_cache_alloc(bh_cachep, SLAB_BUFFER);
+       if (bh)
+               return bh;
+       /*
+        * No luck. First, kick the VM so it doesnt idle around while
+        * we are using up our emergency rations.
+        */
+       wakeup_bdflush(0);
+
+       /*
+        * Try to allocate from the emergency pool.
+        */
+       tmp = &emergency_bhs;
+       spin_lock_irq(&emergency_lock);
+       if (!list_empty(tmp)) {
+               bh = list_entry(tmp->next, struct buffer_head, b_inode_buffers);
+               list_del(tmp->next);
+               nr_emergency_bhs--;
+       }
+       spin_unlock_irq(&emergency_lock);
+       if (bh)
+               return bh;
+
+       /* we need to wait I/O completion */
+       run_task_queue(&tq_disk);
+
+       current->policy |= SCHED_YIELD;
+       __set_current_state(TASK_RUNNING);
+       schedule();
+       goto repeat_alloc;
+}
+
 struct buffer_head * create_bounce(int rw, struct buffer_head * bh_orig)
 {
        struct page *page;
@@ -236,24 +380,15 @@ struct buffer_head * create_bounce(int rw, struct buffer_head * bh_orig)
        if (!PageHighMem(bh_orig->b_page))
                return bh_orig;
 
-repeat_bh:
-       bh = kmem_cache_alloc(bh_cachep, SLAB_BUFFER);
-       if (!bh) {
-               wakeup_bdflush(1);  /* Sets task->state to TASK_RUNNING */
-               goto repeat_bh;
-       }
+       bh = alloc_bounce_bh();
        /*
         * This is wasteful for 1k buffers, but this is a stopgap measure
         * and we are being ineffective anyway. This approach simplifies
         * things immensly. On boxes with more than 4GB RAM this should
         * not be an issue anyway.
         */
-repeat_page:
-       page = alloc_page(GFP_BUFFER);
-       if (!page) {
-               wakeup_bdflush(1);  /* Sets task->state to TASK_RUNNING */
-               goto repeat_page;
-       }
+       page = alloc_bounce_page();
+
        set_bh_page(bh, page, 0);
 
        bh->b_next = NULL;
index 7f02c56e75ecd78cb048667287637be31005cfc1..a01273bf8b0c4b363c1f30ce9a51b18807a659be 100644 (file)
@@ -251,10 +251,10 @@ static struct page * __alloc_pages_limit(zonelist_t *zonelist,
                                water_mark = z->pages_high;
                }
 
-               if (z->free_pages + z->inactive_clean_pages > water_mark) {
+               if (z->free_pages + z->inactive_clean_pages >= water_mark) {
                        struct page *page = NULL;
                        /* If possible, reclaim a page directly. */
-                       if (direct_reclaim && z->free_pages < z->pages_min + 8)
+                       if (direct_reclaim)
                                page = reclaim_page(z);
                        /* If that fails, fall back to rmqueue. */
                        if (!page)
@@ -299,21 +299,6 @@ struct page * __alloc_pages(zonelist_t *zonelist, unsigned long order)
        if (order == 0 && (gfp_mask & __GFP_WAIT))
                direct_reclaim = 1;
 
-       /*
-        * If we are about to get low on free pages and we also have
-        * an inactive page shortage, wake up kswapd.
-        */
-       if (inactive_shortage() > inactive_target / 2 && free_shortage())
-               wakeup_kswapd();
-       /*
-        * If we are about to get low on free pages and cleaning
-        * the inactive_dirty pages would fix the situation,
-        * wake up bdflush.
-        */
-       else if (free_shortage() && nr_inactive_dirty_pages > free_shortage()
-                       && nr_inactive_dirty_pages >= freepages.high)
-               wakeup_bdflush(0);
-
 try_again:
        /*
         * First, see if we have any zones with lots of free memory.
index 158218798dd3ab9c52a61be5ffd64eba46389513..3c37122979f1cdc0c4832878e046272ad481cfec 100644 (file)
@@ -871,8 +871,11 @@ static int do_try_to_free_pages(unsigned int gfp_mask, int user)
         * before we get around to moving them to the other
         * list, so this is a relatively cheap operation.
         */
-       if (free_shortage())
+       if (free_shortage()) {
                ret += page_launder(gfp_mask, user);
+               shrink_dcache_memory(DEF_PRIORITY, gfp_mask);
+               shrink_icache_memory(DEF_PRIORITY, gfp_mask);
+       }
 
        /*
         * If needed, we move pages from the active list
@@ -882,23 +885,9 @@ static int do_try_to_free_pages(unsigned int gfp_mask, int user)
                ret += refill_inactive(gfp_mask, user);
 
        /*      
-        * Delete pages from the inode and dentry caches and 
-        * reclaim unused slab cache if memory is low.
+        * Reclaim unused slab cache if memory is low.
         */
-       if (free_shortage()) {
-               shrink_dcache_memory(DEF_PRIORITY, gfp_mask);
-               shrink_icache_memory(DEF_PRIORITY, gfp_mask);
-       } else {
-               /*
-                * Illogical, but true. At least for now.
-                *
-                * If we're _not_ under shortage any more, we
-                * reap the caches. Why? Because a noticeable
-                * part of the caches are the buffer-heads, 
-                * which we'll want to keep if under shortage.
-                */
-               kmem_cache_reap(gfp_mask);
-       } 
+       kmem_cache_reap(gfp_mask);
 
        return ret;
 }