Merge master.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-2.6
diff --git a/Documentation/i2c/chips/adm1021 b/Documentation/hwmon/adm1021
similarity index 100%
rename from Documentation/i2c/chips/adm1021
rename to Documentation/hwmon/adm1021
diff --git a/Documentation/i2c/chips/adm1025 b/Documentation/hwmon/adm1025
similarity index 100%
rename from Documentation/i2c/chips/adm1025
rename to Documentation/hwmon/adm1025
diff --git a/Documentation/i2c/chips/adm1026 b/Documentation/hwmon/adm1026
similarity index 100%
rename from Documentation/i2c/chips/adm1026
rename to Documentation/hwmon/adm1026
diff --git a/Documentation/i2c/chips/adm1031 b/Documentation/hwmon/adm1031
similarity index 100%
rename from Documentation/i2c/chips/adm1031
rename to Documentation/hwmon/adm1031
diff --git a/Documentation/i2c/chips/adm9240 b/Documentation/hwmon/adm9240
similarity index 100%
rename from Documentation/i2c/chips/adm9240
rename to Documentation/hwmon/adm9240
diff --git a/Documentation/i2c/chips/asb100 b/Documentation/hwmon/asb100
similarity index 100%
rename from Documentation/i2c/chips/asb100
rename to Documentation/hwmon/asb100
diff --git a/Documentation/i2c/chips/ds1621 b/Documentation/hwmon/ds1621
similarity index 100%
rename from Documentation/i2c/chips/ds1621
rename to Documentation/hwmon/ds1621
diff --git a/Documentation/i2c/chips/fscher b/Documentation/hwmon/fscher
similarity index 100%
rename from Documentation/i2c/chips/fscher
rename to Documentation/hwmon/fscher
diff --git a/Documentation/i2c/chips/gl518sm b/Documentation/hwmon/gl518sm
similarity index 100%
rename from Documentation/i2c/chips/gl518sm
rename to Documentation/hwmon/gl518sm
diff --git a/Documentation/i2c/chips/it87 b/Documentation/hwmon/it87
similarity index 100%
rename from Documentation/i2c/chips/it87
rename to Documentation/hwmon/it87
diff --git a/Documentation/i2c/chips/lm63 b/Documentation/hwmon/lm63
similarity index 100%
rename from Documentation/i2c/chips/lm63
rename to Documentation/hwmon/lm63
diff --git a/Documentation/i2c/chips/lm75 b/Documentation/hwmon/lm75
similarity index 100%
rename from Documentation/i2c/chips/lm75
rename to Documentation/hwmon/lm75
diff --git a/Documentation/i2c/chips/lm77 b/Documentation/hwmon/lm77
similarity index 100%
rename from Documentation/i2c/chips/lm77
rename to Documentation/hwmon/lm77
diff --git a/Documentation/i2c/chips/lm78 b/Documentation/hwmon/lm78
similarity index 100%
rename from Documentation/i2c/chips/lm78
rename to Documentation/hwmon/lm78
diff --git a/Documentation/i2c/chips/lm80 b/Documentation/hwmon/lm80
similarity index 100%
rename from Documentation/i2c/chips/lm80
rename to Documentation/hwmon/lm80
diff --git a/Documentation/i2c/chips/lm83 b/Documentation/hwmon/lm83
similarity index 100%
rename from Documentation/i2c/chips/lm83
rename to Documentation/hwmon/lm83
diff --git a/Documentation/i2c/chips/lm85 b/Documentation/hwmon/lm85
similarity index 100%
rename from Documentation/i2c/chips/lm85
rename to Documentation/hwmon/lm85
diff --git a/Documentation/i2c/chips/lm87 b/Documentation/hwmon/lm87
similarity index 100%
rename from Documentation/i2c/chips/lm87
rename to Documentation/hwmon/lm87
diff --git a/Documentation/i2c/chips/lm90 b/Documentation/hwmon/lm90
similarity index 100%
rename from Documentation/i2c/chips/lm90
rename to Documentation/hwmon/lm90
diff --git a/Documentation/i2c/chips/lm92 b/Documentation/hwmon/lm92
similarity index 100%
rename from Documentation/i2c/chips/lm92
rename to Documentation/hwmon/lm92
diff --git a/Documentation/i2c/chips/max1619 b/Documentation/hwmon/max1619
similarity index 100%
rename from Documentation/i2c/chips/max1619
rename to Documentation/hwmon/max1619
diff --git a/Documentation/i2c/chips/pc87360 b/Documentation/hwmon/pc87360
similarity index 100%
rename from Documentation/i2c/chips/pc87360
rename to Documentation/hwmon/pc87360
diff --git a/Documentation/i2c/chips/sis5595 b/Documentation/hwmon/sis5595
similarity index 100%
rename from Documentation/i2c/chips/sis5595
rename to Documentation/hwmon/sis5595
diff --git a/Documentation/i2c/chips/smsc47b397 b/Documentation/hwmon/smsc47b397
similarity index 100%
rename from Documentation/i2c/chips/smsc47b397
rename to Documentation/hwmon/smsc47b397
diff --git a/Documentation/i2c/chips/smsc47m1 b/Documentation/hwmon/smsc47m1
similarity index 100%
rename from Documentation/i2c/chips/smsc47m1
rename to Documentation/hwmon/smsc47m1
diff --git a/Documentation/i2c/sysfs-interface b/Documentation/hwmon/sysfs-interface
similarity index 100%
rename from Documentation/i2c/sysfs-interface
rename to Documentation/hwmon/sysfs-interface
diff --git a/Documentation/i2c/userspace-tools b/Documentation/hwmon/userspace-tools
similarity index 100%
rename from Documentation/i2c/userspace-tools
rename to Documentation/hwmon/userspace-tools
diff --git a/Documentation/i2c/chips/via686a b/Documentation/hwmon/via686a
similarity index 100%
rename from Documentation/i2c/chips/via686a
rename to Documentation/hwmon/via686a
diff --git a/Documentation/i2c/chips/w83627hf b/Documentation/hwmon/w83627hf
similarity index 100%
rename from Documentation/i2c/chips/w83627hf
rename to Documentation/hwmon/w83627hf
diff --git a/Documentation/i2c/chips/w83781d b/Documentation/hwmon/w83781d
similarity index 100%
rename from Documentation/i2c/chips/w83781d
rename to Documentation/hwmon/w83781d
diff --git a/Documentation/i2c/chips/w83l785ts b/Documentation/hwmon/w83l785ts
similarity index 100%
rename from Documentation/i2c/chips/w83l785ts
rename to Documentation/hwmon/w83l785ts
diff --git a/Documentation/i2c/chips/max6875 b/Documentation/i2c/chips/max6875
index b4fb49b..b020028 100644
--- a/Documentation/i2c/chips/max6875
+++ b/Documentation/i2c/chips/max6875
@@ -2,10 +2,10 @@
 =====================
 
 Supported chips:
-  * Maxim max6874, max6875
-    Prefixes: 'max6875'
+  * Maxim MAX6874, MAX6875
+    Prefix: 'max6875'
     Addresses scanned: 0x50, 0x52
-    Datasheets:
+    Datasheet:
         http://pdfserv.maxim-ic.com/en/ds/MAX6874-MAX6875.pdf
 
 Author: Ben Gardner <bgardner@wabtec.com>
@@ -23,14 +23,26 @@
 Description
 -----------
 
-The MAXIM max6875 is a EEPROM-programmable power-supply sequencer/supervisor.
+The Maxim MAX6875 is an EEPROM-programmable power-supply sequencer/supervisor.
 It provides timed outputs that can be used as a watchdog, if properly wired.
 It also provides 512 bytes of user EEPROM.
 
-At reset, the max6875 reads the configuration eeprom into its configuration
+At reset, the MAX6875 reads the configuration EEPROM into its configuration
 registers.  The chip then begins to operate according to the values in the
 registers.
 
+The Maxim MAX6874 is a similar, mostly compatible device, with more intputs
+and outputs:
+
+             vin     gpi    vout
+MAX6874        6       4       8
+MAX6875        4       3       5
+
+MAX6874 chips can have four different addresses (as opposed to only two for
+the MAX6875). The additional addresses (0x54 and 0x56) are not probed by
+this driver by default, but the probe module parameter can be used if
+needed.
+
 See the datasheet for details on how to program the EEPROM.
 
 
diff --git a/Documentation/i2c/dev-interface b/Documentation/i2c/dev-interface
index 09d6cda..b849ad6 100644
--- a/Documentation/i2c/dev-interface
+++ b/Documentation/i2c/dev-interface
@@ -14,9 +14,12 @@
 =========
 
 So let's say you want to access an i2c adapter from a C program. The
-first thing to do is `#include <linux/i2c.h>" and "#include <linux/i2c-dev.h>. 
-Yes, I know, you should never include kernel header files, but until glibc 
-knows about i2c, there is not much choice.
+first thing to do is "#include <linux/i2c-dev.h>". Please note that
+there are two files named "i2c-dev.h" out there, one is distributed
+with the Linux kernel and is meant to be included from kernel
+driver code, the other one is distributed with lm_sensors and is
+meant to be included from user-space programs. You obviously want
+the second one here.
 
 Now, you have to decide which adapter you want to access. You should
 inspect /sys/class/i2c-dev/ to decide this. Adapter numbers are assigned
@@ -78,7 +81,7 @@
 ==========================
 
 The following IOCTLs are defined and fully supported 
-(see also i2c-dev.h and i2c.h):
+(see also i2c-dev.h):
 
 ioctl(file,I2C_SLAVE,long addr)
   Change slave address. The address is passed in the 7 lower bits of the
@@ -97,10 +100,10 @@
 ioctl(file,I2C_FUNCS,unsigned long *funcs)
   Gets the adapter functionality and puts it in *funcs.
 
-ioctl(file,I2C_RDWR,struct i2c_ioctl_rdwr_data *msgset)
+ioctl(file,I2C_RDWR,struct i2c_rdwr_ioctl_data *msgset)
 
   Do combined read/write transaction without stop in between.
-  The argument is a pointer to a struct i2c_ioctl_rdwr_data {
+  The argument is a pointer to a struct i2c_rdwr_ioctl_data {
 
       struct i2c_msg *msgs;  /* ptr to array of simple messages */
       int nmsgs;             /* number of messages to exchange */
diff --git a/Documentation/i2c/writing-clients b/Documentation/i2c/writing-clients
index f482dae..91664be 100644
--- a/Documentation/i2c/writing-clients
+++ b/Documentation/i2c/writing-clients
@@ -27,7 +27,6 @@
 static struct i2c_driver foo_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "Foo version 2.3 driver",
-	.id		= I2C_DRIVERID_FOO, /* from i2c-id.h, optional */
 	.flags		= I2C_DF_NOTIFY,
 	.attach_adapter	= &foo_attach_adapter,
 	.detach_client	= &foo_detach_client,
@@ -37,12 +36,6 @@
 The name can be chosen freely, and may be upto 40 characters long. Please
 use something descriptive here.
 
-If used, the id should be a unique ID. The range 0xf000 to 0xffff is
-reserved for local use, and you can use one of those until you start
-distributing the driver, at which time you should contact the i2c authors
-to get your own ID(s). Note that most of the time you don't need an ID
-at all so you can just omit it.
-
 Don't worry about the flags field; just put I2C_DF_NOTIFY into it. This
 means that your driver will be notified when new adapters are found.
 This is almost always what you want.
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 753db6d..a998a8c 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -37,7 +37,7 @@
 	IA-32	IA-32 aka i386 architecture is enabled.
 	IA-64	IA-64 architecture is enabled.
 	IOSCHED	More than one I/O scheduler is enabled.
-	IP_PNP	IP DCHP, BOOTP, or RARP is enabled.
+	IP_PNP	IP DHCP, BOOTP, or RARP is enabled.
 	ISAPNP	ISA PnP code is enabled.
 	ISDN	Appropriate ISDN support is enabled.
 	JOY	Appropriate joystick support is enabled.
diff --git a/Documentation/pcmcia/driver-changes.txt b/Documentation/pcmcia/driver-changes.txt
index 9c315ab..59ccc63 100644
--- a/Documentation/pcmcia/driver-changes.txt
+++ b/Documentation/pcmcia/driver-changes.txt
@@ -1,6 +1,13 @@
 This file details changes in 2.6 which affect PCMCIA card driver authors:
 
-* in-kernel device<->driver matching
+* event handler initialization in struct pcmcia_driver (as of 2.6.13)
+   The event handler is notified of all events, and must be initialized
+   as the event() callback in the driver's struct pcmcia_driver.
+
+* pcmcia/version.h should not be used (as of 2.6.13)
+   This file will be removed eventually.
+
+* in-kernel device<->driver matching (as of 2.6.13)
    PCMCIA devices and their correct drivers can now be matched in
    kernelspace. See 'devicetable.txt' for details.
 
diff --git a/Documentation/video4linux/CARDLIST.bttv b/Documentation/video4linux/CARDLIST.bttv
index aeeafec..62a12a0 100644
--- a/Documentation/video4linux/CARDLIST.bttv
+++ b/Documentation/video4linux/CARDLIST.bttv
@@ -1,4 +1,4 @@
-card=0 -  *** UNKNOWN/GENERIC *** 
+card=0 -  *** UNKNOWN/GENERIC ***
 card=1 - MIRO PCTV
 card=2 - Hauppauge (bt848)
 card=3 - STB, Gateway P/N 6000699 (bt848)
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88
index 4377aa1..6d44958 100644
--- a/Documentation/video4linux/CARDLIST.cx88
+++ b/Documentation/video4linux/CARDLIST.cx88
@@ -27,3 +27,5 @@
 card=26 - IODATA GV/BCTV7E
 card=27 - PixelView PlayTV Ultra Pro (Stereo)
 card=28 - DViCO FusionHDTV 3 Gold-T
+card=29 - ADS Tech Instant TV DVB-T PCI
+card=30 - TerraTec Cinergy 1400 DVB-T
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
index 735e8ba..1b5a3a9 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -1,10 +1,10 @@
-  0 -> UNKNOWN/GENERIC                         
+  0 -> UNKNOWN/GENERIC
   1 -> Proteus Pro [philips reference design]   [1131:2001,1131:2001]
   2 -> LifeView FlyVIDEO3000                    [5168:0138,4e42:0138]
   3 -> LifeView FlyVIDEO2000                    [5168:0138]
   4 -> EMPRESS                                  [1131:6752]
   5 -> SKNet Monster TV                         [1131:4e85]
-  6 -> Tevion MD 9717                          
+  6 -> Tevion MD 9717
   7 -> KNC One TV-Station RDS / Typhoon TV Tuner RDS [1131:fe01,1894:fe01]
   8 -> Terratec Cinergy 400 TV                  [153B:1142]
   9 -> Medion 5044
@@ -34,6 +34,7 @@
  33 -> AVerMedia DVD EZMaker                    [1461:10ff]
  34 -> Noval Prime TV 7133
  35 -> AverMedia AverTV Studio 305              [1461:2115]
+ 36 -> UPMOST PURPLE TV                         [12ab:0800]
  37 -> Items MuchTV Plus / IT-005
  38 -> Terratec Cinergy 200 TV                  [153B:1152]
  39 -> LifeView FlyTV Platinum Mini             [5168:0212]
@@ -43,20 +44,21 @@
  43 -> :Zolid Xpert TV7134
  44 -> Empire PCI TV-Radio LE
  45 -> Avermedia AVerTV Studio 307              [1461:9715]
- 46 -> AVerMedia Cardbus TV/Radio               [1461:d6ee]
+ 46 -> AVerMedia Cardbus TV/Radio (E500)        [1461:d6ee]
  47 -> Terratec Cinergy 400 mobile              [153b:1162]
  48 -> Terratec Cinergy 600 TV MK3              [153B:1158]
  49 -> Compro VideoMate Gold+ Pal               [185b:c200]
  50 -> Pinnacle PCTV 300i DVB-T + PAL           [11bd:002d]
  51 -> ProVideo PV952                           [1540:9524]
  52 -> AverMedia AverTV/305                     [1461:2108]
+ 53 -> ASUS TV-FM 7135                          [1043:4845]
  54 -> LifeView FlyTV Platinum FM               [5168:0214,1489:0214]
- 55 -> LifeView FlyDVB-T DUO                    [5168:0306]
+ 55 -> LifeView FlyDVB-T DUO                    [5168:0502,5168:0306]
  56 -> Avermedia AVerTV 307                     [1461:a70a]
  57 -> Avermedia AVerTV GO 007 FM               [1461:f31f]
  58 -> ADS Tech Instant TV (saa7135)            [1421:0350,1421:0370]
  59 -> Kworld/Tevion V-Stream Xpert TV PVR7134
- 60 -> Typhoon DVB-T Duo Digital/Analog Cardbus
- 61 -> Philips TOUGH DVB-T reference design
+ 60 -> Typhoon DVB-T Duo Digital/Analog Cardbus [4e42:0502]
+ 61 -> Philips TOUGH DVB-T reference design     [1131:2004]
  62 -> Compro VideoMate TV Gold+II
  63 -> Kworld Xpert TV PVR7134
diff --git a/Documentation/video4linux/CARDLIST.tuner b/Documentation/video4linux/CARDLIST.tuner
index e78020f..d1b9d21 100644
--- a/Documentation/video4linux/CARDLIST.tuner
+++ b/Documentation/video4linux/CARDLIST.tuner
@@ -56,9 +56,9 @@
 tuner=55 - LG PAL (TAPE series)
 tuner=56 - Philips PAL/SECAM multi (FQ1216AME MK4)
 tuner=57 - Philips FQ1236A MK4
-tuner=58 - Ymec TVision TVF-8531MF
+tuner=58 - Ymec TVision TVF-8531MF/8831MF/8731MF
 tuner=59 - Ymec TVision TVF-5533MF
 tuner=60 - Thomson DDT 7611 (ATSC/NTSC)
-tuner=61 - Tena TNF9533-D/IF
+tuner=61 - Tena TNF9533-D/IF/TNF9533-B/DF
 tuner=62 - Philips TEA5767HN FM Radio
 tuner=63 - Philips FMD1216ME MK3 Hybrid Tuner
diff --git a/Documentation/video4linux/bttv/Cards b/Documentation/video4linux/bttv/Cards
index 7f8c7eb..8f1941e 100644
--- a/Documentation/video4linux/bttv/Cards
+++ b/Documentation/video4linux/bttv/Cards
@@ -20,7 +20,7 @@
 decoders, EEPROMs, teletext decoders ...
 
 
-Unsupported Cards: 
+Unsupported Cards:
 ------------------
 
 Cards with Zoran (ZR) or Philips (SAA) or ISA are not supported by
@@ -50,11 +50,11 @@
 Miro/Pinnacle PCTV
 ------------------
 
-- Bt848 
-  some (all??) come with 2 crystals for PAL/SECAM and NTSC 
+- Bt848
+  some (all??) come with 2 crystals for PAL/SECAM and NTSC
 - PAL, SECAM or NTSC TV tuner (Philips or TEMIC)
 - MSP34xx sound decoder on add on board
-  decoder is supported but AFAIK does not yet work 
+  decoder is supported but AFAIK does not yet work
   (other sound MUX setting in GPIO port needed??? somebody who fixed this???)
 - 1 tuner, 1 composite and 1 S-VHS input
 - tuner type is autodetected
@@ -70,7 +70,7 @@
 Hauppauge Win/TV pci
 --------------------
 
-There are many different versions of the Hauppauge cards with different 
+There are many different versions of the Hauppauge cards with different
 tuners (TV+Radio ...), teletext decoders.
 Note that even cards with same model numbers have (depending on the revision)
 different chips on it.
@@ -80,22 +80,22 @@
 - PAL, SECAM, NTSC or tuner with or without Radio support
 
 e.g.:
-  PAL: 
+  PAL:
   TDA5737: VHF, hyperband and UHF mixer/oscillator for TV and VCR 3-band tuners
   TSA5522: 1.4 GHz I2C-bus controlled synthesizer, I2C 0xc2-0xc3
-  
+
   NTSC:
   TDA5731: VHF, hyperband and UHF mixer/oscillator for TV and VCR 3-band tuners
   TSA5518: no datasheet available on Philips site
-- Philips SAA5246 or SAA5284 ( or no) Teletext decoder chip	
+- Philips SAA5246 or SAA5284 ( or no) Teletext decoder chip
   with buffer RAM (e.g. Winbond W24257AS-35: 32Kx8 CMOS static RAM)
   SAA5246 (I2C 0x22) is supported
-- 256 bytes EEPROM: Microchip 24LC02B or Philips 8582E2Y 
+- 256 bytes EEPROM: Microchip 24LC02B or Philips 8582E2Y
   with configuration information
   I2C address 0xa0 (24LC02B also responds to 0xa2-0xaf)
 - 1 tuner, 1 composite and (depending on model) 1 S-VHS input
 - 14052B: mux for selection of sound source
-- sound decoder: TDA9800, MSP34xx (stereo cards) 
+- sound decoder: TDA9800, MSP34xx (stereo cards)
 
 
 Askey CPH-Series
@@ -108,17 +108,17 @@
     CPH05x: BT878 with FM
     CPH06x: BT878 (w/o FM)
     CPH07x: BT878 capture only
- 
+
   TV standards:
      CPH0x0: NTSC-M/M
      CPH0x1: PAL-B/G
      CPH0x2: PAL-I/I
      CPH0x3: PAL-D/K
-     CPH0x4: SECAM-L/L 
-     CPH0x5: SECAM-B/G 
-     CPH0x6: SECAM-D/K 
-     CPH0x7: PAL-N/N 
-     CPH0x8: PAL-B/H 
+     CPH0x4: SECAM-L/L
+     CPH0x5: SECAM-B/G
+     CPH0x6: SECAM-D/K
+     CPH0x7: PAL-N/N
+     CPH0x8: PAL-B/H
      CPH0x9: PAL-M/M
 
   CPH03x was often sold as "TV capturer".
@@ -174,7 +174,7 @@
       "The FlyVideo2000 and FlyVideo2000s product name have renamed to FlyVideo98."
       Their Bt8x8 cards are listed as discontinued.
       Flyvideo 2000S was probably sold as Flyvideo 3000 in some contries(Europe?).
-      The new Flyvideo 2000/3000 are SAA7130/SAA7134 based. 
+      The new Flyvideo 2000/3000 are SAA7130/SAA7134 based.
 
   "Flyvideo II" had been the name for the 848 cards, nowadays (in Germany)
   this name is re-used for LR50 Rev.W.
@@ -235,12 +235,12 @@
    Multimedia TV packages (card + software pack):
    PixelView Play TV Theater - (Model: PV-M4200) =  PixelView Play TV pro + Software
    PixelView Play TV PAK -     (Model: PV-BT878P+ REV 4E)
-   PixelView Play TV/VCR -     (Model: PV-M3200 REV 4C / 8D / 10A ) 
+   PixelView Play TV/VCR -     (Model: PV-M3200 REV 4C / 8D / 10A )
    PixelView Studio PAK -      (Model:    M2200 REV 4C / 8D / 10A )
    PixelView PowerStudio PAK - (Model: PV-M3600 REV 4E)
    PixelView DigitalVCR PAK -  (Model: PV-M2400 REV 4C / 8D / 10A )
 
-   PixelView PlayTV PAK II (TV/FM card + usb camera)  PV-M3800 
+   PixelView PlayTV PAK II (TV/FM card + usb camera)  PV-M3800
    PixelView PlayTV XP PV-M4700,PV-M4700(w/FM)
    PixelView PlayTV DVR PV-M4600  package contents:PixelView PlayTV pro, windvr & videoMail s/w
 
@@ -254,7 +254,7 @@
 
    DTV3000 PV-DTV3000P+ DVB-S CI = Twinhan VP-1030
    DTV2000 DVB-S = Twinhan VP-1020
-   
+
    Video Conferencing:
    PixelView Meeting PAK - (Model: PV-BT878P)
    PixelView Meeting PAK Lite - (Model: PV-BT878P)
@@ -308,7 +308,7 @@
 
    newer Cards have saa7134, but model name stayed the same?
 
-Provideo 
+Provideo
 --------
   PV951 or PV-951 (also are sold as:
    Boeder TV-FM Video Capture Card
@@ -353,7 +353,7 @@
    AVerTV
    AVerTV Stereo
    AVerTV Studio (w/FM)
-   AVerMedia TV98 with Remote 
+   AVerMedia TV98 with Remote
    AVerMedia TV/FM98 Stereo
    AVerMedia TVCAM98
    TVCapture (Bt848)
@@ -373,7 +373,7 @@
    (1) Daughterboard MB68-A with TDA9820T and TDA9840T
    (2) Sony NE41S soldered (stereo sound?)
    (3) Daughterboard M118-A w/ pic 16c54 and 4 MHz quartz
- 
+
    US site has different drivers for (as of 09/2002):
    EZ Capture/InterCam PCI (BT-848 chip)
    EZ Capture/InterCam PCI (BT-878 chip)
@@ -437,7 +437,7 @@
    Terra TValueRadio,             "LR102 Rev.C" printed on the PCB
    Terra TV/Radio+ Version 1.0,   "80-CP2830100-0" TTTV3 printed on the PCB,
 				     "CPH010-E83" on the back, SAA6588T, TDA9873H
-   Terra TValue Version BT878,    "80-CP2830110-0 TTTV4" printed on the PCB, 
+   Terra TValue Version BT878,    "80-CP2830110-0 TTTV4" printed on the PCB,
 				     "CPH011-D83" on back
    Terra TValue Version 1.0       "ceb105.PCB" (really identical to Terra TV+ Version 1.0)
    Terra TValue New Revision	  "LR102 Rec.C"
@@ -528,7 +528,7 @@
    KW-606RSF
    KW-607A (capture only)
    KW-608 (Zoran capture only)
- 
+
 IODATA (jp)
 ------
    GV-BCTV/PCI
@@ -542,15 +542,15 @@
 -------
    WinDVR	= Kworld "KW-TVL878RF"
 
-www.sigmacom.co.kr 
+www.sigmacom.co.kr
 ------------------
-   Sigma Cyber TV II 
+   Sigma Cyber TV II
 
 www.sasem.co.kr
 ---------------
    Litte OnAir TV
 
-hama 
+hama
 ----
    TV/Radio-Tuner Card, PCI (Model 44677) = CPH051
 
@@ -638,7 +638,7 @@
 
 Jetway (www.jetway.com.tw)
 --------------------------
-   JW-TV 878M 
+   JW-TV 878M
    JW-TV 878  = KWorld KW-TV878RF
 
 Galaxis
@@ -715,7 +715,7 @@
   809 MyVideo
   872 MyTV2Go FM
 
- 
+
   546 WinTV Nova-S CI
   543 WinTV Nova
   907 Nova-S USB
@@ -739,7 +739,7 @@
   832 MyTV2Go
   869 MyTV2Go-FM
   805 MyVideo (USB)
-  
+
 
 Matrix-Vision
 -------------
@@ -764,7 +764,7 @@
    Intervision IV-550 (bt8x8)
    Intervision IV-100 (zoran)
    Intervision IV-1000 (bt8x8)
-   
+
 Asonic (www.asonic.com.cn) (website down)
 -----------------------------------------
    SkyEye tv 878
@@ -804,11 +804,11 @@
 
 JTT/ Justy Corp.http://www.justy.co.jp/ (www.jtt.com.jp website down)
 ---------------------------------------------------------------------
-   JTT-02 (JTT TV) "TV watchmate pro" (bt848) 
+   JTT-02 (JTT TV) "TV watchmate pro" (bt848)
 
 ADS www.adstech.com
 -------------------
-   Channel Surfer TV ( CHX-950 ) 
+   Channel Surfer TV ( CHX-950 )
    Channel Surfer TV+FM ( CHX-960FM )
 
 AVEC www.prochips.com
@@ -874,7 +874,7 @@
 ------------------
    Falcon Series (capture only)
  In USA: http://www.theimagingsource.com/
-   DFG/LC1	
+   DFG/LC1
 
 www.sknet-web.co.jp
 -------------------
@@ -890,7 +890,7 @@
    CyberMail Xtreme
   These are Flyvideo
 
-VCR (http://www.vcrinc.com/) 
+VCR (http://www.vcrinc.com/)
 ---
   Video Catcher 16
 
@@ -920,7 +920,7 @@
     SDI Silk 200 SDI Input Card
 
 www.euresys.com
-    PICOLO series 
+    PICOLO series
 
 PMC/Pace
 www.pacecom.co.uk website closed
diff --git a/Documentation/video4linux/not-in-cx2388x-datasheet.txt b/Documentation/video4linux/not-in-cx2388x-datasheet.txt
index 96b638b..edbfe74 100644
--- a/Documentation/video4linux/not-in-cx2388x-datasheet.txt
+++ b/Documentation/video4linux/not-in-cx2388x-datasheet.txt
@@ -34,4 +34,8 @@
   2: HACTEXT
   1: HSFMT
 
+0x47 is the sync byte for MPEG-2 transport stream packets.
+Datasheet incorrectly states to use 47 decimal. 188 is the length.
+All DVB compliant frontends output packets with this start code.
+
 =================================================================================
diff --git a/MAINTAINERS b/MAINTAINERS
index 37fb1e2..5d01472 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -1240,7 +1240,7 @@
 
 IRDA SUBSYSTEM
 P:	Jean Tourrilhes
-L:	irda-users@lists.sourceforge.net
+L:	irda-users@lists.sourceforge.net (subscribers-only)
 W:	http://irda.sourceforge.net/
 S:	Maintained
 
diff --git a/arch/arm/Kconfig b/arch/arm/Kconfig
index 4546271..7bc4a58 100644
--- a/arch/arm/Kconfig
+++ b/arch/arm/Kconfig
@@ -746,6 +746,8 @@
 
 source "drivers/i2c/Kconfig"
 
+source "drivers/hwmon/Kconfig"
+
 #source "drivers/l3/Kconfig"
 
 source "drivers/misc/Kconfig"
diff --git a/arch/h8300/Kconfig b/arch/h8300/Kconfig
index 375f2a8..26698a4 100644
--- a/arch/h8300/Kconfig
+++ b/arch/h8300/Kconfig
@@ -181,6 +181,8 @@
 
 source "drivers/i2c/Kconfig"
 
+source "drivers/hwmon/Kconfig"
+
 source "drivers/usb/Kconfig"
 
 endmenu
diff --git a/arch/ppc/kernel/machine_kexec.c b/arch/ppc/kernel/machine_kexec.c
index 84d65a8..a727877 100644
--- a/arch/ppc/kernel/machine_kexec.c
+++ b/arch/ppc/kernel/machine_kexec.c
@@ -28,6 +28,12 @@
 const extern unsigned char relocate_new_kernel[];
 const extern unsigned int relocate_new_kernel_size;
 
+/*
+ * Provide a dummy crash_notes definition while crash dump arrives to ppc.
+ * This prevents breakage of crash_notes attribute in kernel/ksysfs.c.
+ */
+void *crash_notes = NULL;
+
 void machine_shutdown(void)
 {
 	if (ppc_md.machine_shutdown)
diff --git a/arch/sparc64/Kconfig b/arch/sparc64/Kconfig
index 1406078..9afd28e 100644
--- a/arch/sparc64/Kconfig
+++ b/arch/sparc64/Kconfig
@@ -649,6 +649,8 @@
 
 source "drivers/i2c/Kconfig"
 
+source "drivers/hwmon/Kconfig"
+
 source "fs/Kconfig"
 
 source "drivers/media/Kconfig"
diff --git a/arch/um/Makefile b/arch/um/Makefile
index 3f07390..4a375bb 100644
--- a/arch/um/Makefile
+++ b/arch/um/Makefile
@@ -140,7 +140,8 @@
 #When cleaning we don't include .config, so we don't include
 #TT or skas makefiles and don't clean skas_ptregs.h.
 CLEAN_FILES += linux x.i gmon.out $(ARCH_DIR)/include/uml-config.h \
-	$(GEN_HEADERS) $(ARCH_DIR)/include/skas_ptregs.h
+	$(GEN_HEADERS) $(ARCH_DIR)/include/skas_ptregs.h \
+	$(ARCH_DIR)/include/user_constants.h
 
 MRPROPER_FILES += $(SYMLINK_HEADERS) $(ARCH_SYMLINKS) \
 	$(addprefix $(ARCH_DIR)/kernel/,$(KERN_SYMLINKS)) $(ARCH_DIR)/os \
diff --git a/arch/x86_64/kernel/vmlinux.lds.S b/arch/x86_64/kernel/vmlinux.lds.S
index 61c1275..2a94f9b 100644
--- a/arch/x86_64/kernel/vmlinux.lds.S
+++ b/arch/x86_64/kernel/vmlinux.lds.S
@@ -62,8 +62,8 @@
   }
 
 #define VSYSCALL_ADDR (-10*1024*1024)
-#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.cacheline_aligned) + SIZEOF(.data.cacheline_aligned) + 4095) & ~(4095))
-#define VSYSCALL_VIRT_ADDR ((ADDR(.data.cacheline_aligned) + SIZEOF(.data.cacheline_aligned) + 4095) & ~(4095))
+#define VSYSCALL_PHYS_ADDR ((LOADADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
+#define VSYSCALL_VIRT_ADDR ((ADDR(.data.read_mostly) + SIZEOF(.data.read_mostly) + 4095) & ~(4095))
 
 #define VLOAD_OFFSET (VSYSCALL_ADDR - VSYSCALL_PHYS_ADDR)
 #define VLOAD(x) (ADDR(x) - VLOAD_OFFSET)
diff --git a/arch/xtensa/kernel/asm-offsets.c b/arch/xtensa/kernel/asm-offsets.c
index 840cd9a..7cd1d7f 100644
--- a/arch/xtensa/kernel/asm-offsets.c
+++ b/arch/xtensa/kernel/asm-offsets.c
@@ -15,7 +15,6 @@
 #include <asm/processor.h>
 
 #include <linux/types.h>
-#include <linux/sched.h>
 #include <linux/stddef.h>
 #include <linux/thread_info.h>
 #include <linux/ptrace.h>
diff --git a/arch/xtensa/kernel/syscalls.c b/arch/xtensa/kernel/syscalls.c
index 7270509..f20c649 100644
--- a/arch/xtensa/kernel/syscalls.c
+++ b/arch/xtensa/kernel/syscalls.c
@@ -69,8 +69,8 @@
 /*
  * Common code for old and new mmaps.
  */
-long sys_mmap2(unsigned long addr, unsigned long len, unsigned long prot,
-	       unsigned long flags, unsigned long fd, unsigned long pgoff)
+long sys_mmap(unsigned long addr, unsigned long len, unsigned long prot,
+	      unsigned long flags, unsigned long fd, unsigned long pgoff)
 {
 	int error = -EBADF;
 	struct file * file = NULL;
diff --git a/arch/xtensa/kernel/syscalls.h b/arch/xtensa/kernel/syscalls.h
index 0758069..216c10a 100644
--- a/arch/xtensa/kernel/syscalls.h
+++ b/arch/xtensa/kernel/syscalls.h
@@ -42,7 +42,7 @@
 SYSCALL(sys_chmod, 2)			/* 15 */
 SYSCALL(sys_lchown, 3)
 SYSCALL(sys_ni_syscall, 0)
-SYSCALL(sys_stat, 2)
+SYSCALL(sys_newstat, 2)
 SYSCALL(sys_lseek, 3)
 SYSCALL(sys_getpid, 0)			/* 20 */
 SYSCALL(sys_mount, 5)
@@ -52,7 +52,7 @@
 SYSCALL(sys_ni_syscall, 1)		/* 25 */
 SYSCALL(sys_ptrace, 4)
 SYSCALL(sys_ni_syscall, 1)
-SYSCALL(sys_fstat, 2)
+SYSCALL(sys_newfstat, 2)
 SYSCALL(sys_ni_syscall, 0)
 SYSCALL(sys_utime, 2)			/* 30 */
 SYSCALL(sys_ni_syscall, 0)
@@ -108,7 +108,7 @@
 SYSCALL(sys_setgroups, 2)
 SYSCALL(sys_ni_syscall, 0)
 SYSCALL(sys_symlink, 2)
-SYSCALL(sys_lstat, 2)
+SYSCALL(sys_newlstat, 2)
 SYSCALL(sys_readlink, 3)		/* 85 */
 SYSCALL(sys_uselib, 1)
 SYSCALL(sys_swapon, 2)
diff --git a/arch/xtensa/kernel/traps.c b/arch/xtensa/kernel/traps.c
index 804246e..225d64d 100644
--- a/arch/xtensa/kernel/traps.c
+++ b/arch/xtensa/kernel/traps.c
@@ -29,6 +29,7 @@
 #include <linux/module.h>
 #include <linux/stringify.h>
 #include <linux/kallsyms.h>
+#include <linux/delay.h>
 
 #include <asm/ptrace.h>
 #include <asm/timex.h>
@@ -488,8 +489,7 @@
 
 	if (panic_on_oops) {
 		printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n");
-		set_current_state(TASK_UNINTERRUPTIBLE);
-		schedule_timeout(5 * HZ);
+		ssleep(5);
 		panic("Fatal exception");
 	}
 	do_exit(err);
diff --git a/arch/xtensa/kernel/vmlinux.lds.S b/arch/xtensa/kernel/vmlinux.lds.S
index 476b2b5..5ed71df 100644
--- a/arch/xtensa/kernel/vmlinux.lds.S
+++ b/arch/xtensa/kernel/vmlinux.lds.S
@@ -90,10 +90,10 @@
     *(.literal .text)
     *(.srom.text)
     VMLINUX_SYMBOL(__sched_text_start) = .;
-    *(.sched.text.literal .sched.text)
+    *(.sched.literal .sched.text)
     VMLINUX_SYMBOL(__sched_text_end) = .;
     VMLINUX_SYMBOL(__lock_text_start) = .;
-    *(.spinlock.text.literal .spinlock.text)
+    *(.spinlock.literal .spinlock.text)
     VMLINUX_SYMBOL(__lock_text_end) = .;
 
   }
@@ -164,7 +164,7 @@
   __init_begin = .;
   .init.text : {
   	_sinittext = .;
-	*(.init.text.literal) *(.init.text)
+	*(.init.literal) *(.init.text)
 	_einittext = .;
   }
 
diff --git a/drivers/Kconfig b/drivers/Kconfig
index 34efb21..cecab0a 100644
--- a/drivers/Kconfig
+++ b/drivers/Kconfig
@@ -44,6 +44,8 @@
 
 source "drivers/w1/Kconfig"
 
+source "drivers/hwmon/Kconfig"
+
 source "drivers/misc/Kconfig"
 
 source "drivers/media/Kconfig"
diff --git a/drivers/Makefile b/drivers/Makefile
index 3167be5..126a851 100644
--- a/drivers/Makefile
+++ b/drivers/Makefile
@@ -52,6 +52,7 @@
 obj-$(CONFIG_I2O)		+= message/
 obj-$(CONFIG_I2C)		+= i2c/
 obj-$(CONFIG_W1)		+= w1/
+obj-$(CONFIG_HWMON)		+= hwmon/
 obj-$(CONFIG_PHONE)		+= telephony/
 obj-$(CONFIG_MD)		+= md/
 obj-$(CONFIG_BT)		+= bluetooth/
diff --git a/drivers/char/tb0219.c b/drivers/char/tb0219.c
index 5413f29..eb7058c 100644
--- a/drivers/char/tb0219.c
+++ b/drivers/char/tb0219.c
@@ -24,6 +24,8 @@
 
 #include <asm/io.h>
 #include <asm/reboot.h>
+#include <asm/vr41xx/giu.h>
+#include <asm/vr41xx/tb0219.h>
 
 MODULE_AUTHOR("Yoichi Yuasa <yuasa@hh.iij4u.or.jp>");
 MODULE_DESCRIPTION("TANBAC TB0219 base board driver");
@@ -266,6 +268,21 @@
 	tb0219_write(TB0219_RESET, 0);
 }
 
+static void tb0219_pci_irq_init(void)
+{
+	/* PCI Slot 1 */
+	vr41xx_set_irq_trigger(TB0219_PCI_SLOT1_PIN, IRQ_TRIGGER_LEVEL, IRQ_SIGNAL_THROUGH);
+	vr41xx_set_irq_level(TB0219_PCI_SLOT1_PIN, IRQ_LEVEL_LOW);
+
+	/* PCI Slot 2 */
+	vr41xx_set_irq_trigger(TB0219_PCI_SLOT2_PIN, IRQ_TRIGGER_LEVEL, IRQ_SIGNAL_THROUGH);
+	vr41xx_set_irq_level(TB0219_PCI_SLOT2_PIN, IRQ_LEVEL_LOW);
+
+	/* PCI Slot 3 */
+	vr41xx_set_irq_trigger(TB0219_PCI_SLOT3_PIN, IRQ_TRIGGER_LEVEL, IRQ_SIGNAL_THROUGH);
+	vr41xx_set_irq_level(TB0219_PCI_SLOT3_PIN, IRQ_LEVEL_LOW);
+}
+
 static int tb0219_probe(struct device *dev)
 {
 	int retval;
@@ -292,6 +309,8 @@
 	old_machine_restart = _machine_restart;
 	_machine_restart = tb0219_restart;
 
+	tb0219_pci_irq_init();
+
 	if (major == 0) {
 		major = retval;
 		printk(KERN_INFO "TB0219: major number %d\n", major);
diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
new file mode 100644
index 0000000..140d5f8
--- /dev/null
+++ b/drivers/hwmon/Kconfig
@@ -0,0 +1,420 @@
+#
+# I2C Sensor chip drivers configuration
+#
+
+menu "Hardware Monitoring support"
+
+config HWMON
+	tristate "Hardware Monitoring support"
+	default y
+	help
+	  Hardware monitoring devices let you monitor the hardware health
+	  of a system. Most modern motherboards include such a device. It
+	  can include temperature sensors, voltage sensors, fan speed
+	  sensors and various additional features such as the ability to
+	  control the speed of the fans.
+
+config SENSORS_ADM1021
+	tristate "Analog Devices ADM1021 and compatibles"
+	depends on HWMON && I2C
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Analog Devices ADM1021
+	  and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A,
+	  Genesys Logic GL523SM, National Semiconductor LM84, TI THMC10,
+	  and the XEON processor built-in sensor.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called adm1021.
+
+config SENSORS_ADM1025
+	tristate "Analog Devices ADM1025 and compatibles"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Analog Devices ADM1025
+	  and Philips NE1619 sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called adm1025.
+
+config SENSORS_ADM1026
+	tristate "Analog Devices ADM1026 and compatibles"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Analog Devices ADM1026
+	  sensor chip.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called adm1026.
+
+config SENSORS_ADM1031
+	tristate "Analog Devices ADM1031 and compatibles"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Analog Devices ADM1031
+	  and ADM1030 sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called adm1031.
+
+config SENSORS_ADM9240
+	tristate "Analog Devices ADM9240 and compatibles"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Analog Devices ADM9240,
+	  Dallas DS1780, National Semiconductor LM81 sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called adm9240.
+
+config SENSORS_ASB100
+	tristate "Asus ASB100 Bach"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for the ASB100 Bach sensor
+	  chip found on some Asus mainboards.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called asb100.
+
+config SENSORS_ATXP1
+	tristate "Attansic ATXP1 VID controller"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for the Attansic ATXP1 VID
+	  controller.
+
+	  If your board have such a chip, you are able to control your CPU
+	  core and other voltages.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called atxp1.
+
+config SENSORS_DS1621
+	tristate "Dallas Semiconductor DS1621 and DS1625"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Dallas Semiconductor
+	  DS1621 and DS1625 sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called ds1621.
+
+config SENSORS_FSCHER
+	tristate "FSC Hermes"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Fujitsu Siemens
+	  Computers Hermes sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called fscher.
+
+config SENSORS_FSCPOS
+	tristate "FSC Poseidon"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Fujitsu Siemens
+	  Computers Poseidon sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called fscpos.
+
+config SENSORS_GL518SM
+	tristate "Genesys Logic GL518SM"
+	depends on HWMON && I2C
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Genesys Logic GL518SM
+	  sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called gl518sm.
+
+config SENSORS_GL520SM
+	tristate "Genesys Logic GL520SM"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for Genesys Logic GL520SM
+	  sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called gl520sm.
+
+config SENSORS_IT87
+	tristate "ITE IT87xx and compatibles"
+	depends on HWMON && I2C
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for ITE IT87xx sensor chips
+	  and clones: SiS960.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called it87.
+
+config SENSORS_LM63
+	tristate "National Semiconductor LM63"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for the National Semiconductor
+	  LM63 remote diode digital temperature sensor with integrated fan
+	  control.  Such chips are found on the Tyan S4882 (Thunder K8QS Pro)
+	  motherboard, among others.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called lm63.
+
+config SENSORS_LM75
+	tristate "National Semiconductor LM75 and compatibles"
+	depends on HWMON && I2C
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for National Semiconductor LM75
+	  sensor chips and clones: Dallas Semiconductor DS75 and DS1775 (in
+	  9-bit precision mode), and TelCom (now Microchip) TCN75.
+
+	  The DS75 and DS1775 in 10- to 12-bit precision modes will require
+	  a force module parameter. The driver will not handle the extra
+	  precision anyhow.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called lm75.
+
+config SENSORS_LM77
+	tristate "National Semiconductor LM77"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for National Semiconductor LM77
+	  sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called lm77.
+
+config SENSORS_LM78
+	tristate "National Semiconductor LM78 and compatibles"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for National Semiconductor LM78,
+	  LM78-J and LM79.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called lm78.
+
+config SENSORS_LM80
+	tristate "National Semiconductor LM80"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for National Semiconductor
+	  LM80 sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called lm80.
+
+config SENSORS_LM83
+	tristate "National Semiconductor LM83"
+	depends on HWMON && I2C
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for National Semiconductor
+	  LM83 sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called lm83.
+
+config SENSORS_LM85
+	tristate "National Semiconductor LM85 and compatibles"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for National Semiconductor LM85
+	  sensor chips and clones: ADT7463, EMC6D100, EMC6D102 and ADM1027.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called lm85.
+
+config SENSORS_LM87
+	tristate "National Semiconductor LM87"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for National Semiconductor LM87
+	  sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called lm87.
+
+config SENSORS_LM90
+	tristate "National Semiconductor LM90 and compatibles"
+	depends on HWMON && I2C
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for National Semiconductor LM90,
+	  LM86, LM89 and LM99, Analog Devices ADM1032 and Maxim MAX6657 and
+	  MAX6658 sensor chips.
+
+	  The Analog Devices ADT7461 sensor chip is also supported, but only
+	  if found in ADM1032 compatibility mode.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called lm90.
+
+config SENSORS_LM92
+	tristate "National Semiconductor LM92 and compatibles"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for National Semiconductor LM92
+	  and Maxim MAX6635 sensor chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called lm92.
+
+config SENSORS_MAX1619
+	tristate "Maxim MAX1619 sensor chip"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for MAX1619 sensor chip.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called max1619.
+
+config SENSORS_PC87360
+	tristate "National Semiconductor PC87360 family"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	select I2C_ISA
+	help
+	  If you say yes here you get access to the hardware monitoring
+	  functions of the National Semiconductor PC8736x Super-I/O chips.
+	  The PC87360, PC87363 and PC87364 only have fan monitoring and
+	  control.  The PC87365 and PC87366 additionally have voltage and
+	  temperature monitoring.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called pc87360.
+
+config SENSORS_SIS5595
+	tristate "Silicon Integrated Systems Corp. SiS5595"
+	depends on HWMON && I2C && PCI && EXPERIMENTAL
+	select I2C_SENSOR
+	select I2C_ISA
+	help
+	  If you say yes here you get support for the integrated sensors in
+	  SiS5595 South Bridges.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called sis5595.
+
+config SENSORS_SMSC47M1
+	tristate "SMSC LPC47M10x and compatibles"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	select I2C_ISA
+	help
+	  If you say yes here you get support for the integrated fan
+	  monitoring and control capabilities of the SMSC LPC47B27x,
+	  LPC47M10x, LPC47M13x, LPC47M14x, LPC47M15x and LPC47M192 chips.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called smsc47m1.
+
+config SENSORS_SMSC47B397
+	tristate "SMSC LPC47B397-NC"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	select I2C_ISA
+	help
+	  If you say yes here you get support for the SMSC LPC47B397-NC
+	  sensor chip.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called smsc47b397.
+
+config SENSORS_VIA686A
+	tristate "VIA686A"
+	depends on HWMON && I2C && PCI
+	select I2C_SENSOR
+	select I2C_ISA
+	help
+	  If you say yes here you get support for the integrated sensors in
+	  Via 686A/B South Bridges.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called via686a.
+
+config SENSORS_W83781D
+	tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F"
+	depends on HWMON && I2C
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for the Winbond W8378x series
+	  of sensor chips: the W83781D, W83782D, W83783S and W83627HF,
+	  and the similar Asus AS99127F.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called w83781d.
+
+config SENSORS_W83L785TS
+	tristate "Winbond W83L785TS-S"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	help
+	  If you say yes here you get support for the Winbond W83L785TS-S
+	  sensor chip, which is used on the Asus A7N8X, among other
+	  motherboards.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called w83l785ts.
+
+config SENSORS_W83627HF
+	tristate "Winbond W83627HF, W83627THF, W83637HF, W83697HF"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	select I2C_ISA
+	help
+	  If you say yes here you get support for the Winbond W836X7 series
+	  of sensor chips: the W83627HF, W83627THF, W83637HF, and the W83697HF
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called w83627hf.
+
+config SENSORS_W83627EHF
+	tristate "Winbond W83627EHF"
+	depends on HWMON && I2C && EXPERIMENTAL
+	select I2C_SENSOR
+	select I2C_ISA
+	help
+	  If you say yes here you get preliminary support for the hardware
+	  monitoring functionality of the Winbond W83627EHF Super-I/O chip.
+	  Only fan and temperature inputs are supported at the moment, while
+	  the chip does much more than that.
+
+	  This driver can also be built as a module.  If so, the module
+	  will be called w83627ehf.
+
+config HWMON_DEBUG_CHIP
+	bool "Hardware Monitoring Chip debugging messages"
+	depends on HWMON
+	default n
+	help
+	  Say Y here if you want the I2C chip drivers to produce a bunch of
+	  debug messages to the system log.  Select this if you are having
+	  a problem with I2C support and want to see more of what is going
+	  on.
+
+endmenu
diff --git a/drivers/hwmon/Makefile b/drivers/hwmon/Makefile
new file mode 100644
index 0000000..2781403
--- /dev/null
+++ b/drivers/hwmon/Makefile
@@ -0,0 +1,44 @@
+#
+# Makefile for sensor chip drivers.
+#
+
+# asb100, then w83781d go first, as they can override other drivers' addresses.
+obj-$(CONFIG_SENSORS_ASB100)	+= asb100.o
+obj-$(CONFIG_SENSORS_W83627HF)	+= w83627hf.o
+obj-$(CONFIG_SENSORS_W83781D)	+= w83781d.o
+
+obj-$(CONFIG_SENSORS_ADM1021)	+= adm1021.o
+obj-$(CONFIG_SENSORS_ADM1025)	+= adm1025.o
+obj-$(CONFIG_SENSORS_ADM1026)	+= adm1026.o
+obj-$(CONFIG_SENSORS_ADM1031)	+= adm1031.o
+obj-$(CONFIG_SENSORS_ADM9240)	+= adm9240.o
+obj-$(CONFIG_SENSORS_ATXP1)	+= atxp1.o
+obj-$(CONFIG_SENSORS_DS1621)	+= ds1621.o
+obj-$(CONFIG_SENSORS_FSCHER)	+= fscher.o
+obj-$(CONFIG_SENSORS_FSCPOS)	+= fscpos.o
+obj-$(CONFIG_SENSORS_GL518SM)	+= gl518sm.o
+obj-$(CONFIG_SENSORS_GL520SM)	+= gl520sm.o
+obj-$(CONFIG_SENSORS_IT87)	+= it87.o
+obj-$(CONFIG_SENSORS_LM63)	+= lm63.o
+obj-$(CONFIG_SENSORS_LM75)	+= lm75.o
+obj-$(CONFIG_SENSORS_LM77)	+= lm77.o
+obj-$(CONFIG_SENSORS_LM78)	+= lm78.o
+obj-$(CONFIG_SENSORS_LM80)	+= lm80.o
+obj-$(CONFIG_SENSORS_LM83)	+= lm83.o
+obj-$(CONFIG_SENSORS_LM85)	+= lm85.o
+obj-$(CONFIG_SENSORS_LM87)	+= lm87.o
+obj-$(CONFIG_SENSORS_LM90)	+= lm90.o
+obj-$(CONFIG_SENSORS_LM92)	+= lm92.o
+obj-$(CONFIG_SENSORS_MAX1619)	+= max1619.o
+obj-$(CONFIG_SENSORS_PC87360)	+= pc87360.o
+obj-$(CONFIG_SENSORS_SIS5595)	+= sis5595.o
+obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
+obj-$(CONFIG_SENSORS_SMSC47M1)	+= smsc47m1.o
+obj-$(CONFIG_SENSORS_VIA686A)	+= via686a.o
+obj-$(CONFIG_SENSORS_W83627EHF)	+= w83627ehf.o
+obj-$(CONFIG_SENSORS_W83L785TS)	+= w83l785ts.o
+
+ifeq ($(CONFIG_HWMON_DEBUG_CHIP),y)
+EXTRA_CFLAGS += -DDEBUG
+endif
+
diff --git a/drivers/i2c/chips/adm1021.c b/drivers/hwmon/adm1021.c
similarity index 100%
rename from drivers/i2c/chips/adm1021.c
rename to drivers/hwmon/adm1021.c
diff --git a/drivers/i2c/chips/adm1025.c b/drivers/hwmon/adm1025.c
similarity index 100%
rename from drivers/i2c/chips/adm1025.c
rename to drivers/hwmon/adm1025.c
diff --git a/drivers/i2c/chips/adm1026.c b/drivers/hwmon/adm1026.c
similarity index 100%
rename from drivers/i2c/chips/adm1026.c
rename to drivers/hwmon/adm1026.c
diff --git a/drivers/i2c/chips/adm1031.c b/drivers/hwmon/adm1031.c
similarity index 100%
rename from drivers/i2c/chips/adm1031.c
rename to drivers/hwmon/adm1031.c
diff --git a/drivers/i2c/chips/adm9240.c b/drivers/hwmon/adm9240.c
similarity index 100%
rename from drivers/i2c/chips/adm9240.c
rename to drivers/hwmon/adm9240.c
diff --git a/drivers/i2c/chips/asb100.c b/drivers/hwmon/asb100.c
similarity index 100%
rename from drivers/i2c/chips/asb100.c
rename to drivers/hwmon/asb100.c
diff --git a/drivers/i2c/chips/atxp1.c b/drivers/hwmon/atxp1.c
similarity index 100%
rename from drivers/i2c/chips/atxp1.c
rename to drivers/hwmon/atxp1.c
diff --git a/drivers/i2c/chips/ds1621.c b/drivers/hwmon/ds1621.c
similarity index 100%
rename from drivers/i2c/chips/ds1621.c
rename to drivers/hwmon/ds1621.c
diff --git a/drivers/i2c/chips/fscher.c b/drivers/hwmon/fscher.c
similarity index 100%
rename from drivers/i2c/chips/fscher.c
rename to drivers/hwmon/fscher.c
diff --git a/drivers/i2c/chips/fscpos.c b/drivers/hwmon/fscpos.c
similarity index 100%
rename from drivers/i2c/chips/fscpos.c
rename to drivers/hwmon/fscpos.c
diff --git a/drivers/i2c/chips/gl518sm.c b/drivers/hwmon/gl518sm.c
similarity index 100%
rename from drivers/i2c/chips/gl518sm.c
rename to drivers/hwmon/gl518sm.c
diff --git a/drivers/i2c/chips/gl520sm.c b/drivers/hwmon/gl520sm.c
similarity index 100%
rename from drivers/i2c/chips/gl520sm.c
rename to drivers/hwmon/gl520sm.c
diff --git a/drivers/i2c/chips/it87.c b/drivers/hwmon/it87.c
similarity index 100%
rename from drivers/i2c/chips/it87.c
rename to drivers/hwmon/it87.c
diff --git a/drivers/i2c/chips/lm63.c b/drivers/hwmon/lm63.c
similarity index 100%
rename from drivers/i2c/chips/lm63.c
rename to drivers/hwmon/lm63.c
diff --git a/drivers/i2c/chips/lm75.c b/drivers/hwmon/lm75.c
similarity index 100%
rename from drivers/i2c/chips/lm75.c
rename to drivers/hwmon/lm75.c
diff --git a/drivers/i2c/chips/lm75.h b/drivers/hwmon/lm75.h
similarity index 100%
rename from drivers/i2c/chips/lm75.h
rename to drivers/hwmon/lm75.h
diff --git a/drivers/i2c/chips/lm77.c b/drivers/hwmon/lm77.c
similarity index 100%
rename from drivers/i2c/chips/lm77.c
rename to drivers/hwmon/lm77.c
diff --git a/drivers/i2c/chips/lm78.c b/drivers/hwmon/lm78.c
similarity index 100%
rename from drivers/i2c/chips/lm78.c
rename to drivers/hwmon/lm78.c
diff --git a/drivers/i2c/chips/lm80.c b/drivers/hwmon/lm80.c
similarity index 100%
rename from drivers/i2c/chips/lm80.c
rename to drivers/hwmon/lm80.c
diff --git a/drivers/i2c/chips/lm83.c b/drivers/hwmon/lm83.c
similarity index 100%
rename from drivers/i2c/chips/lm83.c
rename to drivers/hwmon/lm83.c
diff --git a/drivers/i2c/chips/lm85.c b/drivers/hwmon/lm85.c
similarity index 100%
rename from drivers/i2c/chips/lm85.c
rename to drivers/hwmon/lm85.c
diff --git a/drivers/i2c/chips/lm87.c b/drivers/hwmon/lm87.c
similarity index 100%
rename from drivers/i2c/chips/lm87.c
rename to drivers/hwmon/lm87.c
diff --git a/drivers/i2c/chips/lm90.c b/drivers/hwmon/lm90.c
similarity index 100%
rename from drivers/i2c/chips/lm90.c
rename to drivers/hwmon/lm90.c
diff --git a/drivers/i2c/chips/lm92.c b/drivers/hwmon/lm92.c
similarity index 100%
rename from drivers/i2c/chips/lm92.c
rename to drivers/hwmon/lm92.c
diff --git a/drivers/i2c/chips/max1619.c b/drivers/hwmon/max1619.c
similarity index 100%
rename from drivers/i2c/chips/max1619.c
rename to drivers/hwmon/max1619.c
diff --git a/drivers/i2c/chips/pc87360.c b/drivers/hwmon/pc87360.c
similarity index 100%
rename from drivers/i2c/chips/pc87360.c
rename to drivers/hwmon/pc87360.c
diff --git a/drivers/i2c/chips/sis5595.c b/drivers/hwmon/sis5595.c
similarity index 100%
rename from drivers/i2c/chips/sis5595.c
rename to drivers/hwmon/sis5595.c
diff --git a/drivers/i2c/chips/smsc47b397.c b/drivers/hwmon/smsc47b397.c
similarity index 100%
rename from drivers/i2c/chips/smsc47b397.c
rename to drivers/hwmon/smsc47b397.c
diff --git a/drivers/i2c/chips/smsc47m1.c b/drivers/hwmon/smsc47m1.c
similarity index 100%
rename from drivers/i2c/chips/smsc47m1.c
rename to drivers/hwmon/smsc47m1.c
diff --git a/drivers/i2c/chips/via686a.c b/drivers/hwmon/via686a.c
similarity index 98%
rename from drivers/i2c/chips/via686a.c
rename to drivers/hwmon/via686a.c
index 137d9b7..164d479 100644
--- a/drivers/i2c/chips/via686a.c
+++ b/drivers/hwmon/via686a.c
@@ -1,9 +1,9 @@
 /*
     via686a.c - Part of lm_sensors, Linux kernel modules
-                for hardware monitoring
+		for hardware monitoring
 
     Copyright (c) 1998 - 2002  Frodo Looijaard <frodol@dds.nl>,
-                        Kyösti Mälkki <kmalkki@cc.hut.fi>,
+			Kyösti Mälkki <kmalkki@cc.hut.fi>,
 			Mark Studebaker <mdsxyz123@yahoo.com>,
 			and Bob Dougherty <bobd@stanford.edu>
     (Some conversion-factor data were contributed by Jonathan Teh Soon Yew
@@ -171,18 +171,18 @@
 /******** TEMP CONVERSIONS (Bob Dougherty) *********/
 /* linear fits from HWMon.cpp (Copyright 1998-2000 Jonathan Teh Soon Yew)
       if(temp<169)
-              return double(temp)*0.427-32.08;
+	      return double(temp)*0.427-32.08;
       else if(temp>=169 && temp<=202)
-              return double(temp)*0.582-58.16;
+	      return double(temp)*0.582-58.16;
       else
-              return double(temp)*0.924-127.33;
+	      return double(temp)*0.924-127.33;
 
  A fifth-order polynomial fits the unofficial data (provided by Alex van
  Kaam <darkside@chello.nl>) a bit better.  It also give more reasonable
  numbers on my machine (ie. they agree with what my BIOS tells me).
  Here's the fifth-order fit to the 8-bit data:
  temp = 1.625093e-10*val^5 - 1.001632e-07*val^4 + 2.457653e-05*val^3 -
-        2.967619e-03*val^2 + 2.175144e-01*val - 7.090067e+0.
+	2.967619e-03*val^2 + 2.175144e-01*val - 7.090067e+0.
 
  (2000-10-25- RFD: thanks to Uwe Andersen <uandersen@mayah.com> for
  finding my typos in this formula!)
diff --git a/drivers/i2c/chips/w83627ehf.c b/drivers/hwmon/w83627ehf.c
similarity index 100%
rename from drivers/i2c/chips/w83627ehf.c
rename to drivers/hwmon/w83627ehf.c
diff --git a/drivers/i2c/chips/w83627hf.c b/drivers/hwmon/w83627hf.c
similarity index 100%
rename from drivers/i2c/chips/w83627hf.c
rename to drivers/hwmon/w83627hf.c
diff --git a/drivers/i2c/chips/w83781d.c b/drivers/hwmon/w83781d.c
similarity index 100%
rename from drivers/i2c/chips/w83781d.c
rename to drivers/hwmon/w83781d.c
diff --git a/drivers/i2c/chips/w83l785ts.c b/drivers/hwmon/w83l785ts.c
similarity index 100%
rename from drivers/i2c/chips/w83l785ts.c
rename to drivers/hwmon/w83l785ts.c
diff --git a/drivers/i2c/algos/i2c-algo-ite.c b/drivers/i2c/algos/i2c-algo-ite.c
index 68e9e68..e6cae39 100644
--- a/drivers/i2c/algos/i2c-algo-ite.c
+++ b/drivers/i2c/algos/i2c-algo-ite.c
@@ -208,7 +208,7 @@
 		goto bailout;
 	}
 	sdalo(adap);
-	printk("test_bus:1 scl: %d  sda: %d \n",getscl(adap),
+	printk("test_bus:1 scl: %d  sda: %d\n", getscl(adap),
 	       getsda(adap));
 	if ( 0 != getsda(adap) ) {
 		printk("test_bus: %s SDA stuck high!\n",name);
@@ -221,7 +221,7 @@
 		goto bailout;
 	}		
 	sdahi(adap);
-	printk("test_bus:2 scl: %d  sda: %d \n",getscl(adap),
+	printk("test_bus:2 scl: %d  sda: %d\n", getscl(adap),
 	       getsda(adap));
 	if ( 0 == getsda(adap) ) {
 		printk("test_bus: %s SDA stuck low!\n",name);
@@ -234,7 +234,7 @@
 	goto bailout;
 	}
 	scllo(adap);
-	printk("test_bus:3 scl: %d  sda: %d \n",getscl(adap),
+	printk("test_bus:3 scl: %d  sda: %d\n", getscl(adap),
 	       getsda(adap));
 	if ( 0 != getscl(adap) ) {
 
@@ -247,7 +247,7 @@
 		goto bailout;
 	}
 	sclhi(adap);
-	printk("test_bus:4 scl: %d  sda: %d \n",getscl(adap),
+	printk("test_bus:4 scl: %d  sda: %d\n", getscl(adap),
 	       getsda(adap));
 	if ( 0 == getscl(adap) ) {
 		printk("test_bus: %s SCL stuck low!\n",name);
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 45e6efb1..0ab7e37 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -194,7 +194,7 @@
 	/* Make sure the SMBus host is ready to start transmitting */
 	/* 0x1f = Failed, Bus_Err, Dev_Err, Intr, Host_Busy */
 	if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) {
-		dev_dbg(&I801_dev->dev, "SMBus busy (%02x). Resetting... \n",
+		dev_dbg(&I801_dev->dev, "SMBus busy (%02x). Resetting...\n",
 			temp);
 		outb_p(temp, SMBHSTSTS);
 		if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) {
@@ -315,7 +315,7 @@
 		}
 		if (temp & errmask) {
 			dev_dbg(&I801_dev->dev, "SMBus busy (%02x). "
-				"Resetting... \n", temp);
+				"Resetting...\n", temp);
 			outb_p(temp, SMBHSTSTS);
 			if (((temp = inb_p(SMBHSTSTS)) & errmask) != 0x00) {
 				dev_err(&I801_dev->dev,
diff --git a/drivers/i2c/busses/i2c-piix4.c b/drivers/i2c/busses/i2c-piix4.c
index 1f80ba9..6d34ee3 100644
--- a/drivers/i2c/busses/i2c-piix4.c
+++ b/drivers/i2c/busses/i2c-piix4.c
@@ -243,7 +243,7 @@
 	/* Make sure the SMBus host is ready to start transmitting */
 	if ((temp = inb_p(SMBHSTSTS)) != 0x00) {
 		dev_dbg(&piix4_adapter.dev, "SMBus busy (%02x). "
-			"Resetting... \n", temp);
+			"Resetting...\n", temp);
 		outb_p(temp, SMBHSTSTS);
 		if ((temp = inb_p(SMBHSTSTS)) != 0x00) {
 			dev_err(&piix4_adapter.dev, "Failed! (%02x)\n", temp);
diff --git a/drivers/i2c/busses/i2c-sis5595.c b/drivers/i2c/busses/i2c-sis5595.c
index 2b5911c..bbd5e4e 100644
--- a/drivers/i2c/busses/i2c-sis5595.c
+++ b/drivers/i2c/busses/i2c-sis5595.c
@@ -228,7 +228,7 @@
 	/* Make sure the SMBus host is ready to start transmitting */
 	temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8);
 	if (temp != 0x00) {
-		dev_dbg(&adap->dev, "SMBus busy (%04x). Resetting... \n", temp);
+		dev_dbg(&adap->dev, "SMBus busy (%04x). Resetting...\n", temp);
 		sis5595_write(SMB_STS_LO, temp & 0xff);
 		sis5595_write(SMB_STS_HI, temp >> 8);
 		if ((temp = sis5595_read(SMB_STS_LO) + (sis5595_read(SMB_STS_HI) << 8)) != 0x00) {
diff --git a/drivers/i2c/chips/Kconfig b/drivers/i2c/chips/Kconfig
index a0982da..43f70db 100644
--- a/drivers/i2c/chips/Kconfig
+++ b/drivers/i2c/chips/Kconfig
@@ -1,409 +1,12 @@
 #
-# I2C Sensor and "other" chip configuration
+# Miscellaneous I2C chip drivers configuration
 #
 
-menu "Hardware Sensors Chip support"
-	depends on I2C
-
 config I2C_SENSOR
 	tristate
 	default n
 
-config SENSORS_ADM1021
-	tristate "Analog Devices ADM1021 and compatibles"
-	depends on I2C
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for Analog Devices ADM1021 
-	  and ADM1023 sensor chips and clones: Maxim MAX1617 and MAX1617A,
-	  Genesys Logic GL523SM, National Semiconductor LM84, TI THMC10,
-	  and the XEON processor built-in sensor.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called adm1021.
-
-config SENSORS_ADM1025
-	tristate "Analog Devices ADM1025 and compatibles"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for Analog Devices ADM1025
-	  and Philips NE1619 sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called adm1025.
-
-config SENSORS_ADM1026
-	tristate "Analog Devices ADM1026 and compatibles"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for Analog Devices ADM1026
-	  sensor chip.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called adm1026.
-
-config SENSORS_ADM1031
-	tristate "Analog Devices ADM1031 and compatibles"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for Analog Devices ADM1031 
-	  and ADM1030 sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called adm1031.
-
-config SENSORS_ADM9240
-	tristate "Analog Devices ADM9240 and compatibles"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for Analog Devices ADM9240,
-	  Dallas DS1780, National Semiconductor LM81 sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called adm9240.
-
-config SENSORS_ASB100
-	tristate "Asus ASB100 Bach"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for the ASB100 Bach sensor
-	  chip found on some Asus mainboards.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called asb100.
-
-config SENSORS_ATXP1
-	tristate "Attansic ATXP1 VID controller"
-	depends on I2C && EXPERIMENTAL
-	help
-	  If you say yes here you get support for the Attansic ATXP1 VID
-	  controller.
-
-	  If your board have such a chip, you are able to control your CPU
-	  core and other voltages.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called atxp1.
-
-config SENSORS_DS1621
-	tristate "Dallas Semiconductor DS1621 and DS1625"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for Dallas Semiconductor
-	  DS1621 and DS1625 sensor chips. 
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called ds1621.
-
-config SENSORS_FSCHER
-	tristate "FSC Hermes"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for Fujitsu Siemens
-	  Computers Hermes sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called fscher.
-
-config SENSORS_FSCPOS
-	tristate "FSC Poseidon"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for Fujitsu Siemens
-	  Computers Poseidon sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called fscpos.
-
-config SENSORS_GL518SM
-	tristate "Genesys Logic GL518SM"
-	depends on I2C
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for Genesys Logic GL518SM
-	  sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called gl518sm.
-
-config SENSORS_GL520SM
-	tristate "Genesys Logic GL520SM"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for Genesys Logic GL520SM
-	  sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called gl520sm.
-
-config SENSORS_IT87
-	tristate "ITE IT87xx and compatibles"
-	depends on I2C
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for ITE IT87xx sensor chips
-	  and clones: SiS960.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called it87.
-
-config SENSORS_LM63
-	tristate "National Semiconductor LM63"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for the National Semiconductor
-	  LM63 remote diode digital temperature sensor with integrated fan
-	  control.  Such chips are found on the Tyan S4882 (Thunder K8QS Pro)
-	  motherboard, among others.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called lm63.
-
-config SENSORS_LM75
-	tristate "National Semiconductor LM75 and compatibles"
-	depends on I2C
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for National Semiconductor LM75
-	  sensor chips and clones: Dallas Semiconductor DS75 and DS1775 (in
-	  9-bit precision mode), and TelCom (now Microchip) TCN75.
-
-	  The DS75 and DS1775 in 10- to 12-bit precision modes will require
-	  a force module parameter. The driver will not handle the extra
-	  precision anyhow.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called lm75.
-
-config SENSORS_LM77
-	tristate "National Semiconductor LM77"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for National Semiconductor LM77
-	  sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called lm77.
-
-config SENSORS_LM78
-	tristate "National Semiconductor LM78 and compatibles"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for National Semiconductor LM78,
-	  LM78-J and LM79.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called lm78.
-
-config SENSORS_LM80
-	tristate "National Semiconductor LM80"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for National Semiconductor
-	  LM80 sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called lm80.
-
-config SENSORS_LM83
-	tristate "National Semiconductor LM83"
-	depends on I2C
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for National Semiconductor
-	  LM83 sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called lm83.
-
-config SENSORS_LM85
-	tristate "National Semiconductor LM85 and compatibles"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for National Semiconductor LM85
-	  sensor chips and clones: ADT7463, EMC6D100, EMC6D102 and ADM1027.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called lm85.
-
-config SENSORS_LM87
-	tristate "National Semiconductor LM87"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for National Semiconductor LM87
-	  sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called lm87.
-
-config SENSORS_LM90
-	tristate "National Semiconductor LM90 and compatibles"
-	depends on I2C
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for National Semiconductor LM90,
-	  LM86, LM89 and LM99, Analog Devices ADM1032 and Maxim MAX6657 and
-	  MAX6658 sensor chips.
-
-	  The Analog Devices ADT7461 sensor chip is also supported, but only
-	  if found in ADM1032 compatibility mode.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called lm90.
-
-config SENSORS_LM92
-	tristate "National Semiconductor LM92 and compatibles"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for National Semiconductor LM92
-	  and Maxim MAX6635 sensor chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called lm92.
-
-config SENSORS_MAX1619
-	tristate "Maxim MAX1619 sensor chip"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for MAX1619 sensor chip.
-	  
-	  This driver can also be built as a module.  If so, the module
-	  will be called max1619.
-
-config SENSORS_PC87360
-	tristate "National Semiconductor PC87360 family"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	select I2C_ISA
-	help
-	  If you say yes here you get access to the hardware monitoring
-	  functions of the National Semiconductor PC8736x Super-I/O chips.
-	  The PC87360, PC87363 and PC87364 only have fan monitoring and
-	  control.  The PC87365 and PC87366 additionally have voltage and
-	  temperature monitoring.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called pc87360.
-
-config SENSORS_SMSC47B397
-	tristate "SMSC LPC47B397-NC"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	select I2C_ISA
-	help
-	  If you say yes here you get support for the SMSC LPC47B397-NC
-	  sensor chip.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called smsc47b397.
-
-config SENSORS_SIS5595
-	tristate "Silicon Integrated Systems Corp. SiS5595"
-	depends on I2C && PCI && EXPERIMENTAL
-	select I2C_SENSOR
-	select I2C_ISA
-	help
-	  If you say yes here you get support for the integrated sensors in
-	  SiS5595 South Bridges.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called sis5595.
-
-config SENSORS_SMSC47M1
-	tristate "SMSC LPC47M10x and compatibles"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	select I2C_ISA
-	help
-	  If you say yes here you get support for the integrated fan
-	  monitoring and control capabilities of the SMSC LPC47B27x,
-	  LPC47M10x, LPC47M13x, LPC47M14x, LPC47M15x and LPC47M192 chips.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called smsc47m1.
-
-config SENSORS_VIA686A
-	tristate "VIA686A"
-	depends on I2C && PCI
-	select I2C_SENSOR
-	select I2C_ISA
-	help
-	  If you say yes here you get support for the integrated sensors in
-	  Via 686A/B South Bridges.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called via686a.
-
-config SENSORS_W83781D
-	tristate "Winbond W83781D, W83782D, W83783S, W83627HF, Asus AS99127F"
-	depends on I2C
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for the Winbond W8378x series
-	  of sensor chips: the W83781D, W83782D, W83783S and W83627HF,
-	  and the similar Asus AS99127F.
-	  
-	  This driver can also be built as a module.  If so, the module
-	  will be called w83781d.
-
-config SENSORS_W83L785TS
-	tristate "Winbond W83L785TS-S"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	help
-	  If you say yes here you get support for the Winbond W83L785TS-S
-	  sensor chip, which is used on the Asus A7N8X, among other
-	  motherboards.
-	  
-	  This driver can also be built as a module.  If so, the module
-	  will be called w83l785ts.
-
-config SENSORS_W83627HF
-	tristate "Winbond W83627HF, W83627THF, W83637HF, W83697HF"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	select I2C_ISA
-	help
-	  If you say yes here you get support for the Winbond W836X7 series
-	  of sensor chips: the W83627HF, W83627THF, W83637HF, and the W83697HF
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called w83627hf.
-
-config SENSORS_W83627EHF
-	tristate "Winbond W83627EHF"
-	depends on I2C && EXPERIMENTAL
-	select I2C_SENSOR
-	select I2C_ISA
-	help
-	  If you say yes here you get preliminary support for the hardware
-	  monitoring functionality of the Winbond W83627EHF Super-I/O chip.
-	  Only fan and temperature inputs are supported at the moment, while
-	  the chip does much more than that.
-
-	  This driver can also be built as a module.  If so, the module
-	  will be called w83627ehf.
-
-endmenu
-
-menu "Other I2C Chip support"
+menu "Miscellaneous I2C Chip support"
 	depends on I2C
 
 config SENSORS_DS1337
@@ -509,7 +112,6 @@
 	  This driver can also be built as a module.  If so, the module
 	  will be called tps65010.
 
-
 config SENSORS_M41T00
 	tristate "ST M41T00 RTC chip"
 	depends on I2C && PPC32
@@ -520,13 +122,16 @@
 	  will be called m41t00.
 
 config SENSORS_MAX6875
-	tristate "MAXIM MAX6875 Power supply supervisor"
+	tristate "Maxim MAX6875 Power supply supervisor"
 	depends on I2C && EXPERIMENTAL
 	help
-	  If you say yes here you get support for the MAX6875
-	  EEPROM-Programmable, Hex/Quad, Power-Suppy Sequencers/Supervisors.
+	  If you say yes here you get support for the Maxim MAX6875
+	  EEPROM-programmable, quad power-supply sequencer/supervisor.
 
-          This provides a interface to program the EEPROM and reset the chip.
+	  This provides an interface to program the EEPROM and reset the chip.
+
+	  This driver also supports the Maxim MAX6874 hex power-supply
+	  sequencer/supervisor if found at a compatible address.
 
 	  This driver can also be built as a module.  If so, the module
 	  will be called max6875.
diff --git a/drivers/i2c/chips/Makefile b/drivers/i2c/chips/Makefile
index b5e6d2f..a876dd4 100644
--- a/drivers/i2c/chips/Makefile
+++ b/drivers/i2c/chips/Makefile
@@ -1,52 +1,16 @@
 #
-# Makefile for sensor and "other" I2C chip drivers.
+# Makefile for miscellaneous I2C chip drivers.
 #
 
-# asb100, then w83781d go first, as they can override other drivers' addresses.
-obj-$(CONFIG_SENSORS_ASB100)	+= asb100.o
-obj-$(CONFIG_SENSORS_W83627HF)	+= w83627hf.o
-obj-$(CONFIG_SENSORS_W83781D)	+= w83781d.o
-
-obj-$(CONFIG_SENSORS_ADM1021)	+= adm1021.o
-obj-$(CONFIG_SENSORS_ADM1025)	+= adm1025.o
-obj-$(CONFIG_SENSORS_ADM1026)	+= adm1026.o
-obj-$(CONFIG_SENSORS_ADM1031)	+= adm1031.o
-obj-$(CONFIG_SENSORS_ADM9240)	+= adm9240.o
-obj-$(CONFIG_SENSORS_ATXP1)	+= atxp1.o
 obj-$(CONFIG_SENSORS_DS1337)	+= ds1337.o
 obj-$(CONFIG_SENSORS_DS1374)	+= ds1374.o
-obj-$(CONFIG_SENSORS_DS1621)	+= ds1621.o
 obj-$(CONFIG_SENSORS_EEPROM)	+= eeprom.o
-obj-$(CONFIG_SENSORS_FSCHER)	+= fscher.o
-obj-$(CONFIG_SENSORS_FSCPOS)	+= fscpos.o
-obj-$(CONFIG_SENSORS_GL518SM)	+= gl518sm.o
-obj-$(CONFIG_SENSORS_GL520SM)	+= gl520sm.o
-obj-$(CONFIG_SENSORS_IT87)	+= it87.o
-obj-$(CONFIG_SENSORS_LM63)	+= lm63.o
-obj-$(CONFIG_SENSORS_LM75)	+= lm75.o
-obj-$(CONFIG_SENSORS_LM77)	+= lm77.o
-obj-$(CONFIG_SENSORS_LM78)	+= lm78.o
-obj-$(CONFIG_SENSORS_LM80)	+= lm80.o
-obj-$(CONFIG_SENSORS_LM83)	+= lm83.o
-obj-$(CONFIG_SENSORS_LM85)	+= lm85.o
-obj-$(CONFIG_SENSORS_LM87)	+= lm87.o
-obj-$(CONFIG_SENSORS_LM90)	+= lm90.o
-obj-$(CONFIG_SENSORS_LM92)	+= lm92.o
-obj-$(CONFIG_SENSORS_MAX1619)	+= max1619.o
 obj-$(CONFIG_SENSORS_MAX6875)	+= max6875.o
 obj-$(CONFIG_SENSORS_M41T00)	+= m41t00.o
-obj-$(CONFIG_SENSORS_PC87360)	+= pc87360.o
 obj-$(CONFIG_SENSORS_PCA9539)	+= pca9539.o
 obj-$(CONFIG_SENSORS_PCF8574)	+= pcf8574.o
 obj-$(CONFIG_SENSORS_PCF8591)	+= pcf8591.o
 obj-$(CONFIG_SENSORS_RTC8564)	+= rtc8564.o
-obj-$(CONFIG_SENSORS_SIS5595)	+= sis5595.o
-obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
-obj-$(CONFIG_SENSORS_SMSC47M1)	+= smsc47m1.o
-obj-$(CONFIG_SENSORS_VIA686A)	+= via686a.o
-obj-$(CONFIG_SENSORS_W83627EHF)	+= w83627ehf.o
-obj-$(CONFIG_SENSORS_W83L785TS)	+= w83l785ts.o
-
 obj-$(CONFIG_ISP1301_OMAP)	+= isp1301_omap.o
 obj-$(CONFIG_TPS65010)		+= tps65010.o
 
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c
index addf0ad..6ea413f 100644
--- a/drivers/i2c/chips/eeprom.c
+++ b/drivers/i2c/chips/eeprom.c
@@ -173,9 +173,6 @@
 					    | I2C_FUNC_SMBUS_BYTE))
 		goto exit;
 
-	/* OK. For now, we presume we have a valid client. We now create the
-	   client structure, even though we cannot fill it completely yet.
-	   But it allows us to access eeprom_{read,write}_value. */
 	if (!(data = kmalloc(sizeof(struct eeprom_data), GFP_KERNEL))) {
 		err = -ENOMEM;
 		goto exit;
diff --git a/drivers/i2c/chips/m41t00.c b/drivers/i2c/chips/m41t00.c
index 5e463c47..778d7e1 100644
--- a/drivers/i2c/chips/m41t00.c
+++ b/drivers/i2c/chips/m41t00.c
@@ -207,7 +207,7 @@
 	int	rc;
 
 	if ((rc = i2c_detach_client(client)) == 0) {
-		kfree(i2c_get_clientdata(client));
+		kfree(client);
 		tasklet_kill(&m41t00_tasklet);
 	}
 	return rc;
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c
index fe6b150..c4f14d9 100644
--- a/drivers/i2c/chips/max6875.c
+++ b/drivers/i2c/chips/max6875.c
@@ -37,7 +37,8 @@
 #include <linux/i2c-sensor.h>
 
 /* Addresses to scan */
-static unsigned short normal_i2c[] = {0x50, 0x52, I2C_CLIENT_END};
+/* No address scanned by default, as this could corrupt standard EEPROMS. */
+static unsigned short normal_i2c[] = {I2C_CLIENT_END};
 static unsigned int normal_isa[] = {I2C_CLIENT_ISA_END};
 
 /* Insmod parameters */
@@ -369,6 +370,9 @@
 	new_client->driver = &max6875_driver;
 	new_client->flags = 0;
 
+	/* Prevent 24RF08 corruption */
+	i2c_smbus_write_quick(new_client, 0);
+
 	/* Setup the user section */
 	data->blocks[max6875_eeprom_user].type    = max6875_eeprom_user;
 	data->blocks[max6875_eeprom_user].slices  = USER_EEPROM_SLICES;
diff --git a/drivers/i2c/chips/tps65010.c b/drivers/i2c/chips/tps65010.c
index c0ac01b..280e963 100644
--- a/drivers/i2c/chips/tps65010.c
+++ b/drivers/i2c/chips/tps65010.c
@@ -18,7 +18,6 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-#undef	DEBUG
 
 #include <linux/config.h>
 #include <linux/kernel.h>
@@ -49,11 +48,7 @@
 MODULE_DESCRIPTION("TPS6501x Power Management Driver");
 MODULE_LICENSE("GPL");
 
-/* only two addresses possible */
-#define	TPS_BASE	0x48
-static unsigned short normal_i2c[] = {
-	TPS_BASE,
-	I2C_CLIENT_END };
+static unsigned short normal_i2c[] = { 0x48, /* 0x49, */ I2C_CLIENT_END };
 static unsigned short normal_i2c_range[] = { I2C_CLIENT_END };
 
 I2C_CLIENT_INSMOD;
@@ -102,7 +97,7 @@
 	u8			chgstatus, regstatus, chgconf;
 	u8			nmask1, nmask2;
 
-	/* plus four GPIOs, probably used to switch power */
+	/* not currently tracking GPIO state */
 };
 
 #define	POWER_POLL_DELAY	msecs_to_jiffies(800)
@@ -135,7 +130,7 @@
 		(regstatus & TPS_REG_COVER) ? " uncover" : "",
 		(regstatus & TPS_REG_UVLO) ? " UVLO" : "",
 		(regstatus & TPS_REG_NO_CHG) ? " NO_CHG" : "",
-		(regstatus & TPS_REG_PG_LD02) ? " ld01_bad" : "",
+		(regstatus & TPS_REG_PG_LD02) ? " ld02_bad" : "",
 		(regstatus & TPS_REG_PG_LD01) ? " ld01_bad" : "",
 		(regstatus & TPS_REG_PG_MAIN) ? " main_bad" : "",
 		(regstatus & TPS_REG_PG_CORE) ? " core_bad" : "");
@@ -143,7 +138,7 @@
 
 static void dbg_chgconf(int por, char *buf, size_t len, u8 chgconfig)
 {
-	char *hibit;
+	const char *hibit;
 
 	if (por)
 		hibit = (chgconfig & TPS_CHARGE_POR)
@@ -295,7 +290,7 @@
 	seq_printf(s, "defgpio %02x mask3 %02x\n", value, v2);
 
 	for (i = 0; i < 4; i++) {
-		if (value & (1 << (4 +i)))
+		if (value & (1 << (4 + i)))
 			seq_printf(s, "  gpio%d-out %s\n", i + 1,
 				(value & (1 << i)) ? "low" : "hi ");
 		else
@@ -481,7 +476,7 @@
 	debugfs_remove(tps->file);
 	if (i2c_detach_client(client) == 0)
 		kfree(tps);
-	the_tps = 0;
+	the_tps = NULL;
 	return 0;
 }
 
@@ -514,7 +509,6 @@
 	INIT_WORK(&tps->work, tps65010_work, tps);
 	tps->irq = -1;
 	tps->client.addr = address;
-	i2c_set_clientdata(&tps->client, tps);
 	tps->client.adapter = bus;
 	tps->client.driver = &tps65010_driver;
 	strlcpy(tps->client.name, DRIVER_NAME, I2C_NAME_SIZE);
@@ -523,9 +517,7 @@
 	if (status < 0) {
 		dev_dbg(&bus->dev, "can't attach %s to device %d, err %d\n",
 				DRIVER_NAME, address, status);
-fail1:
-		kfree(tps);
-		return 0;
+		goto fail1;
 	}
 
 #ifdef	CONFIG_ARM
@@ -535,7 +527,7 @@
 		tps->irq = OMAP_GPIO_IRQ(58);
 		omap_request_gpio(58);
 		omap_set_gpio_direction(58, 1);
-		omap_set_gpio_edge_ctrl(58, OMAP_GPIO_FALLING_EDGE);
+		set_irq_type(tps->irq, IRQT_FALLING);
 	}
 	if (machine_is_omap_osk()) {
 		tps->model = TPS65010;
@@ -543,7 +535,7 @@
 		tps->irq = OMAP_GPIO_IRQ(OMAP_MPUIO(1));
 		omap_request_gpio(OMAP_MPUIO(1));
 		omap_set_gpio_direction(OMAP_MPUIO(1), 1);
-		omap_set_gpio_edge_ctrl(OMAP_MPUIO(1), OMAP_GPIO_FALLING_EDGE);
+		set_irq_type(tps->irq, IRQT_FALLING);
 	}
 	if (machine_is_omap_h3()) {
 		tps->model = TPS65013;
@@ -633,6 +625,9 @@
 	tps->file = debugfs_create_file(DRIVER_NAME, S_IRUGO, NULL,
 				tps, DEBUG_FOPS);
 	return 0;
+fail1:
+	kfree(tps);
+	return 0;
 }
 
 static int __init tps65010_scan_bus(struct i2c_adapter *bus)
@@ -645,7 +640,6 @@
 static struct i2c_driver tps65010_driver = {
 	.owner		= THIS_MODULE,
 	.name		= "tps65010",
-	.id		= 888,		/* FIXME assign "official" value */
 	.flags		= I2C_DF_NOTIFY,
 	.attach_adapter	= tps65010_scan_bus,
 	.detach_client	= __exit_p(tps65010_detach_client),
@@ -744,7 +738,7 @@
 	if (!the_tps)
 		return -ENODEV;
 
-	if(led == LED1)
+	if (led == LED1)
 		offs = 0;
 	else {
 		offs = 2;
@@ -753,11 +747,13 @@
 
 	down(&the_tps->lock);
 
-	dev_dbg (&the_tps->client.dev, "led%i_on   0x%02x\n", led,
-		i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_ON + offs));
+	pr_debug("%s: led%i_on   0x%02x\n", DRIVER_NAME, led,
+		i2c_smbus_read_byte_data(&the_tps->client,
+				TPS_LED1_ON + offs));
 
-	dev_dbg (&the_tps->client.dev, "led%i_per  0x%02x\n", led,
-		i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_PER + offs));
+	pr_debug("%s: led%i_per  0x%02x\n", DRIVER_NAME, led,
+		i2c_smbus_read_byte_data(&the_tps->client,
+				TPS_LED1_PER + offs));
 
 	switch (mode) {
 	case OFF:
@@ -773,7 +769,7 @@
 		led_per = 0x08 | (1 << 7);
 		break;
 	default:
-		printk(KERN_ERR "%s: Wrong mode parameter for tps65010_set_led()\n",
+		printk(KERN_ERR "%s: Wrong mode parameter for set_led()\n",
 		       DRIVER_NAME);
 		up(&the_tps->lock);
 		return -EINVAL;
@@ -789,7 +785,7 @@
 		return status;
 	}
 
-	dev_dbg (&the_tps->client.dev, "led%i_on   0x%02x\n", led,
+	pr_debug("%s: led%i_on   0x%02x\n", DRIVER_NAME, led,
 		i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_ON + offs));
 
 	status = i2c_smbus_write_byte_data(&the_tps->client,
@@ -802,8 +798,9 @@
 		return status;
 	}
 
-	dev_dbg (&the_tps->client.dev, "led%i_per  0x%02x\n", led,
-		i2c_smbus_read_byte_data(&the_tps->client, TPS_LED1_PER + offs));
+	pr_debug("%s: led%i_per  0x%02x\n", DRIVER_NAME, led,
+		i2c_smbus_read_byte_data(&the_tps->client,
+				TPS_LED1_PER + offs));
 
 	up(&the_tps->lock);
 
@@ -874,7 +871,7 @@
 
 	if (status != 0)
 		printk(KERN_ERR "%s: Failed to write vdcdc1 register\n",
-		       DRIVER_NAME);
+			DRIVER_NAME);
 	else
 		pr_debug("%s: vdcdc1 0x%02x\n", DRIVER_NAME,
 			i2c_smbus_read_byte_data(&the_tps->client, TPS_VDCDC1));
@@ -900,14 +897,14 @@
 	down(&the_tps->lock);
 
 	pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
-		        i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
+			i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
 
 	status = i2c_smbus_write_byte_data(&the_tps->client,
 			TPS_VREGS1, value);
 
 	if (status != 0)
 		printk(KERN_ERR "%s: Failed to write vregs1 register\n",
-		        DRIVER_NAME);
+			DRIVER_NAME);
 	else
 		pr_debug("%s: vregs1 0x%02x\n", DRIVER_NAME,
 			i2c_smbus_read_byte_data(&the_tps->client, TPS_VREGS1));
@@ -1009,7 +1006,7 @@
 		msleep(10);
 	}
 
-#if defined(CONFIG_ARM)
+#ifdef	CONFIG_ARM
 	if (machine_is_omap_osk()) {
 
 		// FIXME: More should be placed in the initialization code
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 51ce268..4fd4f52 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -156,7 +156,7 @@
 		goto out_unlock;
 	}
 
-	res = idr_get_new(&i2c_adapter_idr, NULL, &id);
+	res = idr_get_new(&i2c_adapter_idr, adap, &id);
 	if (res < 0) {
 		if (res == -EAGAIN)
 			res = -ENOMEM;
@@ -765,20 +765,15 @@
 
 struct i2c_adapter* i2c_get_adapter(int id)
 {
-	struct list_head   *item;
 	struct i2c_adapter *adapter;
 	
 	down(&core_lists);
-	list_for_each(item,&adapters) {
-		adapter = list_entry(item, struct i2c_adapter, list);
-		if (id == adapter->nr &&
-		    try_module_get(adapter->owner)) {
-			up(&core_lists);
-			return adapter;
-		}
-	}
+	adapter = (struct i2c_adapter *)idr_find(&i2c_adapter_idr, id);
+	if (adapter && !try_module_get(adapter->owner))
+		adapter = NULL;
+
 	up(&core_lists);
-	return NULL;
+	return adapter;
 }
 
 void i2c_put_adapter(struct i2c_adapter *adap)
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 0a31cfd..74af7e0 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -431,7 +431,7 @@
 #if VERBOSE_IDE_CD_ERRORS
 	{
 		int i;
-		const char *s;
+		const char *s = "bad sense key!";
 		char buf[80];
 
 		printk ("ATAPI device %s:\n", drive->name);
@@ -446,8 +446,6 @@
 
 		if (sense->sense_key < ARY_LEN(sense_key_texts))
 			s = sense_key_texts[sense->sense_key];
-		else
-			s = "bad sense key!";
 
 		printk("%s -- (Sense key=0x%02x)\n", s, sense->sense_key);
 
diff --git a/drivers/media/common/ir-common.c b/drivers/media/common/ir-common.c
index 4adb284..ab7a1fb 100644
--- a/drivers/media/common/ir-common.c
+++ b/drivers/media/common/ir-common.c
@@ -1,5 +1,5 @@
 /*
- * $Id: ir-common.c,v 1.10 2005/05/22 19:23:39 nsh Exp $
+ * $Id: ir-common.c,v 1.11 2005/07/07 14:44:43 mchehab Exp $
  *
  * some common structs and functions to handle infrared remotes via
  * input layer ...
@@ -46,79 +46,49 @@
 /* see http://users.pandora.be/nenya/electronics/rc5/codes00.htm */
 /* used by old (black) Hauppauge remotes                         */
 IR_KEYTAB_TYPE ir_codes_rc5_tv[IR_KEYTAB_SIZE] = {
-	[ 0x00 ] = KEY_KP0,             // 0
-	[ 0x01 ] = KEY_KP1,             // 1
-	[ 0x02 ] = KEY_KP2,             // 2
-	[ 0x03 ] = KEY_KP3,             // 3
-	[ 0x04 ] = KEY_KP4,             // 4
-	[ 0x05 ] = KEY_KP5,             // 5
-	[ 0x06 ] = KEY_KP6,             // 6
-	[ 0x07 ] = KEY_KP7,             // 7
-	[ 0x08 ] = KEY_KP8,             // 8
-	[ 0x09 ] = KEY_KP9,             // 9
+	/* Keys 0 to 9 */
+	[ 0x00 ] = KEY_KP0,
+	[ 0x01 ] = KEY_KP1,
+	[ 0x02 ] = KEY_KP2,
+	[ 0x03 ] = KEY_KP3,
+	[ 0x04 ] = KEY_KP4,
+	[ 0x05 ] = KEY_KP5,
+	[ 0x06 ] = KEY_KP6,
+	[ 0x07 ] = KEY_KP7,
+	[ 0x08 ] = KEY_KP8,
+	[ 0x09 ] = KEY_KP9,
 
-	[ 0x0b ] = KEY_CHANNEL,         // channel / program (japan: 11)
-	[ 0x0c ] = KEY_POWER,           // standby
-	[ 0x0d ] = KEY_MUTE,            // mute / demute
-	[ 0x0f ] = KEY_TV,              // display
-	[ 0x10 ] = KEY_VOLUMEUP,        // volume +
-	[ 0x11 ] = KEY_VOLUMEDOWN,      // volume -
-	[ 0x12 ] = KEY_BRIGHTNESSUP,    // brightness +
-	[ 0x13 ] = KEY_BRIGHTNESSDOWN,  // brightness -
-	[ 0x1e ] = KEY_SEARCH,          // search +
-	[ 0x20 ] = KEY_CHANNELUP,       // channel / program +
-	[ 0x21 ] = KEY_CHANNELDOWN,     // channel / program -
-	[ 0x22 ] = KEY_CHANNEL,         // alt / channel
-	[ 0x23 ] = KEY_LANGUAGE,        // 1st / 2nd language
-	[ 0x26 ] = KEY_SLEEP,           // sleeptimer
-	[ 0x2e ] = KEY_MENU,            // 2nd controls (USA: menu)
-	[ 0x30 ] = KEY_PAUSE,           // pause
-	[ 0x32 ] = KEY_REWIND,          // rewind
-	[ 0x33 ] = KEY_GOTO,            // go to
-	[ 0x35 ] = KEY_PLAY,            // play
-	[ 0x36 ] = KEY_STOP,            // stop
-	[ 0x37 ] = KEY_RECORD,          // recording
-	[ 0x3c ] = KEY_TEXT,            // teletext submode (Japan: 12)
-	[ 0x3d ] = KEY_SUSPEND,         // system standby
+	[ 0x0b ] = KEY_CHANNEL,		/* channel / program (japan: 11) */
+	[ 0x0c ] = KEY_POWER,		/* standby */
+	[ 0x0d ] = KEY_MUTE,		/* mute / demute */
+	[ 0x0f ] = KEY_TV,		/* display */
+	[ 0x10 ] = KEY_VOLUMEUP,
+	[ 0x11 ] = KEY_VOLUMEDOWN,
+	[ 0x12 ] = KEY_BRIGHTNESSUP,
+	[ 0x13 ] = KEY_BRIGHTNESSDOWN,
+	[ 0x1e ] = KEY_SEARCH,		/* search + */
+	[ 0x20 ] = KEY_CHANNELUP,	/* channel / program + */
+	[ 0x21 ] = KEY_CHANNELDOWN,	/* channel / program - */
+	[ 0x22 ] = KEY_CHANNEL,		/* alt / channel */
+	[ 0x23 ] = KEY_LANGUAGE,	/* 1st / 2nd language */
+	[ 0x26 ] = KEY_SLEEP,		/* sleeptimer */
+	[ 0x2e ] = KEY_MENU,		/* 2nd controls (USA: menu) */
+	[ 0x30 ] = KEY_PAUSE,
+	[ 0x32 ] = KEY_REWIND,
+	[ 0x33 ] = KEY_GOTO,
+	[ 0x35 ] = KEY_PLAY,
+	[ 0x36 ] = KEY_STOP,
+	[ 0x37 ] = KEY_RECORD,		/* recording */
+	[ 0x3c ] = KEY_TEXT,    	/* teletext submode (Japan: 12) */
+	[ 0x3d ] = KEY_SUSPEND,		/* system standby */
 
-#if 0 /* FIXME */
-	[ 0x0a ] = KEY_RESERVED,        // 1/2/3 digits (japan: 10)
-	[ 0x0e ] = KEY_RESERVED,        // P.P. (personal preference)
-	[ 0x14 ] = KEY_RESERVED,        // colour saturation +
-	[ 0x15 ] = KEY_RESERVED,        // colour saturation -
-	[ 0x16 ] = KEY_RESERVED,        // bass +
-	[ 0x17 ] = KEY_RESERVED,        // bass -
-	[ 0x18 ] = KEY_RESERVED,        // treble +
-	[ 0x19 ] = KEY_RESERVED,        // treble -
-	[ 0x1a ] = KEY_RESERVED,        // balance right
-	[ 0x1b ] = KEY_RESERVED,        // balance left
-	[ 0x1c ] = KEY_RESERVED,        // contrast +
-	[ 0x1d ] = KEY_RESERVED,        // contrast -
-	[ 0x1f ] = KEY_RESERVED,        // tint/hue +
-	[ 0x24 ] = KEY_RESERVED,        // spacial stereo on/off
-	[ 0x25 ] = KEY_RESERVED,        // mono / stereo (USA)
-	[ 0x27 ] = KEY_RESERVED,        // tint / hue -
-	[ 0x28 ] = KEY_RESERVED,        // RF switch/PIP select
-	[ 0x29 ] = KEY_RESERVED,        // vote
-	[ 0x2a ] = KEY_RESERVED,        // timed page/channel clck
-	[ 0x2b ] = KEY_RESERVED,        // increment (USA)
-	[ 0x2c ] = KEY_RESERVED,        // decrement (USA)
-	[ 0x2d ] = KEY_RESERVED,        //
-	[ 0x2f ] = KEY_RESERVED,        // PIP shift
-	[ 0x31 ] = KEY_RESERVED,        // erase
-	[ 0x34 ] = KEY_RESERVED,        // wind
-	[ 0x38 ] = KEY_RESERVED,        // external 1
-	[ 0x39 ] = KEY_RESERVED,        // external 2
-	[ 0x3a ] = KEY_RESERVED,        // PIP display mode
-	[ 0x3b ] = KEY_RESERVED,        // view data mode / advance
-	[ 0x3e ] = KEY_RESERVED,        // crispener on/off
-	[ 0x3f ] = KEY_RESERVED,        // system select
-#endif
 };
 EXPORT_SYMBOL_GPL(ir_codes_rc5_tv);
 
 /* Table for Leadtek Winfast Remote Controls - used by both bttv and cx88 */
 IR_KEYTAB_TYPE ir_codes_winfast[IR_KEYTAB_SIZE] = {
+	/* Keys 0 to 9 */
+	[ 18 ] = KEY_KP0,
 	[  5 ] = KEY_KP1,
 	[  6 ] = KEY_KP2,
 	[  7 ] = KEY_KP3,
@@ -128,39 +98,31 @@
 	[ 13 ] = KEY_KP7,
 	[ 14 ] = KEY_KP8,
 	[ 15 ] = KEY_KP9,
-	[ 18 ] = KEY_KP0,
 
 	[  0 ] = KEY_POWER,
-//      [ 27 ] = MTS button
-	[  2 ] = KEY_TUNER,     // TV/FM
+	[  2 ] = KEY_TUNER,		/* TV/FM */
 	[ 30 ] = KEY_VIDEO,
-//      [ 22 ] = display button
 	[  4 ] = KEY_VOLUMEUP,
 	[  8 ] = KEY_VOLUMEDOWN,
 	[ 12 ] = KEY_CHANNELUP,
 	[ 16 ] = KEY_CHANNELDOWN,
-	[  3 ] = KEY_ZOOM,      // fullscreen
-	[ 31 ] = KEY_SUBTITLE,  // closed caption/teletext
+	[  3 ] = KEY_ZOOM,		/* fullscreen */
+	[ 31 ] = KEY_SUBTITLE,		/* closed caption/teletext */
 	[ 32 ] = KEY_SLEEP,
-//      [ 41 ] = boss key
 	[ 20 ] = KEY_MUTE,
 	[ 43 ] = KEY_RED,
 	[ 44 ] = KEY_GREEN,
 	[ 45 ] = KEY_YELLOW,
 	[ 46 ] = KEY_BLUE,
-	[ 24 ] = KEY_KPPLUS,    //fine tune +
-	[ 25 ] = KEY_KPMINUS,   //fine tune -
-//      [ 42 ] = picture in picture
+	[ 24 ] = KEY_KPPLUS,		/* fine tune + */
+	[ 25 ] = KEY_KPMINUS,		/* fine tune - */
         [ 33 ] = KEY_KPDOT,
 	[ 19 ] = KEY_KPENTER,
-//      [ 17 ] = recall
 	[ 34 ] = KEY_BACK,
 	[ 35 ] = KEY_PLAYPAUSE,
 	[ 36 ] = KEY_NEXT,
-//      [ 37 ] = time shifting
 	[ 38 ] = KEY_STOP,
 	[ 39 ] = KEY_RECORD
-//      [ 40 ] = snapshot
 };
 EXPORT_SYMBOL_GPL(ir_codes_winfast);
 
@@ -174,54 +136,61 @@
  * slightly different versions), shipped with cx88+ivtv cards.
  * almost rc5 coding, but some non-standard keys */
 IR_KEYTAB_TYPE ir_codes_hauppauge_new[IR_KEYTAB_SIZE] = {
-	[ 0x00 ] = KEY_KP0,             // 0
-	[ 0x01 ] = KEY_KP1,             // 1
-	[ 0x02 ] = KEY_KP2,             // 2
-	[ 0x03 ] = KEY_KP3,             // 3
-	[ 0x04 ] = KEY_KP4,             // 4
-	[ 0x05 ] = KEY_KP5,             // 5
-	[ 0x06 ] = KEY_KP6,             // 6
-	[ 0x07 ] = KEY_KP7,             // 7
-	[ 0x08 ] = KEY_KP8,             // 8
-	[ 0x09 ] = KEY_KP9,             // 9
-	[ 0x0a ] = KEY_TEXT,      	// keypad asterisk as well
-	[ 0x0b ] = KEY_RED,             // red button
-	[ 0x0c ] = KEY_RADIO,           // radio
-	[ 0x0d ] = KEY_MENU,            // menu
-	[ 0x0e ] = KEY_SUBTITLE,	// also the # key
-	[ 0x0f ] = KEY_MUTE,            // mute
-	[ 0x10 ] = KEY_VOLUMEUP,        // volume +
-	[ 0x11 ] = KEY_VOLUMEDOWN,      // volume -
-	[ 0x12 ] = KEY_PREVIOUS,        // previous channel
-	[ 0x14 ] = KEY_UP,              // up
-	[ 0x15 ] = KEY_DOWN,		// down
-	[ 0x16 ] = KEY_LEFT,		// left
-	[ 0x17 ] = KEY_RIGHT,		// right
-	[ 0x18 ] = KEY_VIDEO,		// Videos
-	[ 0x19 ] = KEY_AUDIO,		// Music
-	[ 0x1a ] = KEY_MHP,		// Pictures - presume this means "Multimedia Home Platform"- no "PICTURES" key in input.h
-	[ 0x1b ] = KEY_EPG,		// Guide
-	[ 0x1c ] = KEY_TV,		// TV
-	[ 0x1e ] = KEY_NEXTSONG,        // skip >|
-	[ 0x1f ] = KEY_EXIT,            // back/exit
-	[ 0x20 ] = KEY_CHANNELUP,       // channel / program +
-	[ 0x21 ] = KEY_CHANNELDOWN,     // channel / program -
-	[ 0x22 ] = KEY_CHANNEL,         // source (old black remote)
-	[ 0x24 ] = KEY_PREVIOUSSONG,    // replay |<
-	[ 0x25 ] = KEY_ENTER,           // OK
-	[ 0x26 ] = KEY_SLEEP,           // minimize (old black remote)
-	[ 0x29 ] = KEY_BLUE,            // blue key
-	[ 0x2e ] = KEY_GREEN,           // green button
-	[ 0x30 ] = KEY_PAUSE,           // pause
-	[ 0x32 ] = KEY_REWIND,          // backward <<
-	[ 0x34 ] = KEY_FASTFORWARD,     // forward >>
-	[ 0x35 ] = KEY_PLAY,            // play
-	[ 0x36 ] = KEY_STOP,            // stop
-	[ 0x37 ] = KEY_RECORD,          // recording
-	[ 0x38 ] = KEY_YELLOW,          // yellow key
-	[ 0x3b ] = KEY_SELECT,          // top right button
-	[ 0x3c ] = KEY_ZOOM,            // full
-	[ 0x3d ] = KEY_POWER,           // system power (green button)
+	/* Keys 0 to 9 */
+	[ 0x00 ] = KEY_KP0,
+	[ 0x01 ] = KEY_KP1,
+	[ 0x02 ] = KEY_KP2,
+	[ 0x03 ] = KEY_KP3,
+	[ 0x04 ] = KEY_KP4,
+	[ 0x05 ] = KEY_KP5,
+	[ 0x06 ] = KEY_KP6,
+	[ 0x07 ] = KEY_KP7,
+	[ 0x08 ] = KEY_KP8,
+	[ 0x09 ] = KEY_KP9,
+
+	[ 0x0a ] = KEY_TEXT,      	/* keypad asterisk as well */
+	[ 0x0b ] = KEY_RED,		/* red button */
+	[ 0x0c ] = KEY_RADIO,
+	[ 0x0d ] = KEY_MENU,
+	[ 0x0e ] = KEY_SUBTITLE,	/* also the # key */
+	[ 0x0f ] = KEY_MUTE,
+	[ 0x10 ] = KEY_VOLUMEUP,
+	[ 0x11 ] = KEY_VOLUMEDOWN,
+	[ 0x12 ] = KEY_PREVIOUS,	/* previous channel */
+	[ 0x14 ] = KEY_UP,
+	[ 0x15 ] = KEY_DOWN,
+	[ 0x16 ] = KEY_LEFT,
+	[ 0x17 ] = KEY_RIGHT,
+	[ 0x18 ] = KEY_VIDEO,		/* Videos */
+	[ 0x19 ] = KEY_AUDIO,		/* Music */
+	/* 0x1a: Pictures - presume this means
+	   "Multimedia Home Platform" -
+	   no "PICTURES" key in input.h
+	 */
+	[ 0x1a ] = KEY_MHP,
+
+	[ 0x1b ] = KEY_EPG,		/* Guide */
+	[ 0x1c ] = KEY_TV,
+	[ 0x1e ] = KEY_NEXTSONG,	/* skip >| */
+	[ 0x1f ] = KEY_EXIT,		/* back/exit */
+	[ 0x20 ] = KEY_CHANNELUP,	/* channel / program + */
+	[ 0x21 ] = KEY_CHANNELDOWN,	/* channel / program - */
+	[ 0x22 ] = KEY_CHANNEL,		/* source (old black remote) */
+	[ 0x24 ] = KEY_PREVIOUSSONG,	/* replay |< */
+	[ 0x25 ] = KEY_ENTER,		/* OK */
+	[ 0x26 ] = KEY_SLEEP,		/* minimize (old black remote) */
+	[ 0x29 ] = KEY_BLUE,		/* blue key */
+	[ 0x2e ] = KEY_GREEN,		/* green button */
+	[ 0x30 ] = KEY_PAUSE,		/* pause */
+	[ 0x32 ] = KEY_REWIND,		/* backward << */
+	[ 0x34 ] = KEY_FASTFORWARD,	/* forward >> */
+	[ 0x35 ] = KEY_PLAY,
+	[ 0x36 ] = KEY_STOP,
+	[ 0x37 ] = KEY_RECORD,		/* recording */
+	[ 0x38 ] = KEY_YELLOW,		/* yellow key */
+	[ 0x3b ] = KEY_SELECT,		/* top right button */
+	[ 0x3c ] = KEY_ZOOM,		/* full */
+	[ 0x3d ] = KEY_POWER,		/* system power (green button) */
 };
 EXPORT_SYMBOL(ir_codes_hauppauge_new);
 
@@ -237,9 +206,9 @@
 	[ 10 ] = KEY_KP8,
 	[ 18 ] = KEY_KP9,
 
-	[  3 ] = KEY_TUNER,       // TV/FM
-	[  7 ] = KEY_SEARCH,      // scan
-	[ 28 ] = KEY_ZOOM,        // full screen
+	[  3 ] = KEY_TUNER,		/* TV/FM */
+	[  7 ] = KEY_SEARCH,		/* scan */
+	[ 28 ] = KEY_ZOOM,		/* full screen */
 	[ 30 ] = KEY_POWER,
 	[ 23 ] = KEY_VOLUMEDOWN,
 	[ 31 ] = KEY_VOLUMEUP,
@@ -247,14 +216,14 @@
 	[ 22 ] = KEY_CHANNELUP,
 	[ 24 ] = KEY_MUTE,
 
-	[  0 ] = KEY_LIST,        // source
-	[ 19 ] = KEY_INFO,        // loop
-	[ 16 ] = KEY_LAST,        // +100
-	[ 13 ] = KEY_CLEAR,       // reset
-	[ 12 ] = BTN_RIGHT,       // fun++
-	[  4 ] = BTN_LEFT,        // fun--
-	[ 14 ] = KEY_GOTO,        // function
-	[ 15 ] = KEY_STOP,         // freeze
+	[  0 ] = KEY_LIST,		/* source */
+	[ 19 ] = KEY_INFO,		/* loop */
+	[ 16 ] = KEY_LAST,		/* +100 */
+	[ 13 ] = KEY_CLEAR,		/* reset */
+	[ 12 ] = BTN_RIGHT,		/* fun++ */
+	[  4 ] = BTN_LEFT,		/* fun-- */
+	[ 14 ] = KEY_GOTO,		/* function */
+	[ 15 ] = KEY_STOP,		/* freeze */
 };
 EXPORT_SYMBOL(ir_codes_pixelview);
 
@@ -321,10 +290,6 @@
 		ir->keypressed = 1;
 		ir_input_key_event(dev,ir);
 	}
-#if 0
-	/* maybe do something like this ??? */
-	input_event(a, EV_IR, ir->ir_type, ir->ir_raw);
-#endif
 }
 
 /* -------------------------------------------------------------------------- */
diff --git a/drivers/media/dvb/bt8xx/dst.c b/drivers/media/dvb/bt8xx/dst.c
index 9bd1283..07a0b0a 100644
--- a/drivers/media/dvb/bt8xx/dst.c
+++ b/drivers/media/dvb/bt8xx/dst.c
@@ -928,7 +928,7 @@
 {
 	int retval;
 	u8 get_signal[] = { 0x00, 0x05, 0x00, 0x00, 0x00, 0x00, 0x00, 0xfb };
-	printk("%s: Getting Signal strength and other parameters !!!!!!!!\n", __FUNCTION__);
+	dprintk("%s: Getting Signal strength and other parameters\n", __FUNCTION__);
 	if ((state->diseq_flags & ATTEMPT_TUNE) == 0) {
 		state->decode_lock = state->decode_strength = state->decode_snr = 0;
 		return 0;
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
index bdd72f7..3491ff4 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
@@ -175,7 +175,7 @@
 int dvb_usb_fe_init(struct dvb_usb_device* d)
 {
 	if (d->props.frontend_attach == NULL) {
-		err("strange '%s' don't want to attach a frontend.",d->desc->name);
+		err("strange '%s' doesn't want to attach a frontend.",d->desc->name);
 		return 0;
 	}
 
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c
index c3b3ae4..65f0c09 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c
@@ -51,17 +51,17 @@
 
 /* speed - when running at FULL speed we need a HW PID filter */
 	if (d->udev->speed == USB_SPEED_FULL && !(d->props.caps & DVB_USB_HAS_PID_FILTER)) {
-		err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a HW PID filter)");
+		err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a hardware PID filter)");
 		return -ENODEV;
 	}
 
 	if ((d->udev->speed == USB_SPEED_FULL && d->props.caps & DVB_USB_HAS_PID_FILTER) ||
 		(d->props.caps & DVB_USB_NEED_PID_FILTERING)) {
-		info("will use the device's hw PID filter.");
+		info("will use the device's hardware PID filter (table count: %d).",d->props.pid_filter_count);
 		d->pid_filtering = 1;
 		d->max_feed_count = d->props.pid_filter_count;
 	} else {
-		info("will pass the complete MPEG2 transport stream to the demuxer.");
+		info("will pass the complete MPEG2 transport stream to the software demuxer.");
 		d->pid_filtering = 0;
 		d->max_feed_count = 255;
 	}
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c
index 5adc5d6..9ac95f5 100644
--- a/drivers/media/dvb/dvb-usb/vp7045.c
+++ b/drivers/media/dvb/dvb-usb/vp7045.c
@@ -128,7 +128,7 @@
 	{ 0x00, 0x0f, KEY_TEXT } /* Teletext */
 };
 
-static int vp7045_rc_query(struct dvb_usb_device *d, u32 *key_buf, int *state)
+static int vp7045_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
 {
 	u8 key;
 	int i;
@@ -144,7 +144,7 @@
 	for (i = 0; i < sizeof(vp7045_rc_keys)/sizeof(struct dvb_usb_rc_key); i++)
 		if (vp7045_rc_keys[i].data == key) {
 			*state = REMOTE_KEY_PRESSED;
-			*key_buf = vp7045_rc_keys[i].event;
+			*event = vp7045_rc_keys[i].event;
 			break;
 		}
 	return 0;
diff --git a/drivers/media/dvb/frontends/lgdt3302.c b/drivers/media/dvb/frontends/lgdt3302.c
index 09c9142..2eea03d 100644
--- a/drivers/media/dvb/frontends/lgdt3302.c
+++ b/drivers/media/dvb/frontends/lgdt3302.c
@@ -1,6 +1,4 @@
 /*
- * $Id: lgdt3302.c,v 1.5 2005/07/07 03:47:15 mkrufky Exp $
- *
  *    Support for LGDT3302 (DViCO FustionHDTV 3 Gold) - VSB/QAM
  *
  *    Copyright (C) 2005 Wilson Michaels <wilsonmichaels@earthlink.net>
@@ -83,7 +81,10 @@
 
 		if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
 			printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err);
-			return -EREMOTEIO;
+			if (err < 0)
+				return err;
+			else
+				return -EREMOTEIO;
 		}
 	} else {
 		u8 tmp[] = { buf[0], buf[1] };
@@ -96,7 +97,10 @@
 			tmp[1] = buf[i];
 			if ((err = i2c_transfer(state->i2c, &msg, 1)) != 1) {
 				printk(KERN_WARNING "lgdt3302: %s error (addr %02x <- %02x, err == %i)\n", __FUNCTION__, addr, buf[0], err);
-				return -EREMOTEIO;
+				if (err < 0)
+					return err;
+				else
+					return -EREMOTEIO;
 			}
 			tmp[0]++;
 		}
@@ -218,6 +222,8 @@
 
 	/* Change only if we are actually changing the modulation */
 	if (state->current_modulation != param->u.vsb.modulation) {
+		int value;
+
 		switch(param->u.vsb.modulation) {
 		case VSB_8:
 			dprintk("%s: VSB_8 MODE\n", __FUNCTION__);
@@ -266,36 +272,29 @@
 		i2c_writebytes(state, state->config->demod_address,
 			       demux_ctrl_cfg, sizeof(demux_ctrl_cfg));
 
-		if (param->u.vsb.modulation == VSB_8) {
-			/* Initialization for VSB modes only */
-			/* Change the value of NCOCTFV[25:0]of carrier
-			   recovery center frequency register for VSB */
-			i2c_writebytes(state, state->config->demod_address,
+		/* Change the value of NCOCTFV[25:0] of carrier
+		   recovery center frequency register */
+		i2c_writebytes(state, state->config->demod_address,
 				       vsb_freq_cfg, sizeof(vsb_freq_cfg));
-		} else {
-			/* Initialization for QAM modes only */
-			/* Set the value of 'INLVTHD' register 0x2a/0x2c
-			   to value from 'IFACC' register 0x39/0x3b -1 */
-			int value;
-			i2c_selectreadbytes(state, AGC_RFIF_ACC0,
-					    &agc_delay_cfg[1], 3);
-			value = ((agc_delay_cfg[1] & 0x0f) << 8) | agc_delay_cfg[3];
-			value = value -1;
-			dprintk("%s IFACC -1 = 0x%03x\n", __FUNCTION__, value);
-			agc_delay_cfg[1] = (value >> 8) & 0x0f;
-			agc_delay_cfg[2] = 0x00;
-			agc_delay_cfg[3] = value & 0xff;
-			i2c_writebytes(state, state->config->demod_address,
-				       agc_delay_cfg, sizeof(agc_delay_cfg));
+		/* Set the value of 'INLVTHD' register 0x2a/0x2c
+		   to value from 'IFACC' register 0x39/0x3b -1 */
+		i2c_selectreadbytes(state, AGC_RFIF_ACC0,
+				    &agc_delay_cfg[1], 3);
+		value = ((agc_delay_cfg[1] & 0x0f) << 8) | agc_delay_cfg[3];
+		value = value -1;
+		dprintk("%s IFACC -1 = 0x%03x\n", __FUNCTION__, value);
+		agc_delay_cfg[1] = (value >> 8) & 0x0f;
+		agc_delay_cfg[2] = 0x00;
+		agc_delay_cfg[3] = value & 0xff;
+		i2c_writebytes(state, state->config->demod_address,
+			       agc_delay_cfg, sizeof(agc_delay_cfg));
 
-			/* Change the value of IAGCBW[15:8]
-			   of inner AGC loop filter bandwith */
-			i2c_writebytes(state, state->config->demod_address,
-				       agc_loop_cfg, sizeof(agc_loop_cfg));
-		}
+		/* Change the value of IAGCBW[15:8]
+		   of inner AGC loop filter bandwith */
+		i2c_writebytes(state, state->config->demod_address,
+			       agc_loop_cfg, sizeof(agc_loop_cfg));
 
 		state->config->set_ts_params(fe, 0);
-		lgdt3302_SwReset(state);
 		state->current_modulation = param->u.vsb.modulation;
 	}
 
@@ -311,11 +310,10 @@
 		i2c_readbytes(state, state->config->pll_address, buf, 1);
 		dprintk("%s: tuner status byte = 0x%02x\n", __FUNCTION__, buf[0]);
 
-		lgdt3302_SwReset(state);
-
 		/* Update current frequency */
 		state->current_frequency = param->frequency;
 	}
+	lgdt3302_SwReset(state);
 	return 0;
 }
 
diff --git a/drivers/media/dvb/ttpci/budget-av.c b/drivers/media/dvb/ttpci/budget-av.c
index b65f4b0..9746d2b 100644
--- a/drivers/media/dvb/ttpci/budget-av.c
+++ b/drivers/media/dvb/ttpci/budget-av.c
@@ -1022,7 +1022,7 @@
 MODULE_DEVICE_TABLE(pci, pci_tbl);
 
 static struct saa7146_extension budget_extension = {
-	.name = "budget dvb /w video in\0",
+	.name = "budget_av",
 	.pci_tbl = pci_tbl,
 
 	.module = THIS_MODULE,
diff --git a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
index 2c17a5f..aa43b5f 100644
--- a/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
+++ b/drivers/media/dvb/ttusb-budget/dvb-ttusb-budget.c
@@ -1626,7 +1626,7 @@
 MODULE_DEVICE_TABLE(usb, ttusb_table);
 
 static struct usb_driver ttusb_driver = {
-      .name		= "Technotrend/Hauppauge USB-Nova",
+      .name		= "ttusb",
       .probe		= ttusb_probe,
       .disconnect	= ttusb_disconnect,
       .id_table		= ttusb_table,
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index e771064..f461750 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -7,19 +7,6 @@
 
 comment "Video Adapters"
 
-config TUNER_MULTI_I2C
-	bool "Enable support for multiple I2C devices on Video Adapters (EXPERIMENTAL)"
-	depends on VIDEO_DEV && EXPERIMENTAL
-	---help---
-	  Some video adapters have more than one tuner inside. This patch
-	  enables support for using more than one tuner. This is required
-	  for some cards to allow tunning  both video and radio.
-	  It also improves I2C autodetection for these cards.
-
-	  Only few tuners currently is supporting this. More to come.
-
-	  It is safe to say 'Y' here even if your card has only one I2C tuner.
-
 config VIDEO_BT848
 	tristate "BT848 Video For Linux"
 	depends on VIDEO_DEV && PCI && I2C
diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c
index 9a642c7d..a070417 100644
--- a/drivers/media/video/bt832.c
+++ b/drivers/media/video/bt832.c
@@ -138,25 +138,13 @@
 
         bt832_hexdump(i2c_client_s,buf);
 
-#if 0
-	// Full 30/25 Frame rate
-	printk("Full 30/25 Frame rate\n");
-	buf[0]=BT832_VP_CONTROL0; // Reg.39
-        buf[1]= 0x00;
-        if (2 != (rc = i2c_master_send(i2c_client_s,buf,2)))
-                printk("bt832: i2c i/o error FFR: rc == %d (should be 2)\n",rc);
 
-        bt832_hexdump(i2c_client_s,buf);
-#endif
-
-#if 1
 	// for testing (even works when no camera attached)
 	printk("bt832: *** Generate NTSC M Bars *****\n");
 	buf[0]=BT832_VP_TESTCONTROL0; // Reg. 42
 	buf[1]=3; // Generate NTSC System M bars, Generate Frame timing internally
         if (2 != (rc = i2c_master_send(i2c_client_s,buf,2)))
                 printk("bt832: i2c i/o error MBAR: rc == %d (should be 2)\n",rc);
-#endif
 
 	printk("Bt832: Camera Present: %s\n",
 		(buf[1+BT832_CAM_STATUS] & BT832_56_CAMERA_PRESENT) ? "yes":"no");
diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c
index 251092e..2dbf5ec 100644
--- a/drivers/media/video/bttv-cards.c
+++ b/drivers/media/video/bttv-cards.c
@@ -1,5 +1,5 @@
 /*
-    $Id: bttv-cards.c,v 1.49 2005/06/10 17:20:24 mchehab Exp $
+    $Id: bttv-cards.c,v 1.53 2005/07/05 17:37:35 nsh Exp $
 
     bttv-cards.c
 
@@ -39,9 +39,6 @@
 #include <asm/io.h>
 
 #include "bttvp.h"
-#if 0 /* not working yet */
-#include "bt832.h"
-#endif
 
 /* fwd decl */
 static void boot_msp34xx(struct bttv *btv, int pin);
@@ -513,13 +510,8 @@
 	.svhs		= 2,
 	.gpiomask	= 0x01fe00,
 	.muxsel		= { 2, 3, 1, 1},
-#if 0
-	// old
-	.audiomux	= { 0x01c000, 0, 0x018000, 0x014000, 0x002000, 0 },
-#else
 	// 2003-10-20 by "Anton A. Arapov" <arapov@mail.ru>
 	.audiomux       = { 0x001e00, 0, 0x018000, 0x014000, 0x002000, 0 },
-#endif
 	.needs_tvaudio	= 1,
 	.pll		= PLL_28,
 	.tuner_type	= -1,
@@ -766,14 +758,9 @@
 	.tuner		= 0,
 	.svhs		= 2,
 	.muxsel		= { 2, 3, 1, 1, 0}, // TV, CVid, SVid, CVid over SVid connector
-#if 0
-	.gpiomask	= 0xc33000,
-	.audiomux	= { 0x422000,0x1000,0x0000,0x620000,0x800000 },
-#else
 	/* Alexander Varakin <avarakin@hotmail.com> [stereo version] */
 	.gpiomask	= 0xb33000,
 	.audiomux	= { 0x122000,0x1000,0x0000,0x620000,0x800000 },
-#endif
 	/* Audio Routing for "WinFast 2000 XP" (no tv stereo !)
 		gpio23 -- hef4052:nEnable (0x800000)
 		gpio12 -- hef4052:A1
@@ -1603,20 +1590,11 @@
        .video_inputs   = 4,
        .audio_inputs   = 1,
        .tuner          = -1,
-#if 0 /* TODO ... */
-       .svhs           = OSPREY540_SVID_ANALOG,
-       .muxsel         = {       [OSPREY540_COMP_ANALOG] = 2,
-                               [OSPREY540_SVID_ANALOG] = 3, },
-#endif
        .pll            = PLL_28,
        .tuner_type     = -1,
        .no_msp34xx     = 1,
        .no_tda9875     = 1,
        .no_tda7432     = 1,
-#if 0 /* TODO ... */
-       .muxsel_hook    = osprey_540_muxsel,
-       .picture_hook   = osprey_540_set_picture,
-#endif
 },{
 
 	/* ---- card 0x5C ---------------------------------- */
@@ -2546,21 +2524,12 @@
 	btaor((2)<<5, ~(3<<5), BT848_IFORM);
 	gpio_bits(3,bttv_tvcards[btv->c.type].muxsel[input&7]);
 
-#if 0
-       /* svhs */
-       /* wake chroma ADC */
-       btand(~BT848_ADC_C_SLEEP, BT848_ADC);
-       /* set to YC video */
-       btor(BT848_CONTROL_COMP, BT848_E_CONTROL);
-       btor(BT848_CONTROL_COMP, BT848_O_CONTROL);
-#else
        /* composite */
        /* set chroma ADC to sleep */
        btor(BT848_ADC_C_SLEEP, BT848_ADC);
        /* set to composite video */
        btand(~BT848_CONTROL_COMP, BT848_E_CONTROL);
        btand(~BT848_CONTROL_COMP, BT848_O_CONTROL);
-#endif
 
        /* switch sync drive off */
        gpio_bits(LM1882_SYNC_DRIVE,LM1882_SYNC_DRIVE);
@@ -2813,10 +2782,18 @@
 		btv->tuner_type = tuner[btv->c.nr];
 	printk("bttv%d: using tuner=%d\n",btv->c.nr,btv->tuner_type);
 	if (btv->pinnacle_id != UNSET)
-		bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE,
+		bttv_call_i2c_clients(btv, AUDC_CONFIG_PINNACLE,
 				      &btv->pinnacle_id);
-	if (btv->tuner_type != UNSET)
-		bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
+	if (btv->tuner_type != UNSET) {
+	        struct tuner_setup tun_setup;
+
+	        tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
+		tun_setup.type = btv->tuner_type;
+		tun_setup.addr = ADDR_UNSET;
+
+		bttv_call_i2c_clients(btv, TUNER_SET_TYPE_ADDR, &tun_setup);
+	}
+
 	btv->svhs = bttv_tvcards[btv->c.type].svhs;
 	if (svhs[btv->c.nr] != UNSET)
 		btv->svhs = svhs[btv->c.nr];
@@ -3125,14 +3102,6 @@
         TUNER_PHILIPS_SECAM, TUNER_PHILIPS_SECAM,
         TUNER_PHILIPS_SECAM, TUNER_PHILIPS_PAL,
 	TUNER_PHILIPS_FM1216ME_MK3 };
-#if 0
-int tuner_0_fm_table[] = {
-        PHILIPS_FR1236_NTSC,  PHILIPS_FR1216_PAL,
-        PHILIPS_FR1216_PAL,   PHILIPS_FR1216_PAL,
-        PHILIPS_FR1216_PAL,   PHILIPS_FR1216_PAL,
-        PHILIPS_FR1236_SECAM, PHILIPS_FR1236_SECAM,
-        PHILIPS_FR1236_SECAM, PHILIPS_FR1216_PAL};
-#endif
 
 static int tuner_1_table[] = {
         TUNER_TEMIC_NTSC,  TUNER_TEMIC_PAL,
@@ -3218,36 +3187,6 @@
 
 static void __devinit boot_bt832(struct bttv *btv)
 {
-#if 0 /* not working yet */
-	int resetbit=0;
-
-	switch (btv->c.type) {
-	case BTTV_PXELVWPLTVPAK:
-		resetbit = 0x400000;
-		break;
-	case BTTV_MODTEC_205:
-		resetbit = 1<<9;
-		break;
-	default:
-		BUG();
-	}
-
-	request_module("bt832");
-	bttv_call_i2c_clients(btv, BT832_HEXDUMP, NULL);
-
-	printk("bttv%d: Reset Bt832 [line=0x%x]\n",btv->c.nr,resetbit);
-	gpio_write(0);
-	gpio_inout(resetbit, resetbit);
-	udelay(5);
-	gpio_bits(resetbit, resetbit);
-	udelay(5);
-	gpio_bits(resetbit, 0);
-	udelay(5);
-
-	// bt832 on pixelview changes from i2c 0x8a to 0x88 after
-	// being reset as above. So we must follow by this:
-	bttv_call_i2c_clients(btv, BT832_REATTACH, NULL);
-#endif
 }
 
 /* ----------------------------------------------------------------------- */
@@ -3572,11 +3511,6 @@
 {
 	dprintk("tea5757_set_freq %d\n",freq);
 	tea5757_write(btv, 5 * freq + 0x358); /* add 10.7MHz (see docs) */
-#if 0
-	/* breaks Miro PCTV */
-	value = tea5757_read(btv);
-	dprintk("bttv%d: tea5757 readback=0x%x\n",btv->c.nr,value);
-#endif
 }
 
 
@@ -3656,13 +3590,8 @@
 {
 	unsigned int val, con;
 
-#if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
 	if (btv->radio_user)
 		return;
-#else
-	if (btv->radio)
-		return;
-#endif
 
 	val = gpio_read();
 	if (set) {
@@ -3851,13 +3780,8 @@
 {
 	unsigned int val = 0;
 
-#if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
 	if (btv->radio_user)
 		return;
-#else
-	if (btv->radio)
-		return;
-#endif
 
 	if (set) {
 		if (v->mode & VIDEO_SOUND_MONO)	{
@@ -3888,13 +3812,8 @@
 {
 	unsigned int val = 0xffff;
 
-#if BTTV_VERSION_CODE > KERNEL_VERSION(0,8,0)
 	if (btv->radio_user)
 		return;
-#else
-	if (btv->radio)
-		return;
-#endif
 	if (set) {
 		if (v->mode & VIDEO_SOUND_MONO)	{
 			val = 0x0000;
@@ -4371,11 +4290,6 @@
 		latency = 0x0A;
 #endif
 
-#if 0
-	/* print which chipset we have */
-	while ((dev = pci_find_class(PCI_CLASS_BRIDGE_HOST << 8,dev)))
-		printk(KERN_INFO "bttv: Host bridge is %s\n",pci_name(dev));
-#endif
 
 	/* print warnings about any quirks found */
 	if (triton1)
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c
index 7d62b39..51a0f6d 100644
--- a/drivers/media/video/bttv-driver.c
+++ b/drivers/media/video/bttv-driver.c
@@ -1,5 +1,5 @@
 /*
-    $Id: bttv-driver.c,v 1.40 2005/06/16 21:38:45 nsh Exp $
+    $Id: bttv-driver.c,v 1.42 2005/07/05 17:37:35 nsh Exp $
 
     bttv - Bt848 frame grabber driver
 
@@ -35,6 +35,7 @@
 #include <linux/sched.h>
 #include <linux/interrupt.h>
 #include <linux/kdev_t.h>
+#include <linux/dma-mapping.h>
 
 #include <asm/io.h>
 #include <asm/byteorder.h>
@@ -698,12 +699,10 @@
 static
 void free_btres(struct bttv *btv, struct bttv_fh *fh, int bits)
 {
-#if 1 /* DEBUG */
 	if ((fh->resources & bits) != bits) {
 		/* trying to free ressources not allocated by us ... */
 		printk("bttv: BUG! (btres)\n");
 	}
-#endif
 	down(&btv->reslock);
 	fh->resources  &= ~bits;
 	btv->resources &= ~bits;
@@ -943,11 +942,6 @@
 	i2c_mux = mux = (btv->audio & AUDIO_MUTE) ? AUDIO_OFF : btv->audio;
 	if (btv->opt_automute && !signal && !btv->radio_user)
 		mux = AUDIO_OFF;
-#if 0
-	printk("bttv%d: amux: mode=%d audio=%d signal=%s mux=%d/%d irq=%s\n",
-	       btv->c.nr, mode, btv->audio, signal ? "yes" : "no",
-	       mux, i2c_mux, in_interrupt() ? "yes" : "no");
-#endif
 
 	val = bttv_tvcards[btv->c.type].audiomux[mux];
 	gpio_bits(bttv_tvcards[btv->c.type].gpiomask,val);
@@ -994,11 +988,6 @@
 	case BTTV_VOODOOTV_FM:
 		bttv_tda9880_setnorm(btv,norm);
 		break;
-#if 0
-	case BTTV_OSPREY540:
-		osprey_540_set_norm(btv,norm);
-		break;
-#endif
 	}
 	return 0;
 }
@@ -1849,7 +1838,7 @@
 
 		if (unlikely(f->tuner != 0))
 			return -EINVAL;
-		if (unlikely(f->type != V4L2_TUNER_ANALOG_TV))
+		if (unlikely (f->type != V4L2_TUNER_ANALOG_TV))
 			return -EINVAL;
 		down(&btv->lock);
 		btv->freq = f->frequency;
@@ -3865,7 +3854,7 @@
 		       btv->c.nr);
 		return -EIO;
 	}
-        if (pci_set_dma_mask(dev, 0xffffffff)) {
+        if (pci_set_dma_mask(dev, DMA_32BIT_MASK)) {
                 printk(KERN_WARNING "bttv%d: No suitable DMA available.\n",
 		       btv->c.nr);
 		return -EIO;
diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c
index da448a5..234a855 100644
--- a/drivers/media/video/bttv-i2c.c
+++ b/drivers/media/video/bttv-i2c.c
@@ -1,5 +1,5 @@
 /*
-    $Id: bttv-i2c.c,v 1.21 2005/06/10 17:20:24 mchehab Exp $
+    $Id: bttv-i2c.c,v 1.25 2005/07/05 17:37:35 nsh Exp $
 
     bttv-i2c.c  --  all the i2c code is here
 
@@ -295,14 +295,26 @@
 {
         struct bttv *btv = i2c_get_adapdata(client->adapter);
 
-	if (btv->tuner_type != UNSET)
-		bttv_call_i2c_clients(btv,TUNER_SET_TYPE,&btv->tuner_type);
+	if (bttv_debug)
+		printk(KERN_DEBUG "bttv%d: %s i2c attach [addr=0x%x,client=%s]\n",
+			btv->c.nr,client->driver->name,client->addr,
+			i2c_clientname(client));
+	if (!client->driver->command)
+		return 0;
+
+	if (btv->tuner_type != UNSET) {
+	        struct tuner_setup tun_setup;
+
+	        tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
+		tun_setup.type = btv->tuner_type;
+		tun_setup.addr = ADDR_UNSET;
+
+		client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
+	}
+
 	if (btv->pinnacle_id != UNSET)
-		bttv_call_i2c_clients(btv,AUDC_CONFIG_PINNACLE,
+		client->driver->command(client,AUDC_CONFIG_PINNACLE,
 				      &btv->pinnacle_id);
-        if (bttv_debug)
-		printk("bttv%d: i2c attach [client=%s]\n",
-		       btv->c.nr, i2c_clientname(client));
         return 0;
 }
 
diff --git a/drivers/media/video/bttv-risc.c b/drivers/media/video/bttv-risc.c
index bdc5ce6..9ed21fd 100644
--- a/drivers/media/video/bttv-risc.c
+++ b/drivers/media/video/bttv-risc.c
@@ -334,10 +334,6 @@
 	}
 
 	vdelay = tvnorm->vdelay;
-#if 0 /* FIXME */
-	if (vdelay < btv->vbi.lines*2)
-		vdelay = btv->vbi.lines*2;
-#endif
 
         xsf = (width*scaledtwidth)/swidth;
         geo->hscale =  ((totalwidth*4096UL)/xsf-4096);
@@ -776,13 +772,8 @@
 		bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 0);
 		break;
 	case V4L2_FIELD_INTERLACED:
-#if 0
-		bttv_risc_overlay(btv, &buf->top,    fmt, ov, 1, 0);
-		bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 0, 1);
-#else
 		bttv_risc_overlay(btv, &buf->top,    fmt, ov, 0, 1);
 		bttv_risc_overlay(btv, &buf->bottom, fmt, ov, 1, 0);
-#endif
 		break;
 	default:
 		BUG();
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index 91f8afe..4f39688 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -690,11 +690,9 @@
 	int bitrate_mode = 1;
 	int bitrate = 7500000;
 	int bitrate_peak = 7500000;
-#if 1
 	bitrate_mode = BLACKBIRD_VIDEO_CBR;
 	bitrate = 4000*1024;
 	bitrate_peak = 4000*1024;
-#endif
 
 	/* assign stream type */
 	blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM);
@@ -810,9 +808,6 @@
 	cx_write(MO_VBOS_CONTROL, 0x84A00); /* no 656 mode, 8-bit pixels, disable VBI */
 	cx_clear(MO_OUTPUT_FORMAT, 0x0008); /* Normal Y-limits to let the mpeg encoder sync */
 
-#if 0 /* FIXME */
-	set_scale(dev, 720, 480, V4L2_FIELD_INTERLACED);
-#endif
 	blackbird_codec_settings(dev);
 	msleep(1);
 
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 96cb0ff..5e868f5 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -1,5 +1,5 @@
 /*
- * $Id: cx88-core.c,v 1.31 2005/06/22 22:58:04 mchehab Exp $
+ * $Id: cx88-core.c,v 1.33 2005/07/07 14:17:47 mchehab Exp $
  *
  * device driver for Conexant 2388x based TV cards
  * driver core
@@ -470,25 +470,6 @@
 	return incr[risc >> 28] ? incr[risc >> 28] : 1;
 }
 
-#if 0 /* currently unused, but useful for debugging */
-void cx88_risc_disasm(struct cx88_core *core,
-		      struct btcx_riscmem *risc)
-{
-	unsigned int i,j,n;
-
-	printk("%s: risc disasm: %p [dma=0x%08lx]\n",
-	       core->name, risc->cpu, (unsigned long)risc->dma);
-	for (i = 0; i < (risc->size >> 2); i += n) {
-		printk("%s:   %04d: ", core->name, i);
-		n = cx88_risc_decode(risc->cpu[i]);
-		for (j = 1; j < n; j++)
-			printk("%s:   %04d: 0x%08x [ arg #%d ]\n",
-			       core->name, i+j, risc->cpu[i+j], j);
-		if (risc->cpu[i] == RISC_JUMP)
-			break;
-	}
-}
-#endif
 
 void cx88_sram_channel_dump(struct cx88_core *core,
 			    struct sram_channel *ch)
@@ -545,30 +526,12 @@
 	       core->name,cx_read(ch->cnt2_reg));
 }
 
-/* Used only on cx88-core */
 static char *cx88_pci_irqs[32] = {
 	"vid", "aud", "ts", "vip", "hst", "5", "6", "tm1",
 	"src_dma", "dst_dma", "risc_rd_err", "risc_wr_err",
 	"brdg_err", "src_dma_err", "dst_dma_err", "ipb_dma_err",
 	"i2c", "i2c_rack", "ir_smp", "gpio0", "gpio1"
 };
-/* Used only on cx88-video */
-char *cx88_vid_irqs[32] = {
-	"y_risci1", "u_risci1", "v_risci1", "vbi_risc1",
-	"y_risci2", "u_risci2", "v_risci2", "vbi_risc2",
-	"y_oflow",  "u_oflow",  "v_oflow",  "vbi_oflow",
-	"y_sync",   "u_sync",   "v_sync",   "vbi_sync",
-	"opc_err",  "par_err",  "rip_err",  "pci_abort",
-};
-/* Used only on cx88-mpeg */
-char *cx88_mpeg_irqs[32] = {
-	"ts_risci1", NULL, NULL, NULL,
-	"ts_risci2", NULL, NULL, NULL,
-	"ts_oflow",  NULL, NULL, NULL,
-	"ts_sync",   NULL, NULL, NULL,
-	"opc_err", "par_err", "rip_err", "pci_abort",
-	"ts_err?",
-};
 
 void cx88_print_irqbits(char *name, char *tag, char **strings,
 			u32 bits, u32 mask)
@@ -618,16 +581,11 @@
 			break;
 		buf = list_entry(q->active.next,
 				 struct cx88_buffer, vb.queue);
-#if 0
-		if (buf->count > count)
-			break;
-#else
 		/* count comes from the hw and is is 16bit wide --
 		 * this trick handles wrap-arounds correctly for
 		 * up to 32767 buffers in flight... */
 		if ((s16) (count - buf->count) < 0)
 			break;
-#endif
 		do_gettimeofday(&buf->vb.ts);
 		dprintk(2,"[%p/%d] wakeup reg=%d buf=%d\n",buf,buf->vb.i,
 			count, buf->count);
@@ -955,12 +913,10 @@
 		norm->cxiformat, cx_read(MO_INPUT_FORMAT) & 0x0f);
 	cx_andor(MO_INPUT_FORMAT, 0xf, norm->cxiformat);
 
-#if 1
 	// FIXME: as-is from DScaler
 	dprintk(1,"set_tvnorm: MO_OUTPUT_FORMAT 0x%08x [old=0x%08x]\n",
 		norm->cxoformat, cx_read(MO_OUTPUT_FORMAT));
 	cx_write(MO_OUTPUT_FORMAT, norm->cxoformat);
-#endif
 
 	// MO_SCONV_REG = adc clock / video dec clock * 2^17
 	tmp64  = adc_clock * (u64)(1 << 17);
@@ -1219,8 +1175,6 @@
 /* ------------------------------------------------------------------ */
 
 EXPORT_SYMBOL(cx88_print_ioctl);
-EXPORT_SYMBOL(cx88_vid_irqs);
-EXPORT_SYMBOL(cx88_mpeg_irqs);
 EXPORT_SYMBOL(cx88_print_irqbits);
 
 EXPORT_SYMBOL(cx88_core_irq);
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index 690477a..8db68f2d 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -1,5 +1,5 @@
 /*
- * $Id: cx88-dvb.c,v 1.39 2005/07/02 20:00:46 mkrufky Exp $
+ * $Id: cx88-dvb.c,v 1.41 2005/07/04 19:35:05 mkrufky Exp $
  *
  * device driver for Conexant 2388x based TV cards
  * MPEG Transport Stream (DVB) routines
@@ -30,22 +30,25 @@
 #include <linux/file.h>
 #include <linux/suspend.h>
 
-/* these three frontends need merging via linuxtv cvs ... */
-#define HAVE_CX22702 1
-#define HAVE_OR51132 1
-#define HAVE_LGDT3302 1
+#define CONFIG_DVB_MT352 1
+#define CONFIG_DVB_CX22702 1
+#define CONFIG_DVB_OR51132 1
+#define CONFIG_DVB_LGDT3302 1
 
 #include "cx88.h"
 #include "dvb-pll.h"
-#include "mt352.h"
-#include "mt352_priv.h"
-#if HAVE_CX22702
+
+#if CONFIG_DVB_MT352
+# include "mt352.h"
+# include "mt352_priv.h"
+#endif
+#if CONFIG_DVB_CX22702
 # include "cx22702.h"
 #endif
-#if HAVE_OR51132
+#if CONFIG_DVB_OR51132
 # include "or51132.h"
 #endif
-#if HAVE_LGDT3302
+#if CONFIG_DVB_LGDT3302
 # include "lgdt3302.h"
 #endif
 
@@ -104,6 +107,7 @@
 
 /* ------------------------------------------------------------------ */
 
+#if CONFIG_DVB_MT352
 static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
 {
 	static u8 clock_config []  = { CLOCK_CTL,  0x38, 0x39 };
@@ -171,8 +175,9 @@
 	.demod_init    = dntv_live_dvbt_demod_init,
 	.pll_set       = mt352_pll_set,
 };
+#endif
 
-#if HAVE_CX22702
+#if CONFIG_DVB_CX22702
 static struct cx22702_config connexant_refboard_config = {
 	.demod_address = 0x43,
 	.pll_address   = 0x60,
@@ -186,7 +191,7 @@
 };
 #endif
 
-#if HAVE_OR51132
+#if CONFIG_DVB_OR51132
 static int or51132_set_ts_param(struct dvb_frontend* fe,
 				int is_punctured)
 {
@@ -203,7 +208,7 @@
 };
 #endif
 
-#if HAVE_LGDT3302
+#if CONFIG_DVB_LGDT3302
 static int lgdt3302_set_ts_param(struct dvb_frontend* fe, int is_punctured)
 {
 	struct cx8802_dev *dev= fe->dvb->priv;
@@ -237,7 +242,7 @@
 
 	/* init frontend */
 	switch (dev->core->board) {
-#if HAVE_CX22702
+#if CONFIG_DVB_CX22702
 	case CX88_BOARD_HAUPPAUGE_DVB_T1:
 		dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config,
 						   &dev->core->i2c_adap);
@@ -248,6 +253,7 @@
 						   &dev->core->i2c_adap);
 		break;
 #endif
+#if CONFIG_DVB_MT352
 	case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
 		dev->core->pll_addr = 0x61;
 		dev->core->pll_desc = &dvb_pll_lg_z201;
@@ -268,13 +274,14 @@
 		dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config,
 						 &dev->core->i2c_adap);
 		break;
-#if HAVE_OR51132
+#endif
+#if CONFIG_DVB_OR51132
 	case CX88_BOARD_PCHDTV_HD3000:
 		dev->dvb.frontend = or51132_attach(&pchdtv_hd3000,
 						 &dev->core->i2c_adap);
 		break;
 #endif
-#if HAVE_LGDT3302
+#if CONFIG_DVB_LGDT3302
 	case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
 		dev->ts_gen_cntrl = 0x08;
 		{
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index b534223..8403c4e 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -1,5 +1,5 @@
 /*
-    $Id: cx88-i2c.c,v 1.24 2005/06/17 18:46:23 mkrufky Exp $
+    $Id: cx88-i2c.c,v 1.28 2005/07/05 17:37:35 nsh Exp $
 
     cx88-i2c.c  --  all the i2c code is here
 
@@ -91,25 +91,32 @@
 
 static int attach_inform(struct i2c_client *client)
 {
-        struct tuner_addr tun_addr;
+        struct tuner_setup tun_setup;
 	struct cx88_core *core = i2c_get_adapdata(client->adapter);
 
-	dprintk(1, "i2c attach [addr=0x%x,client=%s]\n",
-		client->addr, i2c_clientname(client));
+	dprintk(1, "%s i2c attach [addr=0x%x,client=%s]\n",
+		client->driver->name,client->addr,i2c_clientname(client));
 	if (!client->driver->command)
 		return 0;
 
         if (core->radio_type != UNSET) {
-                tun_addr.v4l2_tuner = V4L2_TUNER_RADIO;
-                tun_addr.type = core->radio_type;
-                tun_addr.addr = core->radio_addr;
-                client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+		if ((core->radio_addr==ADDR_UNSET)||(core->radio_addr==client->addr)) {
+			tun_setup.mode_mask = T_RADIO;
+			tun_setup.type = core->radio_type;
+			tun_setup.addr = core->radio_addr;
+
+			client->driver->command (client, TUNER_SET_TYPE_ADDR, &tun_setup);
+		}
         }
         if (core->tuner_type != UNSET) {
-                tun_addr.v4l2_tuner = V4L2_TUNER_ANALOG_TV;
-                tun_addr.type = core->tuner_type;
-                tun_addr.addr = core->tuner_addr;
-                client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr);
+		if ((core->tuner_addr==ADDR_UNSET)||(core->tuner_addr==client->addr)) {
+
+			tun_setup.mode_mask = T_ANALOG_TV;
+			tun_setup.type = core->tuner_type;
+			tun_setup.addr = core->tuner_addr;
+
+			client->driver->command (client,TUNER_SET_TYPE_ADDR, &tun_setup);
+		}
         }
 
 	if (core->tda9887_conf)
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index bdc26e7..2148877 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -1,5 +1,5 @@
 /*
- * $Id: cx88-input.c,v 1.13 2005/06/13 16:07:46 nsh Exp $
+ * $Id: cx88-input.c,v 1.15 2005/07/07 13:58:38 mchehab Exp $
  *
  * Device driver for GPIO attached remote control interfaces
  * on Conexant 2388x based TV/DVB cards.
@@ -38,199 +38,206 @@
 
 /* DigitalNow DNTV Live DVB-T Remote */
 static IR_KEYTAB_TYPE ir_codes_dntv_live_dvb_t[IR_KEYTAB_SIZE] = {
-	[ 0x00 ] = KEY_ESC,         // 'go up a level?'
-	[ 0x01 ] = KEY_KP1,         // '1'
-	[ 0x02 ] = KEY_KP2,         // '2'
-	[ 0x03 ] = KEY_KP3,         // '3'
-	[ 0x04 ] = KEY_KP4,         // '4'
-	[ 0x05 ] = KEY_KP5,         // '5'
-	[ 0x06 ] = KEY_KP6,         // '6'
-	[ 0x07 ] = KEY_KP7,         // '7'
-	[ 0x08 ] = KEY_KP8,         // '8'
-	[ 0x09 ] = KEY_KP9,         // '9'
-	[ 0x0a ] = KEY_KP0,         // '0'
-	[ 0x0b ] = KEY_TUNER,       // 'tv/fm'
-	[ 0x0c ] = KEY_SEARCH,      // 'scan'
-	[ 0x0d ] = KEY_STOP,        // 'stop'
-	[ 0x0e ] = KEY_PAUSE,       // 'pause'
-	[ 0x0f ] = KEY_LIST,        // 'source'
+	[0x00] = KEY_ESC,		/* 'go up a level?' */
+	/* Keys 0 to 9 */
+	[0x0a] = KEY_KP0,
+	[0x01] = KEY_KP1,
+	[0x02] = KEY_KP2,
+	[0x03] = KEY_KP3,
+	[0x04] = KEY_KP4,
+	[0x05] = KEY_KP5,
+	[0x06] = KEY_KP6,
+	[0x07] = KEY_KP7,
+	[0x08] = KEY_KP8,
+	[0x09] = KEY_KP9,
 
-	[ 0x10 ] = KEY_MUTE,        // 'mute'
-	[ 0x11 ] = KEY_REWIND,      // 'backward <<'
-	[ 0x12 ] = KEY_POWER,       // 'power'
-	[ 0x13 ] = KEY_S,           // 'snap'
-	[ 0x14 ] = KEY_AUDIO,       // 'stereo'
-	[ 0x15 ] = KEY_CLEAR,       // 'reset'
-	[ 0x16 ] = KEY_PLAY,        // 'play'
-	[ 0x17 ] = KEY_ENTER,       // 'enter'
-	[ 0x18 ] = KEY_ZOOM,        // 'full screen'
-	[ 0x19 ] = KEY_FASTFORWARD, // 'forward >>'
-	[ 0x1a ] = KEY_CHANNELUP,   // 'channel +'
-	[ 0x1b ] = KEY_VOLUMEUP,    // 'volume +'
-	[ 0x1c ] = KEY_INFO,        // 'preview'
-	[ 0x1d ] = KEY_RECORD,      // 'record'
-	[ 0x1e ] = KEY_CHANNELDOWN, // 'channel -'
-	[ 0x1f ] = KEY_VOLUMEDOWN,  // 'volume -'
+	[0x0b] = KEY_TUNER,		/* tv/fm */
+	[0x0c] = KEY_SEARCH,		/* scan */
+	[0x0d] = KEY_STOP,
+	[0x0e] = KEY_PAUSE,
+	[0x0f] = KEY_LIST,		/* source */
+
+	[0x10] = KEY_MUTE,
+	[0x11] = KEY_REWIND,		/* backward << */
+	[0x12] = KEY_POWER,
+	[0x13] = KEY_S,			/* snap */
+	[0x14] = KEY_AUDIO,		/* stereo */
+	[0x15] = KEY_CLEAR,		/* reset */
+	[0x16] = KEY_PLAY,
+	[0x17] = KEY_ENTER,
+	[0x18] = KEY_ZOOM,		/* full screen */
+	[0x19] = KEY_FASTFORWARD,	/* forward >> */
+	[0x1a] = KEY_CHANNELUP,
+	[0x1b] = KEY_VOLUMEUP,
+	[0x1c] = KEY_INFO,		/* preview */
+	[0x1d] = KEY_RECORD,		/* record */
+	[0x1e] = KEY_CHANNELDOWN,
+	[0x1f] = KEY_VOLUMEDOWN,
 };
 
 /* ---------------------------------------------------------------------- */
 
 /* IO-DATA BCTV7E Remote */
 static IR_KEYTAB_TYPE ir_codes_iodata_bctv7e[IR_KEYTAB_SIZE] = {
-	[ 0x40 ] = KEY_TV,              // TV
-	[ 0x20 ] = KEY_RADIO,           // FM
-	[ 0x60 ] = KEY_EPG,             // EPG
-	[ 0x00 ] = KEY_POWER,           // power
+	[0x40] = KEY_TV,
+	[0x20] = KEY_RADIO,		/* FM */
+	[0x60] = KEY_EPG,
+	[0x00] = KEY_POWER,
 
-	[ 0x50 ] = KEY_KP1,             // 1
-	[ 0x30 ] = KEY_KP2,             // 2
-	[ 0x70 ] = KEY_KP3,             // 3
-	[ 0x10 ] = KEY_L,               // Live
+	/* Keys 0 to 9 */
+	[0x44] = KEY_KP0,		/* 10 */
+	[0x50] = KEY_KP1,
+	[0x30] = KEY_KP2,
+	[0x70] = KEY_KP3,
+	[0x48] = KEY_KP4,
+	[0x28] = KEY_KP5,
+	[0x68] = KEY_KP6,
+	[0x58] = KEY_KP7,
+	[0x38] = KEY_KP8,
+	[0x78] = KEY_KP9,
 
-	[ 0x48 ] = KEY_KP4,             // 4
-	[ 0x28 ] = KEY_KP5,             // 5
-	[ 0x68 ] = KEY_KP6,             // 6
-	[ 0x08 ] = KEY_T,               // Time Shift
+	[0x10] = KEY_L,			/* Live */
+	[0x08] = KEY_T,			/* Time Shift */
 
-	[ 0x58 ] = KEY_KP7,             // 7
-	[ 0x38 ] = KEY_KP8,             // 8
-	[ 0x78 ] = KEY_KP9,             // 9
-	[ 0x18 ] = KEY_PLAYPAUSE,       // Play
+	[0x18] = KEY_PLAYPAUSE,		/* Play */
 
-	[ 0x44 ] = KEY_KP0,             // 10
-	[ 0x24 ] = KEY_ENTER,           // 11
-	[ 0x64 ] = KEY_ESC,             // 12
-	[ 0x04 ] = KEY_M,               // Multi
+	[0x24] = KEY_ENTER,		/* 11 */
+	[0x64] = KEY_ESC,		/* 12 */
+	[0x04] = KEY_M,			/* Multi */
 
-	[ 0x54 ] = KEY_VIDEO,           // VIDEO
-	[ 0x34 ] = KEY_CHANNELUP,       // channel +
-	[ 0x74 ] = KEY_VOLUMEUP,        // volume +
-	[ 0x14 ] = KEY_MUTE,            // Mute
+	[0x54] = KEY_VIDEO,
+	[0x34] = KEY_CHANNELUP,
+	[0x74] = KEY_VOLUMEUP,
+	[0x14] = KEY_MUTE,
 
-	[ 0x4c ] = KEY_S,               // SVIDEO
-	[ 0x2c ] = KEY_CHANNELDOWN,     // channel -
-	[ 0x6c ] = KEY_VOLUMEDOWN,      // volume -
-	[ 0x0c ] = KEY_ZOOM,            // Zoom
+	[0x4c] = KEY_S,			/* SVIDEO */
+	[0x2c] = KEY_CHANNELDOWN,
+	[0x6c] = KEY_VOLUMEDOWN,
+	[0x0c] = KEY_ZOOM,
 
-	[ 0x5c ] = KEY_PAUSE,           // pause
-	[ 0x3c ] = KEY_C,               // || (red)
-	[ 0x7c ] = KEY_RECORD,          // recording
-	[ 0x1c ] = KEY_STOP,            // stop
+	[0x5c] = KEY_PAUSE,
+	[0x3c] = KEY_C,			/* || (red) */
+	[0x7c] = KEY_RECORD,		/* recording */
+	[0x1c] = KEY_STOP,
 
-	[ 0x41 ] = KEY_REWIND,          // backward <<
-	[ 0x21 ] = KEY_PLAY,            // play
-	[ 0x61 ] = KEY_FASTFORWARD,     // forward >>
-	[ 0x01 ] = KEY_NEXT,            // skip >|
+	[0x41] = KEY_REWIND,		/* backward << */
+	[0x21] = KEY_PLAY,
+	[0x61] = KEY_FASTFORWARD,	/* forward >> */
+	[0x01] = KEY_NEXT,		/* skip >| */
 };
 
 /* ---------------------------------------------------------------------- */
 
 /* ADS Tech Instant TV DVB-T PCI Remote */
 static IR_KEYTAB_TYPE ir_codes_adstech_dvb_t_pci[IR_KEYTAB_SIZE] = {
-	[ 0x5b ] = KEY_POWER,
-	[ 0x5f ] = KEY_MUTE,
-	[ 0x57 ] = KEY_1,
-	[ 0x4f ] = KEY_2,
-	[ 0x53 ] = KEY_3,
-	[ 0x56 ] = KEY_4,
-	[ 0x4e ] = KEY_5,
-	[ 0x5e ] = KEY_6,
-	[ 0x54 ] = KEY_7,
-	[ 0x4c ] = KEY_8,
-	[ 0x5c ] = KEY_9,
-	[ 0x4d ] = KEY_0,
-	[ 0x55 ] = KEY_GOTO,
-	[ 0x5d ] = KEY_SEARCH,
-	[ 0x17 ] = KEY_EPG,             // Guide
-	[ 0x1f ] = KEY_MENU,
-	[ 0x0f ] = KEY_UP,
-	[ 0x46 ] = KEY_DOWN,
-	[ 0x16 ] = KEY_LEFT,
-	[ 0x1e ] = KEY_RIGHT,
-	[ 0x0e ] = KEY_SELECT,          // Enter
-	[ 0x5a ] = KEY_INFO,
-	[ 0x52 ] = KEY_EXIT,
-	[ 0x59 ] = KEY_PREVIOUS,
-	[ 0x51 ] = KEY_NEXT,
-	[ 0x58 ] = KEY_REWIND,
-	[ 0x50 ] = KEY_FORWARD,
-	[ 0x44 ] = KEY_PLAYPAUSE,
-	[ 0x07 ] = KEY_STOP,
-	[ 0x1b ] = KEY_RECORD,
-	[ 0x13 ] = KEY_TUNER,           // Live
-	[ 0x0a ] = KEY_A,
-	[ 0x12 ] = KEY_B,
-	[ 0x03 ] = KEY_PROG1,           // 1
-	[ 0x01 ] = KEY_PROG2,           // 2
-	[ 0x00 ] = KEY_PROG3,           // 3
-	[ 0x06 ] = KEY_DVD,
-	[ 0x48 ] = KEY_AUX,             // Photo
-	[ 0x40 ] = KEY_VIDEO,
-	[ 0x19 ] = KEY_AUDIO,           // Music
-	[ 0x0b ] = KEY_CHANNELUP,
-	[ 0x08 ] = KEY_CHANNELDOWN,
-	[ 0x15 ] = KEY_VOLUMEUP,
-	[ 0x1c ] = KEY_VOLUMEDOWN,
+	/* Keys 0 to 9 */
+	[0x4d] = KEY_0,
+	[0x57] = KEY_1,
+	[0x4f] = KEY_2,
+	[0x53] = KEY_3,
+	[0x56] = KEY_4,
+	[0x4e] = KEY_5,
+	[0x5e] = KEY_6,
+	[0x54] = KEY_7,
+	[0x4c] = KEY_8,
+	[0x5c] = KEY_9,
+
+	[0x5b] = KEY_POWER,
+	[0x5f] = KEY_MUTE,
+	[0x55] = KEY_GOTO,
+	[0x5d] = KEY_SEARCH,
+	[0x17] = KEY_EPG,		/* Guide */
+	[0x1f] = KEY_MENU,
+	[0x0f] = KEY_UP,
+	[0x46] = KEY_DOWN,
+	[0x16] = KEY_LEFT,
+	[0x1e] = KEY_RIGHT,
+	[0x0e] = KEY_SELECT,		/* Enter */
+	[0x5a] = KEY_INFO,
+	[0x52] = KEY_EXIT,
+	[0x59] = KEY_PREVIOUS,
+	[0x51] = KEY_NEXT,
+	[0x58] = KEY_REWIND,
+	[0x50] = KEY_FORWARD,
+	[0x44] = KEY_PLAYPAUSE,
+	[0x07] = KEY_STOP,
+	[0x1b] = KEY_RECORD,
+	[0x13] = KEY_TUNER,		/* Live */
+	[0x0a] = KEY_A,
+	[0x12] = KEY_B,
+	[0x03] = KEY_PROG1,		/* 1 */
+	[0x01] = KEY_PROG2,		/* 2 */
+	[0x00] = KEY_PROG3,		/* 3 */
+	[0x06] = KEY_DVD,
+	[0x48] = KEY_AUX,		/* Photo */
+	[0x40] = KEY_VIDEO,
+	[0x19] = KEY_AUDIO,		/* Music */
+	[0x0b] = KEY_CHANNELUP,
+	[0x08] = KEY_CHANNELDOWN,
+	[0x15] = KEY_VOLUMEUP,
+	[0x1c] = KEY_VOLUMEDOWN,
 };
 
 /* ---------------------------------------------------------------------- */
 
 /* MSI TV@nywhere remote */
 static IR_KEYTAB_TYPE ir_codes_msi_tvanywhere[IR_KEYTAB_SIZE] = {
-       [ 0x00 ] = KEY_0,           /* '0' */
-       [ 0x01 ] = KEY_1,           /* '1' */
-       [ 0x02 ] = KEY_2,           /* '2' */
-       [ 0x03 ] = KEY_3,           /* '3' */
-       [ 0x04 ] = KEY_4,           /* '4' */
-       [ 0x05 ] = KEY_5,           /* '5' */
-       [ 0x06 ] = KEY_6,           /* '6' */
-       [ 0x07 ] = KEY_7,           /* '7' */
-       [ 0x08 ] = KEY_8,           /* '8' */
-       [ 0x09 ] = KEY_9,           /* '9' */
-       [ 0x0c ] = KEY_MUTE,        /* 'Mute' */
-       [ 0x0f ] = KEY_SCREEN,      /* 'Full Screen' */
-       [ 0x10 ] = KEY_F,           /* 'Funtion' */
-       [ 0x11 ] = KEY_T,           /* 'Time shift' */
-       [ 0x12 ] = KEY_POWER,       /* 'Power' */
-       [ 0x13 ] = KEY_MEDIA,       /* 'MTS' */
-       [ 0x14 ] = KEY_SLOW,        /* 'Slow' */
-       [ 0x16 ] = KEY_REWIND,      /* 'backward <<' */
-       [ 0x17 ] = KEY_ENTER,       /* 'Return' */
-       [ 0x18 ] = KEY_FASTFORWARD, /* 'forward >>' */
-       [ 0x1a ] = KEY_CHANNELUP,   /* 'Channel+' */
-       [ 0x1b ] = KEY_VOLUMEUP,    /* 'Volume+' */
-       [ 0x1e ] = KEY_CHANNELDOWN, /* 'Channel-' */
-       [ 0x1f ] = KEY_VOLUMEDOWN,  /* 'Volume-' */
+	/* Keys 0 to 9 */
+	[0x00] = KEY_0,
+	[0x01] = KEY_1,
+	[0x02] = KEY_2,
+	[0x03] = KEY_3,
+	[0x04] = KEY_4,
+	[0x05] = KEY_5,
+	[0x06] = KEY_6,
+	[0x07] = KEY_7,
+	[0x08] = KEY_8,
+	[0x09] = KEY_9,
+
+	[0x0c] = KEY_MUTE,
+	[0x0f] = KEY_SCREEN,		/* Full Screen */
+	[0x10] = KEY_F,			/* Funtion */
+	[0x11] = KEY_T,			/* Time shift */
+	[0x12] = KEY_POWER,
+	[0x13] = KEY_MEDIA,		/* MTS */
+	[0x14] = KEY_SLOW,
+	[0x16] = KEY_REWIND,		/* backward << */
+	[0x17] = KEY_ENTER,		/* Return */
+	[0x18] = KEY_FASTFORWARD,	/* forward >> */
+	[0x1a] = KEY_CHANNELUP,
+	[0x1b] = KEY_VOLUMEUP,
+	[0x1e] = KEY_CHANNELDOWN,
+	[0x1f] = KEY_VOLUMEDOWN,
 };
 
 /* ---------------------------------------------------------------------- */
 
 struct cx88_IR {
-	struct cx88_core	*core;
-	struct input_dev        input;
-	struct ir_input_state   ir;
-	char                    name[32];
-	char                    phys[32];
+	struct cx88_core *core;
+	struct input_dev input;
+	struct ir_input_state ir;
+	char name[32];
+	char phys[32];
 
 	/* sample from gpio pin 16 */
-	int                     sampling;
-	u32                     samples[16];
-	int                     scount;
-	unsigned long           release;
+	int sampling;
+	u32 samples[16];
+	int scount;
+	unsigned long release;
 
 	/* poll external decoder */
-	int                     polling;
-	struct work_struct      work;
-	struct timer_list       timer;
-	u32			gpio_addr;
-	u32                     last_gpio;
-	u32                     mask_keycode;
-	u32                     mask_keydown;
-	u32                     mask_keyup;
+	int polling;
+	struct work_struct work;
+	struct timer_list timer;
+	u32 gpio_addr;
+	u32 last_gpio;
+	u32 mask_keycode;
+	u32 mask_keydown;
+	u32 mask_keyup;
 };
 
 static int ir_debug = 0;
-module_param(ir_debug, int, 0644);    /* debug level [IR] */
+module_param(ir_debug, int, 0644);	/* debug level [IR] */
 MODULE_PARM_DESC(ir_debug, "enable debug messages [IR]");
 
 #define ir_dprintk(fmt, arg...)	if (ir_debug) \
@@ -254,37 +261,37 @@
 	/* extract data */
 	data = ir_extract_bits(gpio, ir->mask_keycode);
 	ir_dprintk("irq gpio=0x%x code=%d | %s%s%s\n",
-		gpio, data,
-		ir->polling               ? "poll"  : "irq",
-		(gpio & ir->mask_keydown) ? " down" : "",
-		(gpio & ir->mask_keyup)   ? " up"   : "");
+		   gpio, data,
+		   ir->polling ? "poll" : "irq",
+		   (gpio & ir->mask_keydown) ? " down" : "",
+		   (gpio & ir->mask_keyup) ? " up" : "");
 
 	if (ir->mask_keydown) {
 		/* bit set on keydown */
 		if (gpio & ir->mask_keydown) {
-			ir_input_keydown(&ir->input,&ir->ir,data,data);
+			ir_input_keydown(&ir->input, &ir->ir, data, data);
 		} else {
-			ir_input_nokey(&ir->input,&ir->ir);
+			ir_input_nokey(&ir->input, &ir->ir);
 		}
 
 	} else if (ir->mask_keyup) {
 		/* bit cleared on keydown */
 		if (0 == (gpio & ir->mask_keyup)) {
-			ir_input_keydown(&ir->input,&ir->ir,data,data);
+			ir_input_keydown(&ir->input, &ir->ir, data, data);
 		} else {
-			ir_input_nokey(&ir->input,&ir->ir);
+			ir_input_nokey(&ir->input, &ir->ir);
 		}
 
 	} else {
 		/* can't distinguish keydown/up :-/ */
-		ir_input_keydown(&ir->input,&ir->ir,data,data);
-		ir_input_nokey(&ir->input,&ir->ir);
+		ir_input_keydown(&ir->input, &ir->ir, data, data);
+		ir_input_nokey(&ir->input, &ir->ir);
 	}
 }
 
 static void ir_timer(unsigned long data)
 {
-	struct cx88_IR *ir = (struct cx88_IR*)data;
+	struct cx88_IR *ir = (struct cx88_IR *)data;
 
 	schedule_work(&ir->work);
 }
@@ -307,62 +314,62 @@
 	IR_KEYTAB_TYPE *ir_codes = NULL;
 	int ir_type = IR_TYPE_OTHER;
 
-	ir = kmalloc(sizeof(*ir),GFP_KERNEL);
+	ir = kmalloc(sizeof(*ir), GFP_KERNEL);
 	if (NULL == ir)
 		return -ENOMEM;
-	memset(ir,0,sizeof(*ir));
+	memset(ir, 0, sizeof(*ir));
 
 	/* detect & configure */
 	switch (core->board) {
 	case CX88_BOARD_DNTV_LIVE_DVB_T:
 	case CX88_BOARD_KWORLD_DVB_T:
-		ir_codes         = ir_codes_dntv_live_dvb_t;
-		ir->gpio_addr    = MO_GP1_IO;
+		ir_codes = ir_codes_dntv_live_dvb_t;
+		ir->gpio_addr = MO_GP1_IO;
 		ir->mask_keycode = 0x1f;
-		ir->mask_keyup   = 0x60;
-		ir->polling      = 50; // ms
+		ir->mask_keyup = 0x60;
+		ir->polling = 50; /* ms */
 		break;
 	case CX88_BOARD_HAUPPAUGE:
 	case CX88_BOARD_HAUPPAUGE_DVB_T1:
-		ir_codes         = ir_codes_hauppauge_new;
-		ir_type          = IR_TYPE_RC5;
-		ir->sampling     = 1;
+		ir_codes = ir_codes_hauppauge_new;
+		ir_type = IR_TYPE_RC5;
+		ir->sampling = 1;
 		break;
 	case CX88_BOARD_WINFAST2000XP_EXPERT:
-		ir_codes         = ir_codes_winfast;
-		ir->gpio_addr    = MO_GP0_IO;
+		ir_codes = ir_codes_winfast;
+		ir->gpio_addr = MO_GP0_IO;
 		ir->mask_keycode = 0x8f8;
-		ir->mask_keyup   = 0x100;
-		ir->polling      = 1; // ms
+		ir->mask_keyup = 0x100;
+		ir->polling = 1; /* ms */
 		break;
 	case CX88_BOARD_IODATA_GVBCTV7E:
-		ir_codes         = ir_codes_iodata_bctv7e;
-		ir->gpio_addr    = MO_GP0_IO;
+		ir_codes = ir_codes_iodata_bctv7e;
+		ir->gpio_addr = MO_GP0_IO;
 		ir->mask_keycode = 0xfd;
 		ir->mask_keydown = 0x02;
-		ir->polling      = 5; // ms
+		ir->polling = 5; /* ms */
 		break;
 	case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO:
-		ir_codes         = ir_codes_pixelview;
-		ir->gpio_addr    = MO_GP1_IO;
+		ir_codes = ir_codes_pixelview;
+		ir->gpio_addr = MO_GP1_IO;
 		ir->mask_keycode = 0x1f;
-		ir->mask_keyup   = 0x80;
-		ir->polling      = 1; // ms
+		ir->mask_keyup = 0x80;
+		ir->polling = 1; /* ms */
 		break;
 	case CX88_BOARD_ADSTECH_DVB_T_PCI:
-		ir_codes         = ir_codes_adstech_dvb_t_pci;
-		ir->gpio_addr    = MO_GP1_IO;
+		ir_codes = ir_codes_adstech_dvb_t_pci;
+		ir->gpio_addr = MO_GP1_IO;
 		ir->mask_keycode = 0xbf;
-		ir->mask_keyup   = 0x40;
-		ir->polling      = 50; // ms
+		ir->mask_keyup = 0x40;
+		ir->polling = 50; /* ms */
 		break;
-        case CX88_BOARD_MSI_TVANYWHERE_MASTER:
-                ir_codes         = ir_codes_msi_tvanywhere;
-                ir->gpio_addr    = MO_GP1_IO;
-                ir->mask_keycode = 0x1f;
-                ir->mask_keyup   = 0x40;
-                ir->polling      = 1;
-                break;
+	case CX88_BOARD_MSI_TVANYWHERE_MASTER:
+		ir_codes = ir_codes_msi_tvanywhere;
+		ir->gpio_addr = MO_GP1_IO;
+		ir->mask_keycode = 0x1f;
+		ir->mask_keyup = 0x40;
+		ir->polling = 1; /* ms */
+		break;
 	}
 
 	if (NULL == ir_codes) {
@@ -373,8 +380,7 @@
 	/* init input device */
 	snprintf(ir->name, sizeof(ir->name), "cx88 IR (%s)",
 		 cx88_boards[core->board].name);
-	snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0",
-		 pci_name(pci));
+	snprintf(ir->phys, sizeof(ir->phys), "pci-%s/ir0", pci_name(pci));
 
 	ir_input_init(&ir->input, &ir->ir, ir_type, ir_codes);
 	ir->input.name = ir->name;
@@ -382,10 +388,10 @@
 	ir->input.id.bustype = BUS_PCI;
 	ir->input.id.version = 1;
 	if (pci->subsystem_vendor) {
-		ir->input.id.vendor  = pci->subsystem_vendor;
+		ir->input.id.vendor = pci->subsystem_vendor;
 		ir->input.id.product = pci->subsystem_device;
 	} else {
-		ir->input.id.vendor  = pci->vendor;
+		ir->input.id.vendor = pci->vendor;
 		ir->input.id.product = pci->device;
 	}
 
@@ -397,13 +403,13 @@
 		INIT_WORK(&ir->work, cx88_ir_work, ir);
 		init_timer(&ir->timer);
 		ir->timer.function = ir_timer;
-		ir->timer.data     = (unsigned long)ir;
+		ir->timer.data = (unsigned long)ir;
 		schedule_work(&ir->work);
 	}
 	if (ir->sampling) {
-		core->pci_irqmask |= (1<<18);   // IR_SMP_INT
-		cx_write(MO_DDS_IO, 0xa80a80);  // 4 kHz sample rate
-		cx_write(MO_DDSCFG_IO,   0x5);  // enable
+		core->pci_irqmask |= (1 << 18);	/* IR_SMP_INT */
+		cx_write(MO_DDS_IO, 0xa80a80);	/* 4 kHz sample rate */
+		cx_write(MO_DDSCFG_IO, 0x5);	/* enable */
 	}
 
 	/* all done */
@@ -439,7 +445,7 @@
 void cx88_ir_irq(struct cx88_core *core)
 {
 	struct cx88_IR *ir = core->ir;
-	u32 samples,rc5;
+	u32 samples, rc5;
 	int i;
 
 	if (NULL == ir)
@@ -448,7 +454,7 @@
 		return;
 
 	samples = cx_read(MO_SAMPLE_IO);
-	if (0 != samples  &&  0xffffffff != samples) {
+	if (0 != samples && 0xffffffff != samples) {
 		/* record sample data */
 		if (ir->scount < ARRAY_SIZE(ir->samples))
 			ir->samples[ir->scount++] = samples;
@@ -456,8 +462,8 @@
 	}
 	if (!ir->scount) {
 		/* nothing to sample */
-		if (ir->ir.keypressed && time_after(jiffies,ir->release))
-			ir_input_nokey(&ir->input,&ir->ir);
+		if (ir->ir.keypressed && time_after(jiffies, ir->release))
+			ir_input_nokey(&ir->input, &ir->ir);
 		return;
 	}
 
@@ -467,14 +473,14 @@
 	for (i = 0; i < ir->scount; i++)
 		ir->samples[i] = ~ir->samples[i];
 	if (ir_debug)
-		ir_dump_samples(ir->samples,ir->scount);
+		ir_dump_samples(ir->samples, ir->scount);
 
 	/* decode it */
 	switch (core->board) {
 	case CX88_BOARD_HAUPPAUGE:
 	case CX88_BOARD_HAUPPAUGE_DVB_T1:
-		rc5 = ir_decode_biphase(ir->samples,ir->scount,5,7);
-		ir_dprintk("biphase decoded: %x\n",rc5);
+		rc5 = ir_decode_biphase(ir->samples, ir->scount, 5, 7);
+		ir_dprintk("biphase decoded: %x\n", rc5);
 		if ((rc5 & 0xfffff000) != 0x3000)
 			break;
 		ir_input_keydown(&ir->input, &ir->ir, rc5 & 0x3f, rc5);
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index 85da6dc..fe2767c 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -1,5 +1,5 @@
 /*
- * $Id: cx88-mpeg.c,v 1.30 2005/07/05 19:44:40 mkrufky Exp $
+ * $Id: cx88-mpeg.c,v 1.31 2005/07/07 14:17:47 mchehab Exp $
  *
  *  Support for the mpeg transport stream transfers
  *  PCI function #2 of the cx2388x.
@@ -64,7 +64,6 @@
 	/* write TS length to chip */
 	cx_write(MO_TS_LNGTH, buf->vb.width);
 
-#if 1
 	/* FIXME: this needs a review.
 	 * also: move to cx88-blackbird + cx88-dvb source files? */
 
@@ -76,9 +75,9 @@
 		cx_write(TS_HW_SOP_CNTRL,0x47<<16|188<<4|0x01);
 		if ((core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q) ||
 		    (core->board == CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T)) {
-			cx_write(TS_SOP_STAT, 0<<16 | 0<<14 | 1<<13 | 0<<12);
+			cx_write(TS_SOP_STAT, 1<<13);
 		} else {
-			cx_write(TS_SOP_STAT,0x00);
+			cx_write(TS_SOP_STAT, 0x00);
 		}
 		cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl);
 		udelay(100);
@@ -98,7 +97,6 @@
 		cx_write(TS_GEN_CNTRL, 0x06); /* punctured clock TS & posedge driven */
 		udelay(100);
 	}
-#endif
 
 	/* reset counter */
 	cx_write(MO_TS_GPCNTRL, GP_COUNT_CONTROL_RESET);
@@ -270,6 +268,15 @@
 	do_cancel_buffers(dev,"timeout",1);
 }
 
+static char *cx88_mpeg_irqs[32] = {
+	"ts_risci1", NULL, NULL, NULL,
+	"ts_risci2", NULL, NULL, NULL,
+	"ts_oflow",  NULL, NULL, NULL,
+	"ts_sync",   NULL, NULL, NULL,
+	"opc_err", "par_err", "rip_err", "pci_abort",
+	"ts_err?",
+};
+
 static void cx8802_mpeg_irq(struct cx8802_dev *dev)
 {
 	struct cx88_core *core = dev->core;
@@ -282,10 +289,7 @@
 		return;
 
 	cx_write(MO_TS_INTSTAT, status);
-#if 0
-	cx88_print_irqbits(core->name, "irq mpeg ",
-			cx88_mpeg_irqs, status, mask);
-#endif
+
 	if (debug || (status & mask & ~0xff))
 		cx88_print_irqbits(core->name, "irq mpeg ",
 				   cx88_mpeg_irqs, status, mask);
@@ -441,10 +445,8 @@
 	}
 	spin_unlock(&dev->slock);
 
-#if 1
 	/* FIXME -- shutdown device */
 	cx88_shutdown(dev->core);
-#endif
 
 	pci_save_state(pci_dev);
 	if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) {
@@ -466,10 +468,8 @@
 	pci_set_power_state(pci_dev, PCI_D0);
 	pci_restore_state(pci_dev);
 
-#if 1
 	/* FIXME: re-initialize hardware */
 	cx88_reset(dev->core);
-#endif
 
 	/* restart video+vbi capture */
 	spin_lock(&dev->slock);
diff --git a/drivers/media/video/cx88/cx88-reg.h b/drivers/media/video/cx88/cx88-reg.h
index 63ad33f..37f8266 100644
--- a/drivers/media/video/cx88/cx88-reg.h
+++ b/drivers/media/video/cx88/cx88-reg.h
@@ -1,5 +1,5 @@
 /*
-    $Id: cx88-reg.h,v 1.7 2005/06/03 13:31:51 mchehab Exp $
+    $Id: cx88-reg.h,v 1.8 2005/07/07 13:58:38 mchehab Exp $
 
     cx88x-hw.h - CX2388x register offsets
 
@@ -604,20 +604,11 @@
 #define EN_I2SIN_STR2DAC        0x00004000
 #define EN_I2SIN_ENABLE         0x00008000
 
-#if 0
-/* old */
-#define EN_DMTRX_SUMDIFF        0x00000800
-#define EN_DMTRX_SUMR           0x00000880
-#define EN_DMTRX_LR             0x00000900
-#define EN_DMTRX_MONO           0x00000980
-#else
-/* dscaler cvs */
 #define EN_DMTRX_SUMDIFF        (0 << 7)
 #define EN_DMTRX_SUMR           (1 << 7)
 #define EN_DMTRX_LR             (2 << 7)
 #define EN_DMTRX_MONO           (3 << 7)
 #define EN_DMTRX_BYPASS         (1 << 11)
-#endif
 
 // Video
 #define VID_CAPTURE_CONTROL		0x310180
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 46d78b1..91207f1 100644
--- a/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/drivers/media/video/cx88/cx88-tvaudio.c
@@ -1,5 +1,5 @@
 /*
-    $Id: cx88-tvaudio.c,v 1.36 2005/06/05 05:53:45 mchehab Exp $
+    $Id: cx88-tvaudio.c,v 1.37 2005/07/07 13:58:38 mchehab Exp $
 
     cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver
 
@@ -278,80 +278,6 @@
 	set_audio_finish(core);
 }
 
-#if 0
-static void set_audio_standard_NICAM(struct cx88_core *core)
-{
-	static const struct rlist nicam_common[] = {
-		/* from dscaler */
-    		{ AUD_RATE_ADJ1,           0x00000010 },
-    		{ AUD_RATE_ADJ2,           0x00000040 },
-    		{ AUD_RATE_ADJ3,           0x00000100 },
-    		{ AUD_RATE_ADJ4,           0x00000400 },
-    		{ AUD_RATE_ADJ5,           0x00001000 },
-    //		{ AUD_DMD_RA_DDS,          0x00c0d5ce },
-
-		// Deemphasis 1:
-		{ AUD_DEEMPHGAIN_R,        0x000023c2 },
-		{ AUD_DEEMPHNUMER1_R,      0x0002a7bc },
-		{ AUD_DEEMPHNUMER2_R,      0x0003023e },
-		{ AUD_DEEMPHDENOM1_R,      0x0000f3d0 },
-		{ AUD_DEEMPHDENOM2_R,      0x00000000 },
-
-#if 0
-		// Deemphasis 2: (other tv norm?)
-		{ AUD_DEEMPHGAIN_R,        0x0000c600 },
-		{ AUD_DEEMPHNUMER1_R,      0x00066738 },
-		{ AUD_DEEMPHNUMER2_R,      0x00066739 },
-		{ AUD_DEEMPHDENOM1_R,      0x0001e88c },
-		{ AUD_DEEMPHDENOM2_R,      0x0001e88c },
-#endif
-
-		{ AUD_DEEMPHDENOM2_R,      0x00000000 },
-		{ AUD_ERRLOGPERIOD_R,      0x00000fff },
-		{ AUD_ERRINTRPTTHSHLD1_R,  0x000003ff },
-		{ AUD_ERRINTRPTTHSHLD2_R,  0x000000ff },
-		{ AUD_ERRINTRPTTHSHLD3_R,  0x0000003f },
-		{ AUD_POLYPH80SCALEFAC,    0x00000003 },
-
-		// setup QAM registers
-		{ AUD_PDF_DDS_CNST_BYTE2,  0x06 },
-		{ AUD_PDF_DDS_CNST_BYTE1,  0x82 },
-		{ AUD_PDF_DDS_CNST_BYTE0,  0x16 },
-		{ AUD_QAM_MODE,            0x05 },
-
-                { /* end of list */ },
-        };
-	static const struct rlist nicam_pal_i[] = {
-		{ AUD_PDF_DDS_CNST_BYTE0,  0x12 },
-		{ AUD_PHACC_FREQ_8MSB,     0x3a },
-		{ AUD_PHACC_FREQ_8LSB,     0x93 },
-
-                { /* end of list */ },
-	};
-	static const struct rlist nicam_default[] = {
-		{ AUD_PDF_DDS_CNST_BYTE0,  0x16 },
-		{ AUD_PHACC_FREQ_8MSB,     0x34 },
-		{ AUD_PHACC_FREQ_8LSB,     0x4c },
-
-                { /* end of list */ },
-	};
-
-        set_audio_start(core, 0x0010,
-			EN_DMTRX_LR | EN_DMTRX_BYPASS | EN_NICAM_AUTO_STEREO);
-        set_audio_registers(core, nicam_common);
-	switch (core->tvaudio) {
-	case WW_NICAM_I:
-		dprintk("%s PAL-I NICAM (status: unknown)\n",__FUNCTION__);
-		set_audio_registers(core, nicam_pal_i);
-		break;
-	case WW_NICAM_BGDKL:
-		dprintk("%s PAL-BGDK NICAM (status: unknown)\n",__FUNCTION__);
-		set_audio_registers(core, nicam_default);
-		break;
-	};
-        set_audio_finish(core);
-}
-#endif
 
 static void set_audio_standard_NICAM_L(struct cx88_core *core, int stereo)
 {
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index dc99754..c44a079 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1,5 +1,5 @@
 /*
- * $Id: cx88-video.c,v 1.70 2005/06/20 03:36:00 mkrufky Exp $
+ * $Id: cx88-video.c,v 1.79 2005/07/07 14:17:47 mchehab Exp $
  *
  * device driver for Conexant 2388x based TV cards
  * video4linux video interface
@@ -86,13 +86,6 @@
 		.id        = V4L2_STD_NTSC_M_JP,
 		.cxiformat = VideoFormatNTSCJapan,
 		.cxoformat = 0x181f0008,
-#if 0
-	},{
-		.name      = "NTSC-4.43",
-		.id        = FIXME,
-		.cxiformat = VideoFormatNTSC443,
-		.cxoformat = 0x181f0008,
-#endif
 	},{
 		.name      = "PAL-BG",
 		.id        = V4L2_STD_PAL_BG,
@@ -248,6 +241,7 @@
 			.default_value = 0,
 			.type          = V4L2_CTRL_TYPE_INTEGER,
 		},
+		.off                   = 0,
 		.reg                   = MO_CONTR_BRIGHT,
 		.mask                  = 0xff00,
 		.shift                 = 8,
@@ -674,231 +668,6 @@
 
 /* ------------------------------------------------------------------ */
 
-#if 0 /* overlay support not finished yet */
-static u32* ov_risc_field(struct cx8800_dev *dev, struct cx8800_fh *fh,
-			  u32 *rp, struct btcx_skiplist *skips,
-			  u32 sync_line, int skip_even, int skip_odd)
-{
-	int line,maxy,start,end,skip,nskips;
-	u32 ri,ra;
-	u32 addr;
-
-	/* sync instruction */
-	*(rp++) = cpu_to_le32(RISC_RESYNC | sync_line);
-
-	addr  = (unsigned long)dev->fbuf.base;
-	addr += dev->fbuf.fmt.bytesperline * fh->win.w.top;
-	addr += (fh->fmt->depth >> 3)      * fh->win.w.left;
-
-	/* scan lines */
-	for (maxy = -1, line = 0; line < fh->win.w.height;
-	     line++, addr += dev->fbuf.fmt.bytesperline) {
-		if ((line%2) == 0  &&  skip_even)
-			continue;
-		if ((line%2) == 1  &&  skip_odd)
-			continue;
-
-		/* calculate clipping */
-		if (line > maxy)
-			btcx_calc_skips(line, fh->win.w.width, &maxy,
-					skips, &nskips, fh->clips, fh->nclips);
-
-		/* write out risc code */
-		for (start = 0, skip = 0; start < fh->win.w.width; start = end) {
-			if (skip >= nskips) {
-				ri  = RISC_WRITE;
-				end = fh->win.w.width;
-			} else if (start < skips[skip].start) {
-				ri  = RISC_WRITE;
-				end = skips[skip].start;
-			} else {
-				ri  = RISC_SKIP;
-				end = skips[skip].end;
-				skip++;
-			}
-			if (RISC_WRITE == ri)
-				ra = addr + (fh->fmt->depth>>3)*start;
-			else
-				ra = 0;
-
-			if (0 == start)
-				ri |= RISC_SOL;
-			if (fh->win.w.width == end)
-				ri |= RISC_EOL;
-			ri |= (fh->fmt->depth>>3) * (end-start);
-
-			*(rp++)=cpu_to_le32(ri);
-			if (0 != ra)
-				*(rp++)=cpu_to_le32(ra);
-		}
-	}
-	kfree(skips);
-	return rp;
-}
-
-static int ov_risc_frame(struct cx8800_dev *dev, struct cx8800_fh *fh,
-			 struct cx88_buffer *buf)
-{
-	struct btcx_skiplist *skips;
-	u32 instructions,fields;
-	u32 *rp;
-	int rc;
-
-	/* skip list for window clipping */
-	if (NULL == (skips = kmalloc(sizeof(*skips) * fh->nclips,GFP_KERNEL)))
-		return -ENOMEM;
-
-	fields = 0;
-	if (V4L2_FIELD_HAS_TOP(fh->win.field))
-		fields++;
-	if (V4L2_FIELD_HAS_BOTTOM(fh->win.field))
-		fields++;
-
-        /* estimate risc mem: worst case is (clip+1) * lines instructions
-           + syncs + jump (all 2 dwords) */
-	instructions  = (fh->nclips+1) * fh->win.w.height;
-	instructions += 3 + 4;
-	if ((rc = btcx_riscmem_alloc(dev->pci,&buf->risc,instructions*8)) < 0) {
-		kfree(skips);
-		return rc;
-	}
-
-	/* write risc instructions */
-	rp = buf->risc.cpu;
-	switch (fh->win.field) {
-	case V4L2_FIELD_TOP:
-		rp = ov_risc_field(dev, fh, rp, skips, 0,     0, 0);
-		break;
-	case V4L2_FIELD_BOTTOM:
-		rp = ov_risc_field(dev, fh, rp, skips, 0x200, 0, 0);
-		break;
-	case V4L2_FIELD_INTERLACED:
-		rp = ov_risc_field(dev, fh, rp, skips, 0,     0, 1);
-		rp = ov_risc_field(dev, fh, rp, skips, 0x200, 1, 0);
-		break;
-	default:
-		BUG();
-	}
-
-	/* save pointer to jmp instruction address */
-	buf->risc.jmp = rp;
-	kfree(skips);
-	return 0;
-}
-
-static int verify_window(struct cx8800_dev *dev, struct v4l2_window *win)
-{
-	enum v4l2_field field;
-	int maxw, maxh;
-
-	if (NULL == dev->fbuf.base)
-		return -EINVAL;
-	if (win->w.width < 48 || win->w.height <  32)
-		return -EINVAL;
-	if (win->clipcount > 2048)
-		return -EINVAL;
-
-	field = win->field;
-	maxw  = norm_maxw(core->tvnorm);
-	maxh  = norm_maxh(core->tvnorm);
-
-	if (V4L2_FIELD_ANY == field) {
-                field = (win->w.height > maxh/2)
-                        ? V4L2_FIELD_INTERLACED
-                        : V4L2_FIELD_TOP;
-        }
-        switch (field) {
-        case V4L2_FIELD_TOP:
-        case V4L2_FIELD_BOTTOM:
-                maxh = maxh / 2;
-                break;
-        case V4L2_FIELD_INTERLACED:
-                break;
-        default:
-                return -EINVAL;
-        }
-
-	win->field = field;
-	if (win->w.width > maxw)
-		win->w.width = maxw;
-	if (win->w.height > maxh)
-		win->w.height = maxh;
-	return 0;
-}
-
-static int setup_window(struct cx8800_dev *dev, struct cx8800_fh *fh,
-			struct v4l2_window *win)
-{
-	struct v4l2_clip *clips = NULL;
-	int n,size,retval = 0;
-
-	if (NULL == fh->fmt)
-		return -EINVAL;
-	retval = verify_window(dev,win);
-	if (0 != retval)
-		return retval;
-
-	/* copy clips  --  luckily v4l1 + v4l2 are binary
-	   compatible here ...*/
-	n = win->clipcount;
-	size = sizeof(*clips)*(n+4);
-	clips = kmalloc(size,GFP_KERNEL);
-	if (NULL == clips)
-		return -ENOMEM;
-	if (n > 0) {
-		if (copy_from_user(clips,win->clips,sizeof(struct v4l2_clip)*n)) {
-			kfree(clips);
-			return -EFAULT;
-		}
-	}
-
-	/* clip against screen */
-	if (NULL != dev->fbuf.base)
-		n = btcx_screen_clips(dev->fbuf.fmt.width, dev->fbuf.fmt.height,
-				      &win->w, clips, n);
-	btcx_sort_clips(clips,n);
-
-	/* 4-byte alignments */
-	switch (fh->fmt->depth) {
-	case 8:
-	case 24:
-		btcx_align(&win->w, clips, n, 3);
-		break;
-	case 16:
-		btcx_align(&win->w, clips, n, 1);
-		break;
-	case 32:
-		/* no alignment fixups needed */
-		break;
-	default:
-		BUG();
-	}
-
-	down(&fh->vidq.lock);
-	if (fh->clips)
-		kfree(fh->clips);
-	fh->clips    = clips;
-	fh->nclips   = n;
-	fh->win      = *win;
-#if 0
-	fh->ov.setup_ok = 1;
-#endif
-
-	/* update overlay if needed */
-	retval = 0;
-#if 0
-	if (check_btres(fh, RESOURCE_OVERLAY)) {
-		struct bttv_buffer *new;
-
-		new = videobuf_alloc(sizeof(*new));
-		bttv_overlay_risc(btv, &fh->ov, fh->ovfmt, new);
-		retval = bttv_switch_overlay(btv,fh,new);
-	}
-#endif
-	up(&fh->vidq.lock);
-	return retval;
-}
-#endif
 
 /* ------------------------------------------------------------------ */
 
@@ -1327,9 +1096,6 @@
 	struct cx8800_fh  *fh   = file->private_data;
 	struct cx8800_dev *dev  = fh->dev;
 	struct cx88_core  *core = dev->core;
-#if 0
-	unsigned long flags;
-#endif
 	int err;
 
 	if (video_debug > 1)
@@ -1350,9 +1116,6 @@
 			V4L2_CAP_READWRITE     |
 			V4L2_CAP_STREAMING     |
 			V4L2_CAP_VBI_CAPTURE   |
-#if 0
-			V4L2_CAP_VIDEO_OVERLAY |
-#endif
 			0;
 		if (UNSET != core->tuner_type)
 			cap->capabilities |= V4L2_CAP_TUNER;
@@ -1453,36 +1216,6 @@
 	}
 
 
-#if 0
-	/* needs review */
-	case VIDIOC_G_AUDIO:
-	{
-		struct v4l2_audio *a = arg;
-		unsigned int n = a->index;
-
-		memset(a,0,sizeof(*a));
-		a->index = n;
-		switch (n) {
-		case 0:
-			if ((CX88_VMUX_TELEVISION == INPUT(n)->type)
-			    || (CX88_VMUX_CABLE == INPUT(n)->type)) {
-				strcpy(a->name,"Television");
-				// FIXME figure out if stereo received and set V4L2_AUDCAP_STEREO.
-				return 0;
-			}
-			break;
-		case 1:
-			if (CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q == core->board) {
-				strcpy(a->name,"Line In");
-				a->capability = V4L2_AUDCAP_STEREO;
-				return 0;
-			}
-			break;
-		}
-		// Audio input not available.
-		return -EINVAL;
-	}
-#endif
 
 	/* --- capture ioctls ---------------------------------------- */
 	case VIDIOC_ENUM_FMT:
@@ -1592,6 +1325,9 @@
 
 		f->type = fh->radio ? V4L2_TUNER_RADIO : V4L2_TUNER_ANALOG_TV;
 		f->frequency = dev->freq;
+
+		cx88_call_i2c_clients(dev->core,VIDIOC_G_FREQUENCY,f);
+
 		return 0;
 	}
 	case VIDIOC_S_FREQUENCY:
@@ -1846,6 +1582,14 @@
 	spin_unlock_irqrestore(&dev->slock,flags);
 }
 
+static char *cx88_vid_irqs[32] = {
+	"y_risci1", "u_risci1", "v_risci1", "vbi_risc1",
+	"y_risci2", "u_risci2", "v_risci2", "vbi_risc2",
+	"y_oflow",  "u_oflow",  "v_oflow",  "vbi_oflow",
+	"y_sync",   "u_sync",   "v_sync",   "vbi_sync",
+	"opc_err",  "par_err",  "rip_err",  "pci_abort",
+};
+
 static void cx8800_vid_irq(struct cx8800_dev *dev)
 {
 	struct cx88_core *core = dev->core;
@@ -2013,7 +1757,6 @@
 {
 	struct cx8800_dev *dev;
 	struct cx88_core *core;
-	struct tuner_addr tun_addr;
 	int err;
 
 	dev = kmalloc(sizeof(*dev),GFP_KERNEL);
@@ -2087,22 +1830,6 @@
 		request_module("tuner");
 	if (core->tda9887_conf)
 		request_module("tda9887");
-	if (core->radio_type != UNSET) {
-	        tun_addr.v4l2_tuner = V4L2_TUNER_RADIO;
-		tun_addr.type = core->radio_type;
-		tun_addr.addr = core->radio_addr;
-		cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE_ADDR, &tun_addr);
-	}
-	if (core->tuner_type != UNSET) {
-	        tun_addr.v4l2_tuner = V4L2_TUNER_ANALOG_TV;
-		tun_addr.type = core->tuner_type;
-		tun_addr.addr = core->tuner_addr;
-		cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE_ADDR, &tun_addr);
-	}
-
-	if (core->tda9887_conf)
-		cx88_call_i2c_clients(dev->core,TDA9887_SET_CONFIG,&core->tda9887_conf);
-
 	/* register v4l devices */
 	dev->video_dev = cx88_vdev_init(core,dev->pci,
 					&cx8800_video_template,"video");
@@ -2212,10 +1939,8 @@
 	}
 	spin_unlock(&dev->slock);
 
-#if 1
 	/* FIXME -- shutdown device */
 	cx88_shutdown(dev->core);
-#endif
 
 	pci_save_state(pci_dev);
 	if (0 != pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state))) {
@@ -2237,10 +1962,8 @@
 	pci_set_power_state(pci_dev, PCI_D0);
 	pci_restore_state(pci_dev);
 
-#if 1
 	/* FIXME: re-initialize hardware */
 	cx88_reset(dev->core);
-#endif
 
 	/* restart video+vbi capture */
 	spin_lock(&dev->slock);
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index bc5e038..307beae 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -1,5 +1,5 @@
 /*
- * $Id: cx88.h,v 1.67 2005/07/01 12:10:07 mkrufky Exp $
+ * $Id: cx88.h,v 1.68 2005/07/07 14:17:47 mchehab Exp $
  *
  * v4l2 device driver for cx2388x based TV cards
  *
@@ -82,9 +82,9 @@
 static unsigned int inline norm_maxw(struct cx88_tvnorm *norm)
 {
 	return (norm->id & V4L2_STD_625_50) ? 768 : 640;
-//	return (norm->id & V4L2_STD_625_50) ? 720 : 640;
 }
 
+
 static unsigned int inline norm_maxh(struct cx88_tvnorm *norm)
 {
 	return (norm->id & V4L2_STD_625_50) ? 576 : 480;
@@ -220,7 +220,6 @@
 #define RESOURCE_VBI           4
 
 #define BUFFER_TIMEOUT     (HZ/2)  /* 0.5 seconds */
-//#define BUFFER_TIMEOUT     (HZ*2)
 
 /* buffer for one video frame */
 struct cx88_buffer {
@@ -336,11 +335,6 @@
 	struct pci_dev             *pci;
 	unsigned char              pci_rev,pci_lat;
 
-#if 0
-	/* video overlay */
-	struct v4l2_framebuffer    fbuf;
-	struct cx88_buffer         *screen;
-#endif
 
 	/* capture queues */
 	struct cx88_dmaqueue       vidq;
@@ -435,8 +429,6 @@
 /* ----------------------------------------------------------- */
 /* cx88-core.c                                                 */
 
-extern char *cx88_vid_irqs[32];
-extern char *cx88_mpeg_irqs[32];
 extern void cx88_print_irqbits(char *name, char *tag, char **strings,
 			       u32 bits, u32 mask);
 extern void cx88_print_ioctl(char *name, unsigned int cmd);
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index 92664f7..9fc5055 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -1,5 +1,5 @@
 /*
- * $Id: ir-kbd-i2c.c,v 1.10 2004/12/09 12:51:35 kraxel Exp $
+ * $Id: ir-kbd-i2c.c,v 1.11 2005/07/07 16:42:11 mchehab Exp $
  *
  * keyboard input driver for i2c IR remote controls
  *
@@ -66,26 +66,26 @@
 	[ 29 ] = KEY_PAGEDOWN,
 	[ 19 ] = KEY_SOUND,
 
-	[ 24 ] = KEY_KPPLUSMINUS,	// CH +/-
-	[ 22 ] = KEY_SUBTITLE,		// CC
-	[ 13 ] = KEY_TEXT,		// TTX
-	[ 11 ] = KEY_TV,		// AIR/CBL
-	[ 17 ] = KEY_PC,		// PC/TV
-	[ 23 ] = KEY_OK,		// CH RTN
-	[ 25 ] = KEY_MODE, 		// FUNC
-	[ 12 ] = KEY_SEARCH, 		// AUTOSCAN
+	[ 24 ] = KEY_KPPLUSMINUS,	/* CH +/- */
+	[ 22 ] = KEY_SUBTITLE,		/* CC */
+	[ 13 ] = KEY_TEXT,		/* TTX */
+	[ 11 ] = KEY_TV,		/* AIR/CBL */
+	[ 17 ] = KEY_PC,		/* PC/TV */
+	[ 23 ] = KEY_OK,		/* CH RTN */
+	[ 25 ] = KEY_MODE, 		/* FUNC */
+	[ 12 ] = KEY_SEARCH, 		/* AUTOSCAN */
 
 	/* Not sure what to do with these ones! */
-	[ 15 ] = KEY_SELECT, 		// SOURCE
-	[ 10 ] = KEY_KPPLUS,		// +100
-	[ 20 ] = KEY_KPEQUAL,		// SYNC
-	[ 28 ] = KEY_MEDIA,             // PC/TV
+	[ 15 ] = KEY_SELECT, 		/* SOURCE */
+	[ 10 ] = KEY_KPPLUS,		/* +100 */
+	[ 20 ] = KEY_KPEQUAL,		/* SYNC */
+	[ 28 ] = KEY_MEDIA,             /* PC/TV */
 };
 
 static IR_KEYTAB_TYPE ir_codes_purpletv[IR_KEYTAB_SIZE] = {
 	[ 0x3  ] = KEY_POWER,
 	[ 0x6f ] = KEY_MUTE,
-	[ 0x10 ] = KEY_BACKSPACE,	// Recall
+	[ 0x10 ] = KEY_BACKSPACE,	/* Recall */
 
 	[ 0x11 ] = KEY_KP0,
 	[ 0x4  ] = KEY_KP1,
@@ -97,7 +97,7 @@
 	[ 0xc  ] = KEY_KP7,
 	[ 0xd  ] = KEY_KP8,
 	[ 0xe  ] = KEY_KP9,
-	[ 0x12 ] = KEY_KPDOT,		// 100+
+	[ 0x12 ] = KEY_KPDOT,		/* 100+ */
 
 	[ 0x7  ] = KEY_VOLUMEUP,
 	[ 0xb  ] = KEY_VOLUMEDOWN,
@@ -109,25 +109,16 @@
 	[ 0x13 ] = KEY_CHANNELDOWN,
 	[ 0x48 ] = KEY_ZOOM,
 
-	[ 0x1b ] = KEY_VIDEO,		// Video source
-#if 0
-	[ 0x1f ] = KEY_S,       	// Snapshot
-#endif
-	[ 0x49 ] = KEY_LANGUAGE,	// MTS Select
-	[ 0x19 ] = KEY_SEARCH,		// Auto Scan
+	[ 0x1b ] = KEY_VIDEO,		/* Video source */
+	[ 0x49 ] = KEY_LANGUAGE,	/* MTS Select */
+	[ 0x19 ] = KEY_SEARCH,		/* Auto Scan */
 
 	[ 0x4b ] = KEY_RECORD,
 	[ 0x46 ] = KEY_PLAY,
-	[ 0x45 ] = KEY_PAUSE,   	// Pause
+	[ 0x45 ] = KEY_PAUSE,   	/* Pause */
 	[ 0x44 ] = KEY_STOP,
-#if 0
-	[ 0x43 ] = KEY_T,    		// Time Shift
-	[ 0x47 ] = KEY_Y,    		// Time Shift OFF
-	[ 0x4a ] = KEY_O,    		// TOP
-	[ 0x17 ] = KEY_F,    		// SURF CH
-#endif
-	[ 0x40 ] = KEY_FORWARD,   	// Forward ?
-	[ 0x42 ] = KEY_REWIND,   	// Backward ?
+	[ 0x40 ] = KEY_FORWARD,   	/* Forward ? */
+	[ 0x42 ] = KEY_REWIND,   	/* Backward ? */
 
 };
 
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c
index b4ee9df..6239254 100644
--- a/drivers/media/video/msp3400.c
+++ b/drivers/media/video/msp3400.c
@@ -567,10 +567,6 @@
 	switch (audmode) {
 	case V4L2_TUNER_MODE_STEREO:
 		src = 0x0020 | nicam;
-#if 0
-		/* spatial effect */
-		msp3400c_write(client,I2C_MSP3400C_DFP, 0x0005,0x4000);
-#endif
 		break;
 	case V4L2_TUNER_MODE_MONO:
 		if (msp->mode == MSP_MODE_AM_NICAM) {
@@ -741,16 +737,14 @@
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule();
 		} else {
-#if 0
-			/* hmm, that one doesn't return on wakeup ... */
-			msleep_interruptible(timeout);
-#else
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(msecs_to_jiffies(timeout));
-#endif
 		}
 	}
-	try_to_freeze();
+	if (current->flags & PF_FREEZE) {
+		refrigerator ();
+	}
+
 	remove_wait_queue(&msp->wq, &wait);
 	return msp->restart;
 }
@@ -1154,17 +1148,10 @@
 					    MSP_CARRIER(10.7));
 			/* scart routing */
 			msp3400c_set_scart(client,SCART_IN2,0);
-#if 0
-			/* radio from SCART_IN2 */
-			msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0220);
-			msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0220);
-			msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0220);
-#else
 			/* msp34xx does radio decoding */
 			msp3400c_write(client,I2C_MSP3400C_DFP, 0x08, 0x0020);
 			msp3400c_write(client,I2C_MSP3400C_DFP, 0x09, 0x0020);
 			msp3400c_write(client,I2C_MSP3400C_DFP, 0x0b, 0x0020);
-#endif
 			break;
 		case 0x0003:
 		case 0x0004:
@@ -1507,10 +1494,6 @@
 		return -1;
 	}
 
-#if 0
-	/* this will turn on a 1kHz beep - might be useful for debugging... */
-	msp3400c_write(c,I2C_MSP3400C_DFP, 0x0014, 0x1040);
-#endif
 	msp3400c_setvolume(c, msp->muted, msp->volume, msp->balance);
 
 	snprintf(c->name, sizeof(c->name), "MSP34%02d%c-%c%d",
diff --git a/drivers/media/video/mt20xx.c b/drivers/media/video/mt20xx.c
index 9c005cb..2fb7c2d 100644
--- a/drivers/media/video/mt20xx.c
+++ b/drivers/media/video/mt20xx.c
@@ -511,22 +511,6 @@
 	tuner_info("microtune: companycode=%04x part=%02x rev=%02x\n",
 		   company_code,buf[0x13],buf[0x14]);
 
-#if 0
-	/* seems to cause more problems than it solves ... */
-	switch (company_code) {
-	case 0x30bf:
-	case 0x3cbf:
-	case 0x3dbf:
-	case 0x4d54:
-	case 0x8e81:
-	case 0x8e91:
-		/* ok (?) */
-		break;
-	default:
-		tuner_warn("tuner: microtune: unknown companycode\n");
-		return 0;
-	}
-#endif
 
 	if (buf[0x13] < ARRAY_SIZE(microtune_part) &&
 	    NULL != microtune_part[buf[0x13]])
diff --git a/drivers/media/video/mxb.c b/drivers/media/video/mxb.c
index 70bf1f1..486234d 100644
--- a/drivers/media/video/mxb.c
+++ b/drivers/media/video/mxb.c
@@ -326,6 +326,7 @@
 	struct mxb* mxb = (struct mxb*)dev->ext_priv;
 	struct video_decoder_init init;
 	struct i2c_msg msg;
+	struct tuner_setup tun_setup;
 
 	int i = 0, err = 0;
 	struct	tea6415c_multiplex vm;	
@@ -349,8 +350,10 @@
 	mxb->saa7111a->driver->command(mxb->saa7111a,DECODER_SET_VBI_BYPASS, &i);
 
 	/* select a tuner type */
-	i = 5; 
-	mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE, &i);
+	tun_setup.mode_mask = T_ANALOG_TV;
+	tun_setup.addr = ADDR_UNSET;
+	tun_setup.type = 5;
+	mxb->tuner->driver->command(mxb->tuner,TUNER_SET_TYPE_ADDR, &tun_setup);
 	
 	/* mute audio on tea6420s */
 	mxb->tea6420_1->driver->command(mxb->tea6420_1,TEA6420_SWITCH, &TEA6420_line[6][0]);
diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c
index e6d0a18..79d05ea 100644
--- a/drivers/media/video/saa7134/saa6752hs.c
+++ b/drivers/media/video/saa7134/saa6752hs.c
@@ -155,10 +155,6 @@
 		.target  = 256,
 	},
 
-#if 0
-	/* FIXME: size? via S_FMT? */
-	.video_format = MPEG_VIDEO_FORMAT_D1,
-#endif
 };
 
 /* ---------------------------------------------------------------------- */
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 0c781e2..88b71a2 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -1,6 +1,5 @@
-
 /*
- * $Id: saa7134-cards.c,v 1.58 2005/06/07 18:05:00 nsh Exp $
+ * $Id: saa7134-cards.c,v 1.80 2005/07/07 01:49:30 mkrufky Exp $
  *
  * device driver for philips saa7134 based TV cards
  * card-specific stuff.
@@ -47,6 +46,10 @@
 		.name		= "UNKNOWN/GENERIC",
 		.audio_clock	= 0x00187de7,
 		.tuner_type	= TUNER_ABSENT,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+
 		.inputs         = {{
 			.name = "default",
 			.vmux = 0,
@@ -58,6 +61,10 @@
 		.name		= "Proteus Pro [philips reference design]",
 		.audio_clock	= 0x00187de7,
 		.tuner_type	= TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+
 		.inputs         = {{
 			.name = name_comp1,
 			.vmux = 0,
@@ -83,6 +90,10 @@
 		.name		= "LifeView FlyVIDEO3000",
 		.audio_clock	= 0x00200000,
 		.tuner_type	= TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+
 		.gpiomask       = 0xe000,
 		.inputs         = {{
 			.name = name_tv,
@@ -90,7 +101,7 @@
 			.amux = TV,
 			.gpio = 0x8000,
 			.tv   = 1,
-                },{
+		},{
 			.name = name_tv_mono,
 			.vmux = 1,
 			.amux = LINE2,
@@ -117,12 +128,21 @@
 			.amux = LINE2,
 			.gpio = 0x2000,
 		},
+		.mute = {
+			.name = name_mute,
+			.amux = TV,
+			.gpio = 0x8000,
+		},
 	},
 	[SAA7134_BOARD_FLYVIDEO2000] = {
 		/* "TC Wan" <tcwan@cs.usm.my> */
 		.name           = "LifeView FlyVIDEO2000",
 		.audio_clock    = 0x00200000,
 		.tuner_type     = TUNER_LG_PAL_NEW_TAPC,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+
 		.gpiomask       = 0xe000,
 		.inputs         = {{
 			.name = name_tv,
@@ -146,14 +166,14 @@
 			.amux = LINE2,
 			.gpio = 0x4000,
 		}},
-                .radio = {
-                        .name = name_radio,
-                        .amux = LINE2,
+		.radio = {
+			.name = name_radio,
+			.amux = LINE2,
 			.gpio = 0x2000,
-                },
+		},
 		.mute = {
 			.name = name_mute,
-                        .amux = LINE2,
+			.amux = LINE2,
 			.gpio = 0x8000,
 		},
 	},
@@ -162,6 +182,10 @@
 		.name           = "LifeView FlyTV Platinum Mini",
 		.audio_clock    = 0x00200000,
 		.tuner_type     = TUNER_PHILIPS_TDA8290,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+
 		.inputs         = {{
 			.name = name_tv,
 			.vmux = 1,
@@ -183,6 +207,10 @@
 		.name           = "LifeView FlyTV Platinum FM",
 		.audio_clock    = 0x00200000,
 		.tuner_type     = TUNER_PHILIPS_TDA8290,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+
 		.gpiomask       = 0x1E000,	/* Set GP16 and unused 15,14,13 to Output */
 		.inputs         = {{
 			.name = name_tv,
@@ -190,7 +218,7 @@
 			.amux = TV,
 			.gpio = 0x10000,	/* GP16=1 selects TV input */
 			.tv   = 1,
-                },{
+		},{
 /*			.name = name_tv_mono,
 			.vmux = 1,
 			.amux = LINE2,
@@ -200,29 +228,38 @@
 */			.name = name_comp1,	/* Composite signal on S-Video input */
 			.vmux = 0,
 			.amux = LINE2,
-//			.gpio = 0x4000,
+/*			.gpio = 0x4000,         */
 		},{
 			.name = name_comp2,	/* Composite input */
 			.vmux = 3,
 			.amux = LINE2,
-//			.gpio = 0x4000,
+/*			.gpio = 0x4000,         */
 		},{
 			.name = name_svideo,	/* S-Video signal on S-Video input */
 			.vmux = 8,
 			.amux = LINE2,
-//			.gpio = 0x4000,
+/*			.gpio = 0x4000,         */
 		}},
 		.radio = {
 			.name = name_radio,
 			.amux = TV,
 			.gpio = 0x00000,	/* GP16=0 selects FM radio antenna */
 		},
+		.mute = {
+			.name = name_mute,
+			.amux = TV,
+			.gpio = 0x10000,
+		},
 	},
 	[SAA7134_BOARD_EMPRESS] = {
 		/* "Gert Vervoort" <gert.vervoort@philips.com> */
 		.name		= "EMPRESS",
 		.audio_clock	= 0x00187de7,
 		.tuner_type	= TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+
 		.inputs         = {{
 			.name = name_comp1,
 			.vmux = 0,
@@ -245,33 +282,40 @@
 		.video_out = CCIR656,
 	},
 	[SAA7134_BOARD_MONSTERTV] = {
-               /* "K.Ohta" <alpha292@bremen.or.jp> */
-               .name           = "SKNet Monster TV",
-               .audio_clock    = 0x00187de7,
-               .tuner_type     = TUNER_PHILIPS_NTSC_M,
-               .inputs         = {{
-                       .name = name_tv,
-                       .vmux = 1,
-                       .amux = TV,
-                       .tv   = 1,
-               },{
-                       .name = name_comp1,
-                       .vmux = 0,
-                       .amux = LINE1,
-               },{
-                       .name = name_svideo,
-                       .vmux = 8,
-                       .amux = LINE1,
-               }},
-               .radio = {
-                       .name = name_radio,
-                       .amux = LINE2,
-               },
+		/* "K.Ohta" <alpha292@bremen.or.jp> */
+		.name           = "SKNet Monster TV",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_NTSC_M,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.tv   = 1,
+		},{
+			.name = name_comp1,
+			.vmux = 0,
+			.amux = LINE1,
+		},{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE1,
+		}},
+		.radio = {
+			.name = name_radio,
+			.amux = LINE2,
+		},
 	},
 	[SAA7134_BOARD_MD9717] = {
 		.name		= "Tevion MD 9717",
 		.audio_clock	= 0x00200000,
 		.tuner_type	= TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
 			.name = name_tv,
 			.vmux = 1,
@@ -302,10 +346,13 @@
 		},
 	},
 	[SAA7134_BOARD_TVSTATION_RDS] = {
-                /* Typhoon TV Tuner RDS: Art.Nr. 50694 */
+		/* Typhoon TV Tuner RDS: Art.Nr. 50694 */
 		.name		= "KNC One TV-Station RDS / Typhoon TV Tuner RDS",
 		.audio_clock	= 0x00200000,
 		.tuner_type	= TUNER_PHILIPS_FM1216ME_MK3,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.tda9887_conf   = TDA9887_PRESENT,
 		.inputs         = {{
 			.name = name_tv,
@@ -314,10 +361,10 @@
 			.tv   = 1,
 		},{
 			.name = name_tv_mono,
-                        .vmux = 1,
-                        .amux   = LINE2,
-                        .tv   = 1,
-                },{
+			.vmux = 1,
+			.amux   = LINE2,
+			.tv   = 1,
+		},{
 
 			.name = name_svideo,
 			.vmux = 8,
@@ -328,10 +375,10 @@
 			.amux = LINE1,
 		},{
 
-                        .name = "CVid over SVid",
-                        .vmux = 0,
-                        .amux = LINE1,
-                }},
+			.name = "CVid over SVid",
+			.vmux = 0,
+			.amux = LINE1,
+		}},
 		.radio = {
 			.name = name_radio,
 			.amux = LINE2,
@@ -341,6 +388,9 @@
 		.name		= "KNC One TV-Station DVR",
 		.audio_clock	= 0x00200000,
 		.tuner_type	= TUNER_PHILIPS_FM1216ME_MK3,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.tda9887_conf	= TDA9887_PRESENT,
 		.gpiomask	= 0x820000,
 		.inputs		= {{
@@ -369,32 +419,38 @@
 		.video_out	= CCIR656,
 	},
 	[SAA7134_BOARD_CINERGY400] = {
-                .name           = "Terratec Cinergy 400 TV",
-                .audio_clock    = 0x00200000,
-                .tuner_type     = TUNER_PHILIPS_PAL,
-                .inputs         = {{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = TV,
-                        .tv   = 1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 4,
-                        .amux = LINE1,
-                },{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE1,
-                },{
-                        .name = name_comp2, // CVideo over SVideo Connector
-                        .vmux = 0,
-                        .amux = LINE1,
-                }}
-        },
+		.name           = "Terratec Cinergy 400 TV",
+		.audio_clock    = 0x00200000,
+		.tuner_type     = TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.tv   = 1,
+		},{
+			.name = name_comp1,
+			.vmux = 4,
+			.amux = LINE1,
+		},{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE1,
+		},{
+			.name = name_comp2, /* CVideo over SVideo Connector */
+			.vmux = 0,
+			.amux = LINE1,
+		}}
+	},
 	[SAA7134_BOARD_MD5044] = {
 		.name           = "Medion 5044",
-		.audio_clock    = 0x00187de7, // was: 0x00200000,
+		.audio_clock    = 0x00187de7, /* was: 0x00200000, */
 		.tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.tda9887_conf   = TDA9887_PRESENT,
 		.inputs         = {{
 			.name = name_tv,
@@ -426,57 +482,65 @@
 		},
 	},
 	[SAA7134_BOARD_KWORLD] = {
-                .name           = "Kworld/KuroutoShikou SAA7130-TVPCI",
+		.name           = "Kworld/KuroutoShikou SAA7130-TVPCI",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_NTSC_M,
-                .inputs         = {{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 3,
-                        .amux = LINE1,
-                },{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = LINE2,
-                        .tv   = 1,
-                }},
-        },
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.inputs         = {{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE1,
+		},{
+			.name = name_comp1,
+			.vmux = 3,
+			.amux = LINE1,
+		},{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = LINE2,
+			.tv   = 1,
+		}},
+	},
 	[SAA7134_BOARD_CINERGY600] = {
-                .name           = "Terratec Cinergy 600 TV",
-                .audio_clock    = 0x00200000,
-                .tuner_type     = TUNER_PHILIPS_PAL,
+		.name           = "Terratec Cinergy 600 TV",
+		.audio_clock    = 0x00200000,
+		.tuner_type     = TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.tda9887_conf   = TDA9887_PRESENT,
-                .inputs         = {{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = TV,
-                        .tv   = 1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 4,
-                        .amux = LINE1,
-                },{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE1,
-                },{
-                        .name = name_comp2, // CVideo over SVideo Connector
-                        .vmux = 0,
-                        .amux = LINE1,
-                }},
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.tv   = 1,
+		},{
+			.name = name_comp1,
+			.vmux = 4,
+			.amux = LINE1,
+		},{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE1,
+		},{
+			.name = name_comp2, /* CVideo over SVideo Connector */
+			.vmux = 0,
+			.amux = LINE1,
+		}},
 		.radio = {
 			.name = name_radio,
 			.amux = LINE2,
-               },
-        },
+	},
+	},
 	[SAA7134_BOARD_MD7134] = {
 		.name           = "Medion 7134",
-		//.audio_clock    = 0x00200000,
 		.audio_clock    = 0x00187de7,
-		.tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
+		.tuner_type     = TUNER_PHILIPS_FMD1216ME_MK3,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.tda9887_conf   = TDA9887_PRESENT,
 		.mpeg           = SAA7134_MPEG_DVB,
 		.inputs = {{
@@ -504,6 +568,9 @@
 		.name           = "Typhoon TV+Radio 90031",
 		.audio_clock    = 0x00200000,
 		.tuner_type     = TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.tda9887_conf   = TDA9887_PRESENT,
 		.inputs         = {{
 			.name   = name_tv,
@@ -523,11 +590,14 @@
 			.name   = name_radio,
 			.amux   = LINE2,
 		},
-        },
+	},
 	[SAA7134_BOARD_ELSA] = {
 		.name           = "ELSA EX-VISION 300TV",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_HITACHI_NTSC,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
 			.name = name_svideo,
 			.vmux = 8,
@@ -542,11 +612,14 @@
 			.amux = LINE2,
 			.tv   = 1,
 		}},
-        },
+	},
 	[SAA7134_BOARD_ELSA_500TV] = {
 		.name           = "ELSA EX-VISION 500TV",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_HITACHI_NTSC,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
 			.name = name_svideo,
 			.vmux = 7,
@@ -562,83 +635,100 @@
 			.amux = LINE2,
 			.tv   = 1,
 		}},
-        },
-	[SAA7134_BOARD_ASUSTeK_TVFM7134] = {
-                .name           = "ASUS TV-FM 7134",
-                .audio_clock    = 0x00187de7,
-                .tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
-                .tda9887_conf   = TDA9887_PRESENT,
-                .inputs         = {{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = TV,
-                        .tv   = 1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 4,
-                        .amux = LINE2,
-                },{
-                        .name = name_svideo,
-                        .vmux = 6,
-                        .amux = LINE2,
-                }},
-                .radio = {
-                        .name = name_radio,
-                        .amux = LINE1,
-                },
 	},
-	[SAA7135_BOARD_ASUSTeK_TVFM7135] = {
-                .name           = "ASUS TV-FM 7135",
-                .audio_clock    = 0x00187de7,
-                .tuner_type     = TUNER_PHILIPS_TDA8290,
+	[SAA7134_BOARD_ASUSTeK_TVFM7134] = {
+		.name           = "ASUS TV-FM 7134",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.tda9887_conf   = TDA9887_PRESENT,
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.tv   = 1,
+		},{
+			.name = name_comp1,
+			.vmux = 4,
+			.amux = LINE2,
+		},{
+			.name = name_svideo,
+			.vmux = 6,
+			.amux = LINE2,
+		}},
+		.radio = {
+			.name = name_radio,
+			.amux = LINE1,
+		},
+	},
+	[SAA7134_BOARD_ASUSTeK_TVFM7135] = {
+		.name           = "ASUS TV-FM 7135",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_TDA8290,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.gpiomask       = 0x200000,
-                .inputs         = {{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = TV,
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
 			.gpio = 0x0000,
-                        .tv   = 1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 4,
-                        .amux = LINE2,
+			.tv   = 1,
+		},{
+			.name = name_comp1,
+			.vmux = 4,
+			.amux = LINE2,
 			.gpio = 0x0000,
-                },{
-                        .name = name_svideo,
-                        .vmux = 6,
-                        .amux = LINE2,
+		},{
+			.name = name_svideo,
+			.vmux = 6,
+			.amux = LINE2,
 			.gpio = 0x0000,
-                }},
-                .radio = {
-                        .name = name_radio,
-                        .amux = TV,
+		}},
+		.radio = {
+			.name = name_radio,
+			.amux = TV,
 			.gpio = 0x200000,
-                },
+		},
+		.mute  = {
+			.name = name_mute,
+			.gpio = 0x0000,
+		},
+
 	},
 	[SAA7134_BOARD_VA1000POWER] = {
-                .name           = "AOPEN VA1000 POWER",
+		.name           = "AOPEN VA1000 POWER",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_NTSC,
-                .inputs         = {{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 3,
-                        .amux = LINE1,
-                },{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = LINE2,
-                        .tv   = 1,
-                }},
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.inputs         = {{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE1,
+		},{
+			.name = name_comp1,
+			.vmux = 3,
+			.amux = LINE1,
+		},{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = LINE2,
+			.tv   = 1,
+		}},
 	},
 	[SAA7134_BOARD_10MOONSTVMASTER] = {
 		/* "lilicheng" <llc@linuxfans.org> */
 		.name           = "10MOONS PCI TV CAPTURE CARD",
 		.audio_clock    = 0x00200000,
 		.tuner_type     = TUNER_LG_PAL_NEW_TAPC,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.gpiomask       = 0xe000,
 		.inputs         = {{
 			.name = name_tv,
@@ -662,14 +752,14 @@
 			.amux = LINE2,
 			.gpio = 0x4000,
 		}},
-                .radio = {
-                        .name = name_radio,
-                        .amux = LINE2,
+		.radio = {
+			.name = name_radio,
+			.amux = LINE2,
 			.gpio = 0x2000,
-                },
+		},
 		.mute = {
 			.name = name_mute,
-                        .amux = LINE2,
+			.amux = LINE2,
 			.gpio = 0x8000,
 		},
 	},
@@ -678,6 +768,9 @@
 		.name		= "BMK MPEX No Tuner",
 		.audio_clock	= 0x200000,
 		.tuner_type	= TUNER_ABSENT,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
 			.name = name_comp1,
 			.vmux = 4,
@@ -706,80 +799,94 @@
 		.name           = "Compro VideoMate TV",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_NTSC_M,
-                .inputs         = {{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 3,
-                        .amux = LINE1,
-                },{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = LINE2,
-                        .tv   = 1,
-                }},
-        },
-    [SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS] = {
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.inputs         = {{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE1,
+		},{
+			.name = name_comp1,
+			.vmux = 3,
+			.amux = LINE1,
+		},{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = LINE2,
+			.tv   = 1,
+		}},
+	},
+	[SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS] = {
 		.name           = "Compro VideoMate TV Gold+",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_NTSC_M,
 		.gpiomask       = 0x800c0000,
-                .inputs         = {{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE1,
-                        .gpio = 0x06c00012,
-                },{
-                        .name = name_comp1,
-                        .vmux = 3,
-                        .amux = LINE1,
-                        .gpio = 0x0ac20012,
-                },{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = LINE2,
-                        .gpio = 0x08c20012,
-                        .tv   = 1,
-                }},
-        },
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.inputs         = {{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE1,
+			.gpio = 0x06c00012,
+		},{
+			.name = name_comp1,
+			.vmux = 3,
+			.amux = LINE1,
+			.gpio = 0x0ac20012,
+		},{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = LINE2,
+			.gpio = 0x08c20012,
+			.tv   = 1,
+		}},				/* radio and probably mute is missing */
+	},
 	[SAA7134_BOARD_CRONOS_PLUS] = {
-		/* gpio pins:
-		   0  .. 3   BASE_ID
-		   4  .. 7   PROTECT_ID
-		   8  .. 11  USER_OUT
-		   12 .. 13  USER_IN
-		   14 .. 15  VIDIN_SEL */
+		/*
+		gpio pins:
+			0  .. 3   BASE_ID
+			4  .. 7   PROTECT_ID
+			8  .. 11  USER_OUT
+			12 .. 13  USER_IN
+			14 .. 15  VIDIN_SEL
+		*/
 		.name           = "Matrox CronosPlus",
 		.tuner_type     = TUNER_ABSENT,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.gpiomask       = 0xcf00,
-                .inputs         = {{
-                        .name = name_comp1,
-                        .vmux = 0,
+		.inputs         = {{
+			.name = name_comp1,
+			.vmux = 0,
 			.gpio = 2 << 14,
 		},{
-                        .name = name_comp2,
-                        .vmux = 0,
+			.name = name_comp2,
+			.vmux = 0,
 			.gpio = 1 << 14,
 		},{
-                        .name = name_comp3,
-                        .vmux = 0,
+			.name = name_comp3,
+			.vmux = 0,
 			.gpio = 0 << 14,
 		},{
-                        .name = name_comp4,
-                        .vmux = 0,
+			.name = name_comp4,
+			.vmux = 0,
 			.gpio = 3 << 14,
 		},{
 			.name = name_svideo,
 			.vmux = 8,
 			.gpio = 2 << 14,
-                }},
-        },
+		}},
+	},
 	[SAA7134_BOARD_MD2819] = {
 		.name           = "AverMedia M156 / Medion 2819",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_FM1216ME_MK3,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.tda9887_conf   = TDA9887_PRESENT,
 		.inputs         = {{
 			.name = name_tv,
@@ -809,6 +916,9 @@
 		.name           = "BMK MPEX Tuner",
 		.audio_clock    = 0x200000,
 		.tuner_type     = TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
 			.name = name_comp1,
 			.vmux = 1,
@@ -825,62 +935,72 @@
 		}},
 		.mpeg      = SAA7134_MPEG_EMPRESS,
 		.video_out = CCIR656,
-        },
-        [SAA7134_BOARD_ASUSTEK_TVFM7133] = {
-                .name           = "ASUS TV-FM 7133",
-                .audio_clock    = 0x00187de7,
-		// probably wrong, the 7133 one is the NTSC version ...
-		// .tuner_type     = TUNER_PHILIPS_FM1236_MK3
-                .tuner_type     = TUNER_LG_NTSC_NEW_TAPC,
-                .tda9887_conf   = TDA9887_PRESENT,
-                .inputs         = {{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = TV,
-                        .tv   = 1,
+	},
+	[SAA7134_BOARD_ASUSTEK_TVFM7133] = {
+		.name           = "ASUS TV-FM 7133",
+		.audio_clock    = 0x00187de7,
+		/* probably wrong, the 7133 one is the NTSC version ...
+		* .tuner_type  = TUNER_PHILIPS_FM1236_MK3 */
+		.tuner_type     = TUNER_LG_NTSC_NEW_TAPC,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.tda9887_conf   = TDA9887_PRESENT,
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.tv   = 1,
+
 		},{
-                        .name = name_comp1,
-                        .vmux = 4,
-                        .amux = LINE2,
-                },{
-                        .name = name_svideo,
-                        .vmux = 6,
-                        .amux = LINE2,
-                }},
-                .radio = {
-                        .name = name_radio,
-                        .amux = LINE1,
-                },
-        },
+			.name = name_comp1,
+			.vmux = 4,
+			.amux = LINE2,
+		},{
+			.name = name_svideo,
+			.vmux = 6,
+			.amux = LINE2,
+		}},
+		.radio = {
+			.name = name_radio,
+			.amux = LINE1,
+		},
+	},
 	[SAA7134_BOARD_PINNACLE_PCTV_STEREO] = {
-                .name           = "Pinnacle PCTV Stereo (saa7134)",
-                .audio_clock    = 0x00187de7,
-                .tuner_type     = TUNER_MT2032,
-                .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER,
-                .inputs         = {{
-                        .name = name_tv,
-                        .vmux = 3,
-                        .amux = TV,
-                        .tv   = 1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 0,
-                        .amux = LINE2,
-                },{
-                        .name = name_comp2,
-                        .vmux = 1,
-                        .amux = LINE2,
-                },{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE2,
-                }},
-        },
+		.name           = "Pinnacle PCTV Stereo (saa7134)",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_MT2032,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER,
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 3,
+			.amux = TV,
+			.tv   = 1,
+		},{
+			.name = name_comp1,
+			.vmux = 0,
+			.amux = LINE2,
+		},{
+			.name = name_comp2,
+			.vmux = 1,
+			.amux = LINE2,
+		},{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE2,
+		}},
+	},
 	[SAA7134_BOARD_MANLI_MTV002] = {
 		/* Ognjen Nastic <ognjen@logosoft.ba> */
 		.name           = "Manli MuchTV M-TV002/Behold TV 403 FM",
 		.audio_clock    = 0x00200000,
 		.tuner_type     = TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
 			.name = name_svideo,
 			.vmux = 8,
@@ -905,6 +1025,9 @@
 		.name           = "Manli MuchTV M-TV001/Behold TV 401",
 		.audio_clock    = 0x00200000,
 		.tuner_type     = TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
 			.name = name_svideo,
 			.vmux = 8,
@@ -921,14 +1044,17 @@
 		}},
 		.mute = {
 			.name = name_mute,
-                        .amux = LINE1,
+			.amux = LINE1,
 		},
-        },
+	},
 	[SAA7134_BOARD_TG3000TV] = {
 		/* TransGear 3000TV */
 		.name           = "Nagase Sangyo TransGear 3000TV",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_NTSC_M,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
 			.name = name_tv,
 			.vmux = 1,
@@ -944,81 +1070,90 @@
 			.amux = LINE2,
 		}},
 	},
-        [SAA7134_BOARD_ECS_TVP3XP] = {
-                .name           = "Elitegroup ECS TVP3XP FM1216 Tuner Card(PAL-BG,FM) ",
-                .audio_clock    = 0x187de7,  // xtal 32.1 MHz
-                .tuner_type     = TUNER_PHILIPS_PAL,
-                .inputs         = {{
-                        .name   = name_tv,
-                        .vmux   = 1,
-                        .amux   = TV,
-                        .tv     = 1,
-                },{
-                        .name   = name_tv_mono,
-                        .vmux   = 1,
-                        .amux   = LINE2,
-                        .tv     = 1,
-                },{
-                        .name   = name_comp1,
-                        .vmux   = 3,
-                        .amux   = LINE1,
-                },{
-                        .name   = name_svideo,
-                        .vmux   = 8,
-                        .amux   = LINE1,
+	[SAA7134_BOARD_ECS_TVP3XP] = {
+		.name           = "Elitegroup ECS TVP3XP FM1216 Tuner Card(PAL-BG,FM) ",
+		.audio_clock    = 0x187de7,  /* xtal 32.1 MHz */
+		.tuner_type     = TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.inputs         = {{
+			.name   = name_tv,
+			.vmux   = 1,
+			.amux   = TV,
+			.tv     = 1,
+		},{
+			.name   = name_tv_mono,
+			.vmux   = 1,
+			.amux   = LINE2,
+			.tv     = 1,
+		},{
+			.name   = name_comp1,
+			.vmux   = 3,
+			.amux   = LINE1,
+		},{
+			.name   = name_svideo,
+			.vmux   = 8,
+			.amux   = LINE1,
 		},{
 			.name   = "CVid over SVid",
 			.vmux   = 0,
 			.amux   = LINE1,
 		}},
-                .radio = {
-                        .name   = name_radio,
-                        .amux   = LINE2,
-                },
-        },
-        [SAA7134_BOARD_ECS_TVP3XP_4CB5] = {
-                .name           = "Elitegroup ECS TVP3XP FM1236 Tuner Card (NTSC,FM)",
-                .audio_clock    = 0x187de7,
-                .tuner_type     = TUNER_PHILIPS_NTSC,
-                .inputs         = {{
-                        .name   = name_tv,
-                        .vmux   = 1,
-                        .amux   = TV,
-                        .tv     = 1,
-                },{
-                        .name   = name_tv_mono,
-                        .vmux   = 1,
-                        .amux   = LINE2,
-                        .tv     = 1,
-                },{
-                        .name   = name_comp1,
-                        .vmux   = 3,
-                        .amux   = LINE1,
-                },{
-                        .name   = name_svideo,
-                        .vmux   = 8,
-                        .amux   = LINE1,
-                },{
-                        .name   = "CVid over SVid",
-                        .vmux   = 0,
-                        .amux   = LINE1,
-                }},
-                .radio = {
-                        .name   = name_radio,
-                        .amux   = LINE2,
-                },
-        },
+		.radio = {
+			.name   = name_radio,
+			.amux   = LINE2,
+		},
+	},
+	[SAA7134_BOARD_ECS_TVP3XP_4CB5] = {
+		.name           = "Elitegroup ECS TVP3XP FM1236 Tuner Card (NTSC,FM)",
+		.audio_clock    = 0x187de7,
+		.tuner_type     = TUNER_PHILIPS_NTSC,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.inputs         = {{
+			.name   = name_tv,
+			.vmux   = 1,
+			.amux   = TV,
+			.tv     = 1,
+		},{
+			.name   = name_tv_mono,
+			.vmux   = 1,
+			.amux   = LINE2,
+			.tv     = 1,
+		},{
+			.name   = name_comp1,
+			.vmux   = 3,
+			.amux   = LINE1,
+		},{
+			.name   = name_svideo,
+			.vmux   = 8,
+			.amux   = LINE1,
+		},{
+			.name   = "CVid over SVid",
+			.vmux   = 0,
+			.amux   = LINE1,
+		}},
+		.radio = {
+			.name   = name_radio,
+			.amux   = LINE2,
+		},
+	},
 	[SAA7134_BOARD_AVACSSMARTTV] = {
 		/* Roman Pszonczenko <romka@kolos.math.uni.lodz.pl> */
 		.name           = "AVACS SmartTV",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
 			.name = name_tv,
 			.vmux = 1,
 			.amux = TV,
 			.tv   = 1,
-                },{
+		},{
 			.name = name_tv_mono,
 			.vmux = 1,
 			.amux = LINE2,
@@ -1047,6 +1182,9 @@
 		.name           = "AVerMedia DVD EZMaker",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_ABSENT,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
 			.name = name_comp1,
 			.vmux = 3,
@@ -1055,28 +1193,34 @@
 			.vmux = 8,
 		}},
 	},
-        [SAA7134_BOARD_NOVAC_PRIMETV7133] = {
-                /* toshii@netbsd.org */
-                .name           = "Noval Prime TV 7133",
-                .audio_clock    = 0x00200000,
-                .tuner_type     = TUNER_ALPS_TSBH1_NTSC,
-                .inputs         = {{
-                        .name = name_comp1,
-                        .vmux = 3,
-                },{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = TV,
-                        .tv   = 1,
-                },{
-                        .name = name_svideo,
-                        .vmux = 8,
-                }},
-        },
+	[SAA7134_BOARD_NOVAC_PRIMETV7133] = {
+		/* toshii@netbsd.org */
+		.name           = "Noval Prime TV 7133",
+		.audio_clock    = 0x00200000,
+		.tuner_type     = TUNER_ALPS_TSBH1_NTSC,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.inputs         = {{
+			.name = name_comp1,
+			.vmux = 3,
+		},{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.tv   = 1,
+		},{
+			.name = name_svideo,
+			.vmux = 8,
+		}},
+	},
 	[SAA7134_BOARD_AVERMEDIA_STUDIO_305] = {
 		.name           = "AverMedia AverTV Studio 305",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_FM1256_IH3,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.tda9887_conf   = TDA9887_PRESENT,
 		.inputs         = {{
 			.name = name_tv,
@@ -1097,35 +1241,41 @@
 			.amux = LINE2,
 		}},
 		.radio = {
-			 .name = name_radio,
-			 .amux = LINE2,
-		 },
+			.name = name_radio,
+			.amux = LINE2,
+		},
 		.mute = {
-			 .name = name_mute,
-			 .amux = LINE1,
+			.name = name_mute,
+			.amux = LINE1,
 		},
 	},
-  	[SAA7133_BOARD_UPMOST_PURPLE_TV] = {
-  		.name           = "UPMOST PURPLE TV",
-  		.audio_clock    = 0x00187de7,
-  		.tuner_type     = TUNER_PHILIPS_FM1236_MK3,
-  		.tda9887_conf   = TDA9887_PRESENT,
-  		.inputs         = {{
-  			.name = name_tv,
-  			.vmux = 7,
-  			.amux = TV,
-  			.tv   = 1,
-  		},{
-  			.name = name_svideo,
-  			.vmux = 7,
-  			.amux = LINE1,
-  		}},
+	[SAA7134_BOARD_UPMOST_PURPLE_TV] = {
+		.name           = "UPMOST PURPLE TV",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_FM1236_MK3,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.tda9887_conf   = TDA9887_PRESENT,
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 7,
+			.amux = TV,
+			.tv   = 1,
+		},{
+			.name = name_svideo,
+			.vmux = 7,
+			.amux = LINE1,
+		}},
 	},
 	[SAA7134_BOARD_ITEMS_MTV005] = {
 		/* Norman Jonas <normanjonas@arcor.de> */
 		.name           = "Items MuchTV Plus / IT-005",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
 			.name = name_tv,
 			.vmux = 3,
@@ -1149,27 +1299,30 @@
 		.name           = "Terratec Cinergy 200 TV",
 		.audio_clock    = 0x00200000,
 		.tuner_type     = TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
-       			.name = name_tv,
+			.name = name_tv,
 			.vmux = 1,
 			.amux = LINE2,
 			.tv   = 1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 4,
-                        .amux = LINE1,
-                },{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE1,
-                },{
-                        .name = name_comp2, // CVideo over SVideo Connector
-                        .vmux = 0,
-                        .amux = LINE1,
+		},{
+			.name = name_comp1,
+			.vmux = 4,
+			.amux = LINE1,
+		},{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE1,
+		},{
+			.name = name_comp2, /* CVideo over SVideo Connector */
+			.vmux = 0,
+			.amux = LINE1,
 		}},
 		.mute = {
-			 .name = name_mute,
-			 .amux = LINE2,
+			.name = name_mute,
+			.amux = LINE2,
 		},
 	},
 	[SAA7134_BOARD_VIDEOMATE_TV_PVR] = {
@@ -1177,84 +1330,96 @@
 		.name           = "Compro VideoMate TV PVR/FM",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_NTSC_M,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.gpiomask	= 0x808c0080,
-                .inputs         = {{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE1,
+		.inputs         = {{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE1,
 			.gpio = 0x00080,
-                },{
-                        .name = name_comp1,
-                        .vmux = 3,
-                        .amux = LINE1,
+		},{
+			.name = name_comp1,
+			.vmux = 3,
+			.amux = LINE1,
 			.gpio = 0x00080,
-                },{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = LINE2_LEFT,
-                        .tv   = 1,
+		},{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = LINE2_LEFT,
+			.tv   = 1,
 			.gpio = 0x00080,
-                }},
+		}},
 		.radio = {
 			.name = name_radio,
 			.amux = LINE2,
 			.gpio = 0x80000,
-		 },
+		},
 		.mute = {
 			.name = name_mute,
-                        .amux = LINE2,
+			.amux = LINE2,
 			.gpio = 0x40000,
 		},
-        },
-        [SAA7134_BOARD_SABRENT_SBTTVFM] = {
+	},
+	[SAA7134_BOARD_SABRENT_SBTTVFM] = {
 		/* Michael Rodriguez-Torrent <mrtorrent@asu.edu> */
-                .name           = "Sabrent SBT-TVFM (saa7130)",
-                .audio_clock    = 0x00187de7,
-                .tuner_type     = TUNER_PHILIPS_NTSC_M,
-                .inputs         = {{
+		.name           = "Sabrent SBT-TVFM (saa7130)",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_NTSC_M,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.inputs         = {{
 			.name = name_comp1,
 			.vmux = 1,
 			.amux = LINE2,
 		},{
-                        .name = name_tv,
-                        .vmux = 3,
-                        .amux = LINE2,
-                        .tv   = 1,
-                },{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE2,
-                }},
-                .radio = {
-                        .name   = name_radio,
-                        .amux   = LINE2,
-                },
-        },
+			.name = name_tv,
+			.vmux = 3,
+			.amux = LINE2,
+			.tv   = 1,
+		},{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE2,
+		}},
+		.radio = {
+			.name   = name_radio,
+			.amux   = LINE2,
+		},
+	},
 	[SAA7134_BOARD_ZOLID_XPERT_TV7134] = {
 		/* Helge Jensen <helge.jensen@slog.dk> */
-                .name           = ":Zolid Xpert TV7134",
+		.name           = ":Zolid Xpert TV7134",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_NTSC,
-                .inputs         = {{
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.inputs         = {{
 			.name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 3,
-                        .amux = LINE1,
-                },{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = LINE2,
-                        .tv   = 1,
-                }},
+			.vmux = 8,
+			.amux = LINE1,
+		},{
+			.name = name_comp1,
+			.vmux = 3,
+			.amux = LINE1,
+		},{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = LINE2,
+			.tv   = 1,
+		}},
 	},
 	[SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE] = {
 		/* "Matteo Az" <matte.az@nospam.libero.it> ;-) */
 		.name           = "Empire PCI TV-Radio LE",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.gpiomask       = 0x4000,
 		.inputs         = {{
 			.name = name_tv_mono,
@@ -1273,18 +1438,18 @@
 			.amux = LINE1,
 			.gpio = 0x8000,
 		}},
-                .radio = {
-			 .name = name_radio,
-			 .amux = LINE1,
-			 .gpio = 0x8000,
-		 },
+		.radio = {
+			.name = name_radio,
+			.amux = LINE1,
+			.gpio = 0x8000,
+		},
 		.mute = {
-			 .name = name_mute,
-			 .amux = TV,
-			 .gpio =0x8000,
-		 }
+			.name = name_mute,
+			.amux = TV,
+			.gpio =0x8000,
+		}
 	},
-        [SAA7134_BOARD_AVERMEDIA_STUDIO_307] = {
+	[SAA7134_BOARD_AVERMEDIA_STUDIO_307] = {
 		/*
 		Nickolay V. Shmyrev <nshmyrev@yandex.ru>
 		Lots of thanks to Andrey Zolotarev <zolotarev_andrey@mail.ru>
@@ -1292,6 +1457,9 @@
 		.name           = "Avermedia AVerTV Studio 307",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_FM1256_IH3,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.tda9887_conf   = TDA9887_PRESENT,
 		.gpiomask       = 0x03,
 		.inputs         = {{
@@ -1321,13 +1489,21 @@
 			.amux = LINE1,
 			.gpio = 0x01,
 		},
-        },
-        [SAA7134_BOARD_AVERMEDIA_GO_007_FM] = {
+		.mute  = {
+			.name = name_mute,
+			.amux = LINE1,
+			.gpio = 0x00,
+		},
+	},
+	[SAA7134_BOARD_AVERMEDIA_GO_007_FM] = {
 		.name           = "Avermedia AVerTV GO 007 FM",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_TDA8290,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.gpiomask       = 0x00300003,
-//		.gpiomask       = 0x8c240003,
+		/* .gpiomask       = 0x8c240003, */
 		.inputs         = {{
 			.name = name_tv,
 			.vmux = 1,
@@ -1350,16 +1526,24 @@
 			.amux = LINE1,
 			.gpio = 0x00300001,
 		},
-        },
+		.mute = {
+			.name = name_mute,
+			.amux = TV,
+			.gpio = 0x01,
+		},
+	},
 	[SAA7134_BOARD_AVERMEDIA_CARDBUS] = {
-		/* Jon Westgate <oryn@oryn.fsck.tv> */
-		.name           = "AVerMedia Cardbus TV/Radio",
-		.audio_clock    = 0x00200000,
-		.tuner_type     = TUNER_PHILIPS_PAL,
+		/* Kees.Blom@cwi.nl */
+		.name           = "AVerMedia Cardbus TV/Radio (E500)",
+		.audio_clock    = 0x187de7,
+		.tuner_type     = TUNER_PHILIPS_TDA8290,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.inputs         = {{
 			.name = name_tv,
 			.vmux = 1,
-			.amux = LINE2,
+			.amux = TV,
 			.tv   = 1,
 		},{
 			.name = name_comp1,
@@ -1368,10 +1552,10 @@
 		},{
 			.name = name_svideo,
 			.vmux = 8,
-			.amux = LINE2,
+			.amux = LINE1,
 		}},
 		.radio = {
-                	.name = name_radio,
+			.name = name_radio,
 			.amux = LINE1,
 		},
 	},
@@ -1379,119 +1563,134 @@
 		.name           = "Terratec Cinergy 400 mobile",
 		.audio_clock    = 0x187de7,
 		.tuner_type     = TUNER_ALPS_TSBE5_PAL,
-  		.tda9887_conf   = TDA9887_PRESENT,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.tda9887_conf   = TDA9887_PRESENT,
 		.inputs         = {{
-       			.name = name_tv,
+			.name = name_tv,
 			.vmux = 1,
 			.amux = TV,
 			.tv   = 1,
-               },{
+		},{
 			.name = name_tv_mono,
 			.vmux = 1,
 			.amux = LINE2,
 			.tv   = 1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 3,
-                        .amux = LINE1,
-                },{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE1,
+		},{
+			.name = name_comp1,
+			.vmux = 3,
+			.amux = LINE1,
+		},{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE1,
 		}},
 	},
 	[SAA7134_BOARD_CINERGY600_MK3] = {
-                .name           = "Terratec Cinergy 600 TV MK3",
-                .audio_clock    = 0x00200000,
+		.name           = "Terratec Cinergy 600 TV MK3",
+		.audio_clock    = 0x00200000,
 		.tuner_type	= TUNER_PHILIPS_FM1216ME_MK3,
-  		.tda9887_conf   = TDA9887_PRESENT,
-                .inputs         = {{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = TV,
-                        .tv   = 1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 4,
-                        .amux = LINE1,
-                },{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE1,
-                },{
-                        .name = name_comp2, // CVideo over SVideo Connector
-                        .vmux = 0,
-                        .amux = LINE1,
-                }},
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.tda9887_conf   = TDA9887_PRESENT,
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.tv   = 1,
+		},{
+			.name = name_comp1,
+			.vmux = 4,
+			.amux = LINE1,
+		},{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE1,
+		},{
+			.name = name_comp2, /* CVideo over SVideo Connector */
+			.vmux = 0,
+			.amux = LINE1,
+		}},
 		.radio = {
 			.name = name_radio,
 			.amux = LINE2,
-               },
-        },
- 	[SAA7134_BOARD_VIDEOMATE_GOLD_PLUS] = {
- 		/* Dylan Walkden <dylan_walkden@hotmail.com> */
- 		.name		= "Compro VideoMate Gold+ Pal",
- 		.audio_clock	= 0x00187de7,
- 		.tuner_type	= TUNER_PHILIPS_PAL,
- 		.gpiomask	= 0x1ce780,
- 		.inputs		= {{
- 			.name = name_svideo,
- 			.vmux = 0,		// CVideo over SVideo Connector - ok?
- 			.amux = LINE1,
- 			.gpio = 0x008080,
- 		},{
- 			.name = name_comp1,
- 			.vmux = 3,
- 			.amux = LINE1,
- 			.gpio = 0x008080,
- 		},{
- 			.name = name_tv,
- 			.vmux = 1,
- 			.amux = TV,
- 			.tv   = 1,
- 			.gpio = 0x008080,
- 		}},
- 		.radio = {
- 			.name = name_radio,
- 			.amux = LINE2,
- 			.gpio = 0x80000,
- 		},
- 		.mute = {
- 			.name = name_mute,
- 			.amux = LINE2,
- 			.gpio = 0x0c8000,
- 		},
- 	},
+		},
+	},
+	[SAA7134_BOARD_VIDEOMATE_GOLD_PLUS] = {
+		/* Dylan Walkden <dylan_walkden@hotmail.com> */
+		.name		= "Compro VideoMate Gold+ Pal",
+		.audio_clock	= 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_PAL,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.gpiomask	= 0x1ce780,
+		.inputs		= {{
+			.name = name_svideo,
+			.vmux = 0,		/* CVideo over SVideo Connector - ok? */
+			.amux = LINE1,
+			.gpio = 0x008080,
+		},{
+			.name = name_comp1,
+			.vmux = 3,
+			.amux = LINE1,
+			.gpio = 0x008080,
+		},{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.tv   = 1,
+			.gpio = 0x008080,
+		}},
+		.radio = {
+			.name = name_radio,
+			.amux = LINE2,
+			.gpio = 0x80000,
+		},
+		.mute = {
+			.name = name_mute,
+			.amux = LINE2,
+			.gpio = 0x0c8000,
+		},
+	},
 	[SAA7134_BOARD_PINNACLE_300I_DVBT_PAL] = {
-                .name           = "Pinnacle PCTV 300i DVB-T + PAL",
-                .audio_clock    = 0x00187de7,
-                .tuner_type     = TUNER_MT2032,
-                .tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER,
+		.name           = "Pinnacle PCTV 300i DVB-T + PAL",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_MT2032,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.tda9887_conf   = TDA9887_PRESENT | TDA9887_INTERCARRIER,
 		.mpeg           = SAA7134_MPEG_DVB,
-                .inputs         = {{
-                        .name = name_tv,
-                        .vmux = 3,
-                        .amux = TV,
-                        .tv   = 1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 0,
-                        .amux = LINE2,
-                },{
-                        .name = name_comp2,
-                        .vmux = 1,
-                        .amux = LINE2,
-                },{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE2,
-                }},
-        },
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 3,
+			.amux = TV,
+			.tv   = 1,
+		},{
+			.name = name_comp1,
+			.vmux = 0,
+			.amux = LINE2,
+		},{
+			.name = name_comp2,
+			.vmux = 1,
+			.amux = LINE2,
+		},{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE2,
+		}},
+	},
 	[SAA7134_BOARD_PROVIDEO_PV952] = {
 		/* andreas.kretschmer@web.de */
 		.name		= "ProVideo PV952",
 		.audio_clock	= 0x00187de7,
 		.tuner_type	= TUNER_PHILIPS_FM1216ME_MK3,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.tda9887_conf   = TDA9887_PRESENT,
 		.inputs         = {{
 			.name = name_comp1,
@@ -1515,10 +1714,13 @@
 	},
 	[SAA7134_BOARD_AVERMEDIA_305] = {
 		/* much like the "studio" version but without radio
-		 * and another tuner (sirspiritus@yandex.ru) */
+		* and another tuner (sirspiritus@yandex.ru) */
 		.name           = "AverMedia AverTV/305",
 		.audio_clock    = 0x00187de7,
 		.tuner_type     = TUNER_PHILIPS_FQ1216ME,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
 		.tda9887_conf   = TDA9887_PRESENT,
 		.inputs         = {{
 			.name = name_tv,
@@ -1539,115 +1741,268 @@
 			.amux = LINE2,
 		}},
 		.mute = {
-			 .name = name_mute,
-			 .amux = LINE1,
+			.name = name_mute,
+			.amux = LINE1,
 		},
 	},
 	[SAA7134_BOARD_FLYDVBTDUO] = {
 		/* LifeView FlyDVB-T DUO */
-		/* "Nico Sabbi <nsabbi@tiscali.it> */
+		/* "Nico Sabbi <nsabbi@tiscali.it>  Hartmut Hackmann hartmut.hackmann@t-online.de*/
 		.name           = "LifeView FlyDVB-T DUO",
 		.audio_clock    = 0x00200000,
 		.tuner_type     = TUNER_PHILIPS_TDA8290,
-//		.gpiomask       = 0xe000,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.mpeg           = SAA7134_MPEG_DVB,
 		.inputs         = {{
 			.name = name_tv,
 			.vmux = 1,
 			.amux = TV,
-//			.gpio = 0x0000,
 			.tv   = 1,
-                },{
+		},{
 			.name = name_comp1,	/* Composite signal on S-Video input */
 			.vmux = 0,
 			.amux = LINE2,
-//			.gpio = 0x4000,
 		},{
 			.name = name_comp2,	/* Composite input */
 			.vmux = 3,
 			.amux = LINE2,
-//			.gpio = 0x4000,
 		},{
 			.name = name_svideo,	/* S-Video signal on S-Video input */
 			.vmux = 8,
 			.amux = LINE2,
-//			.gpio = 0x4000,
 		}},
 	},
-        [SAA7134_BOARD_AVERMEDIA_307] = {
-               /*
-                 Davydov Vladimir <vladimir@iqmedia.com>
-               */
-               .name           = "Avermedia AVerTV 307",
-               .audio_clock    = 0x00187de7,
-               .tuner_type     = TUNER_PHILIPS_FQ1216ME,
-               .tda9887_conf   = TDA9887_PRESENT,
-               .inputs         = {{
-                       .name = name_tv,
-                       .vmux = 1,
-                       .amux = TV,
-                       .tv   = 1,
-               },{
-                       .name = name_comp1,
-                       .vmux = 0,
-                       .amux = LINE1,
-               },{
-                       .name = name_comp2,
-                       .vmux = 3,
-                       .amux = LINE1,
-               },{
-                       .name = name_svideo,
-                       .vmux = 8,
-                       .amux = LINE1,
-               }},
-        },
-	[SAA7134_BOARD_ADS_INSTANT_TV] = {
-                .name           = "ADS Tech Instant TV (saa7135)",
+	[SAA7134_BOARD_PHILIPS_TOUGH] = {
+		.name           = "Philips TOUGH DVB-T reference design",
+		.tuner_type	= TUNER_ABSENT,
 		.audio_clock    = 0x00187de7,
-                .tuner_type     = TUNER_PHILIPS_TDA8290,
-                .inputs         = {{
-                        .name = name_tv,
-                        .vmux = 1,
-                        .amux = TV,
-                        .tv   = 1,
-                },{
-                        .name = name_comp1,
-                        .vmux = 3,
-                        .amux = LINE2,
-                },{
-                        .name = name_svideo,
-                        .vmux = 8,
-                        .amux = LINE2,
-                }},
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.mpeg           = SAA7134_MPEG_DVB,
+		.inputs = {{
+			.name   = name_comp1,
+			.vmux   = 0,
+			.amux   = LINE1,
+		},{
+			.name   = name_svideo,
+			.vmux   = 8,
+			.amux   = LINE1,
+		}},
 	},
- 	[SAA7134_BOARD_KWORLD_VSTREAM_XPERT] = {
- 		.name           = "Kworld/Tevion V-Stream Xpert TV PVR7134",
- 		.audio_clock    = 0x00187de7,
- 		.tuner_type     = TUNER_PHILIPS_PAL_I,
- 		.gpiomask	= 0x0700,
- 		.inputs = {{
- 			.name   = name_tv,
- 			.vmux   = 1,
- 			.amux   = TV,
- 			.tv     = 1,
- 			.gpio   = 0x000,
- 		},{
- 			.name   = name_comp1,
- 			.vmux   = 3,
- 			.amux   = LINE1,
- 			.gpio   = 0x200,		//gpio by DScaler
- 		},{
- 			.name   = name_svideo,
- 			.vmux   = 0,
- 			.amux   = LINE1,
- 			.gpio   = 0x200,
- 		}},
- 		.radio = {
- 			.name   = name_radio,
- 			.amux   = LINE1,
- 			.gpio   = 0x100,
- 		},
- 	},
- };
+	[SAA7134_BOARD_AVERMEDIA_307] = {
+		/*
+		Davydov Vladimir <vladimir@iqmedia.com>
+		*/
+		.name           = "Avermedia AVerTV 307",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_FQ1216ME,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.tda9887_conf   = TDA9887_PRESENT,
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.tv   = 1,
+		},{
+			.name = name_comp1,
+			.vmux = 0,
+			.amux = LINE1,
+		},{
+			.name = name_comp2,
+			.vmux = 3,
+			.amux = LINE1,
+		},{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE1,
+		}},
+	},
+	[SAA7134_BOARD_ADS_INSTANT_TV] = {
+		.name           = "ADS Tech Instant TV (saa7135)",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_TDA8290,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.tv   = 1,
+		},{
+			.name = name_comp1,
+			.vmux = 3,
+			.amux = LINE2,
+		},{
+			.name = name_svideo,
+			.vmux = 8,
+			.amux = LINE2,
+		}},
+	},
+	[SAA7134_BOARD_KWORLD_VSTREAM_XPERT] = {
+		.name           = "Kworld/Tevion V-Stream Xpert TV PVR7134",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_PHILIPS_PAL_I,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.gpiomask	= 0x0700,
+		.inputs = {{
+			.name   = name_tv,
+			.vmux   = 1,
+			.amux   = TV,
+			.tv     = 1,
+			.gpio   = 0x000,
+		},{
+			.name   = name_comp1,
+			.vmux   = 3,
+			.amux   = LINE1,
+			.gpio   = 0x200,		/* gpio by DScaler */
+		},{
+			.name   = name_svideo,
+			.vmux   = 0,
+			.amux   = LINE1,
+			.gpio   = 0x200,
+		}},
+		.radio = {
+			.name   = name_radio,
+			.amux   = LINE1,
+			.gpio   = 0x100,
+		},
+		.mute  = {
+			.name = name_mute,
+			.amux = TV,
+			.gpio = 0x000,
+		},
+	},
+	[SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS] = {
+		.name		= "Typhoon DVB-T Duo Digital/Analog Cardbus",
+		.audio_clock    = 0x00200000,
+		.tuner_type     = TUNER_PHILIPS_TDA8290,
+		.radio_type     = UNSET,
+		.tuner_addr	= ADDR_UNSET,
+		.radio_addr	= ADDR_UNSET,
+		.mpeg           = SAA7134_MPEG_DVB,
+		/* .gpiomask       = 0xe000, */
+		.inputs         = {{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+		/*	.gpio = 0x0000,      */
+			.tv   = 1,
+		},{
+			.name = name_comp1,	/* Composite signal on S-Video input */
+			.vmux = 0,
+			.amux = LINE2,
+		/*	.gpio = 0x4000,      */
+		},{
+			.name = name_comp2,	/* Composite input */
+			.vmux = 3,
+			.amux = LINE2,
+		/*	.gpio = 0x4000,      */
+		},{
+			.name = name_svideo,	/* S-Video signal on S-Video input */
+			.vmux = 8,
+			.amux = LINE2,
+		/*	.gpio = 0x4000,      */
+		}},
+		.radio = {
+			.name = name_radio,
+			.amux = LINE2,
+		},
+		.mute = {
+			.name = name_mute,
+			.amux = LINE1,
+		},
+	},
+	[SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII] = {
+		.name           = "Compro VideoMate TV Gold+II",
+		.audio_clock    = 0x002187de7,
+		.tuner_type     = TUNER_LG_PAL_NEW_TAPC,
+		.radio_type     = TUNER_TEA5767,
+		.tuner_addr     = 0x63,
+		.radio_addr     = 0x60,
+		.gpiomask       = 0x8c1880,
+		.inputs         = {{
+			.name = name_svideo,
+			.vmux = 0,
+			.amux = LINE1,
+			.gpio = 0x800800,
+		},{
+			.name = name_comp1,
+			.vmux = 3,
+			.amux = LINE1,
+			.gpio = 0x801000,
+		},{
+			.name = name_tv,
+			.vmux = 1,
+			.amux = TV,
+			.tv   = 1,
+			.gpio = 0x800000,
+		}},
+		.radio = {
+			.name = name_radio,
+			.amux = TV,
+			.gpio = 0x880000,
+		},
+		.mute = {
+			.name = name_mute,
+			.amux = LINE2,
+			.gpio = 0x840000,
+		},
+	},
+	[SAA7134_BOARD_KWORLD_XPERT] = {
+		/*
+		FIXME:
+		- Remote control doesn't initialize properly.
+		- Audio volume starts muted,
+		then gradually increases after channel change.
+		- Overlay scaling problems (application error?)
+		- Composite S-Video untested.
+		From: Konrad Rzepecki <hannibal@megapolis.pl>
+		*/
+		.name           = "Kworld Xpert TV PVR7134",
+		.audio_clock    = 0x00187de7,
+		.tuner_type     = TUNER_TENA_9533_DI,
+		.radio_type     = TUNER_TEA5767,
+		.tuner_addr	= 0x61,
+		.radio_addr	= 0x60,
+		.gpiomask	= 0x0700,
+		.inputs = {{
+			.name   = name_tv,
+			.vmux   = 1,
+			.amux   = TV,
+			.tv     = 1,
+			.gpio   = 0x000,
+		},{
+			.name   = name_comp1,
+			.vmux   = 3,
+			.amux   = LINE1,
+			.gpio   = 0x200,		/* gpio by DScaler */
+		},{
+			.name   = name_svideo,
+			.vmux   = 0,
+			.amux   = LINE1,
+			.gpio   = 0x200,
+		}},
+		.radio = {
+			.name   = name_radio,
+			.amux   = LINE1,
+			.gpio   = 0x100,
+		},
+		.mute = {
+			.name = name_mute,
+			.amux = TV,
+			.gpio = 0x000,
+		},
+	},
+};
+
 
 const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
 
@@ -1661,13 +2016,13 @@
 		.subvendor    = PCI_VENDOR_ID_PHILIPS,
 		.subdevice    = 0x2001,
 		.driver_data  = SAA7134_BOARD_PROTEUS_PRO,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
 		.subvendor    = PCI_VENDOR_ID_PHILIPS,
 		.subdevice    = 0x2001,
 		.driver_data  = SAA7134_BOARD_PROTEUS_PRO,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
 		.subvendor    = PCI_VENDOR_ID_PHILIPS,
@@ -1676,70 +2031,70 @@
 	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = 0x1131,
-                .subdevice    = 0x4e85,
+		.subvendor    = 0x1131,
+		.subdevice    = 0x4e85,
 		.driver_data  = SAA7134_BOARD_MONSTERTV,
-        },{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = 0x153B,
-                .subdevice    = 0x1142,
-                .driver_data  = SAA7134_BOARD_CINERGY400,
-        },{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = 0x153B,
-                .subdevice    = 0x1143,
-                .driver_data  = SAA7134_BOARD_CINERGY600,
-        },{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = 0x153B,
-                .subdevice    = 0x1158,
-                .driver_data  = SAA7134_BOARD_CINERGY600_MK3,
-        },{
+	},{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
+		.subvendor    = 0x153B,
+		.subdevice    = 0x1142,
+		.driver_data  = SAA7134_BOARD_CINERGY400,
+	},{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
+		.subvendor    = 0x153B,
+		.subdevice    = 0x1143,
+		.driver_data  = SAA7134_BOARD_CINERGY600,
+	},{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
+		.subvendor    = 0x153B,
+		.subdevice    = 0x1158,
+		.driver_data  = SAA7134_BOARD_CINERGY600_MK3,
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
 		.subvendor    = 0x153b,
 		.subdevice    = 0x1162,
 		.driver_data  = SAA7134_BOARD_CINERGY400_CARDBUS,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
 		.subvendor    = 0x5168,
 		.subdevice    = 0x0138,
 		.driver_data  = SAA7134_BOARD_FLYVIDEO3000,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = 0x4e42,				//"Typhoon PCI Capture TV Card" Art.No. 50673
-                .subdevice    = 0x0138,
-                .driver_data  = SAA7134_BOARD_FLYVIDEO3000,
-        },{
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
+		.subvendor    = 0x4e42,				/* "Typhoon PCI Capture TV Card" Art.No. 50673 */
+		.subdevice    = 0x0138,
+		.driver_data  = SAA7134_BOARD_FLYVIDEO3000,
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
 		.subvendor    = 0x5168,
 		.subdevice    = 0x0138,
 		.driver_data  = SAA7134_BOARD_FLYVIDEO2000,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
-		.device       = PCI_DEVICE_ID_PHILIPS_SAA7135,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
 		.subvendor    = 0x5168,
 		.subdevice    = 0x0212, /* minipci, LR212 */
 		.driver_data  = SAA7134_BOARD_FLYTVPLATINUM_MINI,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
 		.subvendor    = 0x5168,	/* Animation Technologies (LifeView) */
 		.subdevice    = 0x0214, /* Standard PCI, LR214WF */
 		.driver_data  = SAA7134_BOARD_FLYTVPLATINUM_FM,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
 		.subvendor    = 0x1489, /* KYE */
 		.subdevice    = 0x0214, /* Genius VideoWonder ProTV */
 		.driver_data  = SAA7134_BOARD_FLYTVPLATINUM_FM, /* is an LR214WF actually */
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
 		.subvendor    = 0x16be,
@@ -1758,36 +2113,36 @@
 		.subdevice    = 0x226b,
 		.driver_data  = SAA7134_BOARD_ELSA_500TV,
 	},{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = PCI_VENDOR_ID_ASUSTEK,
-                .subdevice    = 0x4842,
-                .driver_data  = SAA7134_BOARD_ASUSTeK_TVFM7134,
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
+		.subvendor    = PCI_VENDOR_ID_ASUSTEK,
+		.subdevice    = 0x4842,
+		.driver_data  = SAA7134_BOARD_ASUSTeK_TVFM7134,
 	},{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7135,
-                .subvendor    = PCI_VENDOR_ID_ASUSTEK,
-                .subdevice    = 0x4845,
-                .driver_data  = SAA7135_BOARD_ASUSTeK_TVFM7135,
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = PCI_VENDOR_ID_ASUSTEK,
+		.subdevice    = 0x4845,
+		.driver_data  = SAA7134_BOARD_ASUSTeK_TVFM7135,
 	},{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = PCI_VENDOR_ID_ASUSTEK,
-                .subdevice    = 0x4830,
-                .driver_data  = SAA7134_BOARD_ASUSTeK_TVFM7134,
-        },{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
-                .subvendor    = PCI_VENDOR_ID_ASUSTEK,
-                .subdevice    = 0x4843,
-                .driver_data  = SAA7134_BOARD_ASUSTEK_TVFM7133,
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
+		.subvendor    = PCI_VENDOR_ID_ASUSTEK,
+		.subdevice    = 0x4830,
+		.driver_data  = SAA7134_BOARD_ASUSTeK_TVFM7134,
 	},{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = PCI_VENDOR_ID_ASUSTEK,
-                .subdevice    = 0x4840,
-                .driver_data  = SAA7134_BOARD_ASUSTeK_TVFM7134,
-        },{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = PCI_VENDOR_ID_ASUSTEK,
+		.subdevice    = 0x4843,
+		.driver_data  = SAA7134_BOARD_ASUSTEK_TVFM7133,
+	},{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
+		.subvendor    = PCI_VENDOR_ID_ASUSTEK,
+		.subdevice    = 0x4840,
+		.driver_data  = SAA7134_BOARD_ASUSTeK_TVFM7134,
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
 		.subvendor    = PCI_VENDOR_ID_PHILIPS,
@@ -1808,118 +2163,118 @@
 	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = 0x1131,
-                .subdevice    = 0x7133,
+		.subvendor    = 0x1131,
+		.subdevice    = 0x7133,
 		.driver_data  = SAA7134_BOARD_VA1000POWER,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
-                .subvendor    = PCI_VENDOR_ID_PHILIPS,
-                .subdevice    = 0x2001,
+		.subvendor    = PCI_VENDOR_ID_PHILIPS,
+		.subdevice    = 0x2001,
 		.driver_data  = SAA7134_BOARD_10MOONSTVMASTER,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
-                .subvendor    = 0x185b,
-                .subdevice    = 0xc100,
+		.subvendor    = 0x185b,
+		.subdevice    = 0xc100,
 		.driver_data  = SAA7134_BOARD_VIDEOMATE_TV,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
-                .subvendor    = 0x185b,
-                .subdevice    = 0xc100,
+		.subvendor    = 0x185b,
+		.subdevice    = 0xc100,
 		.driver_data  = SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUS,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
-                .subvendor    = PCI_VENDOR_ID_MATROX,
-                .subdevice    = 0x48d0,
+		.subvendor    = PCI_VENDOR_ID_MATROX,
+		.subdevice    = 0x48d0,
 		.driver_data  = SAA7134_BOARD_CRONOS_PLUS,
 	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = 0x1461, /* Avermedia Technologies Inc */
-                .subdevice    = 0xa70b,
+		.subvendor    = 0x1461, /* Avermedia Technologies Inc */
+		.subdevice    = 0xa70b,
 		.driver_data  = SAA7134_BOARD_MD2819,
 	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
-                .subvendor    = 0x1461, /* Avermedia Technologies Inc */
-                .subdevice    = 0x2115,
+		.subvendor    = 0x1461, /* Avermedia Technologies Inc */
+		.subdevice    = 0x2115,
 		.driver_data  = SAA7134_BOARD_AVERMEDIA_STUDIO_305,
 	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
-                .subvendor    = 0x1461, /* Avermedia Technologies Inc */
-                .subdevice    = 0x2108,
+		.subvendor    = 0x1461, /* Avermedia Technologies Inc */
+		.subdevice    = 0x2108,
 		.driver_data  = SAA7134_BOARD_AVERMEDIA_305,
 	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
-                .subvendor    = 0x1461, /* Avermedia Technologies Inc */
-                .subdevice    = 0x10ff,
+		.subvendor    = 0x1461, /* Avermedia Technologies Inc */
+		.subdevice    = 0x10ff,
 		.driver_data  = SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER,
-        },{
+	},{
 		/* AVerMedia CardBus */
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = 0x1461, /* Avermedia Technologies Inc */
-                .subdevice    = 0xd6ee,
+		.subvendor    = 0x1461, /* Avermedia Technologies Inc */
+		.subdevice    = 0xd6ee,
 		.driver_data  = SAA7134_BOARD_AVERMEDIA_CARDBUS,
 	},{
 		/* TransGear 3000TV */
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
-                .subvendor    = 0x1461, /* Avermedia Technologies Inc */
-                .subdevice    = 0x050c,
+		.subvendor    = 0x1461, /* Avermedia Technologies Inc */
+		.subdevice    = 0x050c,
 		.driver_data  = SAA7134_BOARD_TG3000TV,
 	},{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = 0x11bd,
-                .subdevice    = 0x002b,
-                .driver_data  = SAA7134_BOARD_PINNACLE_PCTV_STEREO,
-        },{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = 0x11bd,
-                .subdevice    = 0x002d,
-                .driver_data  = SAA7134_BOARD_PINNACLE_300I_DVBT_PAL,
-        },{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = 0x1019,
-                .subdevice    = 0x4cb4,
-                .driver_data  = SAA7134_BOARD_ECS_TVP3XP,
-        },{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
-                .subvendor    = 0x1019,
-                .subdevice    = 0x4cb5,
-                .driver_data  = SAA7134_BOARD_ECS_TVP3XP_4CB5,
-        },{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
- 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
-                .subvendor    = 0x12ab,
-                .subdevice    = 0x0800,
- 		.driver_data  = SAA7133_BOARD_UPMOST_PURPLE_TV,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
+		.subvendor    = 0x11bd,
+		.subdevice    = 0x002b,
+		.driver_data  = SAA7134_BOARD_PINNACLE_PCTV_STEREO,
+	},{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
+		.subvendor    = 0x11bd,
+		.subdevice    = 0x002d,
+		.driver_data  = SAA7134_BOARD_PINNACLE_300I_DVBT_PAL,
+	},{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
+		.subvendor    = 0x1019,
+		.subdevice    = 0x4cb4,
+		.driver_data  = SAA7134_BOARD_ECS_TVP3XP,
+	},{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = 0x1019,
+		.subdevice    = 0x4cb5,
+		.driver_data  = SAA7134_BOARD_ECS_TVP3XP_4CB5,
+	},{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = 0x12ab,
+		.subdevice    = 0x0800,
+		.driver_data  = SAA7134_BOARD_UPMOST_PURPLE_TV,
 	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
 		.subvendor    = 0x153B,
 		.subdevice    = 0x1152,
 		.driver_data  = SAA7134_BOARD_CINERGY200,
- 	},{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
-                .subvendor    = 0x185b,
-                .subdevice    = 0xc100,
+		.subvendor    = 0x185b,
+		.subdevice    = 0xc100,
 		.driver_data  = SAA7134_BOARD_VIDEOMATE_TV_PVR,
- 	},{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
-                .subvendor    = 0x1131,
-                .subdevice    = 0,
+		.subvendor    = 0x1131,
+		.subdevice    = 0,
 		.driver_data  = SAA7134_BOARD_SABRENT_SBTTVFM,
 	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
@@ -1939,18 +2294,24 @@
 		.subvendor    = 0x185b,
 		.subdevice    = 0xc200,
 		.driver_data  = SAA7134_BOARD_VIDEOMATE_GOLD_PLUS,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
 		.subvendor    = 0x1540,
 		.subdevice    = 0x9524,
 		.driver_data  = SAA7134_BOARD_PROVIDEO_PV952,
 
- 	},{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
 		.subvendor    = 0x5168,
-		.subdevice    = 0x0306,
+		.subdevice    = 0x0502,                /* Cardbus version */
+		.driver_data  = SAA7134_BOARD_FLYDVBTDUO,
+	},{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = 0x5168,
+		.subdevice    = 0x0306,                /* PCI version */
 		.driver_data  = SAA7134_BOARD_FLYDVBTDUO,
 	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
@@ -1959,31 +2320,44 @@
 		.subdevice    = 0xf31f,
 		.driver_data  = SAA7134_BOARD_AVERMEDIA_GO_007_FM,
 
- 	},{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
-		.device       = PCI_DEVICE_ID_PHILIPS_SAA7135,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
+		.subvendor    = PCI_VENDOR_ID_PHILIPS,
+		.subdevice    = 0x2004,
+		.driver_data  = SAA7134_BOARD_PHILIPS_TOUGH,
+	},{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
 		.subvendor    = 0x1421,
 		.subdevice    = 0x0350,		/* PCI version */
 		.driver_data  = SAA7134_BOARD_ADS_INSTANT_TV,
 
- 	},{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
-		.device       = PCI_DEVICE_ID_PHILIPS_SAA7135,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
 		.subvendor    = 0x1421,
 		.subdevice    = 0x0370,		/* cardbus version */
 		.driver_data  = SAA7134_BOARD_ADS_INSTANT_TV,
 
- 	},{
+	},{     /* Typhoon DVB-T Duo Digital/Analog Cardbus */
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
+		.subvendor    = 0x4e42,
+		.subdevice    = 0x0502,
+		.driver_data  = SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS,
+
+	},{
 		/* --- boards without eeprom + subsystem ID --- */
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = PCI_VENDOR_ID_PHILIPS,
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
+		.subvendor    = PCI_VENDOR_ID_PHILIPS,
 		.subdevice    = 0,
 		.driver_data  = SAA7134_BOARD_NOAUTO,
-        },{
-                .vendor       = PCI_VENDOR_ID_PHILIPS,
-                .device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
-                .subvendor    = PCI_VENDOR_ID_PHILIPS,
+	},{
+		.vendor       = PCI_VENDOR_ID_PHILIPS,
+		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
+		.subvendor    = PCI_VENDOR_ID_PHILIPS,
 		.subdevice    = 0,
 		.driver_data  = SAA7134_BOARD_NOAUTO,
 	},{
@@ -1991,26 +2365,26 @@
 		/* --- default catch --- */
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7130,
-                .subvendor    = PCI_ANY_ID,
-                .subdevice    = PCI_ANY_ID,
+		.subvendor    = PCI_ANY_ID,
+		.subdevice    = PCI_ANY_ID,
 		.driver_data  = SAA7134_BOARD_UNKNOWN,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7133,
-                .subvendor    = PCI_ANY_ID,
-                .subdevice    = PCI_ANY_ID,
+		.subvendor    = PCI_ANY_ID,
+		.subdevice    = PCI_ANY_ID,
 		.driver_data  = SAA7134_BOARD_UNKNOWN,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7134,
-                .subvendor    = PCI_ANY_ID,
-                .subdevice    = PCI_ANY_ID,
+		.subvendor    = PCI_ANY_ID,
+		.subdevice    = PCI_ANY_ID,
 		.driver_data  = SAA7134_BOARD_UNKNOWN,
-        },{
+	},{
 		.vendor       = PCI_VENDOR_ID_PHILIPS,
 		.device       = PCI_DEVICE_ID_PHILIPS_SAA7135,
-                .subvendor    = PCI_ANY_ID,
-                .subdevice    = PCI_ANY_ID,
+		.subvendor    = PCI_ANY_ID,
+		.subdevice    = PCI_ANY_ID,
 		.driver_data  = SAA7134_BOARD_UNKNOWN,
 	},{
 		/* --- end of list --- */
@@ -2021,46 +2395,9 @@
 /* ----------------------------------------------------------- */
 /* flyvideo tweaks                                             */
 
-#if 0
-static struct {
-	char  *model;
-	int   tuner_type;
-} fly_list[0x20] = {
-	/* default catch ... */
-	[ 0 ... 0x1f ] = {
-		.model      = "UNKNOWN",
-		.tuner_type = TUNER_ABSENT,
-	},
-	/* ... the ones known so far */
-	[ 0x05 ] = {
-		.model      = "PAL-BG",
-		.tuner_type = TUNER_LG_PAL_NEW_TAPC,
-	},
-	[ 0x10 ] = {
-		.model      = "PAL-BG / PAL-DK",
-		.tuner_type = TUNER_PHILIPS_PAL,
-	},
-	[ 0x15 ] = {
-		.model      = "NTSC",
-		.tuner_type = TUNER_ABSENT /* FIXME */,
-	},
-};
-#endif
 
 static void board_flyvideo(struct saa7134_dev *dev)
 {
-#if 0
-	/* non-working attempt to detect the correct tuner type ... */
-	u32 value;
-	int index;
-
-	value = dev->gpio_value;
-	index = (value & 0x1f00) >> 8;
-	printk(KERN_INFO "%s: flyvideo: gpio is 0x%x [model=%s,tuner=%d]\n",
-	       dev->name, value, fly_list[index].model,
-	       fly_list[index].tuner_type);
-	dev->tuner_type = fly_list[index].tuner_type;
-#endif
 	printk("%s: there are different flyvideo cards with different tuners\n"
 	       "%s: out there, you might have to use the tuner=<nr> insmod\n"
 	       "%s: option to override the default value.\n",
@@ -2071,7 +2408,7 @@
 
 int saa7134_board_init1(struct saa7134_dev *dev)
 {
-	// Always print gpio, often manufacturers encode tuner type and other info.
+	/* Always print gpio, often manufacturers encode tuner type and other info. */
 	saa_writel(SAA7134_GPIO_GPMODE0 >> 2, 0);
 	dev->gpio_value = saa_readl(SAA7134_GPIO_GPSTATUS0 >> 2);
 	printk(KERN_INFO "%s: board init: gpio is %x\n", dev->name, dev->gpio_value);
@@ -2082,7 +2419,7 @@
 		dev->has_remote = 1;
 		board_flyvideo(dev);
 		break;
-        case SAA7134_BOARD_FLYTVPLATINUM_FM:
+	case SAA7134_BOARD_FLYTVPLATINUM_FM:
 	case SAA7134_BOARD_CINERGY400:
 	case SAA7134_BOARD_CINERGY600:
 	case SAA7134_BOARD_CINERGY600_MK3:
@@ -2090,23 +2427,25 @@
 	case SAA7134_BOARD_ECS_TVP3XP_4CB5:
 	case SAA7134_BOARD_MD2819:
 	case SAA7134_BOARD_KWORLD_VSTREAM_XPERT:
+	case SAA7134_BOARD_KWORLD_XPERT:
 	case SAA7134_BOARD_AVERMEDIA_STUDIO_305:
 	case SAA7134_BOARD_AVERMEDIA_305:
 	case SAA7134_BOARD_AVERMEDIA_STUDIO_307:
 	case SAA7134_BOARD_AVERMEDIA_307:
 	case SAA7134_BOARD_AVERMEDIA_GO_007_FM:
-//	case SAA7134_BOARD_SABRENT_SBTTVFM:  /* not finished yet */
+/*      case SAA7134_BOARD_SABRENT_SBTTVFM:  */ /* not finished yet */
 	case SAA7134_BOARD_VIDEOMATE_TV_PVR:
- 	case SAA7134_BOARD_MANLI_MTV001:
- 	case SAA7134_BOARD_MANLI_MTV002:
+	case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII:
+	case SAA7134_BOARD_MANLI_MTV001:
+	case SAA7134_BOARD_MANLI_MTV002:
 	case SAA7134_BOARD_AVACSSMARTTV:
 		dev->has_remote = 1;
 		break;
 	case SAA7134_BOARD_MD5044:
 		printk("%s: seems there are two different versions of the MD5044\n"
-		       "%s: (with the same ID) out there.  If sound doesn't work for\n"
-		       "%s: you try the audio_clock_override=0x200000 insmod option.\n",
-		       dev->name,dev->name,dev->name);
+		"%s: (with the same ID) out there.  If sound doesn't work for\n"
+		"%s: you try the audio_clock_override=0x200000 insmod option.\n",
+		dev->name,dev->name,dev->name);
 		break;
 	case SAA7134_BOARD_CINERGY400_CARDBUS:
 		/* power-up tuner chip */
@@ -2114,11 +2453,19 @@
 		saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0x00040000, 0x00000000);
 		msleep(1);
 		break;
+	case SAA7134_BOARD_FLYDVBTDUO:
+	case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS:
+	/* turn the fan on Hac: static for the time being */
+		saa_writeb(SAA7134_GPIO_GPMODE3, 0x08);
+		saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x06);
+		break;
+	case SAA7134_BOARD_AVERMEDIA_CARDBUS:
+		/* power-up tuner chip */
+		saa_andorl(SAA7134_GPIO_GPMODE0 >> 2,   0xffffffff, 0xffffffff);
+		saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, 0xffffffff, 0xffffffff);
+		msleep(1);
+		break;
 	}
-	if (dev->has_remote)
-		dev->irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18  |
-				   SAA7134_IRQ2_INTE_GPIO18A |
-				   SAA7134_IRQ2_INTE_GPIO16  );
 	return 0;
 }
 
@@ -2139,10 +2486,85 @@
 			break;
 		dev->board = board;
 		printk("%s: board type fixup: %s\n", dev->name,
-		       saa7134_boards[dev->board].name);
+		saa7134_boards[dev->board].name);
 		dev->tuner_type = saa7134_boards[dev->board].tuner_type;
-		if (TUNER_ABSENT != dev->tuner_type)
-			saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&dev->tuner_type);
+
+		if (TUNER_ABSENT != dev->tuner_type) {
+				struct tuner_setup tun_setup;
+
+				tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
+				tun_setup.type = dev->tuner_type;
+				tun_setup.addr = ADDR_UNSET;
+
+				saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR, &tun_setup);
+		}
+		break;
+case SAA7134_BOARD_MD7134:
+		{
+		struct tuner_setup tun_setup;
+		u8 subaddr;
+		u8 data[3];
+		int ret, tuner_t;
+
+		struct i2c_msg msg[] = {{.addr=0x50, .flags=0, .buf=&subaddr, .len = 1},
+					{.addr=0x50, .flags=I2C_M_RD, .buf=data, .len = 3}};
+		subaddr= 0x14;
+		tuner_t = 0;
+		ret = i2c_transfer(&dev->i2c_adap, msg, 2);
+		if (ret != 2) {
+			printk(KERN_ERR "EEPROM read failure\n");
+		} else if ((data[0] != 0) && (data[0] != 0xff)) {
+			/* old config structure */
+			subaddr = data[0] + 2;
+			msg[1].len = 2;
+			i2c_transfer(&dev->i2c_adap, msg, 2);
+			tuner_t = (data[0] << 8) + data[1];
+			switch (tuner_t){
+			case 0x0103:
+				dev->tuner_type = TUNER_PHILIPS_PAL;
+				break;
+			case 0x010C:
+				dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3;
+				break;
+			default:
+				printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t);
+			}
+		} else if ((data[1] != 0) && (data[1] != 0xff)) {
+			/* new config structure */
+			subaddr = data[1] + 1;
+			msg[1].len = 1;
+			i2c_transfer(&dev->i2c_adap, msg, 2);
+			subaddr = data[0] + 1;
+			msg[1].len = 2;
+			i2c_transfer(&dev->i2c_adap, msg, 2);
+			tuner_t = (data[1] << 8) + data[0];
+			switch (tuner_t) {
+			case 0x0005:
+				dev->tuner_type = TUNER_PHILIPS_FM1216ME_MK3;
+				break;
+			case 0x001d:
+				dev->tuner_type = TUNER_PHILIPS_FMD1216ME_MK3;
+					printk(KERN_INFO "%s Board has DVB-T\n", dev->name);
+				break;
+			default:
+				printk(KERN_ERR "%s Cant determine tuner type %x from EEPROM\n", dev->name, tuner_t);
+			}
+		} else {
+			printk(KERN_ERR "%s unexpected config structure\n", dev->name);
+		}
+
+		printk(KERN_INFO "%s Tuner type is %d\n", dev->name, dev->tuner_type);
+		if (dev->tuner_type == TUNER_PHILIPS_FMD1216ME_MK3) {
+			dev->tda9887_conf = TDA9887_PRESENT | TDA9887_PORT1_ACTIVE | TDA9887_PORT2_ACTIVE;
+			saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG, &dev->tda9887_conf);
+		}
+
+		tun_setup.mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
+		tun_setup.type = dev->tuner_type;
+		tun_setup.addr = ADDR_UNSET;
+
+		saa7134_i2c_call_clients (dev, TUNER_SET_TYPE_ADDR,&tun_setup);
+		}
 		break;
 	}
 	return 0;
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index f61ed18..1dbe617 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -1,5 +1,5 @@
 /*
- * $Id: saa7134-core.c,v 1.30 2005/05/22 19:23:39 nsh Exp $
+ * $Id: saa7134-core.c,v 1.39 2005/07/05 17:37:35 nsh Exp $
  *
  * device driver for philips saa7134 based TV cards
  * driver core
@@ -183,46 +183,6 @@
 
 /* ------------------------------------------------------------------ */
 
-#if 0
-static char *dec1_bits[8] = {
-	"DCSTD0", "DCSCT1", "WIPA", "GLIMB",
-	"GLIMT", "SLTCA", "HLCK"
-};
-static char *dec2_bits[8] = {
-	"RDCAP", "COPRO", "COLSTR", "TYPE3",
-	NULL, "FIDT", "HLVLN", "INTL"
-};
-static char *scale1_bits[8] = {
-	"VID_A", "VBI_A", NULL, NULL, "VID_B", "VBI_B"
-};
-static char *scale2_bits[8] = {
-	"TRERR", "CFERR", "LDERR", "WASRST",
-	"FIDSCI", "FIDSCO", "D6^D5", "TASK"
-};
-
-static void dump_statusreg(struct saa7134_dev *dev, int reg,
-			   char *regname, char **bits)
-{
-	int value,i;
-
-	value = saa_readb(reg);
-	printk(KERN_DEBUG "%s: %s:", dev->name, regname);
-	for (i = 7; i >= 0; i--) {
-		if (NULL == bits[i])
-			continue;
-		printk(" %s=%d", bits[i], (value & (1 << i)) ? 1 : 0);
-	}
-	printk("\n");
-}
-
-static void dump_statusregs(struct saa7134_dev *dev)
-{
-	dump_statusreg(dev,SAA7134_STATUS_VIDEO1,"dec1",dec1_bits);
-	dump_statusreg(dev,SAA7134_STATUS_VIDEO2,"dec2",dec2_bits);
-	dump_statusreg(dev,SAA7134_SCALER_STATUS0,"scale0",scale1_bits);
-	dump_statusreg(dev,SAA7134_SCALER_STATUS1,"scale1",scale2_bits);
-}
-#endif
 
 /* ----------------------------------------------------------- */
 /* delayed request_module                                      */
@@ -616,10 +576,6 @@
 		if (irq_debug)
 			print_irqstatus(dev,loop,report,status);
 
-#if 0
-		if (report & SAA7134_IRQ_REPORT_CONF_ERR)
-			dump_statusregs(dev);
-#endif
 
 		if (report & SAA7134_IRQ_REPORT_RDCAP /* _INTL */)
 			saa7134_irq_video_intl(dev);
@@ -711,7 +667,6 @@
 		   SAA7134_MAIN_CTRL_EVFE1 |
 		   SAA7134_MAIN_CTRL_EVFE2 |
 		   SAA7134_MAIN_CTRL_ESFE  |
-		   SAA7134_MAIN_CTRL_EBADC |
 		   SAA7134_MAIN_CTRL_EBDAC);
 
 	/* enable peripheral devices */
@@ -726,14 +681,28 @@
 /* late init (with i2c + irq) */
 static int saa7134_hwinit2(struct saa7134_dev *dev)
 {
+	unsigned int irq2_mask;
 	dprintk("hwinit2\n");
 
 	saa7134_video_init2(dev);
 	saa7134_tvaudio_init2(dev);
 
 	/* enable IRQ's */
+   	irq2_mask =
+		SAA7134_IRQ2_INTE_DEC3    |
+		SAA7134_IRQ2_INTE_DEC2    |
+		SAA7134_IRQ2_INTE_DEC1    |
+		SAA7134_IRQ2_INTE_DEC0    |
+		SAA7134_IRQ2_INTE_PE      |
+		SAA7134_IRQ2_INTE_AR;
+
+	if (dev->has_remote)
+		irq2_mask |= (SAA7134_IRQ2_INTE_GPIO18  |
+			      SAA7134_IRQ2_INTE_GPIO18A |
+			      SAA7134_IRQ2_INTE_GPIO16  );
+
 	saa_writel(SAA7134_IRQ1, 0);
-	saa_writel(SAA7134_IRQ2, dev->irq2_mask);
+	saa_writel(SAA7134_IRQ2, irq2_mask);
 
 	return 0;
 }
@@ -954,13 +923,6 @@
 	}
 
 	/* initialize hardware #1 */
-   	dev->irq2_mask =
-		SAA7134_IRQ2_INTE_DEC3    |
-		SAA7134_IRQ2_INTE_DEC2    |
-		SAA7134_IRQ2_INTE_DEC1    |
-		SAA7134_IRQ2_INTE_DEC0    |
-		SAA7134_IRQ2_INTE_PE      |
-		SAA7134_IRQ2_INTE_AR;
 	saa7134_board_init1(dev);
 	saa7134_hwinit1(dev);
 
@@ -990,6 +952,7 @@
 		request_module("saa6752hs");
 		request_module_depend("saa7134-empress",&need_empress);
 	}
+
   	if (card_is_dvb(dev))
 		request_module_depend("saa7134-dvb",&need_dvb);
 
@@ -1144,9 +1107,6 @@
 	release_mem_region(pci_resource_start(pci_dev,0),
 			   pci_resource_len(pci_dev,0));
 
-#if 0  /* causes some trouble when reinserting the driver ... */
-	pci_disable_device(pci_dev);
-#endif
 	pci_set_drvdata(pci_dev, NULL);
 
 	/* free memory */
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index aa8e2cf..334bc18 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1,8 +1,11 @@
 /*
- * $Id: saa7134-dvb.c,v 1.13 2005/06/12 04:19:19 mchehab Exp $
+ * $Id: saa7134-dvb.c,v 1.18 2005/07/04 16:05:50 mkrufky Exp $
  *
  * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]
  *
+ *  Extended 3 / 2005 by Hartmut Hackmann to support various
+ *  cards with the tda10046 DVB-T channel decoder
+ *
  *  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
@@ -27,23 +30,31 @@
 #include <linux/kthread.h>
 #include <linux/suspend.h>
 
+#define CONFIG_DVB_MT352 1
+#define CONFIG_DVB_TDA1004X 1
+
 #include "saa7134-reg.h"
 #include "saa7134.h"
 
-#include "dvb-pll.h"
-#include "mt352.h"
-#include "mt352_priv.h" /* FIXME */
-#include "tda1004x.h"
+#if CONFIG_DVB_MT352
+# include "mt352.h"
+# include "mt352_priv.h" /* FIXME */
+#endif
+#if CONFIG_DVB_TDA1004X
+# include "tda1004x.h"
+#endif
 
 MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
 MODULE_LICENSE("GPL");
 
 static unsigned int antenna_pwr = 0;
+
 module_param(antenna_pwr, int, 0444);
 MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)");
 
 /* ------------------------------------------------------------------ */
 
+#if CONFIG_DVB_MT352
 static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
 {
 	u32 ok;
@@ -138,51 +149,390 @@
 	.demod_init    = mt352_pinnacle_init,
 	.pll_set       = mt352_pinnacle_pll_set,
 };
+#endif
 
 /* ------------------------------------------------------------------ */
 
-static int medion_cardbus_init(struct dvb_frontend* fe)
-{
-	/* anything to do here ??? */
-	return 0;
-}
-
-static int medion_cardbus_pll_set(struct dvb_frontend* fe,
-				  struct dvb_frontend_parameters* params)
+#if CONFIG_DVB_TDA1004X
+static int philips_tu1216_pll_init(struct dvb_frontend *fe)
 {
 	struct saa7134_dev *dev = fe->dvb->priv;
-	struct v4l2_frequency f;
+	static u8 tu1216_init[] = { 0x0b, 0xf5, 0x85, 0xab };
+	struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tu1216_init,.len = sizeof(tu1216_init) };
 
-	/*
-	 * this instructs tuner.o to set the frequency, the call will
-	 * end up in tuner_command(), VIDIOC_S_FREQUENCY switch.
-	 * tda9887.o will see that as well.
-	 */
-	f.tuner     = 0;
-	f.type      = V4L2_TUNER_DIGITAL_TV;
-	f.frequency = params->frequency / 1000 * 16 / 1000;
-	saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,&f);
+	/* setup PLL configuration */
+	if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
+		return -EIO;
+	msleep(1);
+
 	return 0;
 }
 
-static int fe_request_firmware(struct dvb_frontend* fe,
-			       const struct firmware **fw, char* name)
+static int philips_tu1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
+{
+	struct saa7134_dev *dev = fe->dvb->priv;
+	u8 tuner_buf[4];
+	struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,.len =
+			sizeof(tuner_buf) };
+	int tuner_frequency = 0;
+	u8 band, cp, filter;
+
+	/* determine charge pump */
+	tuner_frequency = params->frequency + 36166000;
+	if (tuner_frequency < 87000000)
+		return -EINVAL;
+	else if (tuner_frequency < 130000000)
+		cp = 3;
+	else if (tuner_frequency < 160000000)
+		cp = 5;
+	else if (tuner_frequency < 200000000)
+		cp = 6;
+	else if (tuner_frequency < 290000000)
+		cp = 3;
+	else if (tuner_frequency < 420000000)
+		cp = 5;
+	else if (tuner_frequency < 480000000)
+		cp = 6;
+	else if (tuner_frequency < 620000000)
+		cp = 3;
+	else if (tuner_frequency < 830000000)
+		cp = 5;
+	else if (tuner_frequency < 895000000)
+		cp = 7;
+	else
+		return -EINVAL;
+
+	/* determine band */
+	if (params->frequency < 49000000)
+		return -EINVAL;
+	else if (params->frequency < 161000000)
+		band = 1;
+	else if (params->frequency < 444000000)
+		band = 2;
+	else if (params->frequency < 861000000)
+		band = 4;
+	else
+		return -EINVAL;
+
+	/* setup PLL filter */
+	switch (params->u.ofdm.bandwidth) {
+	case BANDWIDTH_6_MHZ:
+		filter = 0;
+		break;
+
+	case BANDWIDTH_7_MHZ:
+		filter = 0;
+		break;
+
+	case BANDWIDTH_8_MHZ:
+		filter = 1;
+		break;
+
+	default:
+		return -EINVAL;
+	}
+
+	/* calculate divisor
+	 * ((36166000+((1000000/6)/2)) + Finput)/(1000000/6)
+	 */
+	tuner_frequency = (((params->frequency / 1000) * 6) + 217496) / 1000;
+
+	/* setup tuner buffer */
+	tuner_buf[0] = (tuner_frequency >> 8) & 0x7f;
+	tuner_buf[1] = tuner_frequency & 0xff;
+	tuner_buf[2] = 0xca;
+	tuner_buf[3] = (cp << 5) | (filter << 3) | band;
+
+	if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
+		return -EIO;
+
+	msleep(1);
+	return 0;
+}
+
+static int philips_tu1216_request_firmware(struct dvb_frontend *fe,
+					   const struct firmware **fw, char *name)
 {
 	struct saa7134_dev *dev = fe->dvb->priv;
 	return request_firmware(fw, name, &dev->pci->dev);
 }
 
-static struct tda1004x_config medion_cardbus = {
-	.demod_address = 0x08,  /* not sure this is correct */
-	.invert        = 0,
-        .invert_oclk   = 0,
-        .pll_init      = medion_cardbus_init,
-        .pll_set       = medion_cardbus_pll_set,
-        .request_firmware = fe_request_firmware,
+static struct tda1004x_config philips_tu1216_config = {
+
+	.demod_address = 0x8,
+	.invert        = 1,
+	.invert_oclk   = 1,
+	.xtal_freq     = TDA10046_XTAL_4M,
+	.agc_config    = TDA10046_AGC_DEFAULT,
+	.if_freq       = TDA10046_FREQ_3617,
+	.pll_init      = philips_tu1216_pll_init,
+	.pll_set       = philips_tu1216_pll_set,
+	.pll_sleep     = NULL,
+	.request_firmware = philips_tu1216_request_firmware,
 };
 
 /* ------------------------------------------------------------------ */
 
+
+static int philips_fmd1216_pll_init(struct dvb_frontend *fe)
+{
+	struct saa7134_dev *dev = fe->dvb->priv;
+	/* this message is to set up ATC and ALC */
+	static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0xa0 };
+	struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) };
+
+	if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
+		return -EIO;
+	msleep(1);
+
+	return 0;
+}
+
+static void philips_fmd1216_analog(struct dvb_frontend *fe)
+{
+	struct saa7134_dev *dev = fe->dvb->priv;
+	/* this message actually turns the tuner back to analog mode */
+	static u8 fmd1216_init[] = { 0x0b, 0xdc, 0x9c, 0x60 };
+	struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = fmd1216_init,.len = sizeof(fmd1216_init) };
+
+	i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
+	msleep(1);
+	fmd1216_init[2] = 0x86;
+	fmd1216_init[3] = 0x54;
+	i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
+	msleep(1);
+}
+
+static int philips_fmd1216_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
+{
+	struct saa7134_dev *dev = fe->dvb->priv;
+	u8 tuner_buf[4];
+	struct i2c_msg tuner_msg = {.addr = 0x61,.flags = 0,.buf = tuner_buf,.len =
+			sizeof(tuner_buf) };
+	int tuner_frequency = 0;
+	int divider = 0;
+	u8 band, mode, cp;
+
+	/* determine charge pump */
+	tuner_frequency = params->frequency + 36130000;
+	if (tuner_frequency < 87000000)
+		return -EINVAL;
+	/* low band */
+	else if (tuner_frequency < 180000000) {
+		band = 1;
+		mode = 7;
+		cp   = 0;
+	} else if (tuner_frequency < 195000000) {
+		band = 1;
+		mode = 6;
+		cp   = 1;
+	/* mid band	*/
+	} else if (tuner_frequency < 366000000) {
+		if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
+			band = 10;
+		} else {
+			band = 2;
+		}
+		mode = 7;
+		cp   = 0;
+	} else if (tuner_frequency < 478000000) {
+		if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
+			band = 10;
+		} else {
+			band = 2;
+		}
+		mode = 6;
+		cp   = 1;
+	/* high band */
+	} else if (tuner_frequency < 662000000) {
+		if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
+			band = 12;
+		} else {
+			band = 4;
+		}
+		mode = 7;
+		cp   = 0;
+	} else if (tuner_frequency < 840000000) {
+		if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
+			band = 12;
+		} else {
+			band = 4;
+		}
+		mode = 6;
+		cp   = 1;
+	} else {
+		if (params->u.ofdm.bandwidth == BANDWIDTH_8_MHZ) {
+			band = 12;
+		} else {
+			band = 4;
+		}
+		mode = 7;
+		cp   = 1;
+
+	}
+	/* calculate divisor */
+	/* ((36166000 + Finput) / 166666) rounded! */
+	divider = (tuner_frequency + 83333) / 166667;
+
+	/* setup tuner buffer */
+	tuner_buf[0] = (divider >> 8) & 0x7f;
+	tuner_buf[1] = divider & 0xff;
+	tuner_buf[2] = 0x80 | (cp << 6) | (mode  << 3) | 4;
+	tuner_buf[3] = 0x40 | band;
+
+	if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
+		return -EIO;
+	return 0;
+}
+
+
+static struct tda1004x_config medion_cardbus = {
+	.demod_address = 0x08,
+	.invert        = 1,
+	.invert_oclk   = 0,
+	.xtal_freq     = TDA10046_XTAL_16M,
+	.agc_config    = TDA10046_AGC_IFO_AUTO_NEG,
+	.if_freq       = TDA10046_FREQ_3613,
+	.pll_init      = philips_fmd1216_pll_init,
+	.pll_set       = philips_fmd1216_pll_set,
+	.pll_sleep	   = philips_fmd1216_analog,
+	.request_firmware = NULL,
+};
+
+/* ------------------------------------------------------------------ */
+
+struct tda827x_data {
+	u32 lomax;
+	u8  spd;
+	u8  bs;
+	u8  bp;
+	u8  cp;
+	u8  gc3;
+	u8 div1p5;
+};
+
+static struct tda827x_data tda827x_dvbt[] = {
+	{ .lomax =  62000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1},
+	{ .lomax =  66000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1},
+	{ .lomax =  76000000, .spd = 3, .bs = 1, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0},
+	{ .lomax =  84000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0},
+	{ .lomax =  93000000, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0},
+	{ .lomax =  98000000, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0},
+	{ .lomax = 109000000, .spd = 3, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0},
+	{ .lomax = 123000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1},
+	{ .lomax = 133000000, .spd = 2, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1},
+	{ .lomax = 151000000, .spd = 2, .bs = 1, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0},
+	{ .lomax = 154000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0},
+	{ .lomax = 181000000, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 0, .div1p5 = 0},
+	{ .lomax = 185000000, .spd = 2, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
+	{ .lomax = 217000000, .spd = 2, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
+	{ .lomax = 244000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1},
+	{ .lomax = 265000000, .spd = 1, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1},
+	{ .lomax = 302000000, .spd = 1, .bs = 1, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
+	{ .lomax = 324000000, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0},
+	{ .lomax = 370000000, .spd = 1, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0},
+	{ .lomax = 454000000, .spd = 1, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0},
+	{ .lomax = 493000000, .spd = 0, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1},
+	{ .lomax = 530000000, .spd = 0, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1},
+	{ .lomax = 554000000, .spd = 0, .bs = 1, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0},
+	{ .lomax = 604000000, .spd = 0, .bs = 1, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0},
+	{ .lomax = 696000000, .spd = 0, .bs = 2, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0},
+	{ .lomax = 740000000, .spd = 0, .bs = 2, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0},
+	{ .lomax = 820000000, .spd = 0, .bs = 3, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0},
+	{ .lomax = 865000000, .spd = 0, .bs = 3, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0},
+	{ .lomax =         0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0}
+};
+
+static int philips_tda827x_pll_init(struct dvb_frontend *fe)
+{
+	return 0;
+}
+
+static int philips_tda827x_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
+{
+	struct saa7134_dev *dev = fe->dvb->priv;
+	u8 tuner_buf[14];
+
+	struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tuner_buf,
+		                        .len = sizeof(tuner_buf) };
+	int i, tuner_freq, if_freq;
+	u32 N;
+	switch (params->u.ofdm.bandwidth) {
+	case BANDWIDTH_6_MHZ:
+		if_freq = 4000000;
+		break;
+	case BANDWIDTH_7_MHZ:
+		if_freq = 4500000;
+		break;
+	default:		   /* 8 MHz or Auto */
+		if_freq = 5000000;
+		break;
+	}
+	tuner_freq = params->frequency + if_freq;
+
+	i = 0;
+	while (tda827x_dvbt[i].lomax < tuner_freq) {
+		if(tda827x_dvbt[i + 1].lomax == 0)
+			break;
+		i++;
+	}
+
+	N = ((tuner_freq + 125000) / 250000) << (tda827x_dvbt[i].spd + 2);
+	tuner_buf[0] = 0;
+	tuner_buf[1] = (N>>8) | 0x40;
+	tuner_buf[2] = N & 0xff;
+	tuner_buf[3] = 0;
+	tuner_buf[4] = 0x52;
+	tuner_buf[5] = (tda827x_dvbt[i].spd << 6) + (tda827x_dvbt[i].div1p5 << 5) +
+				   (tda827x_dvbt[i].bs << 3) + tda827x_dvbt[i].bp;
+	tuner_buf[6] = (tda827x_dvbt[i].gc3 << 4) + 0x8f;
+	tuner_buf[7] = 0xbf;
+	tuner_buf[8] = 0x2a;
+	tuner_buf[9] = 0x05;
+	tuner_buf[10] = 0xff;
+	tuner_buf[11] = 0x00;
+	tuner_buf[12] = 0x00;
+	tuner_buf[13] = 0x40;
+
+	tuner_msg.len = 14;
+	if (i2c_transfer(&dev->i2c_adap, &tuner_msg, 1) != 1)
+		return -EIO;
+
+	msleep(500);
+	/* correct CP value */
+	tuner_buf[0] = 0x30;
+	tuner_buf[1] = 0x50 + tda827x_dvbt[i].cp;
+	tuner_msg.len = 2;
+	i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
+
+	return 0;
+}
+
+static void philips_tda827x_pll_sleep(struct dvb_frontend *fe)
+{
+	struct saa7134_dev *dev = fe->dvb->priv;
+	static u8 tda827x_sleep[] = { 0x30, 0xd0};
+	struct i2c_msg tuner_msg = {.addr = 0x60,.flags = 0,.buf = tda827x_sleep,
+	                            .len = sizeof(tda827x_sleep) };
+	i2c_transfer(&dev->i2c_adap, &tuner_msg, 1);
+}
+
+static struct tda1004x_config tda827x_lifeview_config = {
+	.demod_address = 0x08,
+	.invert        = 1,
+	.invert_oclk   = 0,
+	.xtal_freq     = TDA10046_XTAL_16M,
+	.agc_config    = TDA10046_AGC_TDA827X,
+	.if_freq       = TDA10046_FREQ_045,
+	.pll_init      = philips_tda827x_pll_init,
+	.pll_set       = philips_tda827x_pll_set,
+	.pll_sleep	   = philips_tda827x_pll_sleep,
+	.request_firmware = NULL,
+};
+#endif
+
+/* ------------------------------------------------------------------ */
+
 static int dvb_init(struct saa7134_dev *dev)
 {
 	/* init struct videobuf_dvb */
@@ -197,18 +547,31 @@
 			    dev);
 
 	switch (dev->board) {
+#if CONFIG_DVB_MT352
 	case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
 		printk("%s: pinnacle 300i dvb setup\n",dev->name);
 		dev->dvb.frontend = mt352_attach(&pinnacle_300i,
 						 &dev->i2c_adap);
 		break;
+#endif
+#if CONFIG_DVB_TDA1004X
 	case SAA7134_BOARD_MD7134:
 		dev->dvb.frontend = tda10046_attach(&medion_cardbus,
 						    &dev->i2c_adap);
-		if (NULL == dev->dvb.frontend)
-			printk("%s: Hmm, looks like this is the old MD7134 "
-			       "version without DVB-T support\n",dev->name);
 		break;
+	case SAA7134_BOARD_PHILIPS_TOUGH:
+		dev->dvb.frontend = tda10046_attach(&philips_tu1216_config,
+						    &dev->i2c_adap);
+		break;
+	case SAA7134_BOARD_FLYDVBTDUO:
+		dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
+						    &dev->i2c_adap);
+		break;
+	case SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS:
+		dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config,
+						    &dev->i2c_adap);
+		break;
+#endif
 	default:
 		printk("%s: Huh? unknown DVB card?\n",dev->name);
 		break;
@@ -227,8 +590,6 @@
 {
 	static int on  = TDA9887_PRESENT | TDA9887_PORT2_INACTIVE;
 
-	printk("%s: %s\n",dev->name,__FUNCTION__);
-
 	switch (dev->board) {
 	case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
 		/* otherwise we don't detect the tuner on next insmod */
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c
index b6f002e..93dd619 100644
--- a/drivers/media/video/saa7134/saa7134-i2c.c
+++ b/drivers/media/video/saa7134/saa7134-i2c.c
@@ -1,5 +1,5 @@
 /*
- * $Id: saa7134-i2c.c,v 1.11 2005/06/12 01:36:14 mchehab Exp $
+ * $Id: saa7134-i2c.c,v 1.19 2005/07/07 01:49:30 mkrufky Exp $
  *
  * device driver for philips saa7134 based TV cards
  * i2c interface support
@@ -197,10 +197,6 @@
 	enum i2c_status status;
 	__u32 dword;
 
-#if 0
-	i2c_set_attr(dev,attr);
-	saa_writeb(SAA7134_I2C_DATA, data);
-#else
 	/* have to write both attr + data in one 32bit word */
 	dword  = saa_readl(SAA7134_I2C_ATTR_STATUS >> 2);
 	dword &= 0x0f;
@@ -210,7 +206,6 @@
 //	dword |= 0x40 << 16;  /* 400 kHz */
 	dword |= 0xf0 << 24;
 	saa_writel(SAA7134_I2C_ATTR_STATUS >> 2, dword);
-#endif
 	d2printk(KERN_DEBUG "%s: i2c data => 0x%x\n",dev->name,data);
 
 	if (!i2c_is_busy_wait(dev))
@@ -331,12 +326,44 @@
 
 static int attach_inform(struct i2c_client *client)
 {
-        struct saa7134_dev *dev = client->adapter->algo_data;
+	struct saa7134_dev *dev = client->adapter->algo_data;
 	int tuner = dev->tuner_type;
 	int conf  = dev->tda9887_conf;
+	struct tuner_setup tun_setup;
 
-	saa7134_i2c_call_clients(dev,TUNER_SET_TYPE,&tuner);
-	saa7134_i2c_call_clients(dev,TDA9887_SET_CONFIG,&conf);
+	d1printk( "%s i2c attach [addr=0x%x,client=%s]\n",
+		client->driver->name,client->addr,i2c_clientname(client));
+
+	if (!client->driver->command)
+		return 0;
+
+	if (saa7134_boards[dev->board].radio_type != UNSET) {
+
+		tun_setup.type = saa7134_boards[dev->board].radio_type;
+		tun_setup.addr = saa7134_boards[dev->board].radio_addr;
+
+		if ((tun_setup.addr == ADDR_UNSET) || (tun_setup.addr == client->addr)) {
+			tun_setup.mode_mask = T_RADIO;
+
+			client->driver->command(client, TUNER_SET_TYPE_ADDR, &tun_setup);
+		}
+        }
+
+	if (tuner != UNSET) {
+
+	        tun_setup.type = tuner;
+	        tun_setup.addr = saa7134_boards[dev->board].tuner_addr;
+
+		if ((tun_setup.addr == ADDR_UNSET)||(tun_setup.addr == client->addr)) {
+
+			tun_setup.mode_mask = T_ANALOG_TV;
+
+			client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_setup);
+		}
+        }
+
+	client->driver->command(client, TDA9887_SET_CONFIG, &conf);
+
         return 0;
 }
 
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index aba2b9d..2137401 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -1,5 +1,5 @@
 /*
- * $Id: saa7134-input.c,v 1.19 2005/06/07 18:02:26 nsh Exp $
+ * $Id: saa7134-input.c,v 1.21 2005/06/22 23:37:34 nsh Exp $
  *
  * handle saa7134 IR remotes via linux kernel input layer.
  *
@@ -68,10 +68,8 @@
 	[    6 ] = KEY_AGAIN,        // Recal
 	[   16 ] = KEY_KPENTER,      // Enter
 
-#if 1 /* FIXME */
 	[   26 ] = KEY_F22,          // Stereo
 	[   24 ] = KEY_EDIT,         // AV Source
-#endif
 };
 
 static IR_KEYTAB_TYPE cinergy_codes[IR_KEYTAB_SIZE] = {
@@ -172,45 +170,45 @@
 };
 
 static IR_KEYTAB_TYPE avacssmart_codes[IR_KEYTAB_SIZE] = {
-        [ 30 ] = KEY_POWER,		// power
+	[ 30 ] = KEY_POWER,		// power
 	[ 28 ] = KEY_SEARCH,		// scan
-        [  7 ] = KEY_SELECT,		// source
+	[  7 ] = KEY_SELECT,		// source
 
 	[ 22 ] = KEY_VOLUMEUP,
 	[ 20 ] = KEY_VOLUMEDOWN,
-        [ 31 ] = KEY_CHANNELUP,
+	[ 31 ] = KEY_CHANNELUP,
 	[ 23 ] = KEY_CHANNELDOWN,
 	[ 24 ] = KEY_MUTE,
 
 	[  2 ] = KEY_KP0,
-        [  1 ] = KEY_KP1,
-        [ 11 ] = KEY_KP2,
-        [ 27 ] = KEY_KP3,
-        [  5 ] = KEY_KP4,
-        [  9 ] = KEY_KP5,
-        [ 21 ] = KEY_KP6,
+	[  1 ] = KEY_KP1,
+	[ 11 ] = KEY_KP2,
+	[ 27 ] = KEY_KP3,
+	[  5 ] = KEY_KP4,
+	[  9 ] = KEY_KP5,
+	[ 21 ] = KEY_KP6,
 	[  6 ] = KEY_KP7,
-        [ 10 ] = KEY_KP8,
+	[ 10 ] = KEY_KP8,
 	[ 18 ] = KEY_KP9,
 	[ 16 ] = KEY_KPDOT,
 
 	[  3 ] = KEY_TUNER,		// tv/fm
-        [  4 ] = KEY_REWIND,		// fm tuning left or function left
-        [ 12 ] = KEY_FORWARD,		// fm tuning right or function right
+	[  4 ] = KEY_REWIND,		// fm tuning left or function left
+	[ 12 ] = KEY_FORWARD,		// fm tuning right or function right
 
 	[  0 ] = KEY_RECORD,
-        [  8 ] = KEY_STOP,
-        [ 17 ] = KEY_PLAY,
+	[  8 ] = KEY_STOP,
+	[ 17 ] = KEY_PLAY,
 
 	[ 25 ] = KEY_ZOOM,
 	[ 14 ] = KEY_MENU,		// function
 	[ 19 ] = KEY_AGAIN,		// recall
 	[ 29 ] = KEY_RESTART,		// reset
+	[ 26 ] = KEY_SHUFFLE,		// snapshot/shuffle
 
 // FIXME
 	[ 13 ] = KEY_F21,		// mts
-        [ 15 ] = KEY_F22,		// min
-	[ 26 ] = KEY_F23,		// freeze
+	[ 15 ] = KEY_F22,		// min
 };
 
 /* Alex Hermann <gaaf@gmx.net> */
@@ -489,13 +487,14 @@
 		break;
 	case SAA7134_BOARD_ECS_TVP3XP:
 	case SAA7134_BOARD_ECS_TVP3XP_4CB5:
-                ir_codes     = eztv_codes;
-                mask_keycode = 0x00017c;
-                mask_keyup   = 0x000002;
+		ir_codes     = eztv_codes;
+		mask_keycode = 0x00017c;
+		mask_keyup   = 0x000002;
 		polling      = 50; // ms
-                break;
+		break;
+	case SAA7134_BOARD_KWORLD_XPERT:
 	case SAA7134_BOARD_AVACSSMARTTV:
-	        ir_codes     = avacssmart_codes;
+		ir_codes     = avacssmart_codes;
 		mask_keycode = 0x00001F;
 		mask_keyup   = 0x000020;
 		polling      = 50; // ms
@@ -524,6 +523,7 @@
 		polling      = 50; // ms
 		break;
 	case SAA7134_BOARD_VIDEOMATE_TV_PVR:
+	case SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII:
 		ir_codes     = videomate_tv_pvr_codes;
 		mask_keycode = 0x00003F;
 		mask_keyup   = 0x400000;
diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c
index 8173290..b5bede9 100644
--- a/drivers/media/video/saa7134/saa7134-oss.c
+++ b/drivers/media/video/saa7134/saa7134-oss.c
@@ -1,5 +1,5 @@
 /*
- * $Id: saa7134-oss.c,v 1.14 2005/05/18 22:45:16 hhackmann Exp $
+ * $Id: saa7134-oss.c,v 1.17 2005/06/28 23:41:47 mkrufky Exp $
  *
  * device driver for philips saa7134 based TV cards
  * oss dsp interface
@@ -556,21 +556,28 @@
 static int
 mixer_recsrc_7133(struct saa7134_dev *dev)
 {
-	u32 value = 0xbbbbbb;
+	u32 anabar, xbarin;
 
+	xbarin = 0x03; // adc
+    anabar = 0;
 	switch (dev->oss.input) {
 	case TV:
-		value = 0xbbbb10;  /* MAIN */
+		xbarin = 0; // Demodulator
+        anabar = 2; // DACs
 		break;
 	case LINE1:
-		value = 0xbbbb32;  /* AUX1 */
+		anabar = 0;  // aux1, aux1
 		break;
 	case LINE2:
 	case LINE2_LEFT:
-		value = 0xbbbb54;  /* AUX2 */
+		anabar = 9;  // aux2, aux2
 		break;
 	}
-	saa_dsp_writel(dev, 0x46c >> 2, value);
+    /* output xbar always main channel */
+	saa_dsp_writel(dev, 0x46c >> 2, 0xbbbb10);
+	saa_dsp_writel(dev, 0x464 >> 2, xbarin);
+	saa_writel(0x594 >> 2, anabar);
+
 	return 0;
 }
 
diff --git a/drivers/media/video/saa7134/saa7134-ts.c b/drivers/media/video/saa7134/saa7134-ts.c
index 345eb2a..4dd9f1b 100644
--- a/drivers/media/video/saa7134/saa7134-ts.c
+++ b/drivers/media/video/saa7134/saa7134-ts.c
@@ -1,5 +1,5 @@
 /*
- * $Id: saa7134-ts.c,v 1.14 2005/02/03 10:24:33 kraxel Exp $
+ * $Id: saa7134-ts.c,v 1.15 2005/06/14 22:48:18 hhackmann Exp $
  *
  * device driver for philips saa7134 based TV cards
  * video4linux video interface
@@ -221,10 +221,10 @@
 	if (dev->ts_q.curr) {
 		field = dev->ts_q.curr->vb.field;
 		if (field == V4L2_FIELD_TOP) {
-			if ((status & 0x100000) != 0x000000)
+			if ((status & 0x100000) != 0x100000)
 				goto done;
 		} else {
-			if ((status & 0x100000) != 0x100000)
+			if ((status & 0x100000) != 0x000000)
 				goto done;
 		}
 		saa7134_buffer_finish(dev,&dev->ts_q,STATE_DONE);
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index 3617e7f..eeafa5a 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -1,5 +1,5 @@
 /*
- * $Id: saa7134-tvaudio.c,v 1.25 2005/06/07 19:00:38 nsh Exp $
+ * $Id: saa7134-tvaudio.c,v 1.30 2005/06/28 23:41:47 mkrufky Exp $
  *
  * device driver for philips saa7134 based TV cards
  * tv audio decoder (fm stereo, nicam, ...)
@@ -169,7 +169,7 @@
 	int clock = saa7134_boards[dev->board].audio_clock;
 
 	if (UNSET != audio_clock_override)
-	        clock = audio_clock_override;
+		clock = audio_clock_override;
 
 	/* init all audio registers */
 	saa_writeb(SAA7134_AUDIO_PLL_CTRL,   0x00);
@@ -219,14 +219,17 @@
 	in   = dev->input;
 	mute = (dev->ctl_mute ||
 		(dev->automute  &&  (&card(dev).radio) != in));
-	if (PCI_DEVICE_ID_PHILIPS_SAA7130 == dev->pci->device &&
-	    card(dev).mute.name) {
-		/* 7130 - we'll mute using some unconnected audio input */
+	if (card(dev).mute.name) {
+		/*
+		 * 7130 - we'll mute using some unconnected audio input
+		 * 7134 - we'll probably should switch external mux with gpio
+		 */
 		if (mute)
 			in = &card(dev).mute;
 	}
+
 	if (dev->hw_mute  == mute &&
-	    dev->hw_input == in) {
+		dev->hw_input == in) {
 		dprintk("mute/input: nothing to do [mute=%d,input=%s]\n",
 			mute,in->name);
 		return;
@@ -260,6 +263,7 @@
 	/* switch gpio-connected external audio mux */
 	if (0 == card(dev).gpiomask)
 		return;
+
 	mask = card(dev).gpiomask;
 	saa_andorl(SAA7134_GPIO_GPMODE0 >> 2,   mask, mask);
 	saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio);
@@ -339,13 +343,8 @@
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule();
 		} else {
-#if 0
-			/* hmm, that one doesn't return on wakeup ... */
-			msleep_interruptible(timeout);
-#else
 			set_current_state(TASK_INTERRUPTIBLE);
 			schedule_timeout(msecs_to_jiffies(timeout));
-#endif
 		}
 	}
 	remove_wait_queue(&dev->thread.wq, &wait);
@@ -400,27 +399,10 @@
 	return value;
 }
 
-#if 0
-static void sifdebug_dump_regs(struct saa7134_dev *dev)
-{
-	print_regb(AUDIO_STATUS);
-	print_regb(IDENT_SIF);
-	print_regb(LEVEL_READOUT1);
-	print_regb(LEVEL_READOUT2);
-	print_regb(DCXO_IDENT_CTRL);
-	print_regb(DEMODULATOR);
-	print_regb(AGC_GAIN_SELECT);
-	print_regb(MONITOR_SELECT);
-	print_regb(FM_DEEMPHASIS);
-	print_regb(FM_DEMATRIX);
-	print_regb(SIF_SAMPLE_FREQ);
-	print_regb(ANALOG_IO_SELECT);
-}
-#endif
 
 static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *audio)
 {
-	__u32 idp,nicam;
+	__u32 idp, nicam, nicam_status;
 	int retval = -1;
 
 	switch (audio->mode) {
@@ -442,18 +424,24 @@
 		break;
 	case TVAUDIO_NICAM_FM:
 	case TVAUDIO_NICAM_AM:
-		nicam = saa_readb(SAA7134_NICAM_STATUS);
+		nicam = saa_readb(SAA7134_AUDIO_STATUS);
 		dprintk("getstereo: nicam=0x%x\n",nicam);
-		switch (nicam & 0x0b) {
-		case 0x08:
-			retval = V4L2_TUNER_SUB_MONO;
-			break;
-		case 0x09:
-			retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
-			break;
-		case 0x0a:
-			retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
-			break;
+		if (nicam & 0x1) {
+			nicam_status = saa_readb(SAA7134_NICAM_STATUS);
+			dprintk("getstereo: nicam_status=0x%x\n", nicam_status);
+
+			switch (nicam_status & 0x03) {
+			    case 0x01:
+				retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2;
+				break;
+			    case 0x02:
+				retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO;
+				break;
+			    default:
+				retval = V4L2_TUNER_SUB_MONO;
+			}
+		} else {
+			/* No nicam detected */
 		}
 		break;
 	}
@@ -489,15 +477,15 @@
 		break;
 	case TVAUDIO_FM_K_STEREO:
 	case TVAUDIO_FM_BG_STEREO:
+	case TVAUDIO_NICAM_AM:
+	case TVAUDIO_NICAM_FM:
 		dprintk("setstereo [fm] => %s\n",
 			name[ mode % ARRAY_SIZE(name) ]);
 		reg = fm[ mode % ARRAY_SIZE(fm) ];
 		saa_writeb(SAA7134_FM_DEMATRIX, reg);
 		break;
 	case TVAUDIO_FM_SAT_STEREO:
-	case TVAUDIO_NICAM_AM:
-	case TVAUDIO_NICAM_FM:
-		/* FIXME */
+		/* Not implemented */
 		break;
 	}
 	return 0;
@@ -596,7 +584,7 @@
 		/* find the exact tv audio norm */
 		for (audio = UNSET, i = 0; i < TVAUDIO; i++) {
 			if (dev->tvnorm->id != UNSET &&
-			    !(dev->tvnorm->id & tvaudio[i].std))
+				!(dev->tvnorm->id & tvaudio[i].std))
 				continue;
 			if (tvaudio[i].carr1 != carrier)
 				continue;
@@ -703,24 +691,6 @@
 	return 0;
 }
 
-#if 0
-static int saa_dsp_readl(struct saa7134_dev *dev, int reg, u32 *value)
-{
-	int err;
-
-	d2printk("dsp read reg 0x%x\n", reg<<2);
-	saa_readl(reg);
-	err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_RDB);
-	if (err < 0)
-		return err;
-	*value = saa_readl(reg);
-	d2printk("dsp read   => 0x%06x\n", *value & 0xffffff);
-	err = saa_dsp_wait_bit(dev,SAA7135_DSP_RWSTATE_IDA);
-	if (err < 0)
-		return err;
-	return 0;
-}
-#endif
 
 int saa_dsp_writel(struct saa7134_dev *dev, int reg, u32 value)
 {
@@ -753,31 +723,50 @@
 static int mute_input_7133(struct saa7134_dev *dev)
 {
 	u32 reg = 0;
+	u32 xbarin, xbarout;
 	int mask;
+	struct saa7134_input *in;
 
+	/* Hac 0506 route OSS sound simultanously  */
+	xbarin = 0x03;
 	switch (dev->input->amux) {
 	case TV:
 		reg = 0x02;
+		xbarin = 0;
 		break;
 	case LINE1:
 		reg = 0x00;
 		break;
 	case LINE2:
 	case LINE2_LEFT:
-		reg = 0x01;
+		reg = 0x09;
 		break;
 	}
-	if (dev->ctl_mute)
+	saa_dsp_writel(dev, 0x464 >> 2, xbarin);
+	if (dev->ctl_mute) {
 		reg = 0x07;
+		xbarout = 0xbbbbbb;
+	} else
+		xbarout = 0xbbbb10;
+	saa_dsp_writel(dev, 0x46c >> 2, xbarout);
+
 	saa_writel(0x594 >> 2, reg);
 
+
 	/* switch gpio-connected external audio mux */
         if (0 != card(dev).gpiomask) {
         	mask = card(dev).gpiomask;
+
+		if (card(dev).mute.name && dev->ctl_mute)
+			in = &card(dev).mute;
+		else
+			in = dev->input;
+
         	saa_andorl(SAA7134_GPIO_GPMODE0 >> 2,   mask, mask);
-        	saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, dev->input->gpio);
-        	saa7134_track_gpio(dev,dev->input->name);
+        	saa_andorl(SAA7134_GPIO_GPSTATUS0 >> 2, mask, in->gpio);
+        	saa7134_track_gpio(dev,in->name);
 	}
+
 	return 0;
 }
 
diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c
index 3c33c59..29e51ca 100644
--- a/drivers/media/video/saa7134/saa7134-vbi.c
+++ b/drivers/media/video/saa7134/saa7134-vbi.c
@@ -130,13 +130,7 @@
 	lines   = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1;
 	if (lines > VBI_LINE_COUNT)
 		lines = VBI_LINE_COUNT;
-#if 1
 	llength = VBI_LINE_LENGTH;
-#else
-	llength = (norm->h_stop - norm->h_start +1) * 2;
-	if (llength > VBI_LINE_LENGTH)
-		llength = VBI_LINE_LENGTH;
-#endif
 	size = lines * llength * 2;
 	if (0 != buf->vb.baddr  &&  buf->vb.bsize < size)
 		return -EINVAL;
@@ -178,13 +172,7 @@
 	int llength,lines;
 
 	lines   = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 +1;
-#if 1
 	llength = VBI_LINE_LENGTH;
-#else
-	llength = (norm->h_stop - norm->h_start +1) * 2;
-	if (llength > VBI_LINE_LENGTH)
-		llength = VBI_LINE_LENGTH;
-#endif
 	*size = lines * llength * 2;
 	if (0 == *count)
 		*count = vbibufs;
diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c
index c0a2ee5..a4c2f75 100644
--- a/drivers/media/video/saa7134/saa7134-video.c
+++ b/drivers/media/video/saa7134/saa7134-video.c
@@ -1,5 +1,5 @@
 /*
- * $Id: saa7134-video.c,v 1.30 2005/06/07 19:00:38 nsh Exp $
+ * $Id: saa7134-video.c,v 1.36 2005/06/28 23:41:47 mkrufky Exp $
  *
  * device driver for philips saa7134 based TV cards
  * video4linux video interface
@@ -274,7 +274,7 @@
 
 		.h_start       = 0,
 		.h_stop        = 719,
-		.video_v_start = 23,
+  		.video_v_start = 23,
   		.video_v_stop  = 262,
   		.vbi_v_start_0 = 10,
   		.vbi_v_stop_0  = 21,
@@ -1204,7 +1204,6 @@
 	struct list_head *list;
 	enum v4l2_buf_type type = V4L2_BUF_TYPE_VIDEO_CAPTURE;
 	int radio = 0;
-
 	list_for_each(list,&saa7134_devlist) {
 		h = list_entry(list, struct saa7134_dev, devlist);
 		if (h->video_dev && (h->video_dev->minor == minor))
@@ -1256,12 +1255,12 @@
 	if (fh->radio) {
 		/* switch to radio mode */
 		saa7134_tvaudio_setinput(dev,&card(dev).radio);
-		saa7134_i2c_call_clients(dev,AUDC_SET_RADIO,NULL);
+		saa7134_i2c_call_clients(dev,AUDC_SET_RADIO, NULL);
 	} else {
 		/* switch to video/vbi mode */
 		video_mux(dev,dev->ctl_input);
 	}
-        return 0;
+	return 0;
 }
 
 static ssize_t
@@ -1304,10 +1303,10 @@
 	} else {
 		down(&fh->cap.lock);
 		if (UNSET == fh->cap.read_off) {
-                        /* need to capture a new frame */
+			/* need to capture a new frame */
 			if (res_locked(fh->dev,RESOURCE_VIDEO)) {
-                                up(&fh->cap.lock);
-                                return POLLERR;
+				up(&fh->cap.lock);
+				return POLLERR;
                         }
                         if (0 != fh->cap.ops->buf_prepare(&fh->cap,fh->cap.read_buf,fh->cap.field)) {
                                 up(&fh->cap.lock);
@@ -1363,6 +1362,36 @@
 		res_free(dev,fh,RESOURCE_VBI);
 	}
 
+	/* ts-capture will not work in planar mode, so turn it off Hac: 04.05*/
+	saa_andorb(SAA7134_OFMT_VIDEO_A, 0x1f, 0);
+	saa_andorb(SAA7134_OFMT_VIDEO_B, 0x1f, 0);
+	saa_andorb(SAA7134_OFMT_DATA_A, 0x1f, 0);
+	saa_andorb(SAA7134_OFMT_DATA_B, 0x1f, 0);
+
+	if (dev->tuner_type == TUNER_PHILIPS_TDA8290) {
+		u8 data[2];
+		int ret;
+		struct i2c_msg msg = {.addr=I2C_ADDR_TDA8290, .flags=0, .buf=data, .len = 2};
+		data[0] = 0x21;
+		data[1] = 0xc0;
+		ret = i2c_transfer(&dev->i2c_adap, &msg, 1);
+		if (ret != 1)
+			printk(KERN_ERR "TDA8290 access failure\n");
+		msg.addr = I2C_ADDR_TDA8275;
+		data[0] = 0x30;
+		data[1] = 0xd0;
+		ret = i2c_transfer(&dev->i2c_adap, &msg, 1);
+		if (ret != 1)
+			printk(KERN_ERR "TDA8275 access failure\n");
+		msg.addr = I2C_ADDR_TDA8290;
+		data[0] = 0x21;
+		data[1] = 0x80;
+		i2c_transfer(&dev->i2c_adap, &msg, 1);
+		data[0] = 0x00;
+		data[1] = 0x02;
+		i2c_transfer(&dev->i2c_adap, &msg, 1);
+	}
+
 	/* free stuff */
 	videobuf_mmap_free(&fh->cap);
 	videobuf_mmap_free(&fh->vbi);
@@ -1399,13 +1428,6 @@
 	f->fmt.vbi.count[1] = f->fmt.vbi.count[0];
 	f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */
 
-#if 0
-	if (V4L2_STD_PAL == norm->id) {
-		/* FIXME */
-		f->fmt.vbi.start[0] += 3;
-		f->fmt.vbi.start[1] += 3*2;
-	}
-#endif
 }
 
 static int saa7134_g_fmt(struct saa7134_dev *dev, struct saa7134_fh *fh,
@@ -2120,8 +2142,6 @@
 
 		memset(t,0,sizeof(*t));
 		strcpy(t->name, "Radio");
-                t->rangelow  = (int)(65*16);
-                t->rangehigh = (int)(108*16);
 
 		saa7134_i2c_call_clients(dev, VIDIOC_G_TUNER, t);
 
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index d6b1c0d..6836c07 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -1,5 +1,5 @@
 /*
- * $Id: saa7134.h,v 1.41 2005/06/07 18:02:26 nsh Exp $
+ * $Id: saa7134.h,v 1.48 2005/07/01 08:22:24 nsh Exp $
  *
  * v4l2 device driver for philips saa7134 based TV cards
  *
@@ -46,8 +46,6 @@
 #endif
 #define UNSET (-1U)
 
-/* 2.4 / 2.5 driver compatibility stuff */
-
 /* ----------------------------------------------------------- */
 /* enums                                                       */
 
@@ -159,7 +157,7 @@
 #define SAA7134_BOARD_AVERMEDIA_DVD_EZMAKER 33
 #define SAA7134_BOARD_NOVAC_PRIMETV7133 34
 #define SAA7134_BOARD_AVERMEDIA_STUDIO_305 35
-#define SAA7133_BOARD_UPMOST_PURPLE_TV 36
+#define SAA7134_BOARD_UPMOST_PURPLE_TV 36
 #define SAA7134_BOARD_ITEMS_MTV005     37
 #define SAA7134_BOARD_CINERGY200       38
 #define SAA7134_BOARD_FLYTVPLATINUM_MINI 39
@@ -176,13 +174,17 @@
 #define SAA7134_BOARD_PINNACLE_300I_DVBT_PAL 50
 #define SAA7134_BOARD_PROVIDEO_PV952   51
 #define SAA7134_BOARD_AVERMEDIA_305    52
-#define SAA7135_BOARD_ASUSTeK_TVFM7135 53
+#define SAA7134_BOARD_ASUSTeK_TVFM7135 53
 #define SAA7134_BOARD_FLYTVPLATINUM_FM 54
 #define SAA7134_BOARD_FLYDVBTDUO 55
 #define SAA7134_BOARD_AVERMEDIA_307    56
 #define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57
 #define SAA7134_BOARD_ADS_INSTANT_TV 58
 #define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59
+#define SAA7134_BOARD_THYPHOON_DVBT_DUO_CARDBUS 60
+#define SAA7134_BOARD_PHILIPS_TOUGH 61
+#define SAA7134_BOARD_VIDEOMATE_TV_GOLD_PLUSII 62
+#define SAA7134_BOARD_KWORLD_XPERT 63
 
 #define SAA7134_MAXBOARDS 8
 #define SAA7134_INPUT_MAX 8
@@ -213,6 +215,10 @@
 
 	/* i2c chip info */
 	unsigned int            tuner_type;
+	unsigned int		radio_type;
+	unsigned char		tuner_addr;
+	unsigned char		radio_addr;
+
 	unsigned int            tda9887_conf;
 
 	/* peripheral I/O */
@@ -403,9 +409,12 @@
 	/* config info */
 	unsigned int               board;
 	unsigned int               tuner_type;
+	unsigned int 		   radio_type;
+	unsigned char		   tuner_addr;
+	unsigned char		   radio_addr;
+
 	unsigned int               tda9887_conf;
 	unsigned int               gpio_value;
-	unsigned int               irq2_mask;
 
 	/* i2c i/o */
 	struct i2c_adapter         i2c_adap;
diff --git a/drivers/media/video/tda7432.c b/drivers/media/video/tda7432.c
index 07ba6d3..7cb1fb3 100644
--- a/drivers/media/video/tda7432.c
+++ b/drivers/media/video/tda7432.c
@@ -243,19 +243,6 @@
 }
 
 /* I don't think we ever actually _read_ the chip... */
-#if 0
-static int tda7432_read(struct i2c_client *client)
-{
-	unsigned char buffer;
-	d2printk("tda7432: In tda7432_read\n");
-	if (1 != i2c_master_recv(client,&buffer,1)) {
-		printk(KERN_WARNING "tda7432: I/O error, trying (read)\n");
-		return -1;
-	}
-	dprintk("tda7432: Read 0x%02x\n", buffer);
-	return buffer;
-}
-#endif
 
 static int tda7432_set(struct i2c_client *client)
 {
diff --git a/drivers/media/video/tda8290.c b/drivers/media/video/tda8290.c
index f59d460..a8b6a8d 100644
--- a/drivers/media/video/tda8290.c
+++ b/drivers/media/video/tda8290.c
@@ -1,5 +1,5 @@
 /*
- * $Id: tda8290.c,v 1.11 2005/06/18 06:09:06 nsh Exp $
+ * $Id: tda8290.c,v 1.15 2005/07/08 20:21:33 mchehab Exp $
  *
  * i2c tv tuner chip device driver
  * controls the philips tda8290+75 tuner chip combo.
@@ -136,15 +136,12 @@
 	return 0;
 }
 
-static void set_frequency(struct tuner *t, u16 ifc)
+static void set_frequency(struct tuner *t, u16 ifc, unsigned int freq)
 {
-	u32 freq;
 	u32 N;
 
 	if (t->mode == V4L2_TUNER_RADIO)
-		freq = t->freq / 1000;
-	else
-		freq = t->freq;
+		freq = freq / 1000;
 
 	N = (((freq<<3)+ifc)&0x3fffc);
 
@@ -187,14 +184,14 @@
 	struct tuner *t = i2c_get_clientdata(c);
 
 	set_audio(t);
-	set_frequency(t, 864);
+	set_frequency(t, 864, freq);
 	tda8290_tune(c);
 }
 
 static void set_radio_freq(struct i2c_client *c, unsigned int freq)
 {
 	struct tuner *t = i2c_get_clientdata(c);
-	set_frequency(t, 704);
+	set_frequency(t, 704, freq);
 	tda8290_tune(c);
 }
 
diff --git a/drivers/media/video/tda9875.c b/drivers/media/video/tda9875.c
index 97b113e..566e1a5 100644
--- a/drivers/media/video/tda9875.c
+++ b/drivers/media/video/tda9875.c
@@ -123,19 +123,6 @@
 	return 0;
 }
 
-#if 0
-static int tda9875_read(struct i2c_client *client)
-{
-	unsigned char buffer;
-	dprintk("In tda9875_read\n");
-	if (1 != i2c_master_recv(client,&buffer,1)) {
-		printk(KERN_WARNING "tda9875: I/O error, trying (read)\n");
-		return -1;
-	}
-	dprintk("Read 0x%02x\n", buffer);
-	return buffer;
-}
-#endif
 
 static int i2c_read_register(struct i2c_adapter *adap, int addr, int reg)
 {
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index ee35562..108c3ad 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -569,15 +569,6 @@
 	tda9887_set_config(t,buf);
 	tda9887_set_insmod(t,buf);
 
-#if 0
-	/* This as-is breaks some cards, must be fixed in a
-	 * card-specific way, probably using TDA9887_SET_CONFIG to
-	 * turn on/off port2 */
-	if (t->std & V4L2_STD_SECAM_L) {
-		/* secam fixup (FIXME: move this to tvnorms array?) */
-		buf[1] &= ~cOutputPort2Inactive;
-	}
-#endif
 
 	dprintk(PREFIX "writing: b=0x%02x c=0x%02x e=0x%02x\n",
 		buf[1],buf[2],buf[3]);
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c
index a29f08f..b53c748c 100644
--- a/drivers/media/video/tea5767.c
+++ b/drivers/media/video/tea5767.c
@@ -2,7 +2,7 @@
  * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview
  * I2C address is allways 0xC0.
  *
- * $Id: tea5767.c,v 1.11 2005/06/21 15:40:33 mchehab Exp $
+ * $Id: tea5767.c,v 1.18 2005/07/07 03:02:55 mchehab Exp $
  *
  * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br)
  * This code is placed under the terms of the GNU General Public License
@@ -11,23 +11,11 @@
  * from their contributions on DScaler.
  */
 
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/string.h>
-#include <linux/timer.h>
-#include <linux/delay.h>
-#include <linux/errno.h>
-#include <linux/slab.h>
-#include <linux/videodev.h>
 #include <linux/i2c.h>
-#include <linux/i2c-algo-bit.h>
-
+#include <linux/videodev.h>
+#include <linux/delay.h>
 #include <media/tuner.h>
-
-/* Declared at tuner-core.c */
-extern unsigned int tuner_debug;
+#include <media/tuner.h>
 
 #define PREFIX "TEA5767 "
 
@@ -38,8 +26,8 @@
  ******************************/
 
 /* First register */
-#define TEA5767_MUTE		0x80 /* Mutes output */
-#define TEA5767_SEARCH		0x40 /* Activates station search */
+#define TEA5767_MUTE		0x80	/* Mutes output */
+#define TEA5767_SEARCH		0x40	/* Activates station search */
 /* Bits 0-5 for divider MSB */
 
 /* Second register */
@@ -130,6 +118,14 @@
 /* Reserved for future extensions */
 #define TEA5767_RESERVED_MASK	0xff
 
+enum tea5767_xtal_freq {
+        TEA5767_LOW_LO_32768    = 0,
+        TEA5767_HIGH_LO_32768   = 1,
+        TEA5767_LOW_LO_13MHz    = 2,
+        TEA5767_HIGH_LO_13MHz   = 3,
+};
+
+
 /*****************************************************************************/
 
 static void set_tv_freq(struct i2c_client *c, unsigned int freq)
@@ -153,103 +149,112 @@
 	else
 		printk(PREFIX "Tuner not at band limit\n");
 
-	div=((buffer[0]&0x3f)<<8) | buffer[1];
+	div = ((buffer[0] & 0x3f) << 8) | buffer[1];
 
 	switch (TEA5767_HIGH_LO_32768) {
 	case TEA5767_HIGH_LO_13MHz:
-		frq = 1000*(div*50-700-225)/4; /* Freq in KHz */
+		frq = 1000 * (div * 50 - 700 - 225) / 4;	/* Freq in KHz */
 		break;
 	case TEA5767_LOW_LO_13MHz:
-		frq = 1000*(div*50+700+225)/4; /* Freq in KHz */
+		frq = 1000 * (div * 50 + 700 + 225) / 4;	/* Freq in KHz */
 		break;
 	case TEA5767_LOW_LO_32768:
-		frq = 1000*(div*32768/1000+700+225)/4; /* Freq in KHz */
+		frq = 1000 * (div * 32768 / 1000 + 700 + 225) / 4;	/* Freq in KHz */
 		break;
 	case TEA5767_HIGH_LO_32768:
 	default:
-		frq = 1000*(div*32768/1000-700-225)/4; /* Freq in KHz */
+		frq = 1000 * (div * 32768 / 1000 - 700 - 225) / 4;	/* Freq in KHz */
 		break;
 	}
-        buffer[0] = (div>>8) & 0x3f;
-        buffer[1] = div      & 0xff;
+	buffer[0] = (div >> 8) & 0x3f;
+	buffer[1] = div & 0xff;
 
 	printk(PREFIX "Frequency %d.%03d KHz (divider = 0x%04x)\n",
-						frq/1000,frq%1000,div);
+	       frq / 1000, frq % 1000, div);
 
 	if (TEA5767_STEREO_MASK & buffer[2])
 		printk(PREFIX "Stereo\n");
 	else
 		printk(PREFIX "Mono\n");
 
-	printk(PREFIX "IF Counter = %d\n",buffer[2] & TEA5767_IF_CNTR_MASK);
+	printk(PREFIX "IF Counter = %d\n", buffer[2] & TEA5767_IF_CNTR_MASK);
 
-	printk(PREFIX "ADC Level = %d\n",(buffer[3] & TEA5767_ADC_LEVEL_MASK)>>4);
+	printk(PREFIX "ADC Level = %d\n",
+	       (buffer[3] & TEA5767_ADC_LEVEL_MASK) >> 4);
 
-	printk(PREFIX "Chip ID = %d\n",(buffer[3] & TEA5767_CHIP_ID_MASK));
+	printk(PREFIX "Chip ID = %d\n", (buffer[3] & TEA5767_CHIP_ID_MASK));
 
-	printk(PREFIX "Reserved = 0x%02x\n",(buffer[4] & TEA5767_RESERVED_MASK));
+	printk(PREFIX "Reserved = 0x%02x\n",
+	       (buffer[4] & TEA5767_RESERVED_MASK));
 }
 
 /* Freq should be specifyed at 62.5 Hz */
 static void set_radio_freq(struct i2c_client *c, unsigned int frq)
 {
 	struct tuner *t = i2c_get_clientdata(c);
-        unsigned char buffer[5];
+	unsigned char buffer[5];
 	unsigned div;
 	int rc;
 
-	if ( tuner_debug )
-		printk(PREFIX "radio freq counter %d\n",frq);
+	tuner_dbg (PREFIX "radio freq counter %d\n", frq);
 
 	/* Rounds freq to next decimal value - for 62.5 KHz step */
 	/* frq = 20*(frq/16)+radio_frq[frq%16]; */
 
 	buffer[2] = TEA5767_PORT1_HIGH;
-	buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL | TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND;
-	buffer[4]=0;
+	buffer[3] = TEA5767_PORT2_HIGH | TEA5767_HIGH_CUT_CTRL |
+		    TEA5767_ST_NOISE_CTL | TEA5767_JAPAN_BAND;
+	buffer[4] = 0;
+
+	if (t->mode == T_STANDBY) {
+		tuner_dbg("TEA5767 set to standby mode\n");
+		buffer[3] |= TEA5767_STDBY;
+	}
 
 	if (t->audmode == V4L2_TUNER_MODE_MONO) {
 		tuner_dbg("TEA5767 set to mono\n");
 		buffer[2] |= TEA5767_MONO;
-	} else
- 		tuner_dbg("TEA5767 set to stereo\n");
+	} else {
+		tuner_dbg("TEA5767 set to stereo\n");
+	}
 
-	switch (t->type) {
+	/* Should be replaced */
+	switch (TEA5767_HIGH_LO_32768) {
 	case TEA5767_HIGH_LO_13MHz:
-		tuner_dbg("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n");
+		tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 13 MHz\n");
 		buffer[2] |= TEA5767_HIGH_LO_INJECT;
 		buffer[4] |= TEA5767_PLLREF_ENABLE;
-		div = (frq*4/16+700+225+25)/50;
+		div = (frq * 4 / 16 + 700 + 225 + 25) / 50;
 		break;
 	case TEA5767_LOW_LO_13MHz:
-		tuner_dbg("TEA5767 radio LOW LO inject xtal @ 13 MHz\n");
+		tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 13 MHz\n");
 
 		buffer[4] |= TEA5767_PLLREF_ENABLE;
-		div = (frq*4/16-700-225+25)/50;
+		div = (frq * 4 / 16 - 700 - 225 + 25) / 50;
 		break;
 	case TEA5767_LOW_LO_32768:
-		tuner_dbg("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n");
+		tuner_dbg ("TEA5767 radio LOW LO inject xtal @ 32,768 MHz\n");
 		buffer[3] |= TEA5767_XTAL_32768;
 		/* const 700=4000*175 Khz - to adjust freq to right value */
-		div = (1000*(frq*4/16-700-225)+16384)>>15;
+		div = (1000 * (frq * 4 / 16 - 700 - 225) + 16384) >> 15;
 		break;
 	case TEA5767_HIGH_LO_32768:
 	default:
-		tuner_dbg("TEA5767 radio HIGH LO inject xtal @ 32,768 MHz\n");
+		tuner_dbg ("TEA5767 radio HIGH LO inject xtal @ 32,768 MHz\n");
 
 		buffer[2] |= TEA5767_HIGH_LO_INJECT;
 		buffer[3] |= TEA5767_XTAL_32768;
-		div = (1000*(frq*4/16+700+225)+16384)>>15;
+		div = (1000 * (frq * 4 / 16 + 700 + 225) + 16384) >> 15;
 		break;
 	}
-        buffer[0] = (div>>8) & 0x3f;
-        buffer[1] = div      & 0xff;
+	buffer[0] = (div >> 8) & 0x3f;
+	buffer[1] = div & 0xff;
 
-	if ( tuner_debug )
+	if (tuner_debug)
 		tea5767_status_dump(buffer);
 
-        if (5 != (rc = i2c_master_send(c,buffer,5)))
-		tuner_warn("i2c i/o error: rc == %d (should be 5)\n",rc);
+	if (5 != (rc = i2c_master_send(c, buffer, 5)))
+		tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
 }
 
 static int tea5767_signal(struct i2c_client *c)
@@ -258,11 +263,11 @@
 	int rc;
 	struct tuner *t = i2c_get_clientdata(c);
 
-	memset(buffer,0,sizeof(buffer));
-        if (5 != (rc = i2c_master_recv(c,buffer,5)))
-                tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc);
+	memset(buffer, 0, sizeof(buffer));
+	if (5 != (rc = i2c_master_recv(c, buffer, 5)))
+		tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
 
-	return ((buffer[3] & TEA5767_ADC_LEVEL_MASK) <<(13-4));
+	return ((buffer[3] & TEA5767_ADC_LEVEL_MASK) << (13 - 4));
 }
 
 static int tea5767_stereo(struct i2c_client *c)
@@ -271,47 +276,46 @@
 	int rc;
 	struct tuner *t = i2c_get_clientdata(c);
 
-	memset(buffer,0,sizeof(buffer));
-        if (5 != (rc = i2c_master_recv(c,buffer,5)))
-                tuner_warn ( "i2c i/o error: rc == %d (should be 5)\n",rc);
+	memset(buffer, 0, sizeof(buffer));
+	if (5 != (rc = i2c_master_recv(c, buffer, 5)))
+		tuner_warn("i2c i/o error: rc == %d (should be 5)\n", rc);
 
 	rc = buffer[2] & TEA5767_STEREO_MASK;
 
-	if ( tuner_debug )
-		tuner_dbg("TEA5767 radio ST GET = %02x\n", rc);
+	tuner_dbg("TEA5767 radio ST GET = %02x\n", rc);
 
-	return ( (buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO: 0);
+	return ((buffer[2] & TEA5767_STEREO_MASK) ? V4L2_TUNER_SUB_STEREO : 0);
 }
 
-int tea_detection(struct i2c_client *c)
+int tea5767_autodetection(struct i2c_client *c)
 {
-	unsigned char buffer[5]= { 0xff, 0xff, 0xff, 0xff, 0xff };
+	unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff };
 	int rc;
 	struct tuner *t = i2c_get_clientdata(c);
 
-        if (5 != (rc = i2c_master_recv(c,buffer,5))) {
-                tuner_warn ( "it is not a TEA5767. Received %i chars.\n",rc );
+	if (5 != (rc = i2c_master_recv(c, buffer, 5))) {
+		tuner_warn("it is not a TEA5767. Received %i chars.\n", rc);
 		return EINVAL;
 	}
 
 	/* If all bytes are the same then it's a TV tuner and not a tea5767 chip. */
-	if (buffer[0] == buffer[1] &&  buffer[0] == buffer[2] &&
-	    buffer[0] == buffer[3] &&  buffer[0] == buffer[4]) {
-                tuner_warn ( "All bytes are equal. It is not a TEA5767\n" );
+	if (buffer[0] == buffer[1] && buffer[0] == buffer[2] &&
+	    buffer[0] == buffer[3] && buffer[0] == buffer[4]) {
+		tuner_warn("All bytes are equal. It is not a TEA5767\n");
 		return EINVAL;
 	}
 
 	/*  Status bytes:
 	 *  Byte 4: bit 3:1 : CI (Chip Identification) == 0
-	 *	    bit 0   : internally set to 0
+	 *          bit 0   : internally set to 0
 	 *  Byte 5: bit 7:0 : == 0
 	 */
 
 	if (!((buffer[3] & 0x0f) == 0x00) && (buffer[4] == 0x00)) {
-                tuner_warn ( "Chip ID is not zero. It is not a TEA5767\n" );
+		tuner_warn("Chip ID is not zero. It is not a TEA5767\n");
 		return EINVAL;
 	}
-	tuner_warn ( "TEA5767 detected.\n" );
+	tuner_warn("TEA5767 detected.\n");
 	return 0;
 }
 
@@ -319,16 +323,16 @@
 {
 	struct tuner *t = i2c_get_clientdata(c);
 
-	if (tea_detection(c)==EINVAL) return EINVAL;
+	if (tea5767_autodetection(c) == EINVAL)
+		return EINVAL;
 
-        tuner_info("type set to %d (%s)\n",
-                   t->type, TEA5767_TUNER_NAME);
-        strlcpy(c->name, TEA5767_TUNER_NAME, sizeof(c->name));
+	tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio");
+	strlcpy(c->name, "tea5767", sizeof(c->name));
 
-	t->tv_freq    = set_tv_freq;
+	t->tv_freq = set_tv_freq;
 	t->radio_freq = set_radio_freq;
 	t->has_signal = tea5767_signal;
-	t->is_stereo  = tea5767_stereo;
+	t->is_stereo = tea5767_stereo;
 
 	return (0);
 }
diff --git a/drivers/media/video/tuner-3036.c b/drivers/media/video/tuner-3036.c
index 51748c6..7d825e5 100644
--- a/drivers/media/video/tuner-3036.c
+++ b/drivers/media/video/tuner-3036.c
@@ -152,7 +152,7 @@
 
 	switch (cmd) 
 	{
-		case TUNER_SET_TVFREQ:
+		case VIDIOCSFREQ:
 			set_tv_freq(client, *iarg);
 			break;
 	    
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c
index 6f6bf4a..de19063 100644
--- a/drivers/media/video/tuner-core.c
+++ b/drivers/media/video/tuner-core.c
@@ -1,5 +1,5 @@
 /*
- * $Id: tuner-core.c,v 1.29 2005/06/21 15:40:33 mchehab Exp $
+ * $Id: tuner-core.c,v 1.55 2005/07/08 13:20:33 mchehab Exp $
  *
  * i2c tv tuner chip device driver
  * core core, i.e. kernel interfaces, registering and so on
@@ -23,42 +23,36 @@
 #include <media/tuner.h>
 #include <media/audiochip.h>
 
-/*
- * comment line bellow to return to old behavor, where only one I2C device is supported
- */
-
 #define UNSET (-1U)
 
 /* standard i2c insmod options */
 static unsigned short normal_i2c[] = {
-	0x4b, /* tda8290 */
+	0x4b,			/* tda8290 */
 	0x60, 0x61, 0x62, 0x63, 0x64, 0x65, 0x66, 0x67,
 	0x68, 0x69, 0x6a, 0x6b, 0x6c, 0x6d, 0x6e, 0x6f,
 	I2C_CLIENT_END
 };
+
 I2C_CLIENT_INSMOD;
 
 /* insmod options used at init time => read/only */
-static unsigned int addr  =  0;
+static unsigned int addr = 0;
 module_param(addr, int, 0444);
 
 /* insmod options used at runtime => read/write */
-unsigned int tuner_debug   = 0;
-module_param(tuner_debug,       int, 0644);
+unsigned int tuner_debug = 0;
+module_param(tuner_debug, int, 0644);
 
-static unsigned int tv_range[2]    = { 44, 958 };
+static unsigned int tv_range[2] = { 44, 958 };
 static unsigned int radio_range[2] = { 65, 108 };
 
-module_param_array(tv_range,    int, NULL, 0644);
+module_param_array(tv_range, int, NULL, 0644);
 module_param_array(radio_range, int, NULL, 0644);
 
 MODULE_DESCRIPTION("device driver for various TV and TV+FM radio tuners");
 MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer");
 MODULE_LICENSE("GPL");
 
-static int this_adap;
-static unsigned short first_tuner, tv_tuner, radio_tuner;
-
 static struct i2c_driver driver;
 static struct i2c_client client_template;
 
@@ -70,18 +64,19 @@
 	struct tuner *t = i2c_get_clientdata(c);
 
 	if (t->type == UNSET) {
-		tuner_info("tuner type not set\n");
+		tuner_warn ("tuner type not set\n");
 		return;
 	}
 	if (NULL == t->tv_freq) {
-		tuner_info("Huh? tv_set is NULL?\n");
+		tuner_warn ("Tuner has no way to set tv freq\n");
 		return;
 	}
-	if (freq < tv_range[0]*16 || freq > tv_range[1]*16) {
-			tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n",
-				   freq/16,freq%16*100/16,tv_range[0],tv_range[1]);
+	if (freq < tv_range[0] * 16 || freq > tv_range[1] * 16) {
+		tuner_dbg ("TV freq (%d.%02d) out of range (%d-%d)\n",
+			   freq / 16, freq % 16 * 100 / 16, tv_range[0],
+			   tv_range[1]);
 	}
-	t->tv_freq(c,freq);
+	t->tv_freq(c, freq);
 }
 
 static void set_radio_freq(struct i2c_client *c, unsigned int freq)
@@ -89,24 +84,20 @@
 	struct tuner *t = i2c_get_clientdata(c);
 
 	if (t->type == UNSET) {
-		tuner_info("tuner type not set\n");
+		tuner_warn ("tuner type not set\n");
 		return;
 	}
 	if (NULL == t->radio_freq) {
-		tuner_info("no radio tuning for this one, sorry.\n");
+		tuner_warn ("tuner has no way to set radio frequency\n");
 		return;
 	}
-	if (freq >= radio_range[0]*16000 && freq <= radio_range[1]*16000) {
-		if (tuner_debug)
-			tuner_info("radio freq step 62.5Hz (%d.%06d)\n",
-			 		    freq/16000,freq%16000*1000/16);
-		t->radio_freq(c,freq);
-        } else {
-		tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n",
-			    freq/16,freq%16*100/16,
-			    radio_range[0],radio_range[1]);
+	if (freq <= radio_range[0] * 16000 || freq >= radio_range[1] * 16000) {
+		tuner_dbg ("radio freq (%d.%02d) out of range (%d-%d)\n",
+			   freq / 16000, freq % 16000 * 100 / 16000,
+			   radio_range[0], radio_range[1]);
 	}
 
+	t->radio_freq(c, freq);
 	return;
 }
 
@@ -117,42 +108,45 @@
 	switch (t->mode) {
 	case V4L2_TUNER_RADIO:
 		tuner_dbg("radio freq set to %lu.%02lu\n",
-			  freq/16,freq%16*100/16);
-		set_radio_freq(c,freq);
+			  freq / 16000, freq % 16000 * 100 / 16000);
+		set_radio_freq(c, freq);
 		break;
 	case V4L2_TUNER_ANALOG_TV:
 	case V4L2_TUNER_DIGITAL_TV:
 		tuner_dbg("tv freq set to %lu.%02lu\n",
-			  freq/16,freq%16*100/16);
+			  freq / 16, freq % 16 * 100 / 16);
 		set_tv_freq(c, freq);
 		break;
 	}
 	t->freq = freq;
 }
 
-static void set_type(struct i2c_client *c, unsigned int type)
+static void set_type(struct i2c_client *c, unsigned int type,
+		     unsigned int new_mode_mask)
 {
 	struct tuner *t = i2c_get_clientdata(c);
 	unsigned char buffer[4];
 
-	/* sanity check */
-	if (type == UNSET || type == TUNER_ABSENT)
-		return;
-	if (type >= tuner_count)
-		return;
-
-	if (NULL == t->i2c.dev.driver) {
-		/* not registered yet */
-		t->type = type;
+	if (type == UNSET || type == TUNER_ABSENT) {
+		tuner_dbg ("tuner 0x%02x: Tuner type absent\n",c->addr);
 		return;
 	}
-	if ((t->initialized) && (t->type == type))
-		/* run only once except type change  Hac 04/05*/
-		return;
 
-	t->initialized = 1;
+	if (type >= tuner_count) {
+		tuner_warn ("tuner 0x%02x: Tuner count greater than %d\n",c->addr,tuner_count);
+		return;
+	}
+
+	/* This code detects calls by card attach_inform */
+	if (NULL == t->i2c.dev.driver) {
+		tuner_dbg ("tuner 0x%02x: called during i2c_client register by adapter's attach_inform\n", c->addr);
+
+		t->type=type;
+		return;
+	}
 
 	t->type = type;
+
 	switch (t->type) {
 	case TUNER_MT2032:
 		microtune_init(c);
@@ -161,136 +155,194 @@
 		tda8290_init(c);
 		break;
 	case TUNER_TEA5767:
-		if (tea5767_tuner_init(c)==EINVAL) t->type=TUNER_ABSENT;
+		if (tea5767_tuner_init(c) == EINVAL) {
+			t->type = TUNER_ABSENT;
+			t->mode_mask = T_UNINITIALIZED;
+			return;
+		}
+		t->mode_mask = T_RADIO;
 		break;
 	case TUNER_PHILIPS_FMD1216ME_MK3:
 		buffer[0] = 0x0b;
 		buffer[1] = 0xdc;
 		buffer[2] = 0x9c;
 		buffer[3] = 0x60;
-    		i2c_master_send(c,buffer,4);
+		i2c_master_send(c, buffer, 4);
 		mdelay(1);
 		buffer[2] = 0x86;
 		buffer[3] = 0x54;
-    		i2c_master_send(c,buffer,4);
+		i2c_master_send(c, buffer, 4);
 		default_tuner_init(c);
 		break;
 	default:
-		/* TEA5767 autodetection code */
-			if (tea5767_tuner_init(c)!=EINVAL) {
-				t->type = TUNER_TEA5767;
-				if (first_tuner == 0x60)
-					first_tuner++;
-				break;
-			}
-
 		default_tuner_init(c);
 		break;
 	}
-	tuner_dbg ("I2C addr 0x%02x with type %d\n",c->addr<<1,type);
+
+	if (t->mode_mask == T_UNINITIALIZED)
+		t->mode_mask = new_mode_mask;
+
+	set_freq(c, t->freq);
+	tuner_dbg("%s %s I2C addr 0x%02x with type %d used for 0x%02x\n",
+		  c->adapter->name, c->driver->name, c->addr << 1, type,
+		  t->mode_mask);
 }
 
-#define CHECK_ADDR(tp,cmd,tun)	if (client->addr!=tp) { \
-			  return 0; } else if (tuner_debug) \
-			  tuner_info ("Cmd %s accepted to "tun"\n",cmd);
-#define CHECK_MODE(cmd)	if (t->mode == V4L2_TUNER_RADIO) { \
-		 	CHECK_ADDR(radio_tuner,cmd,"radio") } else \
-			{ CHECK_ADDR(tv_tuner,cmd,"TV"); }
+/*
+ * This function apply tuner config to tuner specified
+ * by tun_setup structure. I addr is unset, then admin status
+ * and tun addr status is more precise then current status,
+ * it's applied. Otherwise status and type are applied only to
+ * tuner with exactly the same addr.
+*/
 
-static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr)
+static void set_addr(struct i2c_client *c, struct tuner_setup *tun_setup)
 {
-	/* ADDR_UNSET defaults to first available tuner */
-	if ( tun_addr->addr == ADDR_UNSET ) {
-		if (first_tuner != c->addr)
-			return;
-		switch (tun_addr->v4l2_tuner) {
-		case V4L2_TUNER_RADIO:
-	 		radio_tuner=c->addr;
-			break;
-		default:
-			tv_tuner=c->addr;
-			break;
-		}
-	} else {
-		/* Sets tuner to its configured value */
-		switch (tun_addr->v4l2_tuner) {
-		case V4L2_TUNER_RADIO:
- 			radio_tuner=tun_addr->addr;
-			if ( tun_addr->addr == c->addr ) set_type(c,tun_addr->type);
-			return;
-		default:
-			tv_tuner=tun_addr->addr;
-			if ( tun_addr->addr == c->addr ) set_type(c,tun_addr->type);
-			return;
-		}
+	struct tuner *t = i2c_get_clientdata(c);
+
+	if (tun_setup->addr == ADDR_UNSET) {
+		if (t->mode_mask & tun_setup->mode_mask)
+			set_type(c, tun_setup->type, tun_setup->mode_mask);
+	} else if (tun_setup->addr == c->addr) {
+		set_type(c, tun_setup->type, tun_setup->mode_mask);
 	}
-	set_type(c,tun_addr->type);
+}
+
+static inline int check_mode(struct tuner *t, char *cmd)
+{
+	if (1 << t->mode & t->mode_mask) {
+		switch (t->mode) {
+		case V4L2_TUNER_RADIO:
+			tuner_dbg("Cmd %s accepted for radio\n", cmd);
+			break;
+		case V4L2_TUNER_ANALOG_TV:
+			tuner_dbg("Cmd %s accepted for analog TV\n", cmd);
+			break;
+		case V4L2_TUNER_DIGITAL_TV:
+			tuner_dbg("Cmd %s accepted for digital TV\n", cmd);
+			break;
+		}
+		return 0;
+	}
+	return EINVAL;
 }
 
 static char pal[] = "-";
 module_param_string(pal, pal, sizeof(pal), 0644);
+static char secam[] = "-";
+module_param_string(secam, secam, sizeof(secam), 0644);
 
+/* get more precise norm info from insmod option */
 static int tuner_fixup_std(struct tuner *t)
 {
 	if ((t->std & V4L2_STD_PAL) == V4L2_STD_PAL) {
-		/* get more precise norm info from insmod option */
 		switch (pal[0]) {
 		case 'b':
 		case 'B':
 		case 'g':
 		case 'G':
-			tuner_dbg("insmod fixup: PAL => PAL-BG\n");
+			tuner_dbg ("insmod fixup: PAL => PAL-BG\n");
 			t->std = V4L2_STD_PAL_BG;
 			break;
 		case 'i':
 		case 'I':
-			tuner_dbg("insmod fixup: PAL => PAL-I\n");
+			tuner_dbg ("insmod fixup: PAL => PAL-I\n");
 			t->std = V4L2_STD_PAL_I;
 			break;
 		case 'd':
 		case 'D':
 		case 'k':
 		case 'K':
-			tuner_dbg("insmod fixup: PAL => PAL-DK\n");
+			tuner_dbg ("insmod fixup: PAL => PAL-DK\n");
 			t->std = V4L2_STD_PAL_DK;
 			break;
+		case 'M':
+		case 'm':
+			tuner_dbg ("insmod fixup: PAL => PAL-M\n");
+			t->std = V4L2_STD_PAL_M;
+			break;
+		case 'N':
+		case 'n':
+			tuner_dbg ("insmod fixup: PAL => PAL-N\n");
+			t->std = V4L2_STD_PAL_N;
+			break;
 		}
 	}
+	if ((t->std & V4L2_STD_SECAM) == V4L2_STD_SECAM) {
+		switch (secam[0]) {
+		case 'd':
+		case 'D':
+		case 'k':
+		case 'K':
+			tuner_dbg ("insmod fixup: SECAM => SECAM-DK\n");
+			t->std = V4L2_STD_SECAM_DK;
+			break;
+		case 'l':
+		case 'L':
+			tuner_dbg ("insmod fixup: SECAM => SECAM-L\n");
+			t->std = V4L2_STD_SECAM_L;
+			break;
+		}
+	}
+
 	return 0;
 }
 
 /* ---------------------------------------------------------------------- */
 
+/* static var Used only in tuner_attach and tuner_probe */
+static unsigned default_mode_mask;
+
+/* During client attach, set_type is called by adapter's attach_inform callback.
+   set_type must then be completed by tuner_attach.
+ */
 static int tuner_attach(struct i2c_adapter *adap, int addr, int kind)
 {
 	struct tuner *t;
 
-	/* by default, first I2C card is both tv and radio tuner */
-	if (this_adap == 0) {
-		first_tuner = addr;
-		tv_tuner = addr;
-		radio_tuner = addr;
-	}
-	this_adap++;
+	client_template.adapter = adap;
+	client_template.addr = addr;
 
-        client_template.adapter = adap;
-        client_template.addr = addr;
-
-        t = kmalloc(sizeof(struct tuner),GFP_KERNEL);
-        if (NULL == t)
-                return -ENOMEM;
-        memset(t,0,sizeof(struct tuner));
-        memcpy(&t->i2c,&client_template,sizeof(struct i2c_client));
+	t = kmalloc(sizeof(struct tuner), GFP_KERNEL);
+	if (NULL == t)
+		return -ENOMEM;
+	memset(t, 0, sizeof(struct tuner));
+	memcpy(&t->i2c, &client_template, sizeof(struct i2c_client));
 	i2c_set_clientdata(&t->i2c, t);
-	t->type       = UNSET;
-	t->radio_if2  = 10700*1000; /* 10.7MHz - FM radio */
-	t->audmode    = V4L2_TUNER_MODE_STEREO;
+	t->type = UNSET;
+	t->radio_if2 = 10700 * 1000;	/* 10.7MHz - FM radio */
+	t->audmode = V4L2_TUNER_MODE_STEREO;
+	t->mode_mask = T_UNINITIALIZED;
 
-        i2c_attach_client(&t->i2c);
-	tuner_info("chip found @ 0x%x (%s)\n",
-		   addr << 1, adap->name);
 
-	set_type(&t->i2c, t->type);
+	tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name);
+
+	/* TEA5767 autodetection code - only for addr = 0xc0 */
+	if (addr == 0x60) {
+		if (tea5767_autodetection(&t->i2c) != EINVAL) {
+			t->type = TUNER_TEA5767;
+			t->mode_mask = T_RADIO;
+			t->mode = T_STANDBY;
+			t->freq = 87.5 * 16; /* Sets freq to FM range */
+			default_mode_mask &= ~T_RADIO;
+
+			i2c_attach_client (&t->i2c);
+			set_type(&t->i2c,t->type, t->mode_mask);
+			return 0;
+		}
+	}
+
+	/* Initializes only the first adapter found */
+	if (default_mode_mask != T_UNINITIALIZED) {
+		tuner_dbg ("Setting mode_mask to 0x%02x\n", default_mode_mask);
+		t->mode_mask = default_mode_mask;
+		t->freq = 400 * 16; /* Sets freq to VHF High */
+		default_mode_mask = T_UNINITIALIZED;
+	}
+
+	/* Should be just before return */
+	i2c_attach_client (&t->i2c);
+	set_type (&t->i2c,t->type, t->mode_mask);
 	return 0;
 }
 
@@ -300,11 +352,8 @@
 		normal_i2c[0] = addr;
 		normal_i2c[1] = I2C_CLIENT_END;
 	}
-	this_adap = 0;
 
-	first_tuner = 0;
-	tv_tuner = 0;
-	radio_tuner = 0;
+	default_mode_mask = T_RADIO | T_ANALOG_TV | T_DIGITAL_TV;
 
 	if (adap->class & I2C_CLASS_TV_ANALOG)
 		return i2c_probe(adap, &addr_data, tuner_attach);
@@ -316,9 +365,10 @@
 	struct tuner *t = i2c_get_clientdata(client);
 	int err;
 
-	err=i2c_detach_client(&t->i2c);
+	err = i2c_detach_client(&t->i2c);
 	if (err) {
-		tuner_warn ("Client deregistration failed, client not detached.\n");
+		tuner_warn
+		    ("Client deregistration failed, client not detached.\n");
 		return err;
 	}
 
@@ -326,37 +376,65 @@
 	return 0;
 }
 
-#define SWITCH_V4L2	if (!t->using_v4l2 && tuner_debug) \
-		          tuner_info("switching to v4l2\n"); \
-	                  t->using_v4l2 = 1;
-#define CHECK_V4L2	if (t->using_v4l2) { if (tuner_debug) \
-			  tuner_info("ignore v4l1 call\n"); \
-		          return 0; }
+/*
+ * Switch tuner to other mode. If tuner support both tv and radio,
+ * set another frequency to some value (This is needed for some pal
+ * tuners to avoid locking). Otherwise, just put second tuner in
+ * standby mode.
+ */
 
-static int
-tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
+static inline int set_mode(struct i2c_client *client, struct tuner *t, int mode, char *cmd)
+{
+	if (mode != t->mode) {
+
+		t->mode = mode;
+		if (check_mode(t, cmd) == EINVAL) {
+			t->mode = T_STANDBY;
+			if (V4L2_TUNER_RADIO == mode) {
+				set_tv_freq(client, 400 * 16);
+			} else {
+				set_radio_freq(client, 87.5 * 16000);
+			}
+			return EINVAL;
+		}
+	}
+	return 0;
+}
+
+#define switch_v4l2()	if (!t->using_v4l2) \
+		            tuner_dbg("switching to v4l2\n"); \
+	                t->using_v4l2 = 1;
+
+static inline int check_v4l2(struct tuner *t)
+{
+	if (t->using_v4l2) {
+		tuner_dbg ("ignore v4l1 call\n");
+		return EINVAL;
+	}
+	return 0;
+}
+
+static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
 {
 	struct tuner *t = i2c_get_clientdata(client);
-        unsigned int *iarg = (int*)arg;
+	unsigned int *iarg = (int *)arg;
 
-        switch (cmd) {
+	switch (cmd) {
 	/* --- configuration --- */
-	case TUNER_SET_TYPE:
-		set_type(client,*iarg);
-		break;
 	case TUNER_SET_TYPE_ADDR:
-		set_addr(client,(struct tuner_addr *)arg);
+		tuner_dbg ("Calling set_type_addr for type=%d, addr=0x%02x, mode=0x%02x\n",
+				((struct tuner_setup *)arg)->type,
+				((struct tuner_setup *)arg)->addr,
+				((struct tuner_setup *)arg)->mode_mask);
+
+		set_addr(client, (struct tuner_setup *)arg);
 		break;
 	case AUDC_SET_RADIO:
-		t->mode = V4L2_TUNER_RADIO;
-		CHECK_ADDR(tv_tuner,"AUDC_SET_RADIO","TV");
-
-		if (V4L2_TUNER_RADIO != t->mode) {
-			set_tv_freq(client,400 * 16);
-		}
+		set_mode(client,t,V4L2_TUNER_RADIO, "AUDC_SET_RADIO");
 		break;
 	case AUDC_CONFIG_PINNACLE:
-		CHECK_ADDR(tv_tuner,"AUDC_CONFIG_PINNACLE","TV");
+		if (check_mode(t, "AUDC_CONFIG_PINNACLE") == EINVAL)
+			return 0;
 		switch (*iarg) {
 		case 2:
 			tuner_dbg("pinnacle pal\n");
@@ -368,219 +446,238 @@
 			break;
 		}
 		break;
+	case TDA9887_SET_CONFIG:
+		break;
 	/* --- v4l ioctls --- */
 	/* take care: bttv does userspace copying, we'll get a
 	   kernel pointer here... */
 	case VIDIOCSCHAN:
-	{
-		static const v4l2_std_id map[] = {
-			[ VIDEO_MODE_PAL   ] = V4L2_STD_PAL,
-			[ VIDEO_MODE_NTSC  ] = V4L2_STD_NTSC_M,
-			[ VIDEO_MODE_SECAM ] = V4L2_STD_SECAM,
-			[ 4 /* bttv */     ] = V4L2_STD_PAL_M,
-			[ 5 /* bttv */     ] = V4L2_STD_PAL_N,
-			[ 6 /* bttv */     ] = V4L2_STD_NTSC_M_JP,
-		};
-		struct video_channel *vc = arg;
+		{
+			static const v4l2_std_id map[] = {
+				[VIDEO_MODE_PAL] = V4L2_STD_PAL,
+				[VIDEO_MODE_NTSC] = V4L2_STD_NTSC_M,
+				[VIDEO_MODE_SECAM] = V4L2_STD_SECAM,
+				[4 /* bttv */ ] = V4L2_STD_PAL_M,
+				[5 /* bttv */ ] = V4L2_STD_PAL_N,
+				[6 /* bttv */ ] = V4L2_STD_NTSC_M_JP,
+			};
+			struct video_channel *vc = arg;
 
-		CHECK_V4L2;
-		t->mode = V4L2_TUNER_ANALOG_TV;
-		CHECK_ADDR(tv_tuner,"VIDIOCSCHAN","TV");
+			if (check_v4l2(t) == EINVAL)
+				return 0;
 
-		if (vc->norm < ARRAY_SIZE(map))
-			t->std = map[vc->norm];
-		tuner_fixup_std(t);
-		if (t->freq)
-			set_tv_freq(client,t->freq);
-		return 0;
-	}
-	case VIDIOCSFREQ:
-	{
-		unsigned long *v = arg;
+			if (set_mode(client,t,V4L2_TUNER_ANALOG_TV, "VIDIOCSCHAN")==EINVAL)
+				return 0;
 
-		CHECK_MODE("VIDIOCSFREQ");
-		CHECK_V4L2;
-		set_freq(client,*v);
-		return 0;
-	}
-	case VIDIOCGTUNER:
-	{
-		struct video_tuner *vt = arg;
-
-		CHECK_ADDR(radio_tuner,"VIDIOCGTUNER","radio");
-		CHECK_V4L2;
-		if (V4L2_TUNER_RADIO == t->mode) {
-			if (t->has_signal)
-				vt->signal = t->has_signal(client);
-			if (t->is_stereo) {
-				if (t->is_stereo(client))
-					vt->flags |= VIDEO_TUNER_STEREO_ON;
-				else
-					vt->flags &= ~VIDEO_TUNER_STEREO_ON;
-			}
-			vt->flags |= V4L2_TUNER_CAP_LOW; /* Allow freqs at 62.5 Hz */
-
-			vt->rangelow = radio_range[0] * 16000;
-			vt->rangehigh = radio_range[1] * 16000;
-
-		} else {
-			vt->rangelow = tv_range[0] * 16;
-			vt->rangehigh = tv_range[1] * 16;
+			if (vc->norm < ARRAY_SIZE(map))
+				t->std = map[vc->norm];
+			tuner_fixup_std(t);
+			if (t->freq)
+				set_tv_freq(client, t->freq);
+			return 0;
 		}
+	case VIDIOCSFREQ:
+		{
+			unsigned long *v = arg;
 
-		return 0;
-	}
+			if (check_mode(t, "VIDIOCSFREQ") == EINVAL)
+				return 0;
+			if (check_v4l2(t) == EINVAL)
+				return 0;
+
+			set_freq(client, *v);
+			return 0;
+		}
+	case VIDIOCGTUNER:
+		{
+			struct video_tuner *vt = arg;
+
+			if (check_mode(t, "VIDIOCGTUNER") == EINVAL)
+				return 0;
+			if (check_v4l2(t) == EINVAL)
+				return 0;
+
+			if (V4L2_TUNER_RADIO == t->mode) {
+				if (t->has_signal)
+					vt->signal = t->has_signal(client);
+				if (t->is_stereo) {
+					if (t->is_stereo(client))
+						vt->flags |=
+						    VIDEO_TUNER_STEREO_ON;
+					else
+						vt->flags &=
+						    ~VIDEO_TUNER_STEREO_ON;
+				}
+				vt->flags |= VIDEO_TUNER_LOW;	/* Allow freqs at 62.5 Hz */
+
+				vt->rangelow = radio_range[0] * 16000;
+				vt->rangehigh = radio_range[1] * 16000;
+
+			} else {
+				vt->rangelow = tv_range[0] * 16;
+				vt->rangehigh = tv_range[1] * 16;
+			}
+
+			return 0;
+		}
 	case VIDIOCGAUDIO:
-	{
-		struct video_audio *va = arg;
+		{
+			struct video_audio *va = arg;
 
-		CHECK_ADDR(radio_tuner,"VIDIOCGAUDIO","radio");
-		CHECK_V4L2;
-		if (V4L2_TUNER_RADIO == t->mode  &&  t->is_stereo)
-			va->mode = t->is_stereo(client)
-				? VIDEO_SOUND_STEREO
-				: VIDEO_SOUND_MONO;
-		return 0;
-	}
+			if (check_mode(t, "VIDIOCGAUDIO") == EINVAL)
+				return 0;
+			if (check_v4l2(t) == EINVAL)
+				return 0;
+
+			if (V4L2_TUNER_RADIO == t->mode && t->is_stereo)
+				va->mode = t->is_stereo(client)
+				    ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO;
+			return 0;
+		}
 
 	case VIDIOC_S_STD:
-	{
-		v4l2_std_id *id = arg;
+		{
+			v4l2_std_id *id = arg;
 
-		SWITCH_V4L2;
-		t->mode = V4L2_TUNER_ANALOG_TV;
-		CHECK_ADDR(tv_tuner,"VIDIOC_S_STD","TV");
+			if (set_mode (client, t, V4L2_TUNER_ANALOG_TV, "VIDIOC_S_STD")
+					== EINVAL)
+				return 0;
 
-		t->std = *id;
-		tuner_fixup_std(t);
-		if (t->freq)
-			set_freq(client,t->freq);
-		break;
-	}
-	case VIDIOC_S_FREQUENCY:
-	{
-		struct v4l2_frequency *f = arg;
+			switch_v4l2();
 
-		CHECK_MODE("VIDIOC_S_FREQUENCY");
-		SWITCH_V4L2;
-		if (V4L2_TUNER_RADIO == f->type &&
-		    V4L2_TUNER_RADIO != t->mode)
-			set_tv_freq(client,400*16);
-		t->mode  = f->type;
-		set_freq(client,f->frequency);
-		break;
-	}
-	case VIDIOC_G_FREQUENCY:
-	{
-		struct v4l2_frequency *f = arg;
-
-		CHECK_MODE("VIDIOC_G_FREQUENCY");
-		SWITCH_V4L2;
-		f->type = t->mode;
-		f->frequency = t->freq;
-		break;
-	}
-	case VIDIOC_G_TUNER:
-	{
-		struct v4l2_tuner *tuner = arg;
-
-		CHECK_MODE("VIDIOC_G_TUNER");
-		SWITCH_V4L2;
-		if (V4L2_TUNER_RADIO == t->mode) {
-			if (t->has_signal)
-				tuner -> signal = t->has_signal(client);
-			if (t->is_stereo) {
-				if (t->is_stereo(client)) {
-					tuner -> rxsubchans = V4L2_TUNER_SUB_STEREO | V4L2_TUNER_SUB_MONO;
-				} else {
-					tuner -> rxsubchans = V4L2_TUNER_SUB_MONO;
-				}
-			}
-			tuner->capability |= V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
-			tuner->audmode = t->audmode;
-
-			tuner->rangelow = radio_range[0] * 16000;
-			tuner->rangehigh = radio_range[1] * 16000;
-		} else {
-			tuner->rangelow = tv_range[0] * 16;
-			tuner->rangehigh = tv_range[1] * 16;
+			t->std = *id;
+			tuner_fixup_std(t);
+			if (t->freq)
+				set_freq(client, t->freq);
+			break;
 		}
-		break;
-	}
-	case VIDIOC_S_TUNER: /* Allow changing radio range and audio mode */
-	{
-		struct v4l2_tuner *tuner = arg;
+	case VIDIOC_S_FREQUENCY:
+		{
+			struct v4l2_frequency *f = arg;
 
-		CHECK_ADDR(radio_tuner,"VIDIOC_S_TUNER","radio");
-		SWITCH_V4L2;
+			t->freq = f->frequency;
+			switch_v4l2();
+			if (V4L2_TUNER_RADIO == f->type &&
+			    V4L2_TUNER_RADIO != t->mode) {
+			        if (set_mode (client, t, f->type, "VIDIOC_S_FREQUENCY")
+					    == EINVAL)
+					return 0;
+			}
+			set_freq(client,t->freq);
 
-		/* To switch the audio mode, applications initialize the
-		   index and audmode fields and the reserved array and
-		   call the VIDIOC_S_TUNER ioctl. */
-		/* rxsubchannels: V4L2_TUNER_MODE_MONO, V4L2_TUNER_MODE_STEREO,
-		   V4L2_TUNER_MODE_LANG1, V4L2_TUNER_MODE_LANG2,
-		   V4L2_TUNER_MODE_SAP */
+			break;
+		}
+	case VIDIOC_G_FREQUENCY:
+		{
+			struct v4l2_frequency *f = arg;
 
-		if (tuner->audmode == V4L2_TUNER_MODE_MONO)
-			t->audmode = V4L2_TUNER_MODE_MONO;
-		else
-			t->audmode = V4L2_TUNER_MODE_STEREO;
+			if (check_mode(t, "VIDIOC_G_FREQUENCY") == EINVAL)
+				return 0;
+			switch_v4l2();
+			f->type = t->mode;
+			f->frequency = t->freq;
+			break;
+		}
+	case VIDIOC_G_TUNER:
+		{
+			struct v4l2_tuner *tuner = arg;
 
-		set_radio_freq(client, t->freq);
-		break;
-	}
-	case TDA9887_SET_CONFIG: /* Nothing to do on tuner-core */
-		break;
+			if (check_mode(t, "VIDIOC_G_TUNER") == EINVAL)
+				return 0;
+			switch_v4l2();
+
+			if (V4L2_TUNER_RADIO == t->mode) {
+
+				if (t->has_signal)
+					tuner->signal = t->has_signal(client);
+
+				if (t->is_stereo) {
+					if (t->is_stereo(client)) {
+						tuner->rxsubchans =
+						    V4L2_TUNER_SUB_STEREO |
+						    V4L2_TUNER_SUB_MONO;
+					} else {
+						tuner->rxsubchans =
+						    V4L2_TUNER_SUB_MONO;
+					}
+				}
+
+				tuner->capability |=
+				    V4L2_TUNER_CAP_LOW | V4L2_TUNER_CAP_STEREO;
+
+				tuner->audmode = t->audmode;
+
+				tuner->rangelow = radio_range[0] * 16000;
+				tuner->rangehigh = radio_range[1] * 16000;
+			} else {
+				tuner->rangelow = tv_range[0] * 16;
+				tuner->rangehigh = tv_range[1] * 16;
+			}
+			break;
+		}
+	case VIDIOC_S_TUNER:
+		{
+			struct v4l2_tuner *tuner = arg;
+
+			if (check_mode(t, "VIDIOC_S_TUNER") == EINVAL)
+				return 0;
+
+			switch_v4l2();
+
+			if (V4L2_TUNER_RADIO == t->mode) {
+				t->audmode = tuner->audmode;
+				set_radio_freq(client, t->freq);
+			}
+			break;
+		}
 	default:
-		tuner_dbg ("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd);
-		/* nothing */
+		tuner_dbg("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd);
 		break;
 	}
 
 	return 0;
 }
 
-static int tuner_suspend(struct device * dev, u32 state, u32 level)
+static int tuner_suspend(struct device *dev, u32 state, u32 level)
 {
-	struct i2c_client *c = container_of(dev, struct i2c_client, dev);
-	struct tuner *t = i2c_get_clientdata(c);
+	struct i2c_client *c = container_of (dev, struct i2c_client, dev);
+	struct tuner *t = i2c_get_clientdata (c);
 
-	tuner_dbg("suspend\n");
+	tuner_dbg ("suspend\n");
 	/* FIXME: power down ??? */
 	return 0;
 }
 
-static int tuner_resume(struct device * dev, u32 level)
+static int tuner_resume(struct device *dev, u32 level)
 {
-	struct i2c_client *c = container_of(dev, struct i2c_client, dev);
-	struct tuner *t = i2c_get_clientdata(c);
+	struct i2c_client *c = container_of (dev, struct i2c_client, dev);
+	struct tuner *t = i2c_get_clientdata (c);
 
-	tuner_dbg("resume\n");
+	tuner_dbg ("resume\n");
 	if (t->freq)
-		set_freq(c,t->freq);
+		set_freq(c, t->freq);
 	return 0;
 }
 
 /* ----------------------------------------------------------------------- */
 
 static struct i2c_driver driver = {
-	.owner          = THIS_MODULE,
-        .name           = "tuner",
-        .id             = I2C_DRIVERID_TUNER,
-        .flags          = I2C_DF_NOTIFY,
-        .attach_adapter = tuner_probe,
-        .detach_client  = tuner_detach,
-        .command        = tuner_command,
+	.owner = THIS_MODULE,
+	.name = "tuner",
+	.id = I2C_DRIVERID_TUNER,
+	.flags = I2C_DF_NOTIFY,
+	.attach_adapter = tuner_probe,
+	.detach_client = tuner_detach,
+	.command = tuner_command,
 	.driver = {
-		.suspend = tuner_suspend,
-		.resume  = tuner_resume,
-	},
+		   .suspend = tuner_suspend,
+		   .resume = tuner_resume,
+		   },
 };
-static struct i2c_client client_template =
-{
+static struct i2c_client client_template = {
 	I2C_DEVNAME("(tuner unset)"),
-	.flags      = I2C_CLIENT_ALLOW_USE,
-        .driver     = &driver,
+	.flags = I2C_CLIENT_ALLOW_USE,
+	.driver = &driver,
 };
 
 static int __init tuner_init_module(void)
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index c39ed62..a3f8e83 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -1,5 +1,5 @@
 /*
- * $Id: tuner-simple.c,v 1.31 2005/06/21 16:02:25 mkrufky Exp $
+ * $Id: tuner-simple.c,v 1.39 2005/07/07 01:49:30 mkrufky Exp $
  *
  * i2c tv tuner chip device driver
  * controls all those simple 4-control-bytes style tuners.
@@ -54,6 +54,27 @@
 #define PHILIPS_MF_SET_PAL_L	0x03 // France
 #define PHILIPS_MF_SET_PAL_L2	0x02 // L'
 
+/* Control byte */
+
+#define TUNER_RATIO_MASK        0x06 /* Bit cb1:cb2 */
+#define TUNER_RATIO_SELECT_50   0x00
+#define TUNER_RATIO_SELECT_32   0x02
+#define TUNER_RATIO_SELECT_166  0x04
+#define TUNER_RATIO_SELECT_62   0x06
+
+#define TUNER_CHARGE_PUMP       0x40  /* Bit cb6 */
+
+/* Status byte */
+
+#define TUNER_POR	  0x80
+#define TUNER_FL          0x40
+#define TUNER_MODE        0x38
+#define TUNER_AFC         0x07
+#define TUNER_SIGNAL      0x07
+#define TUNER_STEREO      0x10
+
+#define TUNER_PLL_LOCKED   0x40
+#define TUNER_STEREO_MK3   0x04
 
 /* ---------------------------------------------------------------------- */
 
@@ -211,21 +232,17 @@
 	  16*160.00,16*442.00,0x01,0x02,0x04,0xce,623 },
 	{ "Philips FQ1236A MK4", Philips, NTSC,
 	  16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 },
-
-	/* Should work for TVF8531MF, TVF8831MF, TVF8731MF */
-	{ "Ymec TVision TVF-8531MF", Philips, NTSC,
+	{ "Ymec TVision TVF-8531MF/8831MF/8731MF", Philips, NTSC,
 	  16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732},
 	{ "Ymec TVision TVF-5533MF", Philips, NTSC,
 	  16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732},
+
 	{ "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC,
 	  16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732},
-	/* Should work for TNF9533-D/IF, TNF9533-B/DF */
-	{ "Tena TNF9533-D/IF", Philips, PAL,
+	{ "Tena TNF9533-D/IF/TNF9533-B/DF", Philips, PAL,
           16*160.25,16*464.25,0x01,0x02,0x04,0x8e,623},
-
-	/* This entry is for TEA5767 FM radio only chip used on several boards w/TV tuner */
-	{ TEA5767_TUNER_NAME, Philips, RADIO,
-          -1, -1, 0, 0, 0, TEA5767_LOW_LO_32768,0},
+	{ "Philips TEA5767HN FM Radio", Philips, RADIO,
+          /* see tea5767.c for details */},
 	{ "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL,
 	  16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 },
 };
@@ -244,15 +261,6 @@
 	return byte;
 }
 
-#define TUNER_POR       0x80
-#define TUNER_FL        0x40
-#define TUNER_MODE      0x38
-#define TUNER_AFC       0x07
-
-#define TUNER_STEREO       0x10 /* radio mode */
-#define TUNER_STEREO_MK3   0x04 /* radio mode */
-#define TUNER_SIGNAL       0x07 /* radio mode */
-
 static int tuner_signal(struct i2c_client *c)
 {
 	return (tuner_getstatus(c) & TUNER_SIGNAL) << 13;
@@ -278,22 +286,6 @@
 	return stereo;
 }
 
-#if 0 /* unused */
-static int tuner_islocked (struct i2c_client *c)
-{
-        return (tuner_getstatus (c) & TUNER_FL);
-}
-
-static int tuner_afcstatus (struct i2c_client *c)
-{
-        return (tuner_getstatus (c) & TUNER_AFC) - 2;
-}
-
-static int tuner_mode (struct i2c_client *c)
-{
-        return (tuner_getstatus (c) & TUNER_MODE) >> 3;
-}
-#endif
 
 /* ---------------------------------------------------------------------- */
 
@@ -376,7 +368,7 @@
 
 	case TUNER_MICROTUNE_4042FI5:
 		/* Set the charge pump for fast tuning */
-		tun->config |= 0x40;
+		tun->config |= TUNER_CHARGE_PUMP;
 		break;
 	}
 
@@ -425,14 +417,13 @@
 				tuner_warn("i2c i/o read error: rc == %d (should be 1)\n",rc);
 				break;
 			}
-			/* bit 6 is PLL locked indicator */
-			if (status_byte & 0x40)
+			if (status_byte & TUNER_PLL_LOCKED)
 				break;
 			udelay(10);
 		}
 
 		/* Set the charge pump for optimized phase noise figure */
-		tun->config &= ~0x40;
+		tun->config &= ~TUNER_CHARGE_PUMP;
 		buffer[0] = (div>>8) & 0x7f;
 		buffer[1] = div      & 0xff;
 		buffer[2] = tun->config;
@@ -453,26 +444,22 @@
 	unsigned div;
 	int rc;
 
-	tun=&tuners[t->type];
-	div = (freq / 1000) + (int)(16*10.7);
-	buffer[2] = tun->config;
+	tun = &tuners[t->type];
+	div = (20 * freq / 16000) + (int)(20*10.7); /* IF 10.7 MHz */
+	buffer[2] = (tun->config & ~TUNER_RATIO_MASK) | TUNER_RATIO_SELECT_50; /* 50 kHz step */
 
 	switch (t->type) {
 	case TUNER_TENA_9533_DI:
 	case TUNER_YMEC_TVF_5533MF:
-		/*These values are empirically determinated */
-		div = (freq * 122) / 16000 - 20;
-		buffer[2] = 0x88; /* could be also 0x80 */
-		buffer[3] = 0x19; /* could be also 0x10, 0x18, 0x99 */
-		break;
+		tuner_dbg ("This tuner doesn't have FM. Most cards has a TEA5767 for FM\n");
+		return;
 	case TUNER_PHILIPS_FM1216ME_MK3:
 	case TUNER_PHILIPS_FM1236_MK3:
 	case TUNER_PHILIPS_FMD1216ME_MK3:
 		buffer[3] = 0x19;
 		break;
 	case TUNER_PHILIPS_FM1256_IH3:
-		div = (20 * freq) / 16000 + 333 * 2;
-	        buffer[2] = 0x80;
+		div = (20 * freq) / 16000 + (int)(33.3 * 20);  /* IF 33.3 MHz */
 		buffer[3] = 0x19;
 		break;
 	case TUNER_LG_PAL_FM:
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 9a493be..d8b78f1 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -864,13 +864,8 @@
 		 * But changing the mode to VIDEO_SOUND_MONO would switch
 		 * external 4052 multiplexer in audio_hook().
 		 */
-#if 0
-		if((nsr & 0x02) && !(dsr & 0x10)) /* NSR.S/MB=1 and DSR.AMSTAT=0 */
-			mode |= VIDEO_SOUND_STEREO;
-#else
 		if(nsr & 0x02) /* NSR.S/MB=1 */
 			mode |= VIDEO_SOUND_STEREO;
-#endif
 		if(nsr & 0x01) /* NSR.D/SB=1 */
 			mode |= VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2;
 	} else {
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index 0f03c25..e8d9440 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -400,14 +400,6 @@
 		}
 	}
 
-#if 0
-	if (t_format < sizeof(hauppauge_tuner_fmt)/sizeof(struct HAUPPAUGE_TUNER_FMT)) {
-		tvee->tuner_formats = hauppauge_tuner_fmt[t_format].id;
-		t_fmt_name = hauppauge_tuner_fmt[t_format].name;
-	} else {
-		t_fmt_name = "<unknown>";
-	}
-#endif
 
 	TVEEPROM_KERN_INFO("Hauppauge: model = %d, rev = %s, serial# = %d\n",
 		   tvee->model,
@@ -482,6 +474,7 @@
 	0xa0 >> 1,
 	I2C_CLIENT_END,
 };
+
 I2C_CLIENT_INSMOD;
 
 struct i2c_driver i2c_driver_tveeprom;
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig
index 4cecdaf..7fc692a 100644
--- a/drivers/misc/Kconfig
+++ b/drivers/misc/Kconfig
@@ -6,8 +6,7 @@
 
 config IBM_ASM
 	tristate "Device driver for IBM RSA service processor"
-	depends on X86 && EXPERIMENTAL
-	default n
+	depends on X86 && PCI && EXPERIMENTAL
 	---help---
 	  This option enables device driver support for in-band access to the
 	  IBM RSA (Condor) service processor in eServer xSeries systems.
@@ -22,7 +21,7 @@
 	  
 	  WARNING: This software may not be supported or function
 	  correctly on your IBM server. Please consult the IBM ServerProven
-	  website <http://www.pc.ibm/ww/eserver/xseries/serverproven> for
+	  website <http://www.pc.ibm.com/ww/eserver/xseries/serverproven> for
 	  information on the specific driver level and support statement
 	  for your IBM server.
 
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c
index 15f716a..6837491 100644
--- a/drivers/pcmcia/yenta_socket.c
+++ b/drivers/pcmcia/yenta_socket.c
@@ -527,64 +527,29 @@
  * Use an adaptive allocation for the memory resource,
  * sometimes the memory behind pci bridges is limited:
  * 1/8 of the size of the io window of the parent.
- * max 4 MB, min 16 kB.
+ * max 4 MB, min 16 kB. We try very hard to not get below
+ * the "ACC" values, though.
  */
 #define BRIDGE_MEM_MAX 4*1024*1024
+#define BRIDGE_MEM_ACC 128*1024
 #define BRIDGE_MEM_MIN 16*1024
 
-#define BRIDGE_IO_MAX 256
+#define BRIDGE_IO_MAX 512
+#define BRIDGE_IO_ACC 256
 #define BRIDGE_IO_MIN 32
 
 #ifndef PCIBIOS_MIN_CARDBUS_IO
 #define PCIBIOS_MIN_CARDBUS_IO PCIBIOS_MIN_IO
 #endif
 
-static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type)
+static int yenta_search_one_res(struct resource *root, struct resource *res,
+				u32 min)
 {
-	struct pci_bus *bus;
-	struct resource *root, *res;
-	u32 start, end;
-	u32 align, size, min;
-	unsigned offset;
-	unsigned mask;
+	u32 align, size, start, end;
 
-	res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr;
-	/* Already allocated? */
-	if (res->parent)
-		return 0;
-
-	/* The granularity of the memory limit is 4kB, on IO it's 4 bytes */
-	mask = ~0xfff;
-	if (type & IORESOURCE_IO)
-		mask = ~3;
-
-	offset = 0x1c + 8*nr;
-	bus = socket->dev->subordinate;
-	res->name = bus->name;
-	res->flags = type;
-	res->start = 0;
-	res->end = 0;
-	root = pci_find_parent_resource(socket->dev, res);
-
-	if (!root)
-		return;
-
-	start = config_readl(socket, offset) & mask;
-	end = config_readl(socket, offset+4) | ~mask;
-	if (start && end > start && !override_bios) {
-		res->start = start;
-		res->end = end;
-		if (request_resource(root, res) == 0)
-			return;
-		printk(KERN_INFO "yenta %s: Preassigned resource %d busy, reconfiguring...\n",
-				pci_name(socket->dev), nr);
-		res->start = res->end = 0;
-	}
-
-	if (type & IORESOURCE_IO) {
+	if (res->flags & IORESOURCE_IO) {
 		align = 1024;
 		size = BRIDGE_IO_MAX;
-		min = BRIDGE_IO_MIN;
 		start = PCIBIOS_MIN_CARDBUS_IO;
 		end = ~0U;
 	} else {
@@ -599,26 +564,107 @@
 				i++;
 			size = 1 << i;
 		}
-		if (size < BRIDGE_MEM_MIN)
-			size = BRIDGE_MEM_MIN;
-		min = BRIDGE_MEM_MIN;
+		if (size < min)
+			size = min;
 		align = size;
 		start = PCIBIOS_MIN_MEM;
 		end = ~0U;
 	}
-	
+
 	do {
-		if (allocate_resource(root, res, size, start, end, align, NULL, NULL)==0) {
-			config_writel(socket, offset, res->start);
-			config_writel(socket, offset+4, res->end);
-			return;
+		if (allocate_resource(root, res, size, start, end, align,
+				      NULL, NULL)==0) {
+			return 1;
 		}
 		size = size/2;
 		align = size;
 	} while (size >= min);
+
+	return 0;
+}
+
+
+static int yenta_search_res(struct yenta_socket *socket, struct resource *res,
+			    u32 min)
+{
+	int i;
+	for (i=0; i<PCI_BUS_NUM_RESOURCES; i++) {
+		struct resource * root = socket->dev->bus->resource[i];
+		if (!root)
+			continue;
+
+		if ((res->flags ^ root->flags) &
+		    (IORESOURCE_IO | IORESOURCE_MEM | IORESOURCE_PREFETCH))
+			continue; /* Wrong type */
+
+		if (yenta_search_one_res(root, res, min))
+			return 1;
+	}
+	return 0;
+}
+
+static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned type, int addr_start, int addr_end)
+{
+	struct pci_bus *bus;
+	struct resource *root, *res;
+	u32 start, end;
+	unsigned mask;
+
+	res = socket->dev->resource + PCI_BRIDGE_RESOURCES + nr;
+	/* Already allocated? */
+	if (res->parent)
+		return;
+
+	/* The granularity of the memory limit is 4kB, on IO it's 4 bytes */
+	mask = ~0xfff;
+	if (type & IORESOURCE_IO)
+		mask = ~3;
+
+	bus = socket->dev->subordinate;
+	res->name = bus->name;
+	res->flags = type;
+
+	start = config_readl(socket, addr_start) & mask;
+	end = config_readl(socket, addr_end) | ~mask;
+	if (start && end > start && !override_bios) {
+		res->start = start;
+		res->end = end;
+		root = pci_find_parent_resource(socket->dev, res);
+		if (root && (request_resource(root, res) == 0))
+			return;
+		printk(KERN_INFO "yenta %s: Preassigned resource %d busy or not available, reconfiguring...\n",
+				pci_name(socket->dev), nr);
+	}
+
+	if (type & IORESOURCE_IO) {
+		if ((yenta_search_res(socket, res, BRIDGE_IO_MAX)) ||
+		    (yenta_search_res(socket, res, BRIDGE_IO_ACC)) ||
+		    (yenta_search_res(socket, res, BRIDGE_IO_MIN))) {
+			config_writel(socket, addr_start, res->start);
+			config_writel(socket, addr_end, res->end);
+		}
+	} else {
+		if (type & IORESOURCE_PREFETCH) {
+			if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) ||
+			    (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) ||
+			    (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) {
+				config_writel(socket, addr_start, res->start);
+				config_writel(socket, addr_end, res->end);
+			}
+			/* Approximating prefetchable by non-prefetchable */
+			res->flags = IORESOURCE_MEM;
+		}
+		if ((yenta_search_res(socket, res, BRIDGE_MEM_MAX)) ||
+		    (yenta_search_res(socket, res, BRIDGE_MEM_ACC)) ||
+		    (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) {
+			config_writel(socket, addr_start, res->start);
+			config_writel(socket, addr_end, res->end);
+		}
+	}
+
 	printk(KERN_INFO "yenta %s: no resource of type %x available, trying to continue...\n",
-			pci_name(socket->dev), type);
-	res->start = res->end = 0;
+	       pci_name(socket->dev), type);
+	res->start = res->end = res->flags = 0;
 }
 
 /*
@@ -626,10 +672,14 @@
  */
 static void yenta_allocate_resources(struct yenta_socket *socket)
 {
-	yenta_allocate_res(socket, 0, IORESOURCE_MEM|IORESOURCE_PREFETCH);
-	yenta_allocate_res(socket, 1, IORESOURCE_MEM);
-	yenta_allocate_res(socket, 2, IORESOURCE_IO);
-	yenta_allocate_res(socket, 3, IORESOURCE_IO);	/* PCI isn't clever enough to use this one yet */
+	yenta_allocate_res(socket, 0, IORESOURCE_IO,
+			   PCI_CB_IO_BASE_0, PCI_CB_IO_LIMIT_0);
+	yenta_allocate_res(socket, 1, IORESOURCE_IO,
+			   PCI_CB_IO_BASE_1, PCI_CB_IO_LIMIT_1);
+	yenta_allocate_res(socket, 2, IORESOURCE_MEM|IORESOURCE_PREFETCH,
+			   PCI_CB_MEMORY_BASE_0, PCI_CB_MEMORY_LIMIT_0);
+	yenta_allocate_res(socket, 3, IORESOURCE_MEM,
+			   PCI_CB_MEMORY_BASE_1, PCI_CB_MEMORY_LIMIT_1);
 }
 
 
diff --git a/drivers/scsi/aacraid/commctrl.c b/drivers/scsi/aacraid/commctrl.c
index 1fef92d..390cd67 100644
--- a/drivers/scsi/aacraid/commctrl.c
+++ b/drivers/scsi/aacraid/commctrl.c
@@ -469,7 +469,7 @@
 		goto cleanup;
 	}
 
-	user_srbcmd = kmalloc(GFP_KERNEL, fibsize);
+	user_srbcmd = kmalloc(fibsize, GFP_KERNEL);
 	if (!user_srbcmd) {
 		dprintk((KERN_DEBUG"aacraid: Could not make a copy of the srb\n"));
 		rcode = -ENOMEM;
diff --git a/drivers/w1/w1.c b/drivers/w1/w1.c
index 312cf32..8a9c428 100644
--- a/drivers/w1/w1.c
+++ b/drivers/w1/w1.c
@@ -516,6 +516,7 @@
 	struct w1_reg_num *tmp;
 	int family_found = 0;
 	struct w1_master *dev;
+	u64 rn_le = cpu_to_le64(rn);
 
 	dev = w1_search_master(data);
 	if (!dev) {
@@ -544,10 +545,8 @@
 		slave_count++;
 	}
 
-	rn = cpu_to_le64(rn);
-
 	if (slave_count == dev->slave_count &&
-		rn && ((le64_to_cpu(rn) >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn, 7)) {
+		rn && ((rn >> 56) & 0xff) == w1_calc_crc8((u8 *)&rn_le, 7)) {
 		w1_attach_slave_device(dev, tmp);
 	}
 
diff --git a/fs/char_dev.c b/fs/char_dev.c
index a69a5d8..3b1b1ee 100644
--- a/fs/char_dev.c
+++ b/fs/char_dev.c
@@ -277,8 +277,9 @@
 void cdev_put(struct cdev *p)
 {
 	if (p) {
+		struct module *owner = p->owner;
 		kobject_put(&p->kobj);
-		module_put(p->owner);
+		module_put(owner);
 	}
 }
 
diff --git a/fs/exec.c b/fs/exec.c
index 4887191..222ab1c 100644
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -642,6 +642,18 @@
 	count = 2;
 	if (thread_group_leader(current))
 		count = 1;
+	else {
+		/*
+		 * The SIGALRM timer survives the exec, but needs to point
+		 * at us as the new group leader now.  We have a race with
+		 * a timer firing now getting the old leader, so we need to
+		 * synchronize with any firing (by calling del_timer_sync)
+		 * before we can safely let the old group leader die.
+		 */
+		sig->real_timer.data = (unsigned long)current;
+		if (del_timer_sync(&sig->real_timer))
+			add_timer(&sig->real_timer);
+	}
 	while (atomic_read(&sig->count) > count) {
 		sig->group_exit_task = current;
 		sig->notify_count = count;
diff --git a/fs/ext2/ext2.h b/fs/ext2/ext2.h
index eed521d..e977f85 100644
--- a/fs/ext2/ext2.h
+++ b/fs/ext2/ext2.h
@@ -2,6 +2,15 @@
 #include <linux/ext2_fs.h>
 
 /*
+ * ext2 mount options
+ */
+struct ext2_mount_options {
+	unsigned long s_mount_opt;
+	uid_t s_resuid;
+	gid_t s_resgid;
+};
+
+/*
  * second extended file system inode data in memory
  */
 struct ext2_inode_info {
diff --git a/fs/ext2/super.c b/fs/ext2/super.c
index 876e391..dcfe331 100644
--- a/fs/ext2/super.c
+++ b/fs/ext2/super.c
@@ -936,12 +936,23 @@
 	struct ext2_sb_info * sbi = EXT2_SB(sb);
 	struct ext2_super_block * es;
 	unsigned long old_mount_opt = sbi->s_mount_opt;
+	struct ext2_mount_options old_opts;
+	unsigned long old_sb_flags;
+	int err;
+
+	/* Store the old options */
+	old_sb_flags = sb->s_flags;
+	old_opts.s_mount_opt = sbi->s_mount_opt;
+	old_opts.s_resuid = sbi->s_resuid;
+	old_opts.s_resgid = sbi->s_resgid;
 
 	/*
 	 * Allow the "check" option to be passed as a remount option.
 	 */
-	if (!parse_options (data, sbi))
-		return -EINVAL;
+	if (!parse_options (data, sbi)) {
+		err = -EINVAL;
+		goto restore_opts;
+	}
 
 	sb->s_flags = (sb->s_flags & ~MS_POSIXACL) |
 		((sbi->s_mount_opt & EXT2_MOUNT_POSIX_ACL) ? MS_POSIXACL : 0);
@@ -971,7 +982,8 @@
 			printk("EXT2-fs: %s: couldn't remount RDWR because of "
 			       "unsupported optional features (%x).\n",
 			       sb->s_id, le32_to_cpu(ret));
-			return -EROFS;
+			err = -EROFS;
+			goto restore_opts;
 		}
 		/*
 		 * Mounting a RDONLY partition read-write, so reread and
@@ -984,6 +996,12 @@
 	}
 	ext2_sync_super(sb, es);
 	return 0;
+restore_opts:
+	sbi->s_mount_opt = old_opts.s_mount_opt;
+	sbi->s_resuid = old_opts.s_resuid;
+	sbi->s_resgid = old_opts.s_resgid;
+	sb->s_flags = old_sb_flags;
+	return err;
 }
 
 static int ext2_statfs (struct super_block * sb, struct kstatfs * buf)
diff --git a/fs/ext3/super.c b/fs/ext3/super.c
index a6d1779..3c3c6e3 100644
--- a/fs/ext3/super.c
+++ b/fs/ext3/super.c
@@ -890,7 +890,10 @@
 					"quota turned on.\n");
 				return 0;
 			}
-			kfree(sbi->s_qf_names[qtype]);
+			/*
+			 * The space will be released later when all options
+			 * are confirmed to be correct
+			 */
 			sbi->s_qf_names[qtype] = NULL;
 			break;
 		case Opt_jqfmt_vfsold:
@@ -939,7 +942,7 @@
 		case Opt_ignore:
 			break;
 		case Opt_resize:
-			if (!n_blocks_count) {
+			if (!is_remount) {
 				printk("EXT3-fs: resize option only available "
 					"for remount\n");
 				return 0;
@@ -2109,14 +2112,33 @@
 {
 	struct ext3_super_block * es;
 	struct ext3_sb_info *sbi = EXT3_SB(sb);
-	unsigned long tmp;
 	unsigned long n_blocks_count = 0;
+	unsigned long old_sb_flags;
+	struct ext3_mount_options old_opts;
+	int err;
+#ifdef CONFIG_QUOTA
+	int i;
+#endif
+
+	/* Store the original options */
+	old_sb_flags = sb->s_flags;
+	old_opts.s_mount_opt = sbi->s_mount_opt;
+	old_opts.s_resuid = sbi->s_resuid;
+	old_opts.s_resgid = sbi->s_resgid;
+	old_opts.s_commit_interval = sbi->s_commit_interval;
+#ifdef CONFIG_QUOTA
+	old_opts.s_jquota_fmt = sbi->s_jquota_fmt;
+	for (i = 0; i < MAXQUOTAS; i++)
+		old_opts.s_qf_names[i] = sbi->s_qf_names[i];
+#endif
 
 	/*
 	 * Allow the "check" option to be passed as a remount option.
 	 */
-	if (!parse_options(data, sb, &tmp, &n_blocks_count, 1))
-		return -EINVAL;
+	if (!parse_options(data, sb, NULL, &n_blocks_count, 1)) {
+		err = -EINVAL;
+		goto restore_opts;
+	}
 
 	if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)
 		ext3_abort(sb, __FUNCTION__, "Abort forced by user");
@@ -2130,8 +2152,10 @@
 
 	if ((*flags & MS_RDONLY) != (sb->s_flags & MS_RDONLY) ||
 		n_blocks_count > le32_to_cpu(es->s_blocks_count)) {
-		if (sbi->s_mount_opt & EXT3_MOUNT_ABORT)
-			return -EROFS;
+		if (sbi->s_mount_opt & EXT3_MOUNT_ABORT) {
+			err = -EROFS;
+			goto restore_opts;
+		}
 
 		if (*flags & MS_RDONLY) {
 			/*
@@ -2158,7 +2182,8 @@
 				       "remount RDWR because of unsupported "
 				       "optional features (%x).\n",
 				       sb->s_id, le32_to_cpu(ret));
-				return -EROFS;
+				err = -EROFS;
+				goto restore_opts;
 			}
 			/*
 			 * Mounting a RDONLY partition read-write, so reread
@@ -2168,13 +2193,38 @@
 			 */
 			ext3_clear_journal_err(sb, es);
 			sbi->s_mount_state = le16_to_cpu(es->s_state);
-			if ((ret = ext3_group_extend(sb, es, n_blocks_count)))
-				return ret;
+			if ((ret = ext3_group_extend(sb, es, n_blocks_count))) {
+				err = ret;
+				goto restore_opts;
+			}
 			if (!ext3_setup_super (sb, es, 0))
 				sb->s_flags &= ~MS_RDONLY;
 		}
 	}
+#ifdef CONFIG_QUOTA
+	/* Release old quota file names */
+	for (i = 0; i < MAXQUOTAS; i++)
+		if (old_opts.s_qf_names[i] &&
+		    old_opts.s_qf_names[i] != sbi->s_qf_names[i])
+			kfree(old_opts.s_qf_names[i]);
+#endif
 	return 0;
+restore_opts:
+	sb->s_flags = old_sb_flags;
+	sbi->s_mount_opt = old_opts.s_mount_opt;
+	sbi->s_resuid = old_opts.s_resuid;
+	sbi->s_resgid = old_opts.s_resgid;
+	sbi->s_commit_interval = old_opts.s_commit_interval;
+#ifdef CONFIG_QUOTA
+	sbi->s_jquota_fmt = old_opts.s_jquota_fmt;
+	for (i = 0; i < MAXQUOTAS; i++) {
+		if (sbi->s_qf_names[i] &&
+		    old_opts.s_qf_names[i] != sbi->s_qf_names[i])
+			kfree(sbi->s_qf_names[i]);
+		sbi->s_qf_names[i] = old_opts.s_qf_names[i];
+	}
+#endif
+	return err;
 }
 
 static int ext3_statfs (struct super_block * sb, struct kstatfs * buf)
diff --git a/fs/inode.c b/fs/inode.c
index 6d69503..5bc9750 100644
--- a/fs/inode.c
+++ b/fs/inode.c
@@ -282,6 +282,13 @@
 		if (inode->i_data.nrpages)
 			truncate_inode_pages(&inode->i_data, 0);
 		clear_inode(inode);
+
+		spin_lock(&inode_lock);
+		hlist_del_init(&inode->i_hash);
+		list_del_init(&inode->i_sb_list);
+		spin_unlock(&inode_lock);
+
+		wake_up_inode(inode);
 		destroy_inode(inode);
 		nr_disposed++;
 	}
@@ -317,8 +324,6 @@
 		inode = list_entry(tmp, struct inode, i_sb_list);
 		invalidate_inode_buffers(inode);
 		if (!atomic_read(&inode->i_count)) {
-			hlist_del_init(&inode->i_hash);
-			list_del(&inode->i_sb_list);
 			list_move(&inode->i_list, dispose);
 			inode->i_state |= I_FREEING;
 			count++;
@@ -439,8 +444,6 @@
 			if (!can_unuse(inode))
 				continue;
 		}
-		hlist_del_init(&inode->i_hash);
-		list_del_init(&inode->i_sb_list);
 		list_move(&inode->i_list, &freeable);
 		inode->i_state |= I_FREEING;
 		nr_pruned++;
@@ -1244,29 +1247,21 @@
 }
 
 /*
- * If we try to find an inode in the inode hash while it is being deleted, we
- * have to wait until the filesystem completes its deletion before reporting
- * that it isn't found.  This is because iget will immediately call
- * ->read_inode, and we want to be sure that evidence of the deletion is found
- * by ->read_inode.
+ * If we try to find an inode in the inode hash while it is being
+ * deleted, we have to wait until the filesystem completes its
+ * deletion before reporting that it isn't found.  This function waits
+ * until the deletion _might_ have completed.  Callers are responsible
+ * to recheck inode state.
+ *
+ * It doesn't matter if I_LOCK is not set initially, a call to
+ * wake_up_inode() after removing from the hash list will DTRT.
+ *
  * This is called with inode_lock held.
  */
 static void __wait_on_freeing_inode(struct inode *inode)
 {
 	wait_queue_head_t *wq;
 	DEFINE_WAIT_BIT(wait, &inode->i_state, __I_LOCK);
-
-	/*
-	 * I_FREEING and I_CLEAR are cleared in process context under
-	 * inode_lock, so we have to give the tasks who would clear them
-	 * a chance to run and acquire inode_lock.
-	 */
-	if (!(inode->i_state & I_LOCK)) {
-		spin_unlock(&inode_lock);
-		yield();
-		spin_lock(&inode_lock);
-		return;
-	}
 	wq = bit_waitqueue(&inode->i_state, __I_LOCK);
 	prepare_to_wait(wq, &wait.wait, TASK_UNINTERRUPTIBLE);
 	spin_unlock(&inode_lock);
diff --git a/include/asm-alpha/pgtable.h b/include/asm-alpha/pgtable.h
index e139463..22b53e3 100644
--- a/include/asm-alpha/pgtable.h
+++ b/include/asm-alpha/pgtable.h
@@ -132,6 +132,10 @@
 #define __S110	_PAGE_S(0)
 #define __S111	_PAGE_S(0)
 
+/*
+ * pgprot_noncached() is only for infiniband pci support, and a real
+ * implementation for RAM would be more complicated.
+ */
 #define pgprot_noncached(prot)	(prot)
 
 /*
diff --git a/include/asm-ppc/kexec.h b/include/asm-ppc/kexec.h
index 7319131..6d2aa0a 100644
--- a/include/asm-ppc/kexec.h
+++ b/include/asm-ppc/kexec.h
@@ -27,6 +27,8 @@
 
 #ifndef __ASSEMBLY__
 
+extern void *crash_notes;
+
 struct kimage;
 
 extern void machine_kexec_simple(struct kimage *image);
diff --git a/include/asm-um/mmu_context.h b/include/asm-um/mmu_context.h
index 7529c9c..095bb62 100644
--- a/include/asm-um/mmu_context.h
+++ b/include/asm-um/mmu_context.h
@@ -16,8 +16,12 @@
 
 #define deactivate_mm(tsk,mm)	do { } while (0)
 
+extern void force_flush_all(void);
+
 static inline void activate_mm(struct mm_struct *old, struct mm_struct *new)
 {
+	if (old != new)
+		force_flush_all();
 }
 
 static inline void switch_mm(struct mm_struct *prev, struct mm_struct *next, 
diff --git a/include/linux/ext3_fs.h b/include/linux/ext3_fs.h
index 4b6e1ab..c166628 100644
--- a/include/linux/ext3_fs.h
+++ b/include/linux/ext3_fs.h
@@ -239,6 +239,20 @@
 #define EXT3_IOC_SETRSVSZ		_IOW('f', 6, long)
 
 /*
+ *  Mount options
+ */
+struct ext3_mount_options {
+	unsigned long s_mount_opt;
+	uid_t s_resuid;
+	gid_t s_resgid;
+	unsigned long s_commit_interval;
+#ifdef CONFIG_QUOTA
+	int s_jquota_fmt;
+	char *s_qf_names[MAXQUOTAS];
+#endif
+};
+
+/*
  * Structure of an inode on the disk
  */
 struct ext3_inode {
diff --git a/include/linux/hardirq.h b/include/linux/hardirq.h
index 8336dba..5912874 100644
--- a/include/linux/hardirq.h
+++ b/include/linux/hardirq.h
@@ -2,6 +2,7 @@
 #define LINUX_HARDIRQ_H
 
 #include <linux/config.h>
+#include <linux/preempt.h>
 #include <linux/smp_lock.h>
 #include <asm/hardirq.h>
 #include <asm/system.h>
diff --git a/include/linux/mount.h b/include/linux/mount.h
index 74b4727..f8f3993 100644
--- a/include/linux/mount.h
+++ b/include/linux/mount.h
@@ -12,6 +12,7 @@
 #define _LINUX_MOUNT_H
 #ifdef __KERNEL__
 
+#include <linux/types.h>
 #include <linux/list.h>
 #include <linux/spinlock.h>
 #include <asm/atomic.h>
@@ -76,6 +77,7 @@
 extern void mark_mounts_for_expiry(struct list_head *mounts);
 
 extern spinlock_t vfsmount_lock;
+extern dev_t name_to_dev_t(char *name);
 
 #endif
 #endif /* _LINUX_MOUNT_H */
diff --git a/include/linux/swap.h b/include/linux/swap.h
index c75954f..239f520 100644
--- a/include/linux/swap.h
+++ b/include/linux/swap.h
@@ -7,6 +7,8 @@
 #include <linux/mmzone.h>
 #include <linux/list.h>
 #include <linux/sched.h>
+#include <linux/pagemap.h>
+
 #include <asm/atomic.h>
 #include <asm/page.h>
 
diff --git a/include/media/audiochip.h b/include/media/audiochip.h
index f345a61..cd83116 100644
--- a/include/media/audiochip.h
+++ b/include/media/audiochip.h
@@ -1,5 +1,5 @@
 /*
- * $Id: audiochip.h,v 1.3 2005/06/12 04:19:19 mchehab Exp $
+ * $Id: audiochip.h,v 1.5 2005/06/16 22:59:16 hhackmann Exp $
  */
 
 #ifndef AUDIOCHIP_H
@@ -35,5 +35,4 @@
 
 /* misc stuff to pass around config info to i2c chips */
 #define AUDC_CONFIG_PINNACLE  _IOW('m',32,int)
-
 #endif /* AUDIOCHIP_H */
diff --git a/include/media/saa6752hs.h b/include/media/saa6752hs.h
index 791bad2..3b8686e 100644
--- a/include/media/saa6752hs.h
+++ b/include/media/saa6752hs.h
@@ -18,55 +18,6 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-#if 0 /* ndef _SAA6752HS_H */
-#define _SAA6752HS_H
-
-enum mpeg_video_bitrate_mode {
-	MPEG_VIDEO_BITRATE_MODE_VBR = 0, /* Variable bitrate */
-	MPEG_VIDEO_BITRATE_MODE_CBR = 1, /* Constant bitrate */
-
-	MPEG_VIDEO_BITRATE_MODE_MAX
-};
-
-enum mpeg_audio_bitrate {
-	MPEG_AUDIO_BITRATE_256 = 0, /* 256 kBit/sec */
-	MPEG_AUDIO_BITRATE_384 = 1, /* 384 kBit/sec */
-
-	MPEG_AUDIO_BITRATE_MAX
-};
-
-enum mpeg_video_format {
-	MPEG_VIDEO_FORMAT_D1 = 0,
-	MPEG_VIDEO_FORMAT_2_3_D1 = 1,
-	MPEG_VIDEO_FORMAT_1_2_D1 = 2,
-	MPEG_VIDEO_FORMAT_SIF = 3,
-
-	MPEG_VIDEO_FORMAT_MAX
-};
-
-#define MPEG_VIDEO_TARGET_BITRATE_MAX 27000
-#define MPEG_VIDEO_MAX_BITRATE_MAX 27000
-#define MPEG_TOTAL_BITRATE_MAX 27000
-#define MPEG_PID_MAX ((1 << 14) - 1)
-
-struct mpeg_params {
-	enum mpeg_video_bitrate_mode video_bitrate_mode;
-	unsigned int video_target_bitrate;
-	unsigned int video_max_bitrate; // only used for VBR
-	enum mpeg_audio_bitrate audio_bitrate;
-	unsigned int total_bitrate;
-
-   	unsigned int pmt_pid;
-	unsigned int video_pid;
-	unsigned int audio_pid;
-	unsigned int pcr_pid;
-
-	enum mpeg_video_format video_format;
-};
-
-#define MPEG_SETPARAMS             _IOW('6',100,struct mpeg_params)
-
-#endif // _SAA6752HS_H
 
 /*
  * Local variables:
diff --git a/include/media/tuner.h b/include/media/tuner.h
index 4794c56..d8c0a55 100644
--- a/include/media/tuner.h
+++ b/include/media/tuner.h
@@ -1,5 +1,5 @@
 
-/* $Id: tuner.h,v 1.33 2005/06/21 14:58:08 mkrufky Exp $
+/* $Id: tuner.h,v 1.42 2005/07/06 09:42:19 mchehab Exp $
  *
     tuner.h - definition for different tuners
 
@@ -26,8 +26,6 @@
 
 #include <linux/videodev2.h>
 
-#include "id.h"
-
 #define ADDR_UNSET (255)
 
 #define TUNER_TEMIC_PAL     0        /* 4002 FH5 (3X 7756, 9483) */
@@ -111,8 +109,6 @@
 #define TUNER_TEA5767         62	/* Only FM Radio Tuner */
 #define TUNER_PHILIPS_FMD1216ME_MK3 63
 
-#define TEA5767_TUNER_NAME "Philips TEA5767HN FM Radio"
-
 #define NOTUNER 0
 #define PAL     1	/* PAL_BG */
 #define PAL_I   2
@@ -135,19 +131,8 @@
 #define TCL     11
 #define THOMSON 12
 
-enum v4l_radio_tuner {
-        TEA5767_LOW_LO_32768    = 0,
-        TEA5767_HIGH_LO_32768   = 1,
-        TEA5767_LOW_LO_13MHz    = 2,
-        TEA5767_HIGH_LO_13MHz   = 3,
-};
-
-
-#define TUNER_SET_TYPE               _IOW('t',1,int)    /* set tuner type */
-#define TUNER_SET_TVFREQ             _IOW('t',2,int)    /* set tv freq */
-#define TUNER_SET_TYPE_ADDR          _IOW('T',3,int)	/* set tuner type and I2C addr */
-
-#define  TDA9887_SET_CONFIG          _IOW('t',5,int)
+#define TUNER_SET_TYPE_ADDR          _IOW('T',3,int)
+#define TDA9887_SET_CONFIG           _IOW('t',5,int)
 
 /* tv card specific */
 # define TDA9887_PRESENT             (1<<0)
@@ -169,25 +154,34 @@
 #define I2C_ADDR_TDA8290        0x4b
 #define I2C_ADDR_TDA8275        0x61
 
-struct tuner_addr {
-	enum v4l2_tuner_type	v4l2_tuner;
-	unsigned int		type;
+enum tuner_mode {
+	T_UNINITIALIZED = 0,
+	T_RADIO		= 1 << V4L2_TUNER_RADIO,
+	T_ANALOG_TV     = 1 << V4L2_TUNER_ANALOG_TV,
+	T_DIGITAL_TV    = 1 << V4L2_TUNER_DIGITAL_TV,
+	T_STANDBY	= 1 << 31
+};
+
+struct tuner_setup {
 	unsigned short		addr;
+	unsigned int		type;
+	unsigned int		mode_mask;
 };
 
 struct tuner {
 	/* device */
 	struct i2c_client i2c;
 
-	/* state + config */
-	unsigned int initialized;
 	unsigned int type;            /* chip type */
-	unsigned int freq;            /* keep track of the current settings */
-	v4l2_std_id  std;
-	int          using_v4l2;
 
-	enum v4l2_tuner_type mode;
-	unsigned int input;
+	unsigned int          mode;
+	unsigned int          mode_mask; /* Combination of allowable modes */
+
+	unsigned int freq;            /* keep track of the current settings */
+	unsigned int audmode;
+	v4l2_std_id  std;
+
+	int          using_v4l2;
 
 	/* used by MT2032 */
 	unsigned int xogc;
@@ -197,15 +191,11 @@
 	unsigned char i2c_easy_mode[2];
 	unsigned char i2c_set_freq[8];
 
-	/* used to keep track of audmode */
-	unsigned int audmode;
-
 	/* function ptrs */
 	void (*tv_freq)(struct i2c_client *c, unsigned int freq);
 	void (*radio_freq)(struct i2c_client *c, unsigned int freq);
 	int  (*has_signal)(struct i2c_client *c);
 	int  (*is_stereo)(struct i2c_client *c);
-	int  (*set_tuner)(struct i2c_client *c, struct v4l2_tuner *v);
 };
 
 extern unsigned int tuner_debug;
@@ -215,6 +205,7 @@
 extern int tda8290_init(struct i2c_client *c);
 extern int tea5767_tuner_init(struct i2c_client *c);
 extern int default_tuner_init(struct i2c_client *c);
+extern int tea5767_autodetection(struct i2c_client *c);
 
 #define tuner_warn(fmt, arg...) \
 	dev_printk(KERN_WARNING , &t->i2c.dev , fmt , ## arg)
diff --git a/include/pcmcia/ds.h b/include/pcmcia/ds.h
index 0190e76..b707a60 100644
--- a/include/pcmcia/ds.h
+++ b/include/pcmcia/ds.h
@@ -16,10 +16,13 @@
 #ifndef _LINUX_DS_H
 #define _LINUX_DS_H
 
+#ifdef __KERNEL__
+#include <linux/mod_devicetable.h>
+#endif
+
 #include <pcmcia/bulkmem.h>
 #include <pcmcia/cs_types.h>
 #include <pcmcia/device_id.h>
-#include <linux/mod_devicetable.h>
 
 typedef struct tuple_parse_t {
     tuple_t		tuple;
diff --git a/init/do_mounts.c b/init/do_mounts.c
index b7570c0..1b02be7 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -7,6 +7,7 @@
 #include <linux/root_dev.h>
 #include <linux/security.h>
 #include <linux/delay.h>
+#include <linux/mount.h>
 
 #include <linux/nfs_fs.h>
 #include <linux/nfs_fs_sb.h>
diff --git a/init/do_mounts.h b/init/do_mounts.h
index de92bee..e0a7ac9 100644
--- a/init/do_mounts.h
+++ b/init/do_mounts.h
@@ -9,7 +9,6 @@
 #include <linux/major.h>
 #include <linux/root_dev.h>
 
-dev_t name_to_dev_t(char *name);
 void  change_floppy(char *fmt, ...);
 void  mount_block_root(char *name, int flags);
 void  mount_root(void);
diff --git a/ipc/util.h b/ipc/util.h
index 07d6894..44348ca 100644
--- a/ipc/util.h
+++ b/ipc/util.h
@@ -67,7 +67,7 @@
 void kernel_to_ipc64_perm(struct kern_ipc_perm *in, struct ipc64_perm *out);
 void ipc64_perm_to_ipc_perm(struct ipc64_perm *in, struct ipc_perm *out);
 
-#if defined(__ia64__) || defined(__x86_64__) || defined(__hppa__)
+#if defined(__ia64__) || defined(__x86_64__) || defined(__hppa__) || defined(__XTENSA__)
   /* On IA-64, we always use the "64-bit version" of the IPC structures.  */ 
 # define ipc_parse_version(cmd)	IPC_64
 #else
diff --git a/kernel/fork.c b/kernel/fork.c
index cdef6ce..b65187f 100644
--- a/kernel/fork.c
+++ b/kernel/fork.c
@@ -208,8 +208,10 @@
 		struct file *file;
 
 		if (mpnt->vm_flags & VM_DONTCOPY) {
+			long pages = vma_pages(mpnt);
+			mm->total_vm -= pages;
 			__vm_stat_account(mm, mpnt->vm_flags, mpnt->vm_file,
-							-vma_pages(mpnt));
+								-pages);
 			continue;
 		}
 		charge = 0;
diff --git a/kernel/power/disk.c b/kernel/power/disk.c
index c51a4d9..3ec789c 100644
--- a/kernel/power/disk.c
+++ b/kernel/power/disk.c
@@ -16,6 +16,8 @@
 #include <linux/device.h>
 #include <linux/delay.h>
 #include <linux/fs.h>
+#include <linux/mount.h>
+
 #include "power.h"
 
 
diff --git a/kernel/power/swsusp.c b/kernel/power/swsusp.c
index 7d7801c..f2bc71b 100644
--- a/kernel/power/swsusp.c
+++ b/kernel/power/swsusp.c
@@ -63,6 +63,7 @@
 #include <linux/console.h>
 #include <linux/highmem.h>
 #include <linux/bio.h>
+#include <linux/mount.h>
 
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
@@ -1260,8 +1261,6 @@
 	return error;
 }
 
-extern dev_t name_to_dev_t(const char *line);
-
 /**
  *	read_pagedir - Read page backup list pages from swap
  */
diff --git a/mm/filemap_xip.c b/mm/filemap_xip.c
index 3b6e384..4553b2c 100644
--- a/mm/filemap_xip.c
+++ b/mm/filemap_xip.c
@@ -191,7 +191,7 @@
 					 address);
 		if (!IS_ERR(pte)) {
 			/* Nuke the page table entry. */
-			flush_cache_page(vma, address, pte_pfn(pte));
+			flush_cache_page(vma, address, pte_pfn(*pte));
 			pteval = ptep_clear_flush(vma, address, pte);
 			BUG_ON(pte_dirty(pteval));
 			pte_unmap(pte);