aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/feature-removal-schedule.txt36
-rw-r--r--Documentation/video4linux/CARDLIST.cx884
-rw-r--r--Documentation/video4linux/CARDLIST.saa71341
-rw-r--r--MAINTAINERS8
-rw-r--r--arch/mips/Kconfig51
-rw-r--r--arch/mips/Makefile13
-rw-r--r--arch/mips/configs/decstation_defconfig146
-rw-r--r--arch/mips/configs/it8172_defconfig964
-rw-r--r--arch/mips/configs/ivr_defconfig920
-rw-r--r--arch/mips/dec/boot/Makefile12
-rw-r--r--arch/mips/dec/boot/decstation.c84
-rw-r--r--arch/mips/dec/boot/ld.ecoff43
-rw-r--r--arch/mips/dec/time.c2
-rw-r--r--arch/mips/ite-boards/Kconfig8
-rw-r--r--arch/mips/ite-boards/generic/Makefile15
-rw-r--r--arch/mips/ite-boards/generic/dbg_io.c124
-rw-r--r--arch/mips/ite-boards/generic/irq.c308
-rw-r--r--arch/mips/ite-boards/generic/it8172_cir.c170
-rw-r--r--arch/mips/ite-boards/generic/it8172_setup.c352
-rw-r--r--arch/mips/ite-boards/generic/lpc.c144
-rw-r--r--arch/mips/ite-boards/generic/pmon_prom.c135
-rw-r--r--arch/mips/ite-boards/generic/puts.c139
-rw-r--r--arch/mips/ite-boards/generic/reset.c60
-rw-r--r--arch/mips/ite-boards/generic/time.c249
-rw-r--r--arch/mips/ite-boards/ivr/Makefile10
-rw-r--r--arch/mips/ite-boards/ivr/README3
-rw-r--r--arch/mips/ite-boards/ivr/init.c81
-rw-r--r--arch/mips/ite-boards/qed-4n-s01b/Makefile10
-rw-r--r--arch/mips/ite-boards/qed-4n-s01b/README2
-rw-r--r--arch/mips/ite-boards/qed-4n-s01b/init.c82
-rw-r--r--arch/mips/kernel/time.c74
-rw-r--r--arch/mips/mm/init.c4
-rw-r--r--arch/mips/pci/Makefile3
-rw-r--r--arch/mips/pci/fixup-ite8172g.c80
-rw-r--r--arch/mips/pci/fixup-ivr.c75
-rw-r--r--arch/mips/pci/fixup-sb1250.c23
-rw-r--r--arch/mips/pci/ops-it8172.c213
-rw-r--r--arch/mips/sibyte/bcm1480/irq.c2
-rw-r--r--arch/mips/sibyte/sb1250/irq.c7
-rw-r--r--drivers/char/.gitignore1
-rw-r--r--drivers/char/Kconfig30
-rw-r--r--drivers/char/Makefile6
-rw-r--r--drivers/char/ite_gpio.c419
-rw-r--r--drivers/char/qtronixmap.c_shipped265
-rw-r--r--drivers/char/qtronixmap.map287
-rw-r--r--drivers/char/watchdog/Kconfig21
-rw-r--r--drivers/char/watchdog/Makefile1
-rw-r--r--drivers/char/watchdog/iTCO_wdt.c735
-rw-r--r--drivers/char/watchdog/pnx4008_wdt.c2
-rw-r--r--drivers/ide/Kconfig9
-rw-r--r--drivers/ide/pci/Makefile1
-rw-r--r--drivers/ide/pci/it8172.c307
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.c10
-rw-r--r--drivers/media/dvb/dvb-core/dvb_frontend.h1
-rw-r--r--drivers/media/dvb/dvb-usb/Kconfig41
-rw-r--r--drivers/media/dvb/dvb-usb/Makefile5
-rw-r--r--drivers/media/dvb/dvb-usb/a800.c48
-rw-r--r--drivers/media/dvb/dvb-usb/cxusb.c257
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700.h49
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_core.c279
-rw-r--r--drivers/media/dvb/dvb-usb/dib0700_devices.c212
-rw-r--r--drivers/media/dvb/dvb-usb/dib07x0.h21
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-common.c71
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-mb.c198
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb-mc.c40
-rw-r--r--drivers/media/dvb/dvb-usb/dibusb.h13
-rw-r--r--drivers/media/dvb/dvb-usb/digitv.c57
-rw-r--r--drivers/media/dvb/dvb-usb/dtt200u.c160
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-common.h41
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-dvb.c170
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-firmware.c10
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-i2c.c49
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-ids.h17
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-init.c165
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-remote.c2
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb-urb.c268
-rw-r--r--drivers/media/dvb/dvb-usb/dvb-usb.h280
-rw-r--r--drivers/media/dvb/dvb-usb/gp8psk.c32
-rw-r--r--drivers/media/dvb/dvb-usb/nova-t-usb2.c43
-rw-r--r--drivers/media/dvb/dvb-usb/umt-010.c38
-rw-r--r--drivers/media/dvb/dvb-usb/usb-urb.c242
-rw-r--r--drivers/media/dvb/dvb-usb/vp702x-fe.c39
-rw-r--r--drivers/media/dvb/dvb-usb/vp702x.c204
-rw-r--r--drivers/media/dvb/dvb-usb/vp702x.h2
-rw-r--r--drivers/media/dvb/dvb-usb/vp7045.c40
-rw-r--r--drivers/media/dvb/frontends/cx24123.c4
-rw-r--r--drivers/media/dvb/frontends/dib3000mc.c238
-rw-r--r--drivers/media/dvb/frontends/dib3000mc.h8
-rw-r--r--drivers/media/dvb/frontends/mt2060.c17
-rw-r--r--drivers/media/dvb/frontends/mt2060.h4
-rw-r--r--drivers/media/video/Kconfig130
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c2
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c4
-rw-r--r--drivers/media/video/cx88/cx88-cards.c81
-rw-r--r--drivers/media/video/cx88/cx88-core.c9
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c2
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c4
-rw-r--r--drivers/media/video/cx88/cx88-mpeg.c13
-rw-r--r--drivers/media/video/cx88/cx88-tvaudio.c4
-rw-r--r--drivers/media/video/cx88/cx88-video.c3
-rw-r--r--drivers/media/video/cx88/cx88.h17
-rw-r--r--drivers/media/video/ir-kbd-i2c.c19
-rw-r--r--drivers/media/video/msp3400-driver.c2
-rw-r--r--drivers/media/video/msp3400-driver.h1
-rw-r--r--drivers/media/video/msp3400-kthreads.c5
-rw-r--r--drivers/media/video/pvrusb2/Kconfig13
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c37
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.h8
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c125
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c36
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c1
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c1
-rw-r--r--drivers/media/video/saa7134/saa7134.h1
-rw-r--r--drivers/media/video/video-buf.c7
-rw-r--r--include/asm-mips/bootinfo.h12
-rw-r--r--include/asm-mips/it8172/it8172.h348
-rw-r--r--include/asm-mips/it8172/it8172_cir.h140
-rw-r--r--include/asm-mips/it8172/it8172_dbg.h38
-rw-r--r--include/asm-mips/it8172/it8172_int.h144
-rw-r--r--include/asm-mips/it8172/it8172_pci.h108
-rw-r--r--include/asm-mips/it8712.h28
-rw-r--r--include/asm-mips/ptrace.h3
-rw-r--r--include/asm-mips/serial.h34
-rw-r--r--include/linux/ite_gpio.h66
-rw-r--r--include/linux/pci_ids.h5
-rw-r--r--include/linux/videodev2.h80
-rw-r--r--include/media/audiochip.h4
-rw-r--r--sound/oss/Kconfig4
-rw-r--r--sound/oss/Makefile1
-rw-r--r--sound/oss/ite8172.c2261
131 files changed, 3395 insertions, 10526 deletions
diff --git a/Documentation/feature-removal-schedule.txt b/Documentation/feature-removal-schedule.txt
index 486638f24b4f..42b95e0ad558 100644
--- a/Documentation/feature-removal-schedule.txt
+++ b/Documentation/feature-removal-schedule.txt
@@ -211,42 +211,6 @@ Who: Nick Piggin <npiggin@suse.de>
211 211
212--------------------------- 212---------------------------
213 213
214What: Support for the Momentum / PMC-Sierra Jaguar ATX evaluation board
215When: September 2006
216Why: Does no longer build since quite some time, and was never popular,
217 due to the platform being replaced by successor models. Apparently
218 no user base left. It also is one of the last users of
219 WANT_PAGE_VIRTUAL.
220Who: Ralf Baechle <ralf@linux-mips.org>
221
222---------------------------
223
224What: Support for the Momentum Ocelot, Ocelot 3, Ocelot C and Ocelot G
225When: September 2006
226Why: Some do no longer build and apparently there is no user base left
227 for these platforms.
228Who: Ralf Baechle <ralf@linux-mips.org>
229
230---------------------------
231
232What: Support for MIPS Technologies' Altas and SEAD evaluation board
233When: September 2006
234Why: Some do no longer build and apparently there is no user base left
235 for these platforms. Hardware out of production since several years.
236Who: Ralf Baechle <ralf@linux-mips.org>
237
238---------------------------
239
240What: Support for the IT8172-based platforms, ITE 8172G and Globespan IVR
241When: September 2006
242Why: Code does no longer build since at least 2.6.0, apparently there is
243 no user base left for these platforms. Hardware out of production
244 since several years and hardly a trace of the manufacturer left on
245 the net.
246Who: Ralf Baechle <ralf@linux-mips.org>
247
248---------------------------
249
250What: Interrupt only SA_* flags 214What: Interrupt only SA_* flags
251When: Januar 2007 215When: Januar 2007
252Why: The interrupt related SA_* flags are replaced by IRQF_* to move them 216Why: The interrupt related SA_* flags are replaced by IRQF_* to move them
diff --git a/Documentation/video4linux/CARDLIST.cx88 b/Documentation/video4linux/CARDLIST.cx88
index 669a09aa5bb4..126e59d935cd 100644
--- a/Documentation/video4linux/CARDLIST.cx88
+++ b/Documentation/video4linux/CARDLIST.cx88
@@ -16,7 +16,7 @@
16 15 -> DViCO FusionHDTV DVB-T1 [18ac:db00] 16 15 -> DViCO FusionHDTV DVB-T1 [18ac:db00]
17 16 -> KWorld LTV883RF 17 16 -> KWorld LTV883RF
18 17 -> DViCO FusionHDTV 3 Gold-Q [18ac:d810,18ac:d800] 18 17 -> DViCO FusionHDTV 3 Gold-Q [18ac:d810,18ac:d800]
19 18 -> Hauppauge Nova-T DVB-T [0070:9002,0070:9001] 19 18 -> Hauppauge Nova-T DVB-T [0070:9002,0070:9001,0070:9000]
20 19 -> Conexant DVB-T reference design [14f1:0187] 20 19 -> Conexant DVB-T reference design [14f1:0187]
21 20 -> Provideo PV259 [1540:2580] 21 20 -> Provideo PV259 [1540:2580]
22 21 -> DViCO FusionHDTV DVB-T Plus [18ac:db10,18ac:db11] 22 21 -> DViCO FusionHDTV DVB-T Plus [18ac:db10,18ac:db11]
@@ -41,7 +41,7 @@
41 40 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid [0070:9400,0070:9402] 41 40 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid [0070:9400,0070:9402]
42 41 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile) [0070:9800,0070:9802] 42 41 -> Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile) [0070:9800,0070:9802]
43 42 -> digitalnow DNTV Live! DVB-T Pro [1822:0025,1822:0019] 43 42 -> digitalnow DNTV Live! DVB-T Pro [1822:0025,1822:0019]
44 43 -> KWorld/VStream XPert DVB-T with cx22702 [17de:08a1] 44 43 -> KWorld/VStream XPert DVB-T with cx22702 [17de:08a1,12ab:2300]
45 44 -> DViCO FusionHDTV DVB-T Dual Digital [18ac:db50,18ac:db54] 45 44 -> DViCO FusionHDTV DVB-T Dual Digital [18ac:db50,18ac:db54]
46 45 -> KWorld HardwareMpegTV XPert [17de:0840] 46 45 -> KWorld HardwareMpegTV XPert [17de:0840]
47 46 -> DViCO FusionHDTV DVB-T Hybrid [18ac:db40,18ac:db44] 47 46 -> DViCO FusionHDTV DVB-T Hybrid [18ac:db40,18ac:db44]
diff --git a/Documentation/video4linux/CARDLIST.saa7134 b/Documentation/video4linux/CARDLIST.saa7134
index 94cf695b1378..6fb82ac3bef0 100644
--- a/Documentation/video4linux/CARDLIST.saa7134
+++ b/Documentation/video4linux/CARDLIST.saa7134
@@ -97,3 +97,4 @@
97 96 -> Medion Md8800 Quadro [16be:0007,16be:0008] 97 96 -> Medion Md8800 Quadro [16be:0007,16be:0008]
98 97 -> LifeView FlyDVB-S /Acorp TV134DS [5168:0300,4e42:0300] 98 97 -> LifeView FlyDVB-S /Acorp TV134DS [5168:0300,4e42:0300]
99 98 -> Proteus Pro 2309 [0919:2003] 99 98 -> Proteus Pro 2309 [0919:2003]
100 99 -> AVerMedia TV Hybrid A16AR [1461:2c00]
diff --git a/MAINTAINERS b/MAINTAINERS
index 28cd70cf3e99..1c6223d3ce70 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -144,11 +144,9 @@ L: netdev@vger.kernel.org
144S: Maintained 144S: Maintained
145 145
1468250/16?50 (AND CLONE UARTS) SERIAL DRIVER 1468250/16?50 (AND CLONE UARTS) SERIAL DRIVER
147P: Russell King
148M: rmk+serial@arm.linux.org.uk
149L: linux-serial@vger.kernel.org 147L: linux-serial@vger.kernel.org
150W: http://serial.sourceforge.net 148W: http://serial.sourceforge.net
151S: Maintained 149S: Orphan
152 150
1538390 NETWORK DRIVERS [WD80x3/SMC-ELITE, SMC-ULTRA, NE2000, 3C503, etc.] 1518390 NETWORK DRIVERS [WD80x3/SMC-ELITE, SMC-ULTRA, NE2000, 3C503, etc.]
154P: Paul Gortmaker 152P: Paul Gortmaker
@@ -1986,9 +1984,7 @@ W: http://www.atnf.csiro.au/~rgooch/linux/kernel-patches.html
1986S: Maintained 1984S: Maintained
1987 1985
1988MULTIMEDIA CARD (MMC) SUBSYSTEM 1986MULTIMEDIA CARD (MMC) SUBSYSTEM
1989P: Russell King 1987S: Orphan
1990M: rmk+mmc@arm.linux.org.uk
1991S: Maintained
1992 1988
1993MULTISOUND SOUND DRIVER 1989MULTISOUND SOUND DRIVER
1994P: Andrew Veliath 1990P: Andrew Veliath
diff --git a/arch/mips/Kconfig b/arch/mips/Kconfig
index 87cee341eb54..bfab055ad7cc 100644
--- a/arch/mips/Kconfig
+++ b/arch/mips/Kconfig
@@ -203,39 +203,6 @@ config MIPS_EV64120
203 <http://www.marvell.com/>. Say Y here if you wish to build a 203 <http://www.marvell.com/>. Say Y here if you wish to build a
204 kernel for this platform. 204 kernel for this platform.
205 205
206config MIPS_IVR
207 bool "Globespan IVR board"
208 select DMA_NONCOHERENT
209 select HW_HAS_PCI
210 select ITE_BOARD_GEN
211 select SYS_HAS_CPU_NEVADA
212 select SYS_SUPPORTS_32BIT_KERNEL
213 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
214 select SYS_SUPPORTS_LITTLE_ENDIAN
215 help
216 This is an evaluation board built by Globespan to showcase thir
217 iVR (Internet Video Recorder) design. It utilizes a QED RM5231
218 R5000 MIPS core. More information can be found out their website
219 located at <http://www.globespan.net/>. Say Y here if you wish to
220 build a kernel for this platform.
221
222config MIPS_ITE8172
223 bool "ITE 8172G board"
224 select DMA_NONCOHERENT
225 select HW_HAS_PCI
226 select ITE_BOARD_GEN
227 select SYS_HAS_CPU_R5432
228 select SYS_HAS_CPU_NEVADA
229 select SYS_SUPPORTS_32BIT_KERNEL
230 select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
231 select SYS_SUPPORTS_LITTLE_ENDIAN
232 help
233 Ths is an evaluation board made by ITE <http://www.ite.com.tw/>
234 with ATX form factor that utilizes a MIPS R5000 to work with its
235 ITE8172G companion internet appliance chip. The MIPS core can be
236 either a NEC Vr5432 or QED RM5231. Say Y here if you wish to build
237 a kernel for this platform.
238
239config MACH_JAZZ 206config MACH_JAZZ
240 bool "Jazz family of machines" 207 bool "Jazz family of machines"
241 select ARC 208 select ARC
@@ -804,7 +771,6 @@ endchoice
804source "arch/mips/ddb5xxx/Kconfig" 771source "arch/mips/ddb5xxx/Kconfig"
805source "arch/mips/gt64120/ev64120/Kconfig" 772source "arch/mips/gt64120/ev64120/Kconfig"
806source "arch/mips/jazz/Kconfig" 773source "arch/mips/jazz/Kconfig"
807source "arch/mips/ite-boards/Kconfig"
808source "arch/mips/lasat/Kconfig" 774source "arch/mips/lasat/Kconfig"
809source "arch/mips/momentum/Kconfig" 775source "arch/mips/momentum/Kconfig"
810source "arch/mips/pmc-sierra/Kconfig" 776source "arch/mips/pmc-sierra/Kconfig"
@@ -837,6 +803,10 @@ config GENERIC_CALIBRATE_DELAY
837 bool 803 bool
838 default y 804 default y
839 805
806config GENERIC_TIME
807 bool
808 default y
809
840config SCHED_NO_NO_OMIT_FRAME_POINTER 810config SCHED_NO_NO_OMIT_FRAME_POINTER
841 bool 811 bool
842 default y 812 default y
@@ -964,9 +934,6 @@ config MIPS_RM9122
964config PCI_MARVELL 934config PCI_MARVELL
965 bool 935 bool
966 936
967config ITE_BOARD_GEN
968 bool
969
970config SOC_AU1000 937config SOC_AU1000
971 bool 938 bool
972 select SOC_AU1X00 939 select SOC_AU1X00
@@ -1050,16 +1017,6 @@ config AU1X00_USB_DEVICE
1050 depends on MIPS_PB1500 || MIPS_PB1100 || MIPS_PB1000 1017 depends on MIPS_PB1500 || MIPS_PB1100 || MIPS_PB1000
1051 default n 1018 default n
1052 1019
1053config IT8172_CIR
1054 bool
1055 depends on MIPS_ITE8172 || MIPS_IVR
1056 default y
1057
1058config IT8712
1059 bool
1060 depends on MIPS_ITE8172
1061 default y
1062
1063config BOOT_ELF32 1020config BOOT_ELF32
1064 bool 1021 bool
1065 1022
diff --git a/arch/mips/Makefile b/arch/mips/Makefile
index e521826b4234..2124350ab94d 100644
--- a/arch/mips/Makefile
+++ b/arch/mips/Makefile
@@ -287,19 +287,6 @@ cflags-$(CONFIG_WR_PPMC) += -Iinclude/asm-mips/mach-wrppmc
287load-$(CONFIG_WR_PPMC) += 0xffffffff80100000 287load-$(CONFIG_WR_PPMC) += 0xffffffff80100000
288 288
289# 289#
290# Globespan IVR eval board with QED 5231 CPU
291#
292core-$(CONFIG_ITE_BOARD_GEN) += arch/mips/ite-boards/generic/
293core-$(CONFIG_MIPS_IVR) += arch/mips/ite-boards/ivr/
294load-$(CONFIG_MIPS_IVR) += 0xffffffff80100000
295
296#
297# ITE 8172 eval board with QED 5231 CPU
298#
299core-$(CONFIG_MIPS_ITE8172) += arch/mips/ite-boards/qed-4n-s01b/
300load-$(CONFIG_MIPS_ITE8172) += 0xffffffff80100000
301
302#
303# For all MIPS, Inc. eval boards 290# For all MIPS, Inc. eval boards
304# 291#
305core-$(CONFIG_MIPS_BOARDS_GEN) += arch/mips/mips-boards/generic/ 292core-$(CONFIG_MIPS_BOARDS_GEN) += arch/mips/mips-boards/generic/
diff --git a/arch/mips/configs/decstation_defconfig b/arch/mips/configs/decstation_defconfig
index be901df7fefa..fe1387eb83c9 100644
--- a/arch/mips/configs/decstation_defconfig
+++ b/arch/mips/configs/decstation_defconfig
@@ -1,7 +1,7 @@
1# 1#
2# Automatically generated make config: don't edit 2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18-rc1 3# Linux kernel version: 2.6.18
4# Thu Jul 6 10:04:01 2006 4# Tue Oct 3 11:57:53 2006
5# 5#
6CONFIG_MIPS=y 6CONFIG_MIPS=y
7 7
@@ -167,27 +167,28 @@ CONFIG_SWAP=y
167CONFIG_SYSVIPC=y 167CONFIG_SYSVIPC=y
168# CONFIG_POSIX_MQUEUE is not set 168# CONFIG_POSIX_MQUEUE is not set
169# CONFIG_BSD_PROCESS_ACCT is not set 169# CONFIG_BSD_PROCESS_ACCT is not set
170CONFIG_SYSCTL=y 170# CONFIG_TASKSTATS is not set
171# CONFIG_AUDIT is not set 171# CONFIG_AUDIT is not set
172# CONFIG_IKCONFIG is not set 172# CONFIG_IKCONFIG is not set
173CONFIG_RELAY=y 173# CONFIG_RELAY is not set
174CONFIG_INITRAMFS_SOURCE="" 174CONFIG_INITRAMFS_SOURCE=""
175# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set 175# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
176CONFIG_SYSCTL=y
176CONFIG_EMBEDDED=y 177CONFIG_EMBEDDED=y
178# CONFIG_SYSCTL_SYSCALL is not set
177CONFIG_KALLSYMS=y 179CONFIG_KALLSYMS=y
178# CONFIG_KALLSYMS_ALL is not set
179# CONFIG_KALLSYMS_EXTRA_PASS is not set 180# CONFIG_KALLSYMS_EXTRA_PASS is not set
180# CONFIG_HOTPLUG is not set 181# CONFIG_HOTPLUG is not set
181CONFIG_PRINTK=y 182CONFIG_PRINTK=y
182CONFIG_BUG=y 183CONFIG_BUG=y
183CONFIG_ELF_CORE=y 184CONFIG_ELF_CORE=y
184CONFIG_BASE_FULL=y 185CONFIG_BASE_FULL=y
185CONFIG_RT_MUTEXES=y
186CONFIG_FUTEX=y 186CONFIG_FUTEX=y
187CONFIG_EPOLL=y 187CONFIG_EPOLL=y
188CONFIG_SHMEM=y 188CONFIG_SHMEM=y
189CONFIG_SLAB=y 189CONFIG_SLAB=y
190CONFIG_VM_EVENT_COUNTERS=y 190CONFIG_VM_EVENT_COUNTERS=y
191CONFIG_RT_MUTEXES=y
191# CONFIG_TINY_SHMEM is not set 192# CONFIG_TINY_SHMEM is not set
192CONFIG_BASE_SMALL=0 193CONFIG_BASE_SMALL=0
193# CONFIG_SLOB is not set 194# CONFIG_SLOB is not set
@@ -205,6 +206,7 @@ CONFIG_KMOD=y
205# 206#
206# Block layer 207# Block layer
207# 208#
209CONFIG_BLOCK=y
208# CONFIG_LBD is not set 210# CONFIG_LBD is not set
209# CONFIG_BLK_DEV_IO_TRACE is not set 211# CONFIG_BLK_DEV_IO_TRACE is not set
210# CONFIG_LSF is not set 212# CONFIG_LSF is not set
@@ -231,7 +233,6 @@ CONFIG_MMU=y
231# 233#
232# PCCARD (PCMCIA/CardBus) support 234# PCCARD (PCMCIA/CardBus) support
233# 235#
234# CONFIG_PCCARD is not set
235 236
236# 237#
237# PCI Hotplug Support 238# PCI Hotplug Support
@@ -258,9 +259,10 @@ CONFIG_PACKET_MMAP=y
258CONFIG_UNIX=y 259CONFIG_UNIX=y
259CONFIG_XFRM=y 260CONFIG_XFRM=y
260# CONFIG_XFRM_USER is not set 261# CONFIG_XFRM_USER is not set
261# CONFIG_NET_KEY is not set 262# CONFIG_XFRM_SUB_POLICY is not set
263CONFIG_NET_KEY=m
262CONFIG_INET=y 264CONFIG_INET=y
263# CONFIG_IP_MULTICAST is not set 265CONFIG_IP_MULTICAST=y
264# CONFIG_IP_ADVANCED_ROUTER is not set 266# CONFIG_IP_ADVANCED_ROUTER is not set
265CONFIG_IP_FIB_HASH=y 267CONFIG_IP_FIB_HASH=y
266CONFIG_IP_PNP=y 268CONFIG_IP_PNP=y
@@ -269,22 +271,37 @@ CONFIG_IP_PNP_BOOTP=y
269# CONFIG_IP_PNP_RARP is not set 271# CONFIG_IP_PNP_RARP is not set
270# CONFIG_NET_IPIP is not set 272# CONFIG_NET_IPIP is not set
271# CONFIG_NET_IPGRE is not set 273# CONFIG_NET_IPGRE is not set
274# CONFIG_IP_MROUTE is not set
272# CONFIG_ARPD is not set 275# CONFIG_ARPD is not set
273# CONFIG_SYN_COOKIES is not set 276CONFIG_SYN_COOKIES=y
274# CONFIG_INET_AH is not set 277CONFIG_INET_AH=m
275# CONFIG_INET_ESP is not set 278CONFIG_INET_ESP=m
276# CONFIG_INET_IPCOMP is not set 279CONFIG_INET_IPCOMP=m
277# CONFIG_INET_XFRM_TUNNEL is not set 280CONFIG_INET_XFRM_TUNNEL=m
278# CONFIG_INET_TUNNEL is not set 281CONFIG_INET_TUNNEL=m
279CONFIG_INET_XFRM_MODE_TRANSPORT=m 282CONFIG_INET_XFRM_MODE_TRANSPORT=m
280CONFIG_INET_XFRM_MODE_TUNNEL=m 283CONFIG_INET_XFRM_MODE_TUNNEL=m
281CONFIG_INET_DIAG=y 284CONFIG_INET_DIAG=y
282CONFIG_INET_TCP_DIAG=y 285CONFIG_INET_TCP_DIAG=y
283# CONFIG_TCP_CONG_ADVANCED is not set 286# CONFIG_TCP_CONG_ADVANCED is not set
284CONFIG_TCP_CONG_BIC=y 287CONFIG_TCP_CONG_CUBIC=y
285# CONFIG_IPV6 is not set 288CONFIG_DEFAULT_TCP_CONG="cubic"
286# CONFIG_INET6_XFRM_TUNNEL is not set 289CONFIG_IPV6=m
287# CONFIG_INET6_TUNNEL is not set 290CONFIG_IPV6_PRIVACY=y
291CONFIG_IPV6_ROUTER_PREF=y
292CONFIG_IPV6_ROUTE_INFO=y
293CONFIG_INET6_AH=m
294CONFIG_INET6_ESP=m
295CONFIG_INET6_IPCOMP=m
296CONFIG_IPV6_MIP6=y
297CONFIG_INET6_XFRM_TUNNEL=m
298CONFIG_INET6_TUNNEL=m
299CONFIG_INET6_XFRM_MODE_TRANSPORT=m
300CONFIG_INET6_XFRM_MODE_TUNNEL=m
301CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION=m
302# CONFIG_IPV6_TUNNEL is not set
303CONFIG_IPV6_SUBTREES=y
304CONFIG_IPV6_MULTIPLE_TABLES=y
288CONFIG_NETWORK_SECMARK=y 305CONFIG_NETWORK_SECMARK=y
289# CONFIG_NETFILTER is not set 306# CONFIG_NETFILTER is not set
290 307
@@ -304,14 +321,13 @@ CONFIG_NETWORK_SECMARK=y
304# CONFIG_TIPC is not set 321# CONFIG_TIPC is not set
305# CONFIG_ATM is not set 322# CONFIG_ATM is not set
306# CONFIG_BRIDGE is not set 323# CONFIG_BRIDGE is not set
307# CONFIG_VLAN_8021Q is not set 324CONFIG_VLAN_8021Q=m
308# CONFIG_DECNET is not set 325# CONFIG_DECNET is not set
309# CONFIG_LLC2 is not set 326# CONFIG_LLC2 is not set
310# CONFIG_IPX is not set 327# CONFIG_IPX is not set
311# CONFIG_ATALK is not set 328# CONFIG_ATALK is not set
312# CONFIG_X25 is not set 329# CONFIG_X25 is not set
313# CONFIG_LAPB is not set 330# CONFIG_LAPB is not set
314# CONFIG_NET_DIVERT is not set
315# CONFIG_ECONET is not set 331# CONFIG_ECONET is not set
316# CONFIG_WAN_ROUTER is not set 332# CONFIG_WAN_ROUTER is not set
317 333
@@ -327,13 +343,8 @@ CONFIG_NETWORK_SECMARK=y
327# CONFIG_HAMRADIO is not set 343# CONFIG_HAMRADIO is not set
328# CONFIG_IRDA is not set 344# CONFIG_IRDA is not set
329# CONFIG_BT is not set 345# CONFIG_BT is not set
330CONFIG_IEEE80211=m 346# CONFIG_IEEE80211 is not set
331# CONFIG_IEEE80211_DEBUG is not set 347CONFIG_FIB_RULES=y
332CONFIG_IEEE80211_CRYPT_WEP=m
333CONFIG_IEEE80211_CRYPT_CCMP=m
334CONFIG_IEEE80211_SOFTMAC=m
335# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
336CONFIG_WIRELESS_EXT=y
337 348
338# 349#
339# Device Drivers 350# Device Drivers
@@ -344,8 +355,6 @@ CONFIG_WIRELESS_EXT=y
344# 355#
345CONFIG_STANDALONE=y 356CONFIG_STANDALONE=y
346CONFIG_PREVENT_FIRMWARE_BUILD=y 357CONFIG_PREVENT_FIRMWARE_BUILD=y
347# CONFIG_FW_LOADER is not set
348# CONFIG_DEBUG_DRIVER is not set
349# CONFIG_SYS_HYPERVISOR is not set 358# CONFIG_SYS_HYPERVISOR is not set
350 359
351# 360#
@@ -387,8 +396,9 @@ CONFIG_BLK_DEV_LOOP=m
387# 396#
388# SCSI device support 397# SCSI device support
389# 398#
390CONFIG_RAID_ATTRS=m 399# CONFIG_RAID_ATTRS is not set
391CONFIG_SCSI=y 400CONFIG_SCSI=y
401# CONFIG_SCSI_NETLINK is not set
392CONFIG_SCSI_PROC_FS=y 402CONFIG_SCSI_PROC_FS=y
393 403
394# 404#
@@ -410,12 +420,13 @@ CONFIG_SCSI_CONSTANTS=y
410# CONFIG_SCSI_LOGGING is not set 420# CONFIG_SCSI_LOGGING is not set
411 421
412# 422#
413# SCSI Transport Attributes 423# SCSI Transports
414# 424#
415CONFIG_SCSI_SPI_ATTRS=m 425CONFIG_SCSI_SPI_ATTRS=m
416# CONFIG_SCSI_FC_ATTRS is not set 426# CONFIG_SCSI_FC_ATTRS is not set
417CONFIG_SCSI_ISCSI_ATTRS=m 427CONFIG_SCSI_ISCSI_ATTRS=m
418CONFIG_SCSI_SAS_ATTRS=m 428CONFIG_SCSI_SAS_ATTRS=m
429# CONFIG_SCSI_SAS_LIBSAS is not set
419 430
420# 431#
421# SCSI low-level drivers 432# SCSI low-level drivers
@@ -423,10 +434,14 @@ CONFIG_SCSI_SAS_ATTRS=m
423CONFIG_ISCSI_TCP=m 434CONFIG_ISCSI_TCP=m
424CONFIG_SCSI_DECNCR=y 435CONFIG_SCSI_DECNCR=y
425# CONFIG_SCSI_DECSII is not set 436# CONFIG_SCSI_DECSII is not set
426# CONFIG_SCSI_SATA is not set
427# CONFIG_SCSI_DEBUG is not set 437# CONFIG_SCSI_DEBUG is not set
428 438
429# 439#
440# Serial ATA (prod) and Parallel ATA (experimental) drivers
441#
442# CONFIG_ATA is not set
443
444#
430# Multi-device support (RAID and LVM) 445# Multi-device support (RAID and LVM)
431# 446#
432# CONFIG_MD is not set 447# CONFIG_MD is not set
@@ -456,18 +471,7 @@ CONFIG_NETDEVICES=y
456# 471#
457# PHY device support 472# PHY device support
458# 473#
459CONFIG_PHYLIB=m 474# CONFIG_PHYLIB is not set
460
461#
462# MII PHY device drivers
463#
464CONFIG_MARVELL_PHY=m
465CONFIG_DAVICOM_PHY=m
466CONFIG_QSEMI_PHY=m
467CONFIG_LXT_PHY=m
468CONFIG_CICADA_PHY=m
469CONFIG_VITESSE_PHY=m
470CONFIG_SMSC_PHY=m
471 475
472# 476#
473# Ethernet (10 or 100Mbit) 477# Ethernet (10 or 100Mbit)
@@ -712,7 +716,12 @@ CONFIG_EXT2_FS_XATTR=y
712CONFIG_EXT2_FS_POSIX_ACL=y 716CONFIG_EXT2_FS_POSIX_ACL=y
713CONFIG_EXT2_FS_SECURITY=y 717CONFIG_EXT2_FS_SECURITY=y
714# CONFIG_EXT2_FS_XIP is not set 718# CONFIG_EXT2_FS_XIP is not set
715# CONFIG_EXT3_FS is not set 719CONFIG_EXT3_FS=y
720CONFIG_EXT3_FS_XATTR=y
721CONFIG_EXT3_FS_POSIX_ACL=y
722CONFIG_EXT3_FS_SECURITY=y
723CONFIG_JBD=y
724# CONFIG_JBD_DEBUG is not set
716CONFIG_FS_MBCACHE=y 725CONFIG_FS_MBCACHE=y
717# CONFIG_REISERFS_FS is not set 726# CONFIG_REISERFS_FS is not set
718# CONFIG_JFS_FS is not set 727# CONFIG_JFS_FS is not set
@@ -747,11 +756,13 @@ CONFIG_FUSE_FS=m
747# 756#
748CONFIG_PROC_FS=y 757CONFIG_PROC_FS=y
749CONFIG_PROC_KCORE=y 758CONFIG_PROC_KCORE=y
759CONFIG_PROC_SYSCTL=y
750CONFIG_SYSFS=y 760CONFIG_SYSFS=y
751CONFIG_TMPFS=y 761CONFIG_TMPFS=y
762CONFIG_TMPFS_POSIX_ACL=y
752# CONFIG_HUGETLB_PAGE is not set 763# CONFIG_HUGETLB_PAGE is not set
753CONFIG_RAMFS=y 764CONFIG_RAMFS=y
754# CONFIG_CONFIGFS_FS is not set 765CONFIG_CONFIGFS_FS=y
755 766
756# 767#
757# Miscellaneous filesystems 768# Miscellaneous filesystems
@@ -769,7 +780,7 @@ CONFIG_RAMFS=y
769# CONFIG_QNX4FS_FS is not set 780# CONFIG_QNX4FS_FS is not set
770# CONFIG_SYSV_FS is not set 781# CONFIG_SYSV_FS is not set
771CONFIG_UFS_FS=y 782CONFIG_UFS_FS=y
772# CONFIG_UFS_FS_WRITE is not set 783CONFIG_UFS_FS_WRITE=y
773# CONFIG_UFS_DEBUG is not set 784# CONFIG_UFS_DEBUG is not set
774 785
775# 786#
@@ -777,24 +788,25 @@ CONFIG_UFS_FS=y
777# 788#
778CONFIG_NFS_FS=y 789CONFIG_NFS_FS=y
779CONFIG_NFS_V3=y 790CONFIG_NFS_V3=y
780# CONFIG_NFS_V3_ACL is not set 791CONFIG_NFS_V3_ACL=y
781# CONFIG_NFS_V4 is not set 792# CONFIG_NFS_V4 is not set
782# CONFIG_NFS_DIRECTIO is not set 793# CONFIG_NFS_DIRECTIO is not set
783# CONFIG_NFSD is not set 794# CONFIG_NFSD is not set
784CONFIG_ROOT_NFS=y 795CONFIG_ROOT_NFS=y
785CONFIG_LOCKD=y 796CONFIG_LOCKD=y
786CONFIG_LOCKD_V4=y 797CONFIG_LOCKD_V4=y
798CONFIG_NFS_ACL_SUPPORT=y
787CONFIG_NFS_COMMON=y 799CONFIG_NFS_COMMON=y
788CONFIG_SUNRPC=y 800CONFIG_SUNRPC=y
789# CONFIG_RPCSEC_GSS_KRB5 is not set 801# CONFIG_RPCSEC_GSS_KRB5 is not set
790# CONFIG_RPCSEC_GSS_SPKM3 is not set 802# CONFIG_RPCSEC_GSS_SPKM3 is not set
791# CONFIG_SMB_FS is not set 803# CONFIG_SMB_FS is not set
792# CONFIG_CIFS is not set 804# CONFIG_CIFS is not set
793# CONFIG_CIFS_DEBUG2 is not set
794# CONFIG_NCP_FS is not set 805# CONFIG_NCP_FS is not set
795# CONFIG_CODA_FS is not set 806# CONFIG_CODA_FS is not set
796# CONFIG_AFS_FS is not set 807# CONFIG_AFS_FS is not set
797# CONFIG_9P_FS is not set 808# CONFIG_9P_FS is not set
809CONFIG_GENERIC_ACL=y
798 810
799# 811#
800# Partition Types 812# Partition Types
@@ -832,44 +844,29 @@ CONFIG_ULTRIX_PARTITION=y
832# 844#
833CONFIG_TRACE_IRQFLAGS_SUPPORT=y 845CONFIG_TRACE_IRQFLAGS_SUPPORT=y
834# CONFIG_PRINTK_TIME is not set 846# CONFIG_PRINTK_TIME is not set
847CONFIG_ENABLE_MUST_CHECK=y
835CONFIG_MAGIC_SYSRQ=y 848CONFIG_MAGIC_SYSRQ=y
836# CONFIG_UNUSED_SYMBOLS is not set 849# CONFIG_UNUSED_SYMBOLS is not set
837CONFIG_DEBUG_KERNEL=y 850# CONFIG_DEBUG_KERNEL is not set
838CONFIG_LOG_BUF_SHIFT=14 851CONFIG_LOG_BUF_SHIFT=14
839CONFIG_DETECT_SOFTLOCKUP=y
840# CONFIG_SCHEDSTATS is not set
841# CONFIG_DEBUG_SLAB is not set
842# CONFIG_DEBUG_RT_MUTEXES is not set
843# CONFIG_RT_MUTEX_TESTER is not set
844# CONFIG_DEBUG_SPINLOCK is not set
845CONFIG_DEBUG_MUTEXES=y
846# CONFIG_DEBUG_RWSEMS is not set
847# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
848# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
849# CONFIG_DEBUG_KOBJECT is not set
850# CONFIG_DEBUG_INFO is not set
851# CONFIG_DEBUG_FS is not set 852# CONFIG_DEBUG_FS is not set
852# CONFIG_DEBUG_VM is not set
853CONFIG_FORCED_INLINING=y
854# CONFIG_RCU_TORTURE_TEST is not set
855CONFIG_CROSSCOMPILE=y 853CONFIG_CROSSCOMPILE=y
856CONFIG_CMDLINE="" 854CONFIG_CMDLINE=""
857# CONFIG_DEBUG_STACK_USAGE is not set
858# CONFIG_KGDB is not set
859# CONFIG_RUNTIME_DEBUG is not set
860# CONFIG_MIPS_UNCACHED is not set
861 855
862# 856#
863# Security options 857# Security options
864# 858#
865CONFIG_KEYS=y 859# CONFIG_KEYS is not set
866CONFIG_KEYS_DEBUG_PROC_KEYS=y
867# CONFIG_SECURITY is not set 860# CONFIG_SECURITY is not set
868 861
869# 862#
870# Cryptographic options 863# Cryptographic options
871# 864#
872CONFIG_CRYPTO=y 865CONFIG_CRYPTO=y
866CONFIG_CRYPTO_ALGAPI=y
867CONFIG_CRYPTO_BLKCIPHER=m
868CONFIG_CRYPTO_HASH=y
869CONFIG_CRYPTO_MANAGER=m
873CONFIG_CRYPTO_HMAC=y 870CONFIG_CRYPTO_HMAC=y
874CONFIG_CRYPTO_NULL=m 871CONFIG_CRYPTO_NULL=m
875CONFIG_CRYPTO_MD4=m 872CONFIG_CRYPTO_MD4=m
@@ -879,9 +876,12 @@ CONFIG_CRYPTO_SHA256=m
879CONFIG_CRYPTO_SHA512=m 876CONFIG_CRYPTO_SHA512=m
880CONFIG_CRYPTO_WP512=m 877CONFIG_CRYPTO_WP512=m
881CONFIG_CRYPTO_TGR192=m 878CONFIG_CRYPTO_TGR192=m
879CONFIG_CRYPTO_ECB=m
880CONFIG_CRYPTO_CBC=m
882CONFIG_CRYPTO_DES=m 881CONFIG_CRYPTO_DES=m
883CONFIG_CRYPTO_BLOWFISH=m 882CONFIG_CRYPTO_BLOWFISH=m
884CONFIG_CRYPTO_TWOFISH=m 883CONFIG_CRYPTO_TWOFISH=m
884CONFIG_CRYPTO_TWOFISH_COMMON=m
885CONFIG_CRYPTO_SERPENT=m 885CONFIG_CRYPTO_SERPENT=m
886CONFIG_CRYPTO_AES=m 886CONFIG_CRYPTO_AES=m
887CONFIG_CRYPTO_CAST5=m 887CONFIG_CRYPTO_CAST5=m
@@ -903,7 +903,7 @@ CONFIG_CRYPTO_CRC32C=m
903# Library routines 903# Library routines
904# 904#
905# CONFIG_CRC_CCITT is not set 905# CONFIG_CRC_CCITT is not set
906CONFIG_CRC16=m 906# CONFIG_CRC16 is not set
907CONFIG_CRC32=y 907CONFIG_CRC32=y
908CONFIG_LIBCRC32C=m 908CONFIG_LIBCRC32C=m
909CONFIG_ZLIB_INFLATE=m 909CONFIG_ZLIB_INFLATE=m
diff --git a/arch/mips/configs/it8172_defconfig b/arch/mips/configs/it8172_defconfig
deleted file mode 100644
index 18d20fb7d5f0..000000000000
--- a/arch/mips/configs/it8172_defconfig
+++ /dev/null
@@ -1,964 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18-rc1
4# Thu Jul 6 10:04:11 2006
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11# CONFIG_MIPS_MTX1 is not set
12# CONFIG_MIPS_BOSPORUS is not set
13# CONFIG_MIPS_PB1000 is not set
14# CONFIG_MIPS_PB1100 is not set
15# CONFIG_MIPS_PB1500 is not set
16# CONFIG_MIPS_PB1550 is not set
17# CONFIG_MIPS_PB1200 is not set
18# CONFIG_MIPS_DB1000 is not set
19# CONFIG_MIPS_DB1100 is not set
20# CONFIG_MIPS_DB1500 is not set
21# CONFIG_MIPS_DB1550 is not set
22# CONFIG_MIPS_DB1200 is not set
23# CONFIG_MIPS_MIRAGE is not set
24# CONFIG_BASLER_EXCITE is not set
25# CONFIG_MIPS_COBALT is not set
26# CONFIG_MACH_DECSTATION is not set
27# CONFIG_MIPS_EV64120 is not set
28# CONFIG_MIPS_IVR is not set
29CONFIG_MIPS_ITE8172=y
30# CONFIG_MACH_JAZZ is not set
31# CONFIG_LASAT is not set
32# CONFIG_MIPS_ATLAS is not set
33# CONFIG_MIPS_MALTA is not set
34# CONFIG_MIPS_SEAD is not set
35# CONFIG_WR_PPMC is not set
36# CONFIG_MIPS_SIM is not set
37# CONFIG_MOMENCO_JAGUAR_ATX is not set
38# CONFIG_MOMENCO_OCELOT is not set
39# CONFIG_MOMENCO_OCELOT_3 is not set
40# CONFIG_MOMENCO_OCELOT_C is not set
41# CONFIG_MOMENCO_OCELOT_G is not set
42# CONFIG_MIPS_XXS1500 is not set
43# CONFIG_PNX8550_V2PCI is not set
44# CONFIG_PNX8550_JBS is not set
45# CONFIG_DDB5477 is not set
46# CONFIG_MACH_VR41XX is not set
47# CONFIG_PMC_YOSEMITE is not set
48# CONFIG_QEMU is not set
49# CONFIG_MARKEINS is not set
50# CONFIG_SGI_IP22 is not set
51# CONFIG_SGI_IP27 is not set
52# CONFIG_SGI_IP32 is not set
53# CONFIG_SIBYTE_BIGSUR is not set
54# CONFIG_SIBYTE_SWARM is not set
55# CONFIG_SIBYTE_SENTOSA is not set
56# CONFIG_SIBYTE_RHONE is not set
57# CONFIG_SIBYTE_CARMEL is not set
58# CONFIG_SIBYTE_PTSWARM is not set
59# CONFIG_SIBYTE_LITTLESUR is not set
60# CONFIG_SIBYTE_CRHINE is not set
61# CONFIG_SIBYTE_CRHONE is not set
62# CONFIG_SNI_RM200_PCI is not set
63# CONFIG_TOSHIBA_JMR3927 is not set
64# CONFIG_TOSHIBA_RBTX4927 is not set
65# CONFIG_TOSHIBA_RBTX4938 is not set
66# CONFIG_IT8172_REVC is not set
67CONFIG_RWSEM_GENERIC_SPINLOCK=y
68CONFIG_GENERIC_FIND_NEXT_BIT=y
69CONFIG_GENERIC_HWEIGHT=y
70CONFIG_GENERIC_CALIBRATE_DELAY=y
71CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
72CONFIG_DMA_NONCOHERENT=y
73CONFIG_DMA_NEED_PCI_MAP_STATE=y
74# CONFIG_CPU_BIG_ENDIAN is not set
75CONFIG_CPU_LITTLE_ENDIAN=y
76CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
77CONFIG_ITE_BOARD_GEN=y
78CONFIG_IT8172_CIR=y
79CONFIG_IT8712=y
80CONFIG_MIPS_L1_CACHE_SHIFT=5
81
82#
83# CPU selection
84#
85# CONFIG_CPU_MIPS32_R1 is not set
86# CONFIG_CPU_MIPS32_R2 is not set
87# CONFIG_CPU_MIPS64_R1 is not set
88# CONFIG_CPU_MIPS64_R2 is not set
89# CONFIG_CPU_R3000 is not set
90# CONFIG_CPU_TX39XX is not set
91# CONFIG_CPU_VR41XX is not set
92# CONFIG_CPU_R4300 is not set
93# CONFIG_CPU_R4X00 is not set
94# CONFIG_CPU_TX49XX is not set
95# CONFIG_CPU_R5000 is not set
96# CONFIG_CPU_R5432 is not set
97# CONFIG_CPU_R6000 is not set
98CONFIG_CPU_NEVADA=y
99# CONFIG_CPU_R8000 is not set
100# CONFIG_CPU_R10000 is not set
101# CONFIG_CPU_RM7000 is not set
102# CONFIG_CPU_RM9000 is not set
103# CONFIG_CPU_SB1 is not set
104CONFIG_SYS_HAS_CPU_R5432=y
105CONFIG_SYS_HAS_CPU_NEVADA=y
106CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
107CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
108CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
109CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
110
111#
112# Kernel type
113#
114CONFIG_32BIT=y
115# CONFIG_64BIT is not set
116CONFIG_PAGE_SIZE_4KB=y
117# CONFIG_PAGE_SIZE_8KB is not set
118# CONFIG_PAGE_SIZE_16KB is not set
119# CONFIG_PAGE_SIZE_64KB is not set
120CONFIG_MIPS_MT_DISABLED=y
121# CONFIG_MIPS_MT_SMTC is not set
122# CONFIG_MIPS_MT_SMP is not set
123# CONFIG_MIPS_VPE_LOADER is not set
124CONFIG_CPU_HAS_LLSC=y
125CONFIG_CPU_HAS_SYNC=y
126CONFIG_GENERIC_HARDIRQS=y
127CONFIG_GENERIC_IRQ_PROBE=y
128CONFIG_ARCH_FLATMEM_ENABLE=y
129CONFIG_SELECT_MEMORY_MODEL=y
130CONFIG_FLATMEM_MANUAL=y
131# CONFIG_DISCONTIGMEM_MANUAL is not set
132# CONFIG_SPARSEMEM_MANUAL is not set
133CONFIG_FLATMEM=y
134CONFIG_FLAT_NODE_MEM_MAP=y
135# CONFIG_SPARSEMEM_STATIC is not set
136CONFIG_SPLIT_PTLOCK_CPUS=4
137# CONFIG_RESOURCES_64BIT is not set
138# CONFIG_HZ_48 is not set
139# CONFIG_HZ_100 is not set
140# CONFIG_HZ_128 is not set
141# CONFIG_HZ_250 is not set
142# CONFIG_HZ_256 is not set
143CONFIG_HZ_1000=y
144# CONFIG_HZ_1024 is not set
145CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
146CONFIG_HZ=1000
147CONFIG_PREEMPT_NONE=y
148# CONFIG_PREEMPT_VOLUNTARY is not set
149# CONFIG_PREEMPT is not set
150CONFIG_LOCKDEP_SUPPORT=y
151CONFIG_STACKTRACE_SUPPORT=y
152CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
153
154#
155# Code maturity level options
156#
157CONFIG_EXPERIMENTAL=y
158CONFIG_BROKEN_ON_SMP=y
159CONFIG_INIT_ENV_ARG_LIMIT=32
160
161#
162# General setup
163#
164CONFIG_LOCALVERSION=""
165CONFIG_LOCALVERSION_AUTO=y
166CONFIG_SWAP=y
167CONFIG_SYSVIPC=y
168# CONFIG_POSIX_MQUEUE is not set
169CONFIG_BSD_PROCESS_ACCT=y
170# CONFIG_BSD_PROCESS_ACCT_V3 is not set
171CONFIG_SYSCTL=y
172# CONFIG_AUDIT is not set
173# CONFIG_IKCONFIG is not set
174CONFIG_RELAY=y
175CONFIG_INITRAMFS_SOURCE=""
176# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
177CONFIG_EMBEDDED=y
178CONFIG_KALLSYMS=y
179# CONFIG_KALLSYMS_EXTRA_PASS is not set
180# CONFIG_HOTPLUG is not set
181CONFIG_PRINTK=y
182CONFIG_BUG=y
183CONFIG_ELF_CORE=y
184CONFIG_BASE_FULL=y
185CONFIG_RT_MUTEXES=y
186CONFIG_FUTEX=y
187CONFIG_EPOLL=y
188CONFIG_SHMEM=y
189CONFIG_SLAB=y
190CONFIG_VM_EVENT_COUNTERS=y
191# CONFIG_TINY_SHMEM is not set
192CONFIG_BASE_SMALL=0
193# CONFIG_SLOB is not set
194
195#
196# Loadable module support
197#
198CONFIG_MODULES=y
199CONFIG_MODULE_UNLOAD=y
200# CONFIG_MODULE_FORCE_UNLOAD is not set
201CONFIG_MODVERSIONS=y
202CONFIG_MODULE_SRCVERSION_ALL=y
203CONFIG_KMOD=y
204
205#
206# Block layer
207#
208# CONFIG_LBD is not set
209# CONFIG_BLK_DEV_IO_TRACE is not set
210# CONFIG_LSF is not set
211
212#
213# IO Schedulers
214#
215CONFIG_IOSCHED_NOOP=y
216CONFIG_IOSCHED_AS=y
217CONFIG_IOSCHED_DEADLINE=y
218CONFIG_IOSCHED_CFQ=y
219CONFIG_DEFAULT_AS=y
220# CONFIG_DEFAULT_DEADLINE is not set
221# CONFIG_DEFAULT_CFQ is not set
222# CONFIG_DEFAULT_NOOP is not set
223CONFIG_DEFAULT_IOSCHED="anticipatory"
224
225#
226# Bus options (PCI, PCMCIA, EISA, ISA, TC)
227#
228CONFIG_HW_HAS_PCI=y
229# CONFIG_PCI is not set
230CONFIG_MMU=y
231
232#
233# PCCARD (PCMCIA/CardBus) support
234#
235# CONFIG_PCCARD is not set
236
237#
238# PCI Hotplug Support
239#
240
241#
242# Executable file formats
243#
244CONFIG_BINFMT_ELF=y
245# CONFIG_BINFMT_MISC is not set
246CONFIG_TRAD_SIGNALS=y
247
248#
249# Networking
250#
251CONFIG_NET=y
252
253#
254# Networking options
255#
256# CONFIG_NETDEBUG is not set
257CONFIG_PACKET=y
258CONFIG_PACKET_MMAP=y
259CONFIG_UNIX=y
260CONFIG_XFRM=y
261CONFIG_XFRM_USER=m
262CONFIG_NET_KEY=y
263CONFIG_INET=y
264# CONFIG_IP_MULTICAST is not set
265# CONFIG_IP_ADVANCED_ROUTER is not set
266CONFIG_IP_FIB_HASH=y
267CONFIG_IP_PNP=y
268# CONFIG_IP_PNP_DHCP is not set
269CONFIG_IP_PNP_BOOTP=y
270# CONFIG_IP_PNP_RARP is not set
271# CONFIG_NET_IPIP is not set
272# CONFIG_NET_IPGRE is not set
273# CONFIG_ARPD is not set
274# CONFIG_SYN_COOKIES is not set
275# CONFIG_INET_AH is not set
276# CONFIG_INET_ESP is not set
277# CONFIG_INET_IPCOMP is not set
278# CONFIG_INET_XFRM_TUNNEL is not set
279# CONFIG_INET_TUNNEL is not set
280CONFIG_INET_XFRM_MODE_TRANSPORT=m
281CONFIG_INET_XFRM_MODE_TUNNEL=m
282CONFIG_INET_DIAG=y
283CONFIG_INET_TCP_DIAG=y
284# CONFIG_TCP_CONG_ADVANCED is not set
285CONFIG_TCP_CONG_BIC=y
286# CONFIG_IPV6 is not set
287# CONFIG_INET6_XFRM_TUNNEL is not set
288# CONFIG_INET6_TUNNEL is not set
289CONFIG_NETWORK_SECMARK=y
290# CONFIG_NETFILTER is not set
291
292#
293# DCCP Configuration (EXPERIMENTAL)
294#
295# CONFIG_IP_DCCP is not set
296
297#
298# SCTP Configuration (EXPERIMENTAL)
299#
300# CONFIG_IP_SCTP is not set
301
302#
303# TIPC Configuration (EXPERIMENTAL)
304#
305# CONFIG_TIPC is not set
306# CONFIG_ATM is not set
307# CONFIG_BRIDGE is not set
308# CONFIG_VLAN_8021Q is not set
309# CONFIG_DECNET is not set
310# CONFIG_LLC2 is not set
311# CONFIG_IPX is not set
312# CONFIG_ATALK is not set
313# CONFIG_X25 is not set
314# CONFIG_LAPB is not set
315# CONFIG_NET_DIVERT is not set
316# CONFIG_ECONET is not set
317# CONFIG_WAN_ROUTER is not set
318
319#
320# QoS and/or fair queueing
321#
322# CONFIG_NET_SCHED is not set
323
324#
325# Network testing
326#
327# CONFIG_NET_PKTGEN is not set
328# CONFIG_HAMRADIO is not set
329# CONFIG_IRDA is not set
330# CONFIG_BT is not set
331CONFIG_IEEE80211=m
332# CONFIG_IEEE80211_DEBUG is not set
333CONFIG_IEEE80211_CRYPT_WEP=m
334CONFIG_IEEE80211_CRYPT_CCMP=m
335CONFIG_IEEE80211_SOFTMAC=m
336# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
337CONFIG_WIRELESS_EXT=y
338
339#
340# Device Drivers
341#
342
343#
344# Generic Driver Options
345#
346CONFIG_STANDALONE=y
347CONFIG_PREVENT_FIRMWARE_BUILD=y
348# CONFIG_FW_LOADER is not set
349# CONFIG_SYS_HYPERVISOR is not set
350
351#
352# Connector - unified userspace <-> kernelspace linker
353#
354CONFIG_CONNECTOR=m
355
356#
357# Memory Technology Devices (MTD)
358#
359CONFIG_MTD=y
360# CONFIG_MTD_DEBUG is not set
361# CONFIG_MTD_CONCAT is not set
362# CONFIG_MTD_PARTITIONS is not set
363
364#
365# User Modules And Translation Layers
366#
367CONFIG_MTD_CHAR=y
368# CONFIG_MTD_BLOCK is not set
369# CONFIG_MTD_BLOCK_RO is not set
370# CONFIG_FTL is not set
371# CONFIG_NFTL is not set
372# CONFIG_INFTL is not set
373# CONFIG_RFD_FTL is not set
374
375#
376# RAM/ROM/Flash chip drivers
377#
378CONFIG_MTD_CFI=y
379# CONFIG_MTD_JEDECPROBE is not set
380CONFIG_MTD_GEN_PROBE=y
381# CONFIG_MTD_CFI_ADV_OPTIONS is not set
382CONFIG_MTD_MAP_BANK_WIDTH_1=y
383CONFIG_MTD_MAP_BANK_WIDTH_2=y
384CONFIG_MTD_MAP_BANK_WIDTH_4=y
385# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
386# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
387# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
388CONFIG_MTD_CFI_I1=y
389CONFIG_MTD_CFI_I2=y
390# CONFIG_MTD_CFI_I4 is not set
391# CONFIG_MTD_CFI_I8 is not set
392CONFIG_MTD_CFI_INTELEXT=y
393# CONFIG_MTD_CFI_AMDSTD is not set
394# CONFIG_MTD_CFI_STAA is not set
395CONFIG_MTD_CFI_UTIL=y
396# CONFIG_MTD_RAM is not set
397# CONFIG_MTD_ROM is not set
398# CONFIG_MTD_ABSENT is not set
399# CONFIG_MTD_OBSOLETE_CHIPS is not set
400
401#
402# Mapping drivers for chip access
403#
404# CONFIG_MTD_COMPLEX_MAPPINGS is not set
405CONFIG_MTD_PHYSMAP=y
406CONFIG_MTD_PHYSMAP_START=0x8000000
407CONFIG_MTD_PHYSMAP_LEN=0x2000000
408CONFIG_MTD_PHYSMAP_BANKWIDTH=2
409# CONFIG_MTD_PLATRAM is not set
410
411#
412# Self-contained MTD device drivers
413#
414# CONFIG_MTD_SLRAM is not set
415# CONFIG_MTD_PHRAM is not set
416# CONFIG_MTD_MTDRAM is not set
417# CONFIG_MTD_BLOCK2MTD is not set
418
419#
420# Disk-On-Chip Device Drivers
421#
422# CONFIG_MTD_DOC2000 is not set
423# CONFIG_MTD_DOC2001 is not set
424# CONFIG_MTD_DOC2001PLUS is not set
425
426#
427# NAND Flash Device Drivers
428#
429# CONFIG_MTD_NAND is not set
430
431#
432# OneNAND Flash Device Drivers
433#
434# CONFIG_MTD_ONENAND is not set
435
436#
437# Parallel port support
438#
439# CONFIG_PARPORT is not set
440
441#
442# Plug and Play support
443#
444
445#
446# Block devices
447#
448# CONFIG_BLK_DEV_COW_COMMON is not set
449CONFIG_BLK_DEV_LOOP=y
450# CONFIG_BLK_DEV_CRYPTOLOOP is not set
451# CONFIG_BLK_DEV_NBD is not set
452# CONFIG_BLK_DEV_RAM is not set
453# CONFIG_BLK_DEV_INITRD is not set
454CONFIG_CDROM_PKTCDVD=m
455CONFIG_CDROM_PKTCDVD_BUFFERS=8
456# CONFIG_CDROM_PKTCDVD_WCACHE is not set
457CONFIG_ATA_OVER_ETH=m
458
459#
460# ATA/ATAPI/MFM/RLL support
461#
462CONFIG_IDE=y
463CONFIG_BLK_DEV_IDE=y
464
465#
466# Please see Documentation/ide.txt for help/info on IDE drives
467#
468# CONFIG_BLK_DEV_IDE_SATA is not set
469CONFIG_BLK_DEV_IDEDISK=y
470# CONFIG_IDEDISK_MULTI_MODE is not set
471# CONFIG_BLK_DEV_IDECD is not set
472# CONFIG_BLK_DEV_IDETAPE is not set
473# CONFIG_BLK_DEV_IDEFLOPPY is not set
474# CONFIG_IDE_TASK_IOCTL is not set
475
476#
477# IDE chipset support/bugfixes
478#
479CONFIG_IDE_GENERIC=y
480# CONFIG_IDE_ARM is not set
481# CONFIG_BLK_DEV_IDEDMA is not set
482# CONFIG_IDEDMA_AUTO is not set
483# CONFIG_BLK_DEV_HD is not set
484
485#
486# SCSI device support
487#
488CONFIG_RAID_ATTRS=m
489# CONFIG_SCSI is not set
490
491#
492# Multi-device support (RAID and LVM)
493#
494# CONFIG_MD is not set
495
496#
497# Fusion MPT device support
498#
499# CONFIG_FUSION is not set
500
501#
502# IEEE 1394 (FireWire) support
503#
504
505#
506# I2O device support
507#
508
509#
510# Network device support
511#
512CONFIG_NETDEVICES=y
513# CONFIG_DUMMY is not set
514# CONFIG_BONDING is not set
515# CONFIG_EQUALIZER is not set
516# CONFIG_TUN is not set
517
518#
519# PHY device support
520#
521CONFIG_PHYLIB=m
522
523#
524# MII PHY device drivers
525#
526CONFIG_MARVELL_PHY=m
527CONFIG_DAVICOM_PHY=m
528CONFIG_QSEMI_PHY=m
529CONFIG_LXT_PHY=m
530CONFIG_CICADA_PHY=m
531CONFIG_VITESSE_PHY=m
532CONFIG_SMSC_PHY=m
533
534#
535# Ethernet (10 or 100Mbit)
536#
537CONFIG_NET_ETHERNET=y
538# CONFIG_MII is not set
539# CONFIG_DM9000 is not set
540
541#
542# Ethernet (1000 Mbit)
543#
544
545#
546# Ethernet (10000 Mbit)
547#
548
549#
550# Token Ring devices
551#
552
553#
554# Wireless LAN (non-hamradio)
555#
556# CONFIG_NET_RADIO is not set
557
558#
559# Wan interfaces
560#
561# CONFIG_WAN is not set
562# CONFIG_PPP is not set
563# CONFIG_SLIP is not set
564# CONFIG_SHAPER is not set
565# CONFIG_NETCONSOLE is not set
566# CONFIG_NETPOLL is not set
567# CONFIG_NET_POLL_CONTROLLER is not set
568
569#
570# ISDN subsystem
571#
572# CONFIG_ISDN is not set
573
574#
575# Telephony Support
576#
577# CONFIG_PHONE is not set
578
579#
580# Input device support
581#
582CONFIG_INPUT=y
583
584#
585# Userland interfaces
586#
587CONFIG_INPUT_MOUSEDEV=y
588CONFIG_INPUT_MOUSEDEV_PSAUX=y
589CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
590CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
591# CONFIG_INPUT_JOYDEV is not set
592# CONFIG_INPUT_TSDEV is not set
593# CONFIG_INPUT_EVDEV is not set
594# CONFIG_INPUT_EVBUG is not set
595
596#
597# Input Device Drivers
598#
599# CONFIG_INPUT_KEYBOARD is not set
600# CONFIG_INPUT_MOUSE is not set
601# CONFIG_INPUT_JOYSTICK is not set
602# CONFIG_INPUT_TOUCHSCREEN is not set
603# CONFIG_INPUT_MISC is not set
604
605#
606# Hardware I/O ports
607#
608CONFIG_SERIO=y
609# CONFIG_SERIO_I8042 is not set
610CONFIG_SERIO_SERPORT=y
611# CONFIG_SERIO_LIBPS2 is not set
612CONFIG_SERIO_RAW=m
613# CONFIG_GAMEPORT is not set
614
615#
616# Character devices
617#
618CONFIG_VT=y
619CONFIG_VT_CONSOLE=y
620CONFIG_HW_CONSOLE=y
621CONFIG_VT_HW_CONSOLE_BINDING=y
622# CONFIG_SERIAL_NONSTANDARD is not set
623# CONFIG_QTRONIX_KEYBOARD is not set
624# CONFIG_IT8172_SCR0 is not set
625# CONFIG_IT8172_SCR1 is not set
626# CONFIG_ITE_GPIO is not set
627
628#
629# Serial drivers
630#
631CONFIG_SERIAL_8250=y
632CONFIG_SERIAL_8250_CONSOLE=y
633CONFIG_SERIAL_8250_NR_UARTS=4
634CONFIG_SERIAL_8250_RUNTIME_UARTS=4
635# CONFIG_SERIAL_8250_EXTENDED is not set
636
637#
638# Non-8250 serial port support
639#
640CONFIG_SERIAL_CORE=y
641CONFIG_SERIAL_CORE_CONSOLE=y
642CONFIG_UNIX98_PTYS=y
643CONFIG_LEGACY_PTYS=y
644CONFIG_LEGACY_PTY_COUNT=256
645
646#
647# IPMI
648#
649# CONFIG_IPMI_HANDLER is not set
650
651#
652# Watchdog Cards
653#
654# CONFIG_WATCHDOG is not set
655# CONFIG_HW_RANDOM is not set
656# CONFIG_RTC is not set
657# CONFIG_GEN_RTC is not set
658# CONFIG_DTLK is not set
659# CONFIG_R3964 is not set
660
661#
662# Ftape, the floppy tape device driver
663#
664# CONFIG_RAW_DRIVER is not set
665
666#
667# TPM devices
668#
669# CONFIG_TCG_TPM is not set
670# CONFIG_TELCLOCK is not set
671
672#
673# I2C support
674#
675# CONFIG_I2C is not set
676
677#
678# SPI support
679#
680# CONFIG_SPI is not set
681# CONFIG_SPI_MASTER is not set
682
683#
684# Dallas's 1-wire bus
685#
686# CONFIG_W1 is not set
687
688#
689# Hardware Monitoring support
690#
691# CONFIG_HWMON is not set
692# CONFIG_HWMON_VID is not set
693
694#
695# Misc devices
696#
697
698#
699# Multimedia devices
700#
701# CONFIG_VIDEO_DEV is not set
702CONFIG_VIDEO_V4L2=y
703
704#
705# Digital Video Broadcasting Devices
706#
707# CONFIG_DVB is not set
708
709#
710# Graphics support
711#
712# CONFIG_FIRMWARE_EDID is not set
713# CONFIG_FB is not set
714
715#
716# Console display driver support
717#
718# CONFIG_VGA_CONSOLE is not set
719CONFIG_DUMMY_CONSOLE=y
720
721#
722# Sound
723#
724CONFIG_SOUND=y
725
726#
727# Advanced Linux Sound Architecture
728#
729# CONFIG_SND is not set
730
731#
732# Open Sound System
733#
734CONFIG_SOUND_PRIME=y
735CONFIG_SOUND_IT8172=y
736# CONFIG_SOUND_MSNDCLAS is not set
737# CONFIG_SOUND_MSNDPIN is not set
738
739#
740# USB support
741#
742# CONFIG_USB_ARCH_HAS_HCD is not set
743# CONFIG_USB_ARCH_HAS_OHCI is not set
744# CONFIG_USB_ARCH_HAS_EHCI is not set
745
746#
747# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
748#
749
750#
751# USB Gadget Support
752#
753# CONFIG_USB_GADGET is not set
754
755#
756# MMC/SD Card support
757#
758# CONFIG_MMC is not set
759
760#
761# LED devices
762#
763# CONFIG_NEW_LEDS is not set
764
765#
766# LED drivers
767#
768
769#
770# LED Triggers
771#
772
773#
774# InfiniBand support
775#
776
777#
778# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
779#
780
781#
782# Real Time Clock
783#
784# CONFIG_RTC_CLASS is not set
785
786#
787# DMA Engine support
788#
789# CONFIG_DMA_ENGINE is not set
790
791#
792# DMA Clients
793#
794
795#
796# DMA Devices
797#
798
799#
800# File systems
801#
802CONFIG_EXT2_FS=y
803# CONFIG_EXT2_FS_XATTR is not set
804# CONFIG_EXT2_FS_XIP is not set
805# CONFIG_EXT3_FS is not set
806# CONFIG_REISERFS_FS is not set
807# CONFIG_JFS_FS is not set
808# CONFIG_FS_POSIX_ACL is not set
809# CONFIG_XFS_FS is not set
810# CONFIG_OCFS2_FS is not set
811# CONFIG_MINIX_FS is not set
812# CONFIG_ROMFS_FS is not set
813CONFIG_INOTIFY=y
814CONFIG_INOTIFY_USER=y
815# CONFIG_QUOTA is not set
816CONFIG_DNOTIFY=y
817# CONFIG_AUTOFS_FS is not set
818# CONFIG_AUTOFS4_FS is not set
819CONFIG_FUSE_FS=m
820
821#
822# CD-ROM/DVD Filesystems
823#
824# CONFIG_ISO9660_FS is not set
825# CONFIG_UDF_FS is not set
826
827#
828# DOS/FAT/NT Filesystems
829#
830# CONFIG_MSDOS_FS is not set
831# CONFIG_VFAT_FS is not set
832# CONFIG_NTFS_FS is not set
833
834#
835# Pseudo filesystems
836#
837CONFIG_PROC_FS=y
838CONFIG_PROC_KCORE=y
839CONFIG_SYSFS=y
840# CONFIG_TMPFS is not set
841# CONFIG_HUGETLB_PAGE is not set
842CONFIG_RAMFS=y
843# CONFIG_CONFIGFS_FS is not set
844
845#
846# Miscellaneous filesystems
847#
848# CONFIG_ADFS_FS is not set
849# CONFIG_AFFS_FS is not set
850# CONFIG_HFS_FS is not set
851# CONFIG_HFSPLUS_FS is not set
852# CONFIG_BEFS_FS is not set
853# CONFIG_BFS_FS is not set
854# CONFIG_EFS_FS is not set
855# CONFIG_JFFS_FS is not set
856# CONFIG_JFFS2_FS is not set
857# CONFIG_CRAMFS is not set
858# CONFIG_VXFS_FS is not set
859# CONFIG_HPFS_FS is not set
860# CONFIG_QNX4FS_FS is not set
861# CONFIG_SYSV_FS is not set
862# CONFIG_UFS_FS is not set
863
864#
865# Network File Systems
866#
867CONFIG_NFS_FS=y
868# CONFIG_NFS_V3 is not set
869# CONFIG_NFS_V4 is not set
870# CONFIG_NFS_DIRECTIO is not set
871# CONFIG_NFSD is not set
872CONFIG_ROOT_NFS=y
873CONFIG_LOCKD=y
874CONFIG_NFS_COMMON=y
875CONFIG_SUNRPC=y
876# CONFIG_RPCSEC_GSS_KRB5 is not set
877# CONFIG_RPCSEC_GSS_SPKM3 is not set
878# CONFIG_SMB_FS is not set
879# CONFIG_CIFS is not set
880# CONFIG_CIFS_DEBUG2 is not set
881# CONFIG_NCP_FS is not set
882# CONFIG_CODA_FS is not set
883# CONFIG_AFS_FS is not set
884# CONFIG_9P_FS is not set
885
886#
887# Partition Types
888#
889# CONFIG_PARTITION_ADVANCED is not set
890CONFIG_MSDOS_PARTITION=y
891
892#
893# Native Language Support
894#
895# CONFIG_NLS is not set
896
897#
898# Profiling support
899#
900# CONFIG_PROFILING is not set
901
902#
903# Kernel hacking
904#
905CONFIG_TRACE_IRQFLAGS_SUPPORT=y
906# CONFIG_PRINTK_TIME is not set
907# CONFIG_MAGIC_SYSRQ is not set
908# CONFIG_UNUSED_SYMBOLS is not set
909# CONFIG_DEBUG_KERNEL is not set
910CONFIG_LOG_BUF_SHIFT=14
911# CONFIG_DEBUG_FS is not set
912CONFIG_CROSSCOMPILE=y
913CONFIG_CMDLINE=""
914
915#
916# Security options
917#
918CONFIG_KEYS=y
919CONFIG_KEYS_DEBUG_PROC_KEYS=y
920# CONFIG_SECURITY is not set
921
922#
923# Cryptographic options
924#
925CONFIG_CRYPTO=y
926CONFIG_CRYPTO_HMAC=y
927CONFIG_CRYPTO_NULL=m
928CONFIG_CRYPTO_MD4=m
929CONFIG_CRYPTO_MD5=m
930CONFIG_CRYPTO_SHA1=m
931CONFIG_CRYPTO_SHA256=m
932CONFIG_CRYPTO_SHA512=m
933CONFIG_CRYPTO_WP512=m
934CONFIG_CRYPTO_TGR192=m
935CONFIG_CRYPTO_DES=m
936CONFIG_CRYPTO_BLOWFISH=m
937CONFIG_CRYPTO_TWOFISH=m
938CONFIG_CRYPTO_SERPENT=m
939CONFIG_CRYPTO_AES=m
940CONFIG_CRYPTO_CAST5=m
941CONFIG_CRYPTO_CAST6=m
942CONFIG_CRYPTO_TEA=m
943CONFIG_CRYPTO_ARC4=m
944CONFIG_CRYPTO_KHAZAD=m
945CONFIG_CRYPTO_ANUBIS=m
946CONFIG_CRYPTO_DEFLATE=m
947CONFIG_CRYPTO_MICHAEL_MIC=m
948CONFIG_CRYPTO_CRC32C=m
949# CONFIG_CRYPTO_TEST is not set
950
951#
952# Hardware crypto devices
953#
954
955#
956# Library routines
957#
958# CONFIG_CRC_CCITT is not set
959CONFIG_CRC16=m
960CONFIG_CRC32=m
961CONFIG_LIBCRC32C=m
962CONFIG_ZLIB_INFLATE=m
963CONFIG_ZLIB_DEFLATE=m
964CONFIG_PLIST=y
diff --git a/arch/mips/configs/ivr_defconfig b/arch/mips/configs/ivr_defconfig
deleted file mode 100644
index 99831d0bf76b..000000000000
--- a/arch/mips/configs/ivr_defconfig
+++ /dev/null
@@ -1,920 +0,0 @@
1#
2# Automatically generated make config: don't edit
3# Linux kernel version: 2.6.18-rc1
4# Thu Jul 6 10:04:12 2006
5#
6CONFIG_MIPS=y
7
8#
9# Machine selection
10#
11# CONFIG_MIPS_MTX1 is not set
12# CONFIG_MIPS_BOSPORUS is not set
13# CONFIG_MIPS_PB1000 is not set
14# CONFIG_MIPS_PB1100 is not set
15# CONFIG_MIPS_PB1500 is not set
16# CONFIG_MIPS_PB1550 is not set
17# CONFIG_MIPS_PB1200 is not set
18# CONFIG_MIPS_DB1000 is not set
19# CONFIG_MIPS_DB1100 is not set
20# CONFIG_MIPS_DB1500 is not set
21# CONFIG_MIPS_DB1550 is not set
22# CONFIG_MIPS_DB1200 is not set
23# CONFIG_MIPS_MIRAGE is not set
24# CONFIG_BASLER_EXCITE is not set
25# CONFIG_MIPS_COBALT is not set
26# CONFIG_MACH_DECSTATION is not set
27# CONFIG_MIPS_EV64120 is not set
28CONFIG_MIPS_IVR=y
29# CONFIG_MIPS_ITE8172 is not set
30# CONFIG_MACH_JAZZ is not set
31# CONFIG_LASAT is not set
32# CONFIG_MIPS_ATLAS is not set
33# CONFIG_MIPS_MALTA is not set
34# CONFIG_MIPS_SEAD is not set
35# CONFIG_WR_PPMC is not set
36# CONFIG_MIPS_SIM is not set
37# CONFIG_MOMENCO_JAGUAR_ATX is not set
38# CONFIG_MOMENCO_OCELOT is not set
39# CONFIG_MOMENCO_OCELOT_3 is not set
40# CONFIG_MOMENCO_OCELOT_C is not set
41# CONFIG_MOMENCO_OCELOT_G is not set
42# CONFIG_MIPS_XXS1500 is not set
43# CONFIG_PNX8550_V2PCI is not set
44# CONFIG_PNX8550_JBS is not set
45# CONFIG_DDB5477 is not set
46# CONFIG_MACH_VR41XX is not set
47# CONFIG_PMC_YOSEMITE is not set
48# CONFIG_QEMU is not set
49# CONFIG_MARKEINS is not set
50# CONFIG_SGI_IP22 is not set
51# CONFIG_SGI_IP27 is not set
52# CONFIG_SGI_IP32 is not set
53# CONFIG_SIBYTE_BIGSUR is not set
54# CONFIG_SIBYTE_SWARM is not set
55# CONFIG_SIBYTE_SENTOSA is not set
56# CONFIG_SIBYTE_RHONE is not set
57# CONFIG_SIBYTE_CARMEL is not set
58# CONFIG_SIBYTE_PTSWARM is not set
59# CONFIG_SIBYTE_LITTLESUR is not set
60# CONFIG_SIBYTE_CRHINE is not set
61# CONFIG_SIBYTE_CRHONE is not set
62# CONFIG_SNI_RM200_PCI is not set
63# CONFIG_TOSHIBA_JMR3927 is not set
64# CONFIG_TOSHIBA_RBTX4927 is not set
65# CONFIG_TOSHIBA_RBTX4938 is not set
66CONFIG_RWSEM_GENERIC_SPINLOCK=y
67CONFIG_GENERIC_FIND_NEXT_BIT=y
68CONFIG_GENERIC_HWEIGHT=y
69CONFIG_GENERIC_CALIBRATE_DELAY=y
70CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
71CONFIG_DMA_NONCOHERENT=y
72CONFIG_DMA_NEED_PCI_MAP_STATE=y
73# CONFIG_CPU_BIG_ENDIAN is not set
74CONFIG_CPU_LITTLE_ENDIAN=y
75CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
76CONFIG_ITE_BOARD_GEN=y
77CONFIG_IT8172_CIR=y
78CONFIG_MIPS_L1_CACHE_SHIFT=5
79
80#
81# CPU selection
82#
83# CONFIG_CPU_MIPS32_R1 is not set
84# CONFIG_CPU_MIPS32_R2 is not set
85# CONFIG_CPU_MIPS64_R1 is not set
86# CONFIG_CPU_MIPS64_R2 is not set
87# CONFIG_CPU_R3000 is not set
88# CONFIG_CPU_TX39XX is not set
89# CONFIG_CPU_VR41XX is not set
90# CONFIG_CPU_R4300 is not set
91# CONFIG_CPU_R4X00 is not set
92# CONFIG_CPU_TX49XX is not set
93# CONFIG_CPU_R5000 is not set
94# CONFIG_CPU_R5432 is not set
95# CONFIG_CPU_R6000 is not set
96CONFIG_CPU_NEVADA=y
97# CONFIG_CPU_R8000 is not set
98# CONFIG_CPU_R10000 is not set
99# CONFIG_CPU_RM7000 is not set
100# CONFIG_CPU_RM9000 is not set
101# CONFIG_CPU_SB1 is not set
102CONFIG_SYS_HAS_CPU_NEVADA=y
103CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
104CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
105CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
106CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
107
108#
109# Kernel type
110#
111CONFIG_32BIT=y
112# CONFIG_64BIT is not set
113CONFIG_PAGE_SIZE_4KB=y
114# CONFIG_PAGE_SIZE_8KB is not set
115# CONFIG_PAGE_SIZE_16KB is not set
116# CONFIG_PAGE_SIZE_64KB is not set
117CONFIG_MIPS_MT_DISABLED=y
118# CONFIG_MIPS_MT_SMTC is not set
119# CONFIG_MIPS_MT_SMP is not set
120# CONFIG_MIPS_VPE_LOADER is not set
121CONFIG_CPU_HAS_LLSC=y
122CONFIG_CPU_HAS_SYNC=y
123CONFIG_GENERIC_HARDIRQS=y
124CONFIG_GENERIC_IRQ_PROBE=y
125CONFIG_ARCH_FLATMEM_ENABLE=y
126CONFIG_SELECT_MEMORY_MODEL=y
127CONFIG_FLATMEM_MANUAL=y
128# CONFIG_DISCONTIGMEM_MANUAL is not set
129# CONFIG_SPARSEMEM_MANUAL is not set
130CONFIG_FLATMEM=y
131CONFIG_FLAT_NODE_MEM_MAP=y
132# CONFIG_SPARSEMEM_STATIC is not set
133CONFIG_SPLIT_PTLOCK_CPUS=4
134# CONFIG_RESOURCES_64BIT is not set
135# CONFIG_HZ_48 is not set
136# CONFIG_HZ_100 is not set
137# CONFIG_HZ_128 is not set
138# CONFIG_HZ_250 is not set
139# CONFIG_HZ_256 is not set
140CONFIG_HZ_1000=y
141# CONFIG_HZ_1024 is not set
142CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
143CONFIG_HZ=1000
144CONFIG_PREEMPT_NONE=y
145# CONFIG_PREEMPT_VOLUNTARY is not set
146# CONFIG_PREEMPT is not set
147CONFIG_LOCKDEP_SUPPORT=y
148CONFIG_STACKTRACE_SUPPORT=y
149CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
150
151#
152# Code maturity level options
153#
154CONFIG_EXPERIMENTAL=y
155CONFIG_BROKEN_ON_SMP=y
156CONFIG_INIT_ENV_ARG_LIMIT=32
157
158#
159# General setup
160#
161CONFIG_LOCALVERSION=""
162CONFIG_LOCALVERSION_AUTO=y
163CONFIG_SWAP=y
164CONFIG_SYSVIPC=y
165# CONFIG_POSIX_MQUEUE is not set
166CONFIG_BSD_PROCESS_ACCT=y
167# CONFIG_BSD_PROCESS_ACCT_V3 is not set
168CONFIG_SYSCTL=y
169# CONFIG_AUDIT is not set
170# CONFIG_IKCONFIG is not set
171CONFIG_RELAY=y
172CONFIG_INITRAMFS_SOURCE=""
173# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
174CONFIG_EMBEDDED=y
175CONFIG_KALLSYMS=y
176# CONFIG_KALLSYMS_EXTRA_PASS is not set
177CONFIG_HOTPLUG=y
178CONFIG_PRINTK=y
179CONFIG_BUG=y
180CONFIG_ELF_CORE=y
181CONFIG_BASE_FULL=y
182CONFIG_RT_MUTEXES=y
183CONFIG_FUTEX=y
184CONFIG_EPOLL=y
185CONFIG_SHMEM=y
186CONFIG_SLAB=y
187CONFIG_VM_EVENT_COUNTERS=y
188# CONFIG_TINY_SHMEM is not set
189CONFIG_BASE_SMALL=0
190# CONFIG_SLOB is not set
191
192#
193# Loadable module support
194#
195CONFIG_MODULES=y
196CONFIG_MODULE_UNLOAD=y
197# CONFIG_MODULE_FORCE_UNLOAD is not set
198CONFIG_MODVERSIONS=y
199CONFIG_MODULE_SRCVERSION_ALL=y
200CONFIG_KMOD=y
201
202#
203# Block layer
204#
205# CONFIG_LBD is not set
206# CONFIG_BLK_DEV_IO_TRACE is not set
207# CONFIG_LSF is not set
208
209#
210# IO Schedulers
211#
212CONFIG_IOSCHED_NOOP=y
213CONFIG_IOSCHED_AS=y
214CONFIG_IOSCHED_DEADLINE=y
215CONFIG_IOSCHED_CFQ=y
216CONFIG_DEFAULT_AS=y
217# CONFIG_DEFAULT_DEADLINE is not set
218# CONFIG_DEFAULT_CFQ is not set
219# CONFIG_DEFAULT_NOOP is not set
220CONFIG_DEFAULT_IOSCHED="anticipatory"
221
222#
223# Bus options (PCI, PCMCIA, EISA, ISA, TC)
224#
225CONFIG_HW_HAS_PCI=y
226CONFIG_PCI=y
227CONFIG_MMU=y
228
229#
230# PCCARD (PCMCIA/CardBus) support
231#
232# CONFIG_PCCARD is not set
233
234#
235# PCI Hotplug Support
236#
237# CONFIG_HOTPLUG_PCI is not set
238
239#
240# Executable file formats
241#
242CONFIG_BINFMT_ELF=y
243# CONFIG_BINFMT_MISC is not set
244CONFIG_TRAD_SIGNALS=y
245
246#
247# Networking
248#
249CONFIG_NET=y
250
251#
252# Networking options
253#
254# CONFIG_NETDEBUG is not set
255CONFIG_PACKET=y
256CONFIG_PACKET_MMAP=y
257CONFIG_UNIX=y
258CONFIG_XFRM=y
259CONFIG_XFRM_USER=m
260CONFIG_NET_KEY=y
261CONFIG_INET=y
262# CONFIG_IP_MULTICAST is not set
263# CONFIG_IP_ADVANCED_ROUTER is not set
264CONFIG_IP_FIB_HASH=y
265CONFIG_IP_PNP=y
266# CONFIG_IP_PNP_DHCP is not set
267CONFIG_IP_PNP_BOOTP=y
268# CONFIG_IP_PNP_RARP is not set
269# CONFIG_NET_IPIP is not set
270# CONFIG_NET_IPGRE is not set
271# CONFIG_ARPD is not set
272# CONFIG_SYN_COOKIES is not set
273# CONFIG_INET_AH is not set
274# CONFIG_INET_ESP is not set
275# CONFIG_INET_IPCOMP is not set
276# CONFIG_INET_XFRM_TUNNEL is not set
277# CONFIG_INET_TUNNEL is not set
278CONFIG_INET_XFRM_MODE_TRANSPORT=m
279CONFIG_INET_XFRM_MODE_TUNNEL=m
280CONFIG_INET_DIAG=y
281CONFIG_INET_TCP_DIAG=y
282# CONFIG_TCP_CONG_ADVANCED is not set
283CONFIG_TCP_CONG_BIC=y
284# CONFIG_IPV6 is not set
285# CONFIG_INET6_XFRM_TUNNEL is not set
286# CONFIG_INET6_TUNNEL is not set
287CONFIG_NETWORK_SECMARK=y
288# CONFIG_NETFILTER is not set
289
290#
291# DCCP Configuration (EXPERIMENTAL)
292#
293# CONFIG_IP_DCCP is not set
294
295#
296# SCTP Configuration (EXPERIMENTAL)
297#
298# CONFIG_IP_SCTP is not set
299
300#
301# TIPC Configuration (EXPERIMENTAL)
302#
303# CONFIG_TIPC is not set
304# CONFIG_ATM is not set
305# CONFIG_BRIDGE is not set
306# CONFIG_VLAN_8021Q is not set
307# CONFIG_DECNET is not set
308# CONFIG_LLC2 is not set
309# CONFIG_IPX is not set
310# CONFIG_ATALK is not set
311# CONFIG_X25 is not set
312# CONFIG_LAPB is not set
313# CONFIG_NET_DIVERT is not set
314# CONFIG_ECONET is not set
315# CONFIG_WAN_ROUTER is not set
316
317#
318# QoS and/or fair queueing
319#
320# CONFIG_NET_SCHED is not set
321
322#
323# Network testing
324#
325# CONFIG_NET_PKTGEN is not set
326# CONFIG_HAMRADIO is not set
327# CONFIG_IRDA is not set
328# CONFIG_BT is not set
329CONFIG_IEEE80211=m
330# CONFIG_IEEE80211_DEBUG is not set
331CONFIG_IEEE80211_CRYPT_WEP=m
332CONFIG_IEEE80211_CRYPT_CCMP=m
333CONFIG_IEEE80211_SOFTMAC=m
334# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
335CONFIG_WIRELESS_EXT=y
336
337#
338# Device Drivers
339#
340
341#
342# Generic Driver Options
343#
344CONFIG_STANDALONE=y
345CONFIG_PREVENT_FIRMWARE_BUILD=y
346CONFIG_FW_LOADER=m
347# CONFIG_SYS_HYPERVISOR is not set
348
349#
350# Connector - unified userspace <-> kernelspace linker
351#
352CONFIG_CONNECTOR=m
353
354#
355# Memory Technology Devices (MTD)
356#
357# CONFIG_MTD is not set
358
359#
360# Parallel port support
361#
362# CONFIG_PARPORT is not set
363
364#
365# Plug and Play support
366#
367
368#
369# Block devices
370#
371# CONFIG_BLK_CPQ_DA is not set
372# CONFIG_BLK_CPQ_CISS_DA is not set
373# CONFIG_BLK_DEV_DAC960 is not set
374# CONFIG_BLK_DEV_UMEM is not set
375# CONFIG_BLK_DEV_COW_COMMON is not set
376# CONFIG_BLK_DEV_LOOP is not set
377# CONFIG_BLK_DEV_NBD is not set
378# CONFIG_BLK_DEV_SX8 is not set
379# CONFIG_BLK_DEV_RAM is not set
380# CONFIG_BLK_DEV_INITRD is not set
381CONFIG_CDROM_PKTCDVD=m
382CONFIG_CDROM_PKTCDVD_BUFFERS=8
383# CONFIG_CDROM_PKTCDVD_WCACHE is not set
384CONFIG_ATA_OVER_ETH=m
385
386#
387# ATA/ATAPI/MFM/RLL support
388#
389CONFIG_IDE=y
390CONFIG_BLK_DEV_IDE=y
391
392#
393# Please see Documentation/ide.txt for help/info on IDE drives
394#
395# CONFIG_BLK_DEV_IDE_SATA is not set
396CONFIG_BLK_DEV_IDEDISK=y
397# CONFIG_IDEDISK_MULTI_MODE is not set
398# CONFIG_BLK_DEV_IDECD is not set
399# CONFIG_BLK_DEV_IDETAPE is not set
400# CONFIG_BLK_DEV_IDEFLOPPY is not set
401# CONFIG_IDE_TASK_IOCTL is not set
402
403#
404# IDE chipset support/bugfixes
405#
406CONFIG_IDE_GENERIC=y
407# CONFIG_BLK_DEV_IDEPCI is not set
408# CONFIG_IDE_ARM is not set
409# CONFIG_BLK_DEV_IDEDMA is not set
410# CONFIG_IDEDMA_AUTO is not set
411# CONFIG_BLK_DEV_HD is not set
412
413#
414# SCSI device support
415#
416CONFIG_RAID_ATTRS=m
417# CONFIG_SCSI is not set
418
419#
420# Multi-device support (RAID and LVM)
421#
422# CONFIG_MD is not set
423
424#
425# Fusion MPT device support
426#
427# CONFIG_FUSION is not set
428
429#
430# IEEE 1394 (FireWire) support
431#
432# CONFIG_IEEE1394 is not set
433
434#
435# I2O device support
436#
437# CONFIG_I2O is not set
438
439#
440# Network device support
441#
442CONFIG_NETDEVICES=y
443# CONFIG_DUMMY is not set
444# CONFIG_BONDING is not set
445# CONFIG_EQUALIZER is not set
446# CONFIG_TUN is not set
447
448#
449# ARCnet devices
450#
451# CONFIG_ARCNET is not set
452
453#
454# PHY device support
455#
456CONFIG_PHYLIB=m
457
458#
459# MII PHY device drivers
460#
461CONFIG_MARVELL_PHY=m
462CONFIG_DAVICOM_PHY=m
463CONFIG_QSEMI_PHY=m
464CONFIG_LXT_PHY=m
465CONFIG_CICADA_PHY=m
466CONFIG_VITESSE_PHY=m
467CONFIG_SMSC_PHY=m
468
469#
470# Ethernet (10 or 100Mbit)
471#
472CONFIG_NET_ETHERNET=y
473# CONFIG_MII is not set
474# CONFIG_HAPPYMEAL is not set
475# CONFIG_SUNGEM is not set
476# CONFIG_CASSINI is not set
477# CONFIG_NET_VENDOR_3COM is not set
478# CONFIG_DM9000 is not set
479
480#
481# Tulip family network device support
482#
483# CONFIG_NET_TULIP is not set
484# CONFIG_HP100 is not set
485# CONFIG_NET_PCI is not set
486
487#
488# Ethernet (1000 Mbit)
489#
490# CONFIG_ACENIC is not set
491# CONFIG_DL2K is not set
492# CONFIG_E1000 is not set
493# CONFIG_NS83820 is not set
494# CONFIG_HAMACHI is not set
495# CONFIG_YELLOWFIN is not set
496# CONFIG_R8169 is not set
497# CONFIG_SIS190 is not set
498# CONFIG_SKGE is not set
499# CONFIG_SKY2 is not set
500# CONFIG_SK98LIN is not set
501# CONFIG_TIGON3 is not set
502# CONFIG_BNX2 is not set
503
504#
505# Ethernet (10000 Mbit)
506#
507# CONFIG_CHELSIO_T1 is not set
508# CONFIG_IXGB is not set
509# CONFIG_S2IO is not set
510# CONFIG_MYRI10GE is not set
511
512#
513# Token Ring devices
514#
515# CONFIG_TR is not set
516
517#
518# Wireless LAN (non-hamradio)
519#
520# CONFIG_NET_RADIO is not set
521
522#
523# Wan interfaces
524#
525# CONFIG_WAN is not set
526# CONFIG_FDDI is not set
527# CONFIG_HIPPI is not set
528# CONFIG_PPP is not set
529# CONFIG_SLIP is not set
530# CONFIG_SHAPER is not set
531# CONFIG_NETCONSOLE is not set
532# CONFIG_NETPOLL is not set
533# CONFIG_NET_POLL_CONTROLLER is not set
534
535#
536# ISDN subsystem
537#
538# CONFIG_ISDN is not set
539
540#
541# Telephony Support
542#
543# CONFIG_PHONE is not set
544
545#
546# Input device support
547#
548CONFIG_INPUT=y
549
550#
551# Userland interfaces
552#
553CONFIG_INPUT_MOUSEDEV=y
554CONFIG_INPUT_MOUSEDEV_PSAUX=y
555CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
556CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
557# CONFIG_INPUT_JOYDEV is not set
558# CONFIG_INPUT_TSDEV is not set
559# CONFIG_INPUT_EVDEV is not set
560# CONFIG_INPUT_EVBUG is not set
561
562#
563# Input Device Drivers
564#
565# CONFIG_INPUT_KEYBOARD is not set
566# CONFIG_INPUT_MOUSE is not set
567# CONFIG_INPUT_JOYSTICK is not set
568# CONFIG_INPUT_TOUCHSCREEN is not set
569# CONFIG_INPUT_MISC is not set
570
571#
572# Hardware I/O ports
573#
574CONFIG_SERIO=y
575# CONFIG_SERIO_I8042 is not set
576CONFIG_SERIO_SERPORT=y
577# CONFIG_SERIO_PCIPS2 is not set
578# CONFIG_SERIO_LIBPS2 is not set
579CONFIG_SERIO_RAW=m
580# CONFIG_GAMEPORT is not set
581
582#
583# Character devices
584#
585CONFIG_VT=y
586CONFIG_VT_CONSOLE=y
587CONFIG_HW_CONSOLE=y
588CONFIG_VT_HW_CONSOLE_BINDING=y
589# CONFIG_SERIAL_NONSTANDARD is not set
590CONFIG_QTRONIX_KEYBOARD=y
591CONFIG_IT8172_SCR0=y
592CONFIG_IT8172_SCR1=y
593
594#
595# Serial drivers
596#
597CONFIG_SERIAL_8250=y
598CONFIG_SERIAL_8250_CONSOLE=y
599CONFIG_SERIAL_8250_PCI=y
600CONFIG_SERIAL_8250_NR_UARTS=4
601CONFIG_SERIAL_8250_RUNTIME_UARTS=4
602# CONFIG_SERIAL_8250_EXTENDED is not set
603
604#
605# Non-8250 serial port support
606#
607CONFIG_SERIAL_CORE=y
608CONFIG_SERIAL_CORE_CONSOLE=y
609# CONFIG_SERIAL_JSM is not set
610CONFIG_UNIX98_PTYS=y
611CONFIG_LEGACY_PTYS=y
612CONFIG_LEGACY_PTY_COUNT=256
613
614#
615# IPMI
616#
617# CONFIG_IPMI_HANDLER is not set
618
619#
620# Watchdog Cards
621#
622# CONFIG_WATCHDOG is not set
623# CONFIG_HW_RANDOM is not set
624CONFIG_RTC=y
625# CONFIG_DTLK is not set
626# CONFIG_R3964 is not set
627# CONFIG_APPLICOM is not set
628
629#
630# Ftape, the floppy tape device driver
631#
632# CONFIG_DRM is not set
633# CONFIG_RAW_DRIVER is not set
634
635#
636# TPM devices
637#
638# CONFIG_TCG_TPM is not set
639# CONFIG_TELCLOCK is not set
640
641#
642# I2C support
643#
644# CONFIG_I2C is not set
645
646#
647# SPI support
648#
649# CONFIG_SPI is not set
650# CONFIG_SPI_MASTER is not set
651
652#
653# Dallas's 1-wire bus
654#
655# CONFIG_W1 is not set
656
657#
658# Hardware Monitoring support
659#
660# CONFIG_HWMON is not set
661# CONFIG_HWMON_VID is not set
662
663#
664# Misc devices
665#
666
667#
668# Multimedia devices
669#
670# CONFIG_VIDEO_DEV is not set
671CONFIG_VIDEO_V4L2=y
672
673#
674# Digital Video Broadcasting Devices
675#
676# CONFIG_DVB is not set
677
678#
679# Graphics support
680#
681# CONFIG_FIRMWARE_EDID is not set
682# CONFIG_FB is not set
683
684#
685# Console display driver support
686#
687# CONFIG_VGA_CONSOLE is not set
688CONFIG_DUMMY_CONSOLE=y
689
690#
691# Sound
692#
693# CONFIG_SOUND is not set
694
695#
696# USB support
697#
698CONFIG_USB_ARCH_HAS_HCD=y
699CONFIG_USB_ARCH_HAS_OHCI=y
700CONFIG_USB_ARCH_HAS_EHCI=y
701# CONFIG_USB is not set
702
703#
704# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
705#
706
707#
708# USB Gadget Support
709#
710# CONFIG_USB_GADGET is not set
711
712#
713# MMC/SD Card support
714#
715# CONFIG_MMC is not set
716
717#
718# LED devices
719#
720# CONFIG_NEW_LEDS is not set
721
722#
723# LED drivers
724#
725
726#
727# LED Triggers
728#
729
730#
731# InfiniBand support
732#
733# CONFIG_INFINIBAND is not set
734
735#
736# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
737#
738
739#
740# Real Time Clock
741#
742# CONFIG_RTC_CLASS is not set
743
744#
745# DMA Engine support
746#
747# CONFIG_DMA_ENGINE is not set
748
749#
750# DMA Clients
751#
752
753#
754# DMA Devices
755#
756
757#
758# File systems
759#
760CONFIG_EXT2_FS=y
761# CONFIG_EXT2_FS_XATTR is not set
762# CONFIG_EXT2_FS_XIP is not set
763# CONFIG_EXT3_FS is not set
764# CONFIG_REISERFS_FS is not set
765# CONFIG_JFS_FS is not set
766# CONFIG_FS_POSIX_ACL is not set
767# CONFIG_XFS_FS is not set
768# CONFIG_OCFS2_FS is not set
769# CONFIG_MINIX_FS is not set
770# CONFIG_ROMFS_FS is not set
771CONFIG_INOTIFY=y
772CONFIG_INOTIFY_USER=y
773# CONFIG_QUOTA is not set
774CONFIG_DNOTIFY=y
775# CONFIG_AUTOFS_FS is not set
776# CONFIG_AUTOFS4_FS is not set
777CONFIG_FUSE_FS=m
778
779#
780# CD-ROM/DVD Filesystems
781#
782# CONFIG_ISO9660_FS is not set
783# CONFIG_UDF_FS is not set
784
785#
786# DOS/FAT/NT Filesystems
787#
788# CONFIG_MSDOS_FS is not set
789# CONFIG_VFAT_FS is not set
790# CONFIG_NTFS_FS is not set
791
792#
793# Pseudo filesystems
794#
795CONFIG_PROC_FS=y
796CONFIG_PROC_KCORE=y
797CONFIG_SYSFS=y
798# CONFIG_TMPFS is not set
799# CONFIG_HUGETLB_PAGE is not set
800CONFIG_RAMFS=y
801# CONFIG_CONFIGFS_FS is not set
802
803#
804# Miscellaneous filesystems
805#
806# CONFIG_ADFS_FS is not set
807# CONFIG_AFFS_FS is not set
808# CONFIG_HFS_FS is not set
809# CONFIG_HFSPLUS_FS is not set
810# CONFIG_BEFS_FS is not set
811# CONFIG_BFS_FS is not set
812# CONFIG_EFS_FS is not set
813# CONFIG_CRAMFS is not set
814# CONFIG_VXFS_FS is not set
815# CONFIG_HPFS_FS is not set
816# CONFIG_QNX4FS_FS is not set
817# CONFIG_SYSV_FS is not set
818# CONFIG_UFS_FS is not set
819
820#
821# Network File Systems
822#
823CONFIG_NFS_FS=y
824# CONFIG_NFS_V3 is not set
825# CONFIG_NFS_V4 is not set
826# CONFIG_NFS_DIRECTIO is not set
827# CONFIG_NFSD is not set
828CONFIG_ROOT_NFS=y
829CONFIG_LOCKD=y
830CONFIG_NFS_COMMON=y
831CONFIG_SUNRPC=y
832# CONFIG_RPCSEC_GSS_KRB5 is not set
833# CONFIG_RPCSEC_GSS_SPKM3 is not set
834# CONFIG_SMB_FS is not set
835# CONFIG_CIFS is not set
836# CONFIG_CIFS_DEBUG2 is not set
837# CONFIG_NCP_FS is not set
838# CONFIG_CODA_FS is not set
839# CONFIG_AFS_FS is not set
840# CONFIG_9P_FS is not set
841
842#
843# Partition Types
844#
845# CONFIG_PARTITION_ADVANCED is not set
846CONFIG_MSDOS_PARTITION=y
847
848#
849# Native Language Support
850#
851# CONFIG_NLS is not set
852
853#
854# Profiling support
855#
856# CONFIG_PROFILING is not set
857
858#
859# Kernel hacking
860#
861CONFIG_TRACE_IRQFLAGS_SUPPORT=y
862# CONFIG_PRINTK_TIME is not set
863# CONFIG_MAGIC_SYSRQ is not set
864# CONFIG_UNUSED_SYMBOLS is not set
865# CONFIG_DEBUG_KERNEL is not set
866CONFIG_LOG_BUF_SHIFT=14
867# CONFIG_DEBUG_FS is not set
868CONFIG_CROSSCOMPILE=y
869CONFIG_CMDLINE=""
870
871#
872# Security options
873#
874CONFIG_KEYS=y
875CONFIG_KEYS_DEBUG_PROC_KEYS=y
876# CONFIG_SECURITY is not set
877
878#
879# Cryptographic options
880#
881CONFIG_CRYPTO=y
882CONFIG_CRYPTO_HMAC=y
883CONFIG_CRYPTO_NULL=m
884CONFIG_CRYPTO_MD4=m
885CONFIG_CRYPTO_MD5=m
886CONFIG_CRYPTO_SHA1=m
887CONFIG_CRYPTO_SHA256=m
888CONFIG_CRYPTO_SHA512=m
889CONFIG_CRYPTO_WP512=m
890CONFIG_CRYPTO_TGR192=m
891CONFIG_CRYPTO_DES=m
892CONFIG_CRYPTO_BLOWFISH=m
893CONFIG_CRYPTO_TWOFISH=m
894CONFIG_CRYPTO_SERPENT=m
895CONFIG_CRYPTO_AES=m
896CONFIG_CRYPTO_CAST5=m
897CONFIG_CRYPTO_CAST6=m
898CONFIG_CRYPTO_TEA=m
899CONFIG_CRYPTO_ARC4=m
900CONFIG_CRYPTO_KHAZAD=m
901CONFIG_CRYPTO_ANUBIS=m
902CONFIG_CRYPTO_DEFLATE=m
903CONFIG_CRYPTO_MICHAEL_MIC=m
904CONFIG_CRYPTO_CRC32C=m
905# CONFIG_CRYPTO_TEST is not set
906
907#
908# Hardware crypto devices
909#
910
911#
912# Library routines
913#
914# CONFIG_CRC_CCITT is not set
915CONFIG_CRC16=m
916CONFIG_CRC32=m
917CONFIG_LIBCRC32C=m
918CONFIG_ZLIB_INFLATE=m
919CONFIG_ZLIB_DEFLATE=m
920CONFIG_PLIST=y
diff --git a/arch/mips/dec/boot/Makefile b/arch/mips/dec/boot/Makefile
deleted file mode 100644
index bcea41698ef5..000000000000
--- a/arch/mips/dec/boot/Makefile
+++ /dev/null
@@ -1,12 +0,0 @@
1#
2# Makefile for the DECstation family specific parts of the kernel
3#
4
5netboot: all
6 $(LD) -N -G 0 -T ld.ecoff ../../boot/zImage \
7 dec_boot.o ramdisk.img -o nbImage
8
9obj-y := decstation.o
10
11clean:
12 rm -f nbImage
diff --git a/arch/mips/dec/boot/decstation.c b/arch/mips/dec/boot/decstation.c
deleted file mode 100644
index f2fb82bd34a9..000000000000
--- a/arch/mips/dec/boot/decstation.c
+++ /dev/null
@@ -1,84 +0,0 @@
1/*
2 * arch/mips/dec/boot/decstation.c
3 */
4#include <asm/sections.h>
5
6#define RELOC
7#define INITRD
8#define DEBUG_BOOT
9
10/*
11 * Magic number indicating REX PROM available on DECSTATION.
12 */
13#define REX_PROM_MAGIC 0x30464354
14
15#define REX_PROM_CLEARCACHE 0x7c/4
16#define REX_PROM_PRINTF 0x30/4
17
18#define VEC_RESET 0xBFC00000 /* Prom base address */
19#define PMAX_PROM_ENTRY(x) (VEC_RESET+((x)*8)) /* Prom jump table */
20#define PMAX_PROM_PRINTF PMAX_PROM_ENTRY(17)
21
22#define PARAM (k_start + 0x2000)
23
24#define LOADER_TYPE (*(unsigned char *) (PARAM+0x210))
25#define INITRD_START (*(unsigned long *) (PARAM+0x218))
26#define INITRD_SIZE (*(unsigned long *) (PARAM+0x21c))
27
28extern int _ftext; /* begin and end of kernel image */
29extern void kernel_entry(int, char **, unsigned long, int *);
30
31void * memcpy(void * dest, const void *src, unsigned int count)
32{
33 unsigned long *tmp = (unsigned long *) dest, *s = (unsigned long *) src;
34
35 count >>= 2;
36 while (count--)
37 *tmp++ = *s++;
38
39 return dest;
40}
41
42void dec_entry(int argc, char **argv,
43 unsigned long magic, int *prom_vec)
44{
45 void (*rex_clear_cache)(void);
46 int (*prom_printf)(char *, ...);
47 unsigned long k_start, len;
48
49 /*
50 * The DS5100 leaves cpu with BEV enabled, clear it.
51 */
52 asm( "lui\t$8,0x3000\n\t"
53 "mtc0\t$8,$12\n\t"
54 ".section\t.sdata\n\t"
55 ".section\t.sbss\n\t"
56 ".section\t.text"
57 : : : "$8");
58
59#ifdef DEBUG_BOOT
60 if (magic == REX_PROM_MAGIC) {
61 prom_printf = (int (*)(char *, ...)) *(prom_vec + REX_PROM_PRINTF);
62 } else {
63 prom_printf = (int (*)(char *, ...)) PMAX_PROM_PRINTF;
64 }
65 prom_printf("Launching kernel...\n");
66#endif
67
68 k_start = (unsigned long) (&kernel_entry) & 0xffff0000;
69
70#ifdef RELOC
71 /*
72 * Now copy kernel image to its destination.
73 */
74 len = ((unsigned long) (&_end) - k_start);
75 memcpy((void *)k_start, &_ftext, len);
76#endif
77
78 if (magic == REX_PROM_MAGIC) {
79 rex_clear_cache = (void (*)(void)) * (prom_vec + REX_PROM_CLEARCACHE);
80 rex_clear_cache();
81 }
82
83 kernel_entry(argc, argv, magic, prom_vec);
84}
diff --git a/arch/mips/dec/boot/ld.ecoff b/arch/mips/dec/boot/ld.ecoff
deleted file mode 100644
index aaa633dfb5f7..000000000000
--- a/arch/mips/dec/boot/ld.ecoff
+++ /dev/null
@@ -1,43 +0,0 @@
1OUTPUT_FORMAT("ecoff-littlemips")
2OUTPUT_ARCH(mips)
3ENTRY(dec_entry)
4SECTIONS
5{
6 . = 0x80200000;
7
8 .text :
9 {
10 _ftext = .;
11 *(.text)
12 *(.fixup)
13 }
14 .rdata :
15 {
16 *(.rodata .rodata.* .rdata)
17 }
18 .data :
19 {
20 . = ALIGN(0x1000);
21 ramdisk.img (.data)
22 *(.data)
23 }
24 .sdata :
25 {
26 *(.sdata)
27 }
28 _gp = .;
29 .sbss :
30 {
31 *(.sbss)
32 *(.scommon)
33 }
34 .bss :
35 {
36 *(.dynbss)
37 *(.bss)
38 *(COMMON)
39 }
40 /DISCARD/ : {
41 *(.reginfo .mdebug .note)
42 }
43}
diff --git a/arch/mips/dec/time.c b/arch/mips/dec/time.c
index 57294740c2dd..4cf0c06e2414 100644
--- a/arch/mips/dec/time.c
+++ b/arch/mips/dec/time.c
@@ -184,8 +184,6 @@ void __init dec_time_init(void)
184 CMOS_WRITE(RTC_REF_CLCK_32KHZ | (16 - __ffs(HZ)), RTC_REG_A); 184 CMOS_WRITE(RTC_REF_CLCK_32KHZ | (16 - __ffs(HZ)), RTC_REG_A);
185} 185}
186 186
187EXPORT_SYMBOL(do_settimeofday);
188
189void __init plat_timer_setup(struct irqaction *irq) 187void __init plat_timer_setup(struct irqaction *irq)
190{ 188{
191 setup_irq(dec_interrupt[DEC_IRQ_RTC], irq); 189 setup_irq(dec_interrupt[DEC_IRQ_RTC], irq);
diff --git a/arch/mips/ite-boards/Kconfig b/arch/mips/ite-boards/Kconfig
deleted file mode 100644
index a6d59ad8f846..000000000000
--- a/arch/mips/ite-boards/Kconfig
+++ /dev/null
@@ -1,8 +0,0 @@
1config IT8172_REVC
2 bool "Support for older IT8172 (Rev C)"
3 depends on MIPS_ITE8172
4 help
5 Say Y here to support the older, Revision C version of the Integrated
6 Technology Express, Inc. ITE8172 SBC. Vendor page at
7 <http://www.ite.com.tw/ia/brief_it8172bsp.htm>; picture of the
8 board at <http://www.mvista.com/partners/semiconductor/ite.html>.
diff --git a/arch/mips/ite-boards/generic/Makefile b/arch/mips/ite-boards/generic/Makefile
deleted file mode 100644
index 63431538d0ec..000000000000
--- a/arch/mips/ite-boards/generic/Makefile
+++ /dev/null
@@ -1,15 +0,0 @@
1#
2# Copyright 2000 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the ITE 8172 (qed-4n-s01b) board, generic files.
7#
8
9obj-y += it8172_setup.o irq.o pmon_prom.o \
10 time.o lpc.o puts.o reset.o
11
12obj-$(CONFIG_IT8172_CIR)+= it8172_cir.o
13obj-$(CONFIG_KGDB) += dbg_io.o
14
15EXTRA_AFLAGS := $(CFLAGS)
diff --git a/arch/mips/ite-boards/generic/dbg_io.c b/arch/mips/ite-boards/generic/dbg_io.c
deleted file mode 100644
index 8e9cd8a9670a..000000000000
--- a/arch/mips/ite-boards/generic/dbg_io.c
+++ /dev/null
@@ -1,124 +0,0 @@
1
2
3#ifdef CONFIG_KGDB
4
5/* --- CONFIG --- */
6
7/* we need uint32 uint8 */
8/* #include "types.h" */
9typedef unsigned char uint8;
10typedef unsigned int uint32;
11
12/* --- END OF CONFIG --- */
13
14#define UART16550_BAUD_2400 2400
15#define UART16550_BAUD_4800 4800
16#define UART16550_BAUD_9600 9600
17#define UART16550_BAUD_19200 19200
18#define UART16550_BAUD_38400 38400
19#define UART16550_BAUD_57600 57600
20#define UART16550_BAUD_115200 115200
21
22#define UART16550_PARITY_NONE 0
23#define UART16550_PARITY_ODD 0x08
24#define UART16550_PARITY_EVEN 0x18
25#define UART16550_PARITY_MARK 0x28
26#define UART16550_PARITY_SPACE 0x38
27
28#define UART16550_DATA_5BIT 0x0
29#define UART16550_DATA_6BIT 0x1
30#define UART16550_DATA_7BIT 0x2
31#define UART16550_DATA_8BIT 0x3
32
33#define UART16550_STOP_1BIT 0x0
34#define UART16550_STOP_2BIT 0x4
35
36/* ----------------------------------------------------- */
37
38/* === CONFIG === */
39
40/* [stevel] we use the IT8712 serial port for kgdb */
41#define DEBUG_BASE 0xB40003F8 /* 8712 serial port 1 base address */
42#define MAX_BAUD 115200
43
44/* === END OF CONFIG === */
45
46/* register offset */
47#define OFS_RCV_BUFFER 0
48#define OFS_TRANS_HOLD 0
49#define OFS_SEND_BUFFER 0
50#define OFS_INTR_ENABLE 1
51#define OFS_INTR_ID 2
52#define OFS_DATA_FORMAT 3
53#define OFS_LINE_CONTROL 3
54#define OFS_MODEM_CONTROL 4
55#define OFS_RS232_OUTPUT 4
56#define OFS_LINE_STATUS 5
57#define OFS_MODEM_STATUS 6
58#define OFS_RS232_INPUT 6
59#define OFS_SCRATCH_PAD 7
60
61#define OFS_DIVISOR_LSB 0
62#define OFS_DIVISOR_MSB 1
63
64
65/* memory-mapped read/write of the port */
66#define UART16550_READ(y) (*((volatile uint8*)(DEBUG_BASE + y)))
67#define UART16550_WRITE(y,z) ((*((volatile uint8*)(DEBUG_BASE + y))) = z)
68
69void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
70{
71 /* disable interrupts */
72 UART16550_WRITE(OFS_INTR_ENABLE, 0);
73
74 /* set up baud rate */
75 {
76 uint32 divisor;
77
78 /* set DIAB bit */
79 UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
80
81 /* set divisor */
82 divisor = MAX_BAUD / baud;
83 UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
84 UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00) >> 8);
85
86 /* clear DIAB bit */
87 UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
88 }
89
90 /* set data format */
91 UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
92}
93
94static int remoteDebugInitialized = 0;
95
96uint8 getDebugChar(void)
97{
98 if (!remoteDebugInitialized) {
99 remoteDebugInitialized = 1;
100 debugInit(UART16550_BAUD_115200,
101 UART16550_DATA_8BIT,
102 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
103 }
104
105 while ((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
106 return UART16550_READ(OFS_RCV_BUFFER);
107}
108
109
110int putDebugChar(uint8 byte)
111{
112 if (!remoteDebugInitialized) {
113 remoteDebugInitialized = 1;
114 debugInit(UART16550_BAUD_115200,
115 UART16550_DATA_8BIT,
116 UART16550_PARITY_NONE, UART16550_STOP_1BIT);
117 }
118
119 while ((UART16550_READ(OFS_LINE_STATUS) & 0x20) == 0);
120 UART16550_WRITE(OFS_SEND_BUFFER, byte);
121 return 1;
122}
123
124#endif
diff --git a/arch/mips/ite-boards/generic/irq.c b/arch/mips/ite-boards/generic/irq.c
deleted file mode 100644
index cb59ca4f76f0..000000000000
--- a/arch/mips/ite-boards/generic/irq.c
+++ /dev/null
@@ -1,308 +0,0 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * ITE 8172G interrupt/setup routines.
4 *
5 * Copyright 2000,2001 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
8 *
9 * Part of this file was derived from Carsten Langgaard's
10 * arch/mips/mips-boards/atlas/atlas_int.c.
11 *
12 * Carsten Langgaard, carstenl@mips.com
13 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
14 *
15 * This program is free software; you can redistribute it and/or modify it
16 * under the terms of the GNU General Public License as published by the
17 * Free Software Foundation; either version 2 of the License, or (at your
18 * option) any later version.
19 *
20 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
21 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
22 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
23 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
25 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
26 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
27 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
28 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
29 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 *
31 * You should have received a copy of the GNU General Public License along
32 * with this program; if not, write to the Free Software Foundation, Inc.,
33 * 675 Mass Ave, Cambridge, MA 02139, USA.
34 */
35#include <linux/errno.h>
36#include <linux/init.h>
37#include <linux/irq.h>
38#include <linux/kernel_stat.h>
39#include <linux/module.h>
40#include <linux/signal.h>
41#include <linux/sched.h>
42#include <linux/types.h>
43#include <linux/interrupt.h>
44#include <linux/ioport.h>
45#include <linux/timex.h>
46#include <linux/slab.h>
47#include <linux/random.h>
48#include <linux/serial_reg.h>
49#include <linux/bitops.h>
50
51#include <asm/bootinfo.h>
52#include <asm/io.h>
53#include <asm/mipsregs.h>
54#include <asm/system.h>
55#include <asm/it8172/it8172.h>
56#include <asm/it8172/it8172_int.h>
57#include <asm/it8172/it8172_dbg.h>
58
59/* revisit */
60#define EXT_IRQ0_TO_IP 2 /* IP 2 */
61#define EXT_IRQ5_TO_IP 7 /* IP 7 */
62
63#define ALLINTS_NOTIMER (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4)
64
65extern void set_debug_traps(void);
66extern void mips_timer_interrupt(int irq, struct pt_regs *regs);
67
68struct it8172_intc_regs volatile *it8172_hw0_icregs =
69 (struct it8172_intc_regs volatile *)(KSEG1ADDR(IT8172_PCI_IO_BASE + IT_INTC_BASE));
70
71static void disable_it8172_irq(unsigned int irq_nr)
72{
73 if ( (irq_nr >= IT8172_LPC_IRQ_BASE) && (irq_nr <= IT8172_SERIRQ_15)) {
74 /* LPC interrupt */
75 it8172_hw0_icregs->lpc_mask |=
76 (1 << (irq_nr - IT8172_LPC_IRQ_BASE));
77 } else if ( (irq_nr >= IT8172_LB_IRQ_BASE) && (irq_nr <= IT8172_IOCHK_IRQ)) {
78 /* Local Bus interrupt */
79 it8172_hw0_icregs->lb_mask |=
80 (1 << (irq_nr - IT8172_LB_IRQ_BASE));
81 } else if ( (irq_nr >= IT8172_PCI_DEV_IRQ_BASE) && (irq_nr <= IT8172_DMA_IRQ)) {
82 /* PCI and other interrupts */
83 it8172_hw0_icregs->pci_mask |=
84 (1 << (irq_nr - IT8172_PCI_DEV_IRQ_BASE));
85 } else if ( (irq_nr >= IT8172_NMI_IRQ_BASE) && (irq_nr <= IT8172_POWER_NMI_IRQ)) {
86 /* NMI interrupts */
87 it8172_hw0_icregs->nmi_mask |=
88 (1 << (irq_nr - IT8172_NMI_IRQ_BASE));
89 } else {
90 panic("disable_it8172_irq: bad irq %d", irq_nr);
91 }
92}
93
94static void enable_it8172_irq(unsigned int irq_nr)
95{
96 if ( (irq_nr >= IT8172_LPC_IRQ_BASE) && (irq_nr <= IT8172_SERIRQ_15)) {
97 /* LPC interrupt */
98 it8172_hw0_icregs->lpc_mask &=
99 ~(1 << (irq_nr - IT8172_LPC_IRQ_BASE));
100 }
101 else if ( (irq_nr >= IT8172_LB_IRQ_BASE) && (irq_nr <= IT8172_IOCHK_IRQ)) {
102 /* Local Bus interrupt */
103 it8172_hw0_icregs->lb_mask &=
104 ~(1 << (irq_nr - IT8172_LB_IRQ_BASE));
105 }
106 else if ( (irq_nr >= IT8172_PCI_DEV_IRQ_BASE) && (irq_nr <= IT8172_DMA_IRQ)) {
107 /* PCI and other interrupts */
108 it8172_hw0_icregs->pci_mask &=
109 ~(1 << (irq_nr - IT8172_PCI_DEV_IRQ_BASE));
110 }
111 else if ( (irq_nr >= IT8172_NMI_IRQ_BASE) && (irq_nr <= IT8172_POWER_NMI_IRQ)) {
112 /* NMI interrupts */
113 it8172_hw0_icregs->nmi_mask &=
114 ~(1 << (irq_nr - IT8172_NMI_IRQ_BASE));
115 }
116 else {
117 panic("enable_it8172_irq: bad irq %d", irq_nr);
118 }
119}
120
121static unsigned int startup_ite_irq(unsigned int irq)
122{
123 enable_it8172_irq(irq);
124 return 0;
125}
126
127#define shutdown_ite_irq disable_it8172_irq
128#define mask_and_ack_ite_irq disable_it8172_irq
129
130static void end_ite_irq(unsigned int irq)
131{
132 if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
133 enable_it8172_irq(irq);
134}
135
136static struct irq_chip it8172_irq_type = {
137 .typename = "ITE8172",
138 .startup = startup_ite_irq,
139 .shutdown = shutdown_ite_irq,
140 .enable = enable_it8172_irq,
141 .disable = disable_it8172_irq,
142 .ack = mask_and_ack_ite_irq,
143 .end = end_ite_irq,
144};
145
146
147static void enable_none(unsigned int irq) { }
148static unsigned int startup_none(unsigned int irq) { return 0; }
149static void disable_none(unsigned int irq) { }
150static void ack_none(unsigned int irq) { }
151
152/* startup is the same as "enable", shutdown is same as "disable" */
153#define shutdown_none disable_none
154#define end_none enable_none
155
156static struct irq_chip cp0_irq_type = {
157 .typename = "CP0 Count",
158 .startup = startup_none,
159 .shutdown = shutdown_none,
160 .enable = enable_none,
161 .disable = disable_none,
162 .ack = ack_none,
163 .end = end_none
164};
165
166void enable_cpu_timer(void)
167{
168 unsigned long flags;
169
170 local_irq_save(flags);
171 set_c0_status(0x100 << EXT_IRQ5_TO_IP);
172 local_irq_restore(flags);
173}
174
175void __init arch_init_irq(void)
176{
177 int i;
178 unsigned long flags;
179
180 /* mask all interrupts */
181 it8172_hw0_icregs->lb_mask = 0xffff;
182 it8172_hw0_icregs->lpc_mask = 0xffff;
183 it8172_hw0_icregs->pci_mask = 0xffff;
184 it8172_hw0_icregs->nmi_mask = 0xffff;
185
186 /* make all interrupts level triggered */
187 it8172_hw0_icregs->lb_trigger = 0;
188 it8172_hw0_icregs->lpc_trigger = 0;
189 it8172_hw0_icregs->pci_trigger = 0;
190 it8172_hw0_icregs->nmi_trigger = 0;
191
192 /* active level setting */
193 /* uart, keyboard, and mouse are active high */
194 it8172_hw0_icregs->lpc_level = (0x10 | 0x2 | 0x1000);
195 it8172_hw0_icregs->lb_level |= 0x20;
196
197 /* keyboard and mouse are edge triggered */
198 it8172_hw0_icregs->lpc_trigger |= (0x2 | 0x1000);
199
200
201#if 0
202 // Enable this piece of code to make internal USB interrupt
203 // edge triggered.
204 it8172_hw0_icregs->pci_trigger |=
205 (1 << (IT8172_USB_IRQ - IT8172_PCI_DEV_IRQ_BASE));
206 it8172_hw0_icregs->pci_level &=
207 ~(1 << (IT8172_USB_IRQ - IT8172_PCI_DEV_IRQ_BASE));
208#endif
209
210 for (i = 0; i <= IT8172_LAST_IRQ; i++) {
211 irq_desc[i].chip = &it8172_irq_type;
212 spin_lock_init(&irq_desc[i].lock);
213 }
214 irq_desc[MIPS_CPU_TIMER_IRQ].chip = &cp0_irq_type;
215 set_c0_status(ALLINTS_NOTIMER);
216}
217
218void mips_spurious_interrupt(struct pt_regs *regs)
219{
220#if 1
221 return;
222#else
223 unsigned long status, cause;
224
225 printk("got spurious interrupt\n");
226 status = read_c0_status();
227 cause = read_c0_cause();
228 printk("status %x cause %x\n", status, cause);
229 printk("epc %x badvaddr %x \n", regs->cp0_epc, regs->cp0_badvaddr);
230#endif
231}
232
233void it8172_hw0_irqdispatch(struct pt_regs *regs)
234{
235 int irq;
236 unsigned short intstatus = 0, status = 0;
237
238 intstatus = it8172_hw0_icregs->intstatus;
239 if (intstatus & 0x8) {
240 panic("Got NMI interrupt");
241 } else if (intstatus & 0x4) {
242 /* PCI interrupt */
243 irq = 0;
244 status |= it8172_hw0_icregs->pci_req;
245 while (!(status & 0x1)) {
246 irq++;
247 status >>= 1;
248 }
249 irq += IT8172_PCI_DEV_IRQ_BASE;
250 } else if (intstatus & 0x1) {
251 /* Local Bus interrupt */
252 irq = 0;
253 status |= it8172_hw0_icregs->lb_req;
254 while (!(status & 0x1)) {
255 irq++;
256 status >>= 1;
257 }
258 irq += IT8172_LB_IRQ_BASE;
259 } else if (intstatus & 0x2) {
260 /* LPC interrupt */
261 /* Since some lpc interrupts are edge triggered,
262 * we could lose an interrupt this way because
263 * we acknowledge all ints at onces. Revisit.
264 */
265 status |= it8172_hw0_icregs->lpc_req;
266 it8172_hw0_icregs->lpc_req = 0; /* acknowledge ints */
267 irq = 0;
268 while (!(status & 0x1)) {
269 irq++;
270 status >>= 1;
271 }
272 irq += IT8172_LPC_IRQ_BASE;
273 } else
274 return;
275
276 do_IRQ(irq, regs);
277}
278
279asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
280{
281 unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
282
283 if (!pending)
284 mips_spurious_interrupt(regs);
285 else if (pending & CAUSEF_IP7)
286 ll_timer_interrupt(127, regs);
287 else if (pending & CAUSEF_IP2)
288 it8172_hw0_irqdispatch(regs);
289}
290
291void show_pending_irqs(void)
292{
293 fputs("intstatus: ");
294 put32(it8172_hw0_icregs->intstatus);
295 puts("");
296
297 fputs("pci_req: ");
298 put32(it8172_hw0_icregs->pci_req);
299 puts("");
300
301 fputs("lb_req: ");
302 put32(it8172_hw0_icregs->lb_req);
303 puts("");
304
305 fputs("lpc_req: ");
306 put32(it8172_hw0_icregs->lpc_req);
307 puts("");
308}
diff --git a/arch/mips/ite-boards/generic/it8172_cir.c b/arch/mips/ite-boards/generic/it8172_cir.c
deleted file mode 100644
index bfc25adcfec6..000000000000
--- a/arch/mips/ite-boards/generic/it8172_cir.c
+++ /dev/null
@@ -1,170 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 Consumer IR port generic routines.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31
32#ifdef CONFIG_IT8172_CIR
33
34#include <linux/types.h>
35#include <linux/pci.h>
36#include <linux/kernel.h>
37#include <linux/init.h>
38
39#include <asm/it8172/it8172.h>
40#include <asm/it8172/it8172_cir.h>
41
42
43volatile struct it8172_cir_regs *cir_regs[NUM_CIR_PORTS] = {
44 (volatile struct it8172_cir_regs *)(KSEG1ADDR(IT8172_PCI_IO_BASE + IT_CIR0_BASE)),
45 (volatile struct it8172_cir_regs *)(KSEG1ADDR(IT8172_PCI_IO_BASE + IT_CIR1_BASE))};
46
47
48/*
49 * Initialize Consumer IR Port.
50 */
51int cir_port_init(struct cir_port *cir)
52{
53 int port = cir->port;
54 unsigned char data;
55
56 /* set baud rate */
57 cir_regs[port]->bdlr = cir->baud_rate & 0xff;
58 cir_regs[port]->bdhr = (cir->baud_rate >> 8) & 0xff;
59
60 /* set receiver control register */
61 cir_regs[port]->rcr = (CIR_SET_RDWOS(cir->rdwos) | CIR_SET_RXDCR(cir->rxdcr));
62
63 /* set carrier frequency register */
64 cir_regs[port]->cfr = (CIR_SET_CF(cir->cfq) | CIR_SET_HS(cir->hcfs));
65
66 /* set fifo threshold */
67 data = cir_regs[port]->mstcr & 0xf3;
68 data |= CIR_SET_FIFO_TL(cir->fifo_tl);
69 cir_regs[port]->mstcr = data;
70
71 clear_fifo(cir);
72 enable_receiver(cir);
73 disable_rx_demodulation(cir);
74
75 set_rx_active(cir);
76 int_enable(cir);
77 rx_int_enable(cir);
78
79 return 0;
80}
81
82
83void clear_fifo(struct cir_port *cir)
84{
85 cir_regs[cir->port]->mstcr |= CIR_FIFO_CLEAR;
86}
87
88void enable_receiver(struct cir_port *cir)
89{
90 cir_regs[cir->port]->rcr |= CIR_RXEN;
91}
92
93void disable_receiver(struct cir_port *cir)
94{
95 cir_regs[cir->port]->rcr &= ~CIR_RXEN;
96}
97
98void enable_rx_demodulation(struct cir_port *cir)
99{
100 cir_regs[cir->port]->rcr |= CIR_RXEND;
101}
102
103void disable_rx_demodulation(struct cir_port *cir)
104{
105 cir_regs[cir->port]->rcr &= ~CIR_RXEND;
106}
107
108void set_rx_active(struct cir_port *cir)
109{
110 cir_regs[cir->port]->rcr |= CIR_RXACT;
111}
112
113void int_enable(struct cir_port *cir)
114{
115 cir_regs[cir->port]->ier |= CIR_IEC;
116}
117
118void rx_int_enable(struct cir_port *cir)
119{
120 cir_regs[cir->port]->ier |= CIR_RDAIE;
121}
122
123void dump_regs(struct cir_port *cir)
124{
125 printk("mstcr %x ier %x iir %x cfr %x rcr %x tcr %x tfsr %x rfsr %x\n",
126 cir_regs[cir->port]->mstcr,
127 cir_regs[cir->port]->ier,
128 cir_regs[cir->port]->iir,
129 cir_regs[cir->port]->cfr,
130 cir_regs[cir->port]->rcr,
131 cir_regs[cir->port]->tcr,
132 cir_regs[cir->port]->tfsr,
133 cir_regs[cir->port]->rfsr);
134
135 while (cir_regs[cir->port]->iir & CIR_RDAI) {
136 printk("data %x\n", cir_regs[cir->port]->dr);
137 }
138}
139
140void dump_reg_addr(struct cir_port *cir)
141{
142 printk("dr %x mstcr %x ier %x iir %x cfr %x rcr %x tcr %x bdlr %x bdhr %x tfsr %x rfsr %x\n",
143 (unsigned)&cir_regs[cir->port]->dr,
144 (unsigned)&cir_regs[cir->port]->mstcr,
145 (unsigned)&cir_regs[cir->port]->ier,
146 (unsigned)&cir_regs[cir->port]->iir,
147 (unsigned)&cir_regs[cir->port]->cfr,
148 (unsigned)&cir_regs[cir->port]->rcr,
149 (unsigned)&cir_regs[cir->port]->tcr,
150 (unsigned)&cir_regs[cir->port]->bdlr,
151 (unsigned)&cir_regs[cir->port]->bdhr,
152 (unsigned)&cir_regs[cir->port]->tfsr,
153 (unsigned)&cir_regs[cir->port]->rfsr);
154}
155
156int cir_get_rx_count(struct cir_port *cir)
157{
158 return cir_regs[cir->port]->rfsr & CIR_RXFBC_MASK;
159}
160
161char cir_read_data(struct cir_port *cir)
162{
163 return cir_regs[cir->port]->dr;
164}
165
166char get_int_status(struct cir_port *cir)
167{
168 return cir_regs[cir->port]->iir;
169}
170#endif
diff --git a/arch/mips/ite-boards/generic/it8172_setup.c b/arch/mips/ite-boards/generic/it8172_setup.c
deleted file mode 100644
index 07faf3cacff2..000000000000
--- a/arch/mips/ite-boards/generic/it8172_setup.c
+++ /dev/null
@@ -1,352 +0,0 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * IT8172/QED5231 board setup.
4 *
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29#include <linux/init.h>
30#include <linux/sched.h>
31#include <linux/ioport.h>
32#include <linux/irq.h>
33#include <linux/serial_reg.h>
34#include <linux/major.h>
35#include <linux/kdev_t.h>
36#include <linux/root_dev.h>
37#include <linux/pm.h>
38
39#include <asm/cpu.h>
40#include <asm/time.h>
41#include <asm/io.h>
42#include <asm/bootinfo.h>
43#include <asm/irq.h>
44#include <asm/mipsregs.h>
45#include <asm/reboot.h>
46#include <asm/traps.h>
47#include <asm/it8172/it8172.h>
48#include <asm/it8712.h>
49
50extern struct resource ioport_resource;
51#ifdef CONFIG_SERIO_I8042
52int init_8712_keyboard(void);
53#endif
54
55extern int SearchIT8712(void);
56extern void InitLPCInterface(void);
57extern char * __init prom_getcmdline(void);
58extern void it8172_restart(char *command);
59extern void it8172_halt(void);
60extern void it8172_power_off(void);
61
62extern void it8172_time_init(void);
63
64#ifdef CONFIG_IT8172_REVC
65struct {
66 struct resource ram;
67 struct resource pci_mem;
68 struct resource pci_io;
69 struct resource flash;
70 struct resource boot;
71} it8172_resources = {
72 {
73 .start = 0, /* to be initted */
74 .end = 0,
75 .name = "RAM",
76 .flags = IORESOURCE_MEM
77 }, {
78 .start = 0x10000000,
79 .end = 0x13FFFFFF,
80 .name = "PCI Mem",
81 .flags = IORESOURCE_MEM
82 }, {
83 .start = 0x14000000,
84 .end = 0x17FFFFFF
85 .name = "PCI I/O",
86 }, {
87 .start = 0x08000000,
88 .end = 0x0CFFFFFF
89 .name = "Flash",
90 }, {
91 .start = 0x1FC00000,
92 .end = 0x1FFFFFFF
93 .name = "Boot ROM",
94 }
95};
96#else
97struct {
98 struct resource ram;
99 struct resource pci_mem0;
100 struct resource pci_mem1;
101 struct resource pci_io;
102 struct resource pci_mem2;
103 struct resource pci_mem3;
104 struct resource flash;
105 struct resource boot;
106} it8172_resources = {
107 {
108 .start = 0, /* to be initted */
109 .end = 0,
110 .name = "RAM",
111 .flags = IORESOURCE_MEM
112 }, {
113 .start = 0x0C000000,
114 .end = 0x0FFFFFFF,
115 .name = "PCI Mem0",
116 .flags = IORESOURCE_MEM
117 }, {
118 .start = 0x10000000,
119 .end = 0x13FFFFFF,
120 .name = "PCI Mem1",
121 .flags = IORESOURCE_MEM
122 }, {
123 .start = 0x14000000,
124 .end = 0x17FFFFFF
125 .name = "PCI I/O",
126 }, {
127 .start = 0x1A000000,
128 .end = 0x1BFFFFFF,
129 .name = "PCI Mem2",
130 .flags = IORESOURCE_MEM
131 }, {
132 .start = 0x1C000000,
133 .end = 0x1FBFFFFF,
134 .name = "PCI Mem3",
135 .flags = IORESOURCE_MEM
136 }, {
137 .start = 0x08000000,
138 .end = 0x0CFFFFFF
139 .name = "Flash",
140 }, {
141 .start = 0x1FC00000,
142 .end = 0x1FFFFFFF
143 .name = "Boot ROM",
144 }
145};
146#endif
147
148
149void __init it8172_init_ram_resource(unsigned long memsize)
150{
151 it8172_resources.ram.end = memsize;
152}
153
154void __init plat_mem_setup(void)
155{
156 unsigned short dsr;
157 char *argptr;
158
159 argptr = prom_getcmdline();
160#ifdef CONFIG_SERIAL_CONSOLE
161 if ((argptr = strstr(argptr, "console=")) == NULL) {
162 argptr = prom_getcmdline();
163 strcat(argptr, " console=ttyS0,115200");
164 }
165#endif
166
167 clear_c0_status(ST0_FR);
168
169 board_time_init = it8172_time_init;
170
171 _machine_restart = it8172_restart;
172 _machine_halt = it8172_halt;
173 pm_power_off = it8172_power_off;
174
175 /*
176 * IO/MEM resources.
177 *
178 * revisit this area.
179 */
180 set_io_port_base(KSEG1);
181 ioport_resource.start = it8172_resources.pci_io.start;
182 ioport_resource.end = it8172_resources.pci_io.end;
183#ifdef CONFIG_IT8172_REVC
184 iomem_resource.start = it8172_resources.pci_mem.start;
185 iomem_resource.end = it8172_resources.pci_mem.end;
186#else
187 iomem_resource.start = it8172_resources.pci_mem0.start;
188 iomem_resource.end = it8172_resources.pci_mem3.end;
189#endif
190
191#ifdef CONFIG_BLK_DEV_INITRD
192 ROOT_DEV = Root_RAM0;
193#endif
194
195 /*
196 * Pull enabled devices out of standby
197 */
198 IT_IO_READ16(IT_PM_DSR, dsr);
199
200 /*
201 * Fixme: This breaks when these drivers are modules!!!
202 */
203#ifdef CONFIG_SOUND_IT8172
204 dsr &= ~IT_PM_DSR_ACSB;
205#else
206 dsr |= IT_PM_DSR_ACSB;
207#endif
208#ifdef CONFIG_BLK_DEV_IT8172
209 dsr &= ~IT_PM_DSR_IDESB;
210#else
211 dsr |= IT_PM_DSR_IDESB;
212#endif
213 IT_IO_WRITE16(IT_PM_DSR, dsr);
214
215 InitLPCInterface();
216
217#ifdef CONFIG_MIPS_ITE8172
218 if (SearchIT8712()) {
219 printk("Found IT8712 Super IO\n");
220 /* enable IT8712 serial port */
221 LPCSetConfig(LDN_SERIAL1, 0x30, 0x01); /* enable */
222 LPCSetConfig(LDN_SERIAL1, 0x23, 0x01); /* clock selection */
223#ifdef CONFIG_SERIO_I8042
224 if (init_8712_keyboard()) {
225 printk("Unable to initialize keyboard\n");
226 LPCSetConfig(LDN_KEYBOARD, 0x30, 0x0); /* disable keyboard */
227 } else {
228 LPCSetConfig(LDN_KEYBOARD, 0x30, 0x1); /* enable keyboard */
229 LPCSetConfig(LDN_KEYBOARD, 0xf0, 0x2);
230 LPCSetConfig(LDN_KEYBOARD, 0x71, 0x3);
231
232 LPCSetConfig(LDN_MOUSE, 0x30, 0x1); /* enable mouse */
233
234 LPCSetConfig(0x4, 0x30, 0x1);
235 LPCSetConfig(0x4, 0xf4, LPCGetConfig(0x4, 0xf4) | 0x80);
236
237 if ((LPCGetConfig(LDN_KEYBOARD, 0x30) == 0) ||
238 (LPCGetConfig(LDN_MOUSE, 0x30) == 0))
239 printk("Error: keyboard or mouse not enabled\n");
240
241 }
242#endif
243 }
244 else {
245 printk("IT8712 Super IO not found\n");
246 }
247#endif
248
249#ifdef CONFIG_IT8172_CIR
250 {
251 unsigned long data;
252 //printk("Enabling CIR0\n");
253 IT_IO_READ16(IT_PM_DSR, data);
254 data &= ~IT_PM_DSR_CIR0SB;
255 IT_IO_WRITE16(IT_PM_DSR, data);
256 //printk("DSR register: %x\n", (unsigned)IT_IO_READ16(IT_PM_DSR, data));
257 }
258#endif
259#ifdef CONFIG_IT8172_SCR0
260 {
261 unsigned i;
262 /* Enable Smart Card Reader 0 */
263 /* First power it up */
264 IT_IO_READ16(IT_PM_DSR, i);
265 i &= ~IT_PM_DSR_SCR0SB;
266 IT_IO_WRITE16(IT_PM_DSR, i);
267 /* Then initialize its registers */
268 outb(( IT_SCR_SFR_GATE_UART_OFF << IT_SCR_SFR_GATE_UART_BIT
269 |IT_SCR_SFR_FET_CHARGE_213_US << IT_SCR_SFR_FET_CHARGE_BIT
270 |IT_SCR_SFR_CARD_FREQ_3_5_MHZ << IT_SCR_SFR_CARD_FREQ_BIT
271 |IT_SCR_SFR_FET_ACTIVE_INVERT << IT_SCR_SFR_FET_ACTIVE_BIT
272 |IT_SCR_SFR_ENABLE_ON << IT_SCR_SFR_ENABLE_BIT),
273 IT8172_PCI_IO_BASE + IT_SCR0_BASE + IT_SCR_SFR);
274 outb(IT_SCR_SCDR_RESET_MODE_ASYNC << IT_SCR_SCDR_RESET_MODE_BIT,
275 IT8172_PCI_IO_BASE + IT_SCR0_BASE + IT_SCR_SCDR);
276 }
277#endif /* CONFIG_IT8172_SCR0 */
278#ifdef CONFIG_IT8172_SCR1
279 {
280 unsigned i;
281 /* Enable Smart Card Reader 1 */
282 /* First power it up */
283 IT_IO_READ16(IT_PM_DSR, i);
284 i &= ~IT_PM_DSR_SCR1SB;
285 IT_IO_WRITE16(IT_PM_DSR, i);
286 /* Then initialize its registers */
287 outb(( IT_SCR_SFR_GATE_UART_OFF << IT_SCR_SFR_GATE_UART_BIT
288 |IT_SCR_SFR_FET_CHARGE_213_US << IT_SCR_SFR_FET_CHARGE_BIT
289 |IT_SCR_SFR_CARD_FREQ_3_5_MHZ << IT_SCR_SFR_CARD_FREQ_BIT
290 |IT_SCR_SFR_FET_ACTIVE_INVERT << IT_SCR_SFR_FET_ACTIVE_BIT
291 |IT_SCR_SFR_ENABLE_ON << IT_SCR_SFR_ENABLE_BIT),
292 IT8172_PCI_IO_BASE + IT_SCR1_BASE + IT_SCR_SFR);
293 outb(IT_SCR_SCDR_RESET_MODE_ASYNC << IT_SCR_SCDR_RESET_MODE_BIT,
294 IT8172_PCI_IO_BASE + IT_SCR1_BASE + IT_SCR_SCDR);
295 }
296#endif /* CONFIG_IT8172_SCR1 */
297}
298
299#ifdef CONFIG_SERIO_I8042
300/*
301 * According to the ITE Special BIOS Note for waking up the
302 * keyboard controller...
303 */
304static int init_8712_keyboard(void)
305{
306 unsigned int cmd_port = 0x14000064;
307 unsigned int data_port = 0x14000060;
308 ^^^^^^^^^^^
309 Somebody here doesn't grok the concept of io ports.
310
311 unsigned char data;
312 int i;
313
314 outb(0xaa, cmd_port); /* send self-test cmd */
315 i = 0;
316 while (!(inb(cmd_port) & 0x1)) { /* wait output buffer full */
317 i++;
318 if (i > 0xffffff)
319 return 1;
320 }
321
322 data = inb(data_port);
323 outb(0xcb, cmd_port); /* set ps2 mode */
324 while (inb(cmd_port) & 0x2) { /* wait while input buffer full */
325 i++;
326 if (i > 0xffffff)
327 return 1;
328 }
329 outb(0x01, data_port);
330 while (inb(cmd_port) & 0x2) { /* wait while input buffer full */
331 i++;
332 if (i > 0xffffff)
333 return 1;
334 }
335
336 outb(0x60, cmd_port); /* write 8042 command byte */
337 while (inb(cmd_port) & 0x2) { /* wait while input buffer full */
338 i++;
339 if (i > 0xffffff)
340 return 1;
341 }
342 outb(0x45, data_port); /* at interface, keyboard enabled, system flag */
343 while (inb(cmd_port) & 0x2) { /* wait while input buffer full */
344 i++;
345 if (i > 0xffffff)
346 return 1;
347 }
348
349 outb(0xae, cmd_port); /* enable interface */
350 return 0;
351}
352#endif
diff --git a/arch/mips/ite-boards/generic/lpc.c b/arch/mips/ite-boards/generic/lpc.c
deleted file mode 100644
index cc7584fbef8a..000000000000
--- a/arch/mips/ite-boards/generic/lpc.c
+++ /dev/null
@@ -1,144 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * ITE Semi IT8712 Super I/O functions.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#include <asm/io.h>
32#include <asm/types.h>
33#include <asm/it8712.h>
34#include <asm/it8172/it8172.h>
35
36#ifndef TRUE
37#define TRUE 1
38#endif
39
40#ifndef FALSE
41#define FALSE 0
42#endif
43
44void LPCEnterMBPnP(void)
45{
46 int i;
47 unsigned char key[4] = {0x87, 0x01, 0x55, 0x55};
48
49 for (i = 0; i<4; i++)
50 outb(key[i], LPC_KEY_ADDR);
51
52}
53
54void LPCExitMBPnP(void)
55{
56 outb(0x02, LPC_KEY_ADDR);
57 outb(0x02, LPC_DATA_ADDR);
58}
59
60void LPCSetConfig(char LdnNumber, char Index, char data)
61{
62 LPCEnterMBPnP(); // Enter IT8712 MB PnP mode
63 outb(0x07, LPC_KEY_ADDR);
64 outb(LdnNumber, LPC_DATA_ADDR);
65 outb(Index, LPC_KEY_ADDR);
66 outb(data, LPC_DATA_ADDR);
67 LPCExitMBPnP();
68}
69
70char LPCGetConfig(char LdnNumber, char Index)
71{
72 char rtn;
73
74 LPCEnterMBPnP(); // Enter IT8712 MB PnP mode
75 outb(0x07, LPC_KEY_ADDR);
76 outb(LdnNumber, LPC_DATA_ADDR);
77 outb(Index, LPC_KEY_ADDR);
78 rtn = inb(LPC_DATA_ADDR);
79 LPCExitMBPnP();
80 return rtn;
81}
82
83int SearchIT8712(void)
84{
85 unsigned char Id1, Id2;
86 unsigned short Id;
87
88 LPCEnterMBPnP();
89 outb(0x20, LPC_KEY_ADDR); /* chip id byte 1 */
90 Id1 = inb(LPC_DATA_ADDR);
91 outb(0x21, LPC_KEY_ADDR); /* chip id byte 2 */
92 Id2 = inb(LPC_DATA_ADDR);
93 Id = (Id1 << 8) | Id2;
94 LPCExitMBPnP();
95 if (Id == 0x8712)
96 return TRUE;
97 else
98 return FALSE;
99}
100
101void InitLPCInterface(void)
102{
103 unsigned char bus, dev_fn;
104 unsigned long data;
105
106 bus = 0;
107 dev_fn = 1<<3 | 4;
108
109
110 /* pci cmd, SERR# Enable */
111 IT_WRITE(IT_CONFADDR,
112 (bus << IT_BUSNUM_SHF) |
113 (dev_fn << IT_FUNCNUM_SHF) |
114 ((0x4 / 4) << IT_REGNUM_SHF));
115 IT_READ(IT_CONFDATA, data);
116 data |= 0x0100;
117 IT_WRITE(IT_CONFADDR,
118 (bus << IT_BUSNUM_SHF) |
119 (dev_fn << IT_FUNCNUM_SHF) |
120 ((0x4 / 4) << IT_REGNUM_SHF));
121 IT_WRITE(IT_CONFDATA, data);
122
123 /* setup serial irq control register */
124 IT_WRITE(IT_CONFADDR,
125 (bus << IT_BUSNUM_SHF) |
126 (dev_fn << IT_FUNCNUM_SHF) |
127 ((0x48 / 4) << IT_REGNUM_SHF));
128 IT_READ(IT_CONFDATA, data);
129 data = (data & 0xffff00ff) | 0xc400;
130 IT_WRITE(IT_CONFADDR,
131 (bus << IT_BUSNUM_SHF) |
132 (dev_fn << IT_FUNCNUM_SHF) |
133 ((0x48 / 4) << IT_REGNUM_SHF));
134 IT_WRITE(IT_CONFDATA, data);
135
136
137 /* Enable I/O Space Subtractive Decode */
138 /* default 0x4C is 0x3f220000 */
139 IT_WRITE(IT_CONFADDR,
140 (bus << IT_BUSNUM_SHF) |
141 (dev_fn << IT_FUNCNUM_SHF) |
142 ((0x4C / 4) << IT_REGNUM_SHF));
143 IT_WRITE(IT_CONFDATA, 0x3f2200f3);
144}
diff --git a/arch/mips/ite-boards/generic/pmon_prom.c b/arch/mips/ite-boards/generic/pmon_prom.c
deleted file mode 100644
index 7d0a79be34d8..000000000000
--- a/arch/mips/ite-boards/generic/pmon_prom.c
+++ /dev/null
@@ -1,135 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * PROM library initialisation code, assuming a version of
5 * pmon is the boot code.
6 *
7 * Copyright 2000 MontaVista Software Inc.
8 * Author: MontaVista Software, Inc.
9 * ppopov@mvista.com or source@mvista.com
10 *
11 * This file was derived from Carsten Langgaard's
12 * arch/mips/mips-boards/xx files.
13 *
14 * Carsten Langgaard, carstenl@mips.com
15 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
16 *
17 * This program is free software; you can redistribute it and/or modify it
18 * under the terms of the GNU General Public License as published by the
19 * Free Software Foundation; either version 2 of the License, or (at your
20 * option) any later version.
21 *
22 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
23 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
24 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
25 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
26 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
27 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
28 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
29 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
31 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 *
33 * You should have received a copy of the GNU General Public License along
34 * with this program; if not, write to the Free Software Foundation, Inc.,
35 * 675 Mass Ave, Cambridge, MA 02139, USA.
36 */
37
38#include <linux/kernel.h>
39#include <linux/init.h>
40#include <linux/string.h>
41
42#include <asm/bootinfo.h>
43
44extern int prom_argc;
45extern char **prom_argv, **prom_envp;
46
47typedef struct
48{
49 char *name;
50/* char *val; */
51}t_env_var;
52
53
54char * __init prom_getcmdline(void)
55{
56 return &(arcs_cmdline[0]);
57}
58
59void __init prom_init_cmdline(void)
60{
61 char *cp;
62 int actr;
63
64 actr = 1; /* Always ignore argv[0] */
65
66 cp = &(arcs_cmdline[0]);
67 while(actr < prom_argc) {
68 strcpy(cp, prom_argv[actr]);
69 cp += strlen(prom_argv[actr]);
70 *cp++ = ' ';
71 actr++;
72 }
73 if (cp != &(arcs_cmdline[0])) /* get rid of trailing space */
74 --cp;
75 *cp = '\0';
76
77}
78
79
80char *prom_getenv(char *envname)
81{
82 /*
83 * Return a pointer to the given environment variable.
84 * Environment variables are stored in the form of "memsize=64".
85 */
86
87 t_env_var *env = (t_env_var *)prom_envp;
88 int i;
89
90 i = strlen(envname);
91
92 while(env->name) {
93 if(strncmp(envname, env->name, i) == 0) {
94 return(env->name + strlen(envname) + 1);
95 }
96 env++;
97 }
98 return(NULL);
99}
100
101static inline unsigned char str2hexnum(unsigned char c)
102{
103 if(c >= '0' && c <= '9')
104 return c - '0';
105 if(c >= 'a' && c <= 'f')
106 return c - 'a' + 10;
107 return 0; /* foo */
108}
109
110unsigned long __init prom_free_prom_memory(void)
111{
112 return 0;
113}
114
115unsigned long __init prom_get_memsize(void)
116{
117 char *memsize_str;
118 unsigned int memsize;
119
120 memsize_str = prom_getenv("memsize");
121 if (!memsize_str) {
122#ifdef CONFIG_MIPS_ITE8172
123 memsize = 32;
124#elif defined(CONFIG_MIPS_IVR)
125 memsize = 64;
126#else
127 memsize = 8;
128#endif
129 printk("memsize unknown: setting to %dMB\n", memsize);
130 } else {
131 printk("memsize: %s\n", memsize_str);
132 memsize = simple_strtol(memsize_str, NULL, 0);
133 }
134 return memsize;
135}
diff --git a/arch/mips/ite-boards/generic/puts.c b/arch/mips/ite-boards/generic/puts.c
deleted file mode 100644
index 20b02df6b414..000000000000
--- a/arch/mips/ite-boards/generic/puts.c
+++ /dev/null
@@ -1,139 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Low level uart routines to directly access a 16550 uart.
5 *
6 * Copyright 2000,2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#include <linux/types.h>
32
33#define SERIAL_BASE 0xB4011800 /* it8172 */
34#define SER_CMD 5
35#define SER_DATA 0x00
36#define TX_BUSY 0x20
37
38#define TIMEOUT 0xffff
39#undef SLOW_DOWN
40
41static const char digits[16] = "0123456789abcdef";
42static volatile unsigned char *const com1 = (unsigned char *) SERIAL_BASE;
43
44
45#ifdef SLOW_DOWN
46static inline void slow_down()
47{
48 int k;
49 for (k = 0; k < 10000; k++);
50}
51#else
52#define slow_down()
53#endif
54
55void putch(const unsigned char c)
56{
57 unsigned char ch;
58 int i = 0;
59
60 do {
61 ch = com1[SER_CMD];
62 slow_down();
63 i++;
64 if (i > TIMEOUT) {
65 break;
66 }
67 } while (0 == (ch & TX_BUSY));
68 com1[SER_DATA] = c;
69}
70
71void puts(unsigned char *cp)
72{
73 unsigned char ch;
74 int i = 0;
75
76 while (*cp) {
77 do {
78 ch = com1[SER_CMD];
79 slow_down();
80 i++;
81 if (i > TIMEOUT) {
82 break;
83 }
84 } while (0 == (ch & TX_BUSY));
85 com1[SER_DATA] = *cp++;
86 }
87 putch('\r');
88 putch('\n');
89}
90
91void fputs(unsigned char *cp)
92{
93 unsigned char ch;
94 int i = 0;
95
96 while (*cp) {
97
98 do {
99 ch = com1[SER_CMD];
100 slow_down();
101 i++;
102 if (i > TIMEOUT) {
103 break;
104 }
105 } while (0 == (ch & TX_BUSY));
106 com1[SER_DATA] = *cp++;
107 }
108}
109
110
111void put64(uint64_t ul)
112{
113 int cnt;
114 unsigned ch;
115
116 cnt = 16; /* 16 nibbles in a 64 bit long */
117 putch('0');
118 putch('x');
119 do {
120 cnt--;
121 ch = (unsigned char) (ul >> cnt * 4) & 0x0F;
122 putch(digits[ch]);
123 } while (cnt > 0);
124}
125
126void put32(unsigned u)
127{
128 int cnt;
129 unsigned ch;
130
131 cnt = 8; /* 8 nibbles in a 32 bit long */
132 putch('0');
133 putch('x');
134 do {
135 cnt--;
136 ch = (unsigned char) (u >> cnt * 4) & 0x0F;
137 putch(digits[ch]);
138 } while (cnt > 0);
139}
diff --git a/arch/mips/ite-boards/generic/reset.c b/arch/mips/ite-boards/generic/reset.c
deleted file mode 100644
index 03bd5ba8c913..000000000000
--- a/arch/mips/ite-boards/generic/reset.c
+++ /dev/null
@@ -1,60 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * ITE 8172 reset routines.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#include <linux/sched.h>
32#include <linux/mm.h>
33#include <asm/cacheflush.h>
34#include <asm/io.h>
35#include <asm/processor.h>
36#include <asm/reboot.h>
37#include <asm/system.h>
38
39void it8172_restart()
40{
41 set_c0_status(ST0_BEV | ST0_ERL);
42 change_c0_config(CONF_CM_CMASK, CONF_CM_UNCACHED);
43 flush_cache_all();
44 write_c0_wired(0);
45 __asm__ __volatile__("jr\t%0"::"r"(0xbfc00000));
46}
47
48void it8172_halt(void)
49{
50 printk(KERN_NOTICE "\n** You can safely turn off the power\n");
51 while (1)
52 __asm__(".set\tmips3\n\t"
53 "wait\n\t"
54 ".set\tmips0");
55}
56
57void it8172_power_off(void)
58{
59 it8172_halt();
60}
diff --git a/arch/mips/ite-boards/generic/time.c b/arch/mips/ite-boards/generic/time.c
deleted file mode 100644
index 3dc55569ff7f..000000000000
--- a/arch/mips/ite-boards/generic/time.c
+++ /dev/null
@@ -1,249 +0,0 @@
1/*
2 * Carsten Langgaard, carstenl@mips.com
3 * Copyright (C) 1999,2000 MIPS Technologies, Inc. All rights reserved.
4 *
5 * Copyright (C) 2003 MontaVista Software Inc.
6 * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
7 *
8 * ########################################################################
9 *
10 * This program is free software; you can distribute it and/or modify it
11 * under the terms of the GNU General Public License (Version 2) as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
17 * for more details.
18 *
19 * You should have received a copy of the GNU General Public License along
20 * with this program; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston MA 02111-1307, USA.
22 *
23 * ########################################################################
24 *
25 * Setting up the clock on the MIPS boards.
26 */
27#include <linux/init.h>
28#include <linux/kernel_stat.h>
29#include <linux/sched.h>
30#include <linux/time.h>
31#include <linux/spinlock.h>
32#include <linux/mc146818rtc.h>
33
34#include <asm/time.h>
35#include <asm/mipsregs.h>
36#include <asm/ptrace.h>
37#include <asm/it8172/it8172.h>
38#include <asm/it8172/it8172_int.h>
39#include <asm/debug.h>
40
41#define IT8172_RTC_ADR_REG (IT8172_PCI_IO_BASE + IT_RTC_BASE)
42#define IT8172_RTC_DAT_REG (IT8172_RTC_ADR_REG + 1)
43#define IT8172_RTC_CENTURY_REG (IT8172_PCI_IO_BASE + IT_RTC_CENTURY)
44
45static volatile char *rtc_adr_reg = (char*)KSEG1ADDR(IT8172_RTC_ADR_REG);
46static volatile char *rtc_dat_reg = (char*)KSEG1ADDR(IT8172_RTC_DAT_REG);
47static volatile char *rtc_century_reg = (char*)KSEG1ADDR(IT8172_RTC_CENTURY_REG);
48
49unsigned char it8172_rtc_read_data(unsigned long addr)
50{
51 unsigned char retval;
52
53 *rtc_adr_reg = addr;
54 retval = *rtc_dat_reg;
55 return retval;
56}
57
58void it8172_rtc_write_data(unsigned char data, unsigned long addr)
59{
60 *rtc_adr_reg = addr;
61 *rtc_dat_reg = data;
62}
63
64#undef CMOS_READ
65#undef CMOS_WRITE
66#define CMOS_READ(addr) it8172_rtc_read_data(addr)
67#define CMOS_WRITE(data, addr) it8172_rtc_write_data(data, addr)
68
69static unsigned char saved_control; /* remember rtc control reg */
70static inline int rtc_24h(void) { return saved_control & RTC_24H; }
71static inline int rtc_dm_binary(void) { return saved_control & RTC_DM_BINARY; }
72
73static inline unsigned char
74bin_to_hw(unsigned char c)
75{
76 if (rtc_dm_binary())
77 return c;
78 else
79 return ((c/10) << 4) + (c%10);
80}
81
82static inline unsigned char
83hw_to_bin(unsigned char c)
84{
85 if (rtc_dm_binary())
86 return c;
87 else
88 return (c>>4)*10 + (c &0xf);
89}
90
91/* 0x80 bit indicates pm in 12-hour format */
92static inline unsigned char
93hour_bin_to_hw(unsigned char c)
94{
95 if (rtc_24h())
96 return bin_to_hw(c);
97 if (c >= 12)
98 return 0x80 | bin_to_hw((c==12)?12:c-12); /* 12 is 12pm */
99 else
100 return bin_to_hw((c==0)?12:c); /* 0 is 12 AM, not 0 am */
101}
102
103static inline unsigned char
104hour_hw_to_bin(unsigned char c)
105{
106 unsigned char tmp = hw_to_bin(c&0x3f);
107 if (rtc_24h())
108 return tmp;
109 if (c & 0x80)
110 return (tmp==12)?12:tmp+12; /* 12pm is 12, not 24 */
111 else
112 return (tmp==12)?0:tmp; /* 12am is 0 */
113}
114
115static unsigned long r4k_offset; /* Amount to increment compare reg each time */
116static unsigned long r4k_cur; /* What counter should be at next timer irq */
117extern unsigned int mips_hpt_frequency;
118
119/*
120 * Figure out the r4k offset, the amount to increment the compare
121 * register for each time tick.
122 * Use the RTC to calculate offset.
123 */
124static unsigned long __init cal_r4koff(void)
125{
126 unsigned int flags;
127
128 local_irq_save(flags);
129
130 /* Start counter exactly on falling edge of update flag */
131 while (CMOS_READ(RTC_REG_A) & RTC_UIP);
132 while (!(CMOS_READ(RTC_REG_A) & RTC_UIP));
133
134 /* Start r4k counter. */
135 write_c0_count(0);
136
137 /* Read counter exactly on falling edge of update flag */
138 while (CMOS_READ(RTC_REG_A) & RTC_UIP);
139 while (!(CMOS_READ(RTC_REG_A) & RTC_UIP));
140
141 mips_hpt_frequency = read_c0_count();
142
143 /* restore interrupts */
144 local_irq_restore(flags);
145
146 return (mips_hpt_frequency / HZ);
147}
148
149static unsigned long
150it8172_rtc_get_time(void)
151{
152 unsigned int year, mon, day, hour, min, sec;
153 unsigned int flags;
154
155 /* avoid update-in-progress. */
156 for (;;) {
157 local_irq_save(flags);
158 if (! (CMOS_READ(RTC_REG_A) & RTC_UIP))
159 break;
160 /* don't hold intr closed all the time */
161 local_irq_restore(flags);
162 }
163
164 /* Read regs. */
165 sec = hw_to_bin(CMOS_READ(RTC_SECONDS));
166 min = hw_to_bin(CMOS_READ(RTC_MINUTES));
167 hour = hour_hw_to_bin(CMOS_READ(RTC_HOURS));
168 day = hw_to_bin(CMOS_READ(RTC_DAY_OF_MONTH));
169 mon = hw_to_bin(CMOS_READ(RTC_MONTH));
170 year = hw_to_bin(CMOS_READ(RTC_YEAR)) +
171 hw_to_bin(*rtc_century_reg) * 100;
172
173 /* restore interrupts */
174 local_irq_restore(flags);
175
176 return mktime(year, mon, day, hour, min, sec);
177}
178
179static int
180it8172_rtc_set_time(unsigned long t)
181{
182 struct rtc_time tm;
183 unsigned int flags;
184
185 /* convert */
186 to_tm(t, &tm);
187
188 /* avoid update-in-progress. */
189 for (;;) {
190 local_irq_save(flags);
191 if (! (CMOS_READ(RTC_REG_A) & RTC_UIP))
192 break;
193 /* don't hold intr closed all the time */
194 local_irq_restore(flags);
195 }
196
197 *rtc_century_reg = bin_to_hw(tm.tm_year/100);
198 CMOS_WRITE(bin_to_hw(tm.tm_sec), RTC_SECONDS);
199 CMOS_WRITE(bin_to_hw(tm.tm_min), RTC_MINUTES);
200 CMOS_WRITE(hour_bin_to_hw(tm.tm_hour), RTC_HOURS);
201 CMOS_WRITE(bin_to_hw(tm.tm_mday), RTC_DAY_OF_MONTH);
202 CMOS_WRITE(bin_to_hw(tm.tm_mon+1), RTC_MONTH); /* tm_mon starts from 0 */
203 CMOS_WRITE(bin_to_hw(tm.tm_year%100), RTC_YEAR);
204
205 /* restore interrupts */
206 local_irq_restore(flags);
207
208 return 0;
209}
210
211void __init it8172_time_init(void)
212{
213 unsigned int est_freq, flags;
214
215 local_irq_save(flags);
216
217 saved_control = CMOS_READ(RTC_CONTROL);
218
219 printk("calculating r4koff... ");
220 r4k_offset = cal_r4koff();
221 printk("%08lx(%d)\n", r4k_offset, (int) r4k_offset);
222
223 est_freq = 2*r4k_offset*HZ;
224 est_freq += 5000; /* round */
225 est_freq -= est_freq%10000;
226 printk("CPU frequency %d.%02d MHz\n", est_freq/1000000,
227 (est_freq%1000000)*100/1000000);
228
229 local_irq_restore(flags);
230
231 rtc_mips_get_time = it8172_rtc_get_time;
232 rtc_mips_set_time = it8172_rtc_set_time;
233}
234
235#define ALLINTS (IE_IRQ0 | IE_IRQ1 | IE_IRQ2 | IE_IRQ3 | IE_IRQ4 | IE_IRQ5)
236
237void __init plat_timer_setup(struct irqaction *irq)
238{
239 puts("timer_setup\n");
240 put32(NR_IRQS);
241 puts("");
242 /* we are using the cpu counter for timer interrupts */
243 setup_irq(MIPS_CPU_TIMER_IRQ, irq);
244
245 /* to generate the first timer interrupt */
246 r4k_cur = (read_c0_count() + r4k_offset);
247 write_c0_compare(r4k_cur);
248 set_c0_status(ALLINTS);
249}
diff --git a/arch/mips/ite-boards/ivr/Makefile b/arch/mips/ite-boards/ivr/Makefile
deleted file mode 100644
index e4fa6042b472..000000000000
--- a/arch/mips/ite-boards/ivr/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# Copyright 2000 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the Globespan IVR board,
7# board-specific files.
8#
9
10obj-y += init.o
diff --git a/arch/mips/ite-boards/ivr/README b/arch/mips/ite-boards/ivr/README
deleted file mode 100644
index aa7d8db855bb..000000000000
--- a/arch/mips/ite-boards/ivr/README
+++ /dev/null
@@ -1,3 +0,0 @@
1This is not really a board made by ITE Semi, but it's very
2similar to the ITE QED-4N-S01B board. The IVR board is made
3by Globespan and it's a reference board for the PVR chip.
diff --git a/arch/mips/ite-boards/ivr/init.c b/arch/mips/ite-boards/ivr/init.c
deleted file mode 100644
index 05cf9218c432..000000000000
--- a/arch/mips/ite-boards/ivr/init.c
+++ /dev/null
@@ -1,81 +0,0 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * IVR board setup.
4 *
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29#include <linux/init.h>
30#include <linux/mm.h>
31#include <linux/sched.h>
32#include <linux/bootmem.h>
33#include <asm/addrspace.h>
34#include <asm/bootinfo.h>
35#include <linux/string.h>
36#include <linux/kernel.h>
37#include <asm/sections.h>
38#include <asm/it8172/it8172.h>
39#include <asm/it8172/it8172_dbg.h>
40
41int prom_argc;
42char **prom_argv, **prom_envp;
43
44extern void __init prom_init_cmdline(void);
45extern unsigned long __init prom_get_memsize(void);
46extern void __init it8172_init_ram_resource(unsigned long memsize);
47
48const char *get_system_type(void)
49{
50 return "Globespan IVR";
51}
52
53void __init prom_init(void)
54{
55 unsigned long mem_size;
56 unsigned long pcicr;
57
58 prom_argc = fw_arg0;
59 prom_argv = (char **) fw_arg1;
60 prom_envp = (int *) fw_arg3;
61
62 mips_machgroup = MACH_GROUP_GLOBESPAN;
63 mips_machtype = MACH_IVR; /* Globespan's iTVC15 reference board */
64
65 prom_init_cmdline();
66
67 /* pmon does not set memsize */
68 mem_size = prom_get_memsize();
69 mem_size = mem_size << 20;
70
71 /*
72 * make the entire physical memory visible to pci bus masters
73 */
74 IT_READ(IT_MC_PCICR, pcicr);
75 pcicr &= ~0x1f;
76 pcicr |= (mem_size - 1) >> 22;
77 IT_WRITE(IT_MC_PCICR, pcicr);
78
79 it8172_init_ram_resource(mem_size);
80 add_memory_region(0, mem_size, BOOT_MEM_RAM);
81}
diff --git a/arch/mips/ite-boards/qed-4n-s01b/Makefile b/arch/mips/ite-boards/qed-4n-s01b/Makefile
deleted file mode 100644
index bb9972ad9c45..000000000000
--- a/arch/mips/ite-boards/qed-4n-s01b/Makefile
+++ /dev/null
@@ -1,10 +0,0 @@
1#
2# Copyright 2000 MontaVista Software Inc.
3# Author: MontaVista Software, Inc.
4# ppopov@mvista.com or source@mvista.com
5#
6# Makefile for the ITE 8172 (qed-4n-s01b) board, board
7# specific files.
8#
9
10obj-y := init.o
diff --git a/arch/mips/ite-boards/qed-4n-s01b/README b/arch/mips/ite-boards/qed-4n-s01b/README
deleted file mode 100644
index fb4b5197e800..000000000000
--- a/arch/mips/ite-boards/qed-4n-s01b/README
+++ /dev/null
@@ -1,2 +0,0 @@
1This is an ITE (www.iteusa.com) eval board for the ITE 8172G
2system controller, with a QED 5231 CPU.
diff --git a/arch/mips/ite-boards/qed-4n-s01b/init.c b/arch/mips/ite-boards/qed-4n-s01b/init.c
deleted file mode 100644
index ea2a754cafe5..000000000000
--- a/arch/mips/ite-boards/qed-4n-s01b/init.c
+++ /dev/null
@@ -1,82 +0,0 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * IT8172/QED5231 board setup.
4 *
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29#include <linux/init.h>
30#include <linux/mm.h>
31#include <linux/sched.h>
32#include <linux/bootmem.h>
33#include <asm/addrspace.h>
34#include <asm/bootinfo.h>
35#include <linux/string.h>
36#include <linux/kernel.h>
37#include <asm/sections.h>
38#include <asm/it8172/it8172.h>
39#include <asm/it8172/it8172_dbg.h>
40
41int prom_argc;
42char **prom_argv, **prom_envp;
43
44extern void __init prom_init_cmdline(void);
45extern unsigned long __init prom_get_memsize(void);
46extern void __init it8172_init_ram_resource(unsigned long memsize);
47
48const char *get_system_type(void)
49{
50 return "ITE QED-4N-S01B";
51}
52
53void __init prom_init(void)
54{
55 unsigned long mem_size;
56 unsigned long pcicr;
57
58 prom_argc = fw_arg0;
59 prom_argv = (char **) fw_arg1;
60 prom_envp = (int *) fw_arg3;
61
62 mips_machgroup = MACH_GROUP_ITE;
63 mips_machtype = MACH_QED_4N_S01B; /* ITE board name/number */
64
65 prom_init_cmdline();
66 mem_size = prom_get_memsize();
67
68 printk("Memory size: %dMB\n", (unsigned)mem_size);
69
70 mem_size <<= 20; /* MB */
71
72 /*
73 * make the entire physical memory visible to pci bus masters
74 */
75 IT_READ(IT_MC_PCICR, pcicr);
76 pcicr &= ~0x1f;
77 pcicr |= (mem_size - 1) >> 22;
78 IT_WRITE(IT_MC_PCICR, pcicr);
79
80 it8172_init_ram_resource(mem_size);
81 add_memory_region(0, mem_size, BOOT_MEM_RAM);
82}
diff --git a/arch/mips/kernel/time.c b/arch/mips/kernel/time.c
index 845c7e55505d..a8340802f2d7 100644
--- a/arch/mips/kernel/time.c
+++ b/arch/mips/kernel/time.c
@@ -149,80 +149,6 @@ void (*mips_timer_ack)(void);
149unsigned int (*mips_hpt_read)(void); 149unsigned int (*mips_hpt_read)(void);
150void (*mips_hpt_init)(unsigned int); 150void (*mips_hpt_init)(unsigned int);
151 151
152
153/*
154 * This version of gettimeofday has microsecond resolution and better than
155 * microsecond precision on fast machines with cycle counter.
156 */
157void do_gettimeofday(struct timeval *tv)
158{
159 unsigned long seq;
160 unsigned long usec, sec;
161 unsigned long max_ntp_tick;
162
163 do {
164 seq = read_seqbegin(&xtime_lock);
165
166 usec = do_gettimeoffset();
167
168 /*
169 * If time_adjust is negative then NTP is slowing the clock
170 * so make sure not to go into next possible interval.
171 * Better to lose some accuracy than have time go backwards..
172 */
173 if (unlikely(time_adjust < 0)) {
174 max_ntp_tick = (USEC_PER_SEC / HZ) - tickadj;
175 usec = min(usec, max_ntp_tick);
176 }
177
178 sec = xtime.tv_sec;
179 usec += (xtime.tv_nsec / 1000);
180
181 } while (read_seqretry(&xtime_lock, seq));
182
183 while (usec >= 1000000) {
184 usec -= 1000000;
185 sec++;
186 }
187
188 tv->tv_sec = sec;
189 tv->tv_usec = usec;
190}
191
192EXPORT_SYMBOL(do_gettimeofday);
193
194int do_settimeofday(struct timespec *tv)
195{
196 time_t wtm_sec, sec = tv->tv_sec;
197 long wtm_nsec, nsec = tv->tv_nsec;
198
199 if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
200 return -EINVAL;
201
202 write_seqlock_irq(&xtime_lock);
203
204 /*
205 * This is revolting. We need to set "xtime" correctly. However,
206 * the value in this location is the value at the most recent update
207 * of wall time. Discover what correction gettimeofday() would have
208 * made, and then undo it!
209 */
210 nsec -= do_gettimeoffset() * NSEC_PER_USEC;
211
212 wtm_sec = wall_to_monotonic.tv_sec + (xtime.tv_sec - sec);
213 wtm_nsec = wall_to_monotonic.tv_nsec + (xtime.tv_nsec - nsec);
214
215 set_normalized_timespec(&xtime, sec, nsec);
216 set_normalized_timespec(&wall_to_monotonic, wtm_sec, wtm_nsec);
217
218 ntp_clear();
219 write_sequnlock_irq(&xtime_lock);
220 clock_was_set();
221 return 0;
222}
223
224EXPORT_SYMBOL(do_settimeofday);
225
226/* 152/*
227 * Gettimeoffset routines. These routines returns the time duration 153 * Gettimeoffset routines. These routines returns the time duration
228 * since last timer interrupt in usecs. 154 * since last timer interrupt in usecs.
diff --git a/arch/mips/mm/init.c b/arch/mips/mm/init.c
index 5b06349af2d5..88b72c9a8495 100644
--- a/arch/mips/mm/init.c
+++ b/arch/mips/mm/init.c
@@ -163,10 +163,10 @@ static int __init page_is_ram(unsigned long pagenr)
163 163
164void __init paging_init(void) 164void __init paging_init(void)
165{ 165{
166 unsigned long zones_size[] = { 0, }; 166 unsigned long zones_size[MAX_NR_ZONES] = { 0, };
167 unsigned long max_dma, high, low; 167 unsigned long max_dma, high, low;
168#ifndef CONFIG_FLATMEM 168#ifndef CONFIG_FLATMEM
169 unsigned long zholes_size[] = { 0, }; 169 unsigned long zholes_size[MAX_NR_ZONES] = { 0, };
170 unsigned long i, j, pfn; 170 unsigned long i, j, pfn;
171#endif 171#endif
172 172
diff --git a/arch/mips/pci/Makefile b/arch/mips/pci/Makefile
index edefa97b2330..3cf0dd4ba548 100644
--- a/arch/mips/pci/Makefile
+++ b/arch/mips/pci/Makefile
@@ -7,7 +7,6 @@ obj-y += pci.o
7# 7#
8# PCI bus host bridge specific code 8# PCI bus host bridge specific code
9# 9#
10obj-$(CONFIG_ITE_BOARD_GEN) += ops-it8172.o
11obj-$(CONFIG_MIPS_BONITO64) += ops-bonito64.o 10obj-$(CONFIG_MIPS_BONITO64) += ops-bonito64.o
12obj-$(CONFIG_MIPS_GT64111) += ops-gt64111.o 11obj-$(CONFIG_MIPS_GT64111) += ops-gt64111.o
13obj-$(CONFIG_MIPS_GT64120) += ops-gt64120.o 12obj-$(CONFIG_MIPS_GT64120) += ops-gt64120.o
@@ -28,8 +27,6 @@ obj-$(CONFIG_LASAT) += pci-lasat.o
28obj-$(CONFIG_MIPS_ATLAS) += fixup-atlas.o 27obj-$(CONFIG_MIPS_ATLAS) += fixup-atlas.o
29obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o 28obj-$(CONFIG_MIPS_COBALT) += fixup-cobalt.o
30obj-$(CONFIG_MIPS_EV64120) += fixup-ev64120.o 29obj-$(CONFIG_MIPS_EV64120) += fixup-ev64120.o
31obj-$(CONFIG_MIPS_ITE8172) += fixup-ite8172g.o
32obj-$(CONFIG_MIPS_IVR) += fixup-ivr.o
33obj-$(CONFIG_SOC_AU1500) += fixup-au1000.o ops-au1000.o 30obj-$(CONFIG_SOC_AU1500) += fixup-au1000.o ops-au1000.o
34obj-$(CONFIG_SOC_AU1550) += fixup-au1000.o ops-au1000.o 31obj-$(CONFIG_SOC_AU1550) += fixup-au1000.o ops-au1000.o
35obj-$(CONFIG_SOC_PNX8550) += fixup-pnx8550.o ops-pnx8550.o 32obj-$(CONFIG_SOC_PNX8550) += fixup-pnx8550.o ops-pnx8550.o
diff --git a/arch/mips/pci/fixup-ite8172g.c b/arch/mips/pci/fixup-ite8172g.c
deleted file mode 100644
index 2290ea4228dd..000000000000
--- a/arch/mips/pci/fixup-ite8172g.c
+++ /dev/null
@@ -1,80 +0,0 @@
1/*
2 * BRIEF MODULE DESCRIPTION
3 * Board specific pci fixups.
4 *
5 * Copyright 2000 MontaVista Software Inc.
6 * Author: MontaVista Software, Inc.
7 * ppopov@mvista.com or source@mvista.com
8 *
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public License as published by the
11 * Free Software Foundation; either version 2 of the License, or (at your
12 * option) any later version.
13 *
14 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
15 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
16 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
17 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
18 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
19 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
20 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
21 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
23 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 *
25 * You should have received a copy of the GNU General Public License along
26 * with this program; if not, write to the Free Software Foundation, Inc.,
27 * 675 Mass Ave, Cambridge, MA 02139, USA.
28 */
29#include <linux/types.h>
30#include <linux/pci.h>
31#include <linux/kernel.h>
32#include <linux/init.h>
33
34#include <asm/it8172/it8172.h>
35#include <asm/it8172/it8172_pci.h>
36#include <asm/it8172/it8172_int.h>
37
38/*
39 * Shortcuts
40 */
41#define INTA IT8172_PCI_INTA_IRQ
42#define INTB IT8172_PCI_INTB_IRQ
43#define INTC IT8172_PCI_INTC_IRQ
44#define INTD IT8172_PCI_INTD_IRQ
45
46static const int internal_func_irqs[7] __initdata = {
47 IT8172_AC97_IRQ,
48 IT8172_DMA_IRQ,
49 IT8172_CDMA_IRQ,
50 IT8172_USB_IRQ,
51 IT8172_BRIDGE_MASTER_IRQ,
52 IT8172_IDE_IRQ,
53 IT8172_MC68K_IRQ
54};
55
56static char irq_tab_ite8172g[][5] __initdata = {
57 [0x10] = { 0, INTA, INTB, INTC, INTD },
58 [0x11] = { 0, INTA, INTB, INTC, INTD },
59 [0x12] = { 0, INTB, INTC, INTD, INTA },
60 [0x13] = { 0, INTC, INTD, INTA, INTB },
61 [0x14] = { 0, INTD, INTA, INTB, INTC },
62};
63
64int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
65{
66 /*
67 * Internal device 1 is actually 7 different internal devices on the
68 * IT8172G (a multifunction device).
69 */
70 if (slot == 1)
71 return internal_func_irqs[PCI_FUNC(dev->devfn)];
72
73 return irq_tab_ite8172g[slot][pin];
74}
75
76/* Do platform specific device initialization at pci_enable_device() time */
77int pcibios_plat_dev_init(struct pci_dev *dev)
78{
79 return 0;
80}
diff --git a/arch/mips/pci/fixup-ivr.c b/arch/mips/pci/fixup-ivr.c
deleted file mode 100644
index 0c7c16464c11..000000000000
--- a/arch/mips/pci/fixup-ivr.c
+++ /dev/null
@@ -1,75 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Globespan IVR board-specific pci fixups.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30#include <linux/types.h>
31#include <linux/pci.h>
32#include <linux/kernel.h>
33#include <linux/init.h>
34
35#include <asm/it8172/it8172.h>
36#include <asm/it8172/it8172_pci.h>
37#include <asm/it8172/it8172_int.h>
38
39/*
40 * Shortcuts
41 */
42#define INTA IT8172_PCI_INTA_IRQ
43#define INTB IT8172_PCI_INTB_IRQ
44#define INTC IT8172_PCI_INTC_IRQ
45#define INTD IT8172_PCI_INTD_IRQ
46
47static const int internal_func_irqs[7] __initdata = {
48 IT8172_AC97_IRQ,
49 IT8172_DMA_IRQ,
50 IT8172_CDMA_IRQ,
51 IT8172_USB_IRQ,
52 IT8172_BRIDGE_MASTER_IRQ,
53 IT8172_IDE_IRQ,
54 IT8172_MC68K_IRQ
55};
56
57static char irq_tab_ivr[][5] __initdata = {
58 [0x11] = { INTC, INTC, INTD, INTA, INTB }, /* Realtek RTL-8139 */
59 [0x12] = { INTB, INTB, INTB, INTC, INTC }, /* IVR slot */
60 [0x13] = { INTA, INTA, INTB, INTC, INTD } /* Expansion slot */
61};
62
63int __init pcibios_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
64{
65 if (slot == 1)
66 return internal_func_irqs[PCI_FUNC(dev->devfn)];
67
68 return irq_tab_ivr[slot][pin];
69}
70
71/* Do platform specific device initialization at pci_enable_device() time */
72int pcibios_plat_dev_init(struct pci_dev *dev)
73{
74 return 0;
75}
diff --git a/arch/mips/pci/fixup-sb1250.c b/arch/mips/pci/fixup-sb1250.c
index 13791b78e598..7a7444874e80 100644
--- a/arch/mips/pci/fixup-sb1250.c
+++ b/arch/mips/pci/fixup-sb1250.c
@@ -1,7 +1,7 @@
1/* 1/*
2 * arch/mips/pci/fixup-sb1250.c 2 * arch/mips/pci/fixup-sb1250.c
3 * 3 *
4 * Copyright (C) 2004 MIPS Technologies, Inc. All rights reserved. 4 * Copyright (C) 2004, 2006 MIPS Technologies, Inc. All rights reserved.
5 * Author: Maciej W. Rozycki <macro@mips.com> 5 * Author: Maciej W. Rozycki <macro@mips.com>
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
@@ -14,6 +14,17 @@
14#include <linux/pci.h> 14#include <linux/pci.h>
15 15
16/* 16/*
17 * Set the the BCM1250, etc. PCI host bridge's TRDY timeout
18 * to the finite max.
19 */
20static void __init quirk_sb1250_pci(struct pci_dev *dev)
21{
22 pci_write_config_byte(dev, 0x40, 0xff);
23}
24DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIBYTE, PCI_DEVICE_ID_BCM1250_PCI,
25 quirk_sb1250_pci);
26
27/*
17 * The BCM1250, etc. PCI/HT bridge reports as a host bridge. 28 * The BCM1250, etc. PCI/HT bridge reports as a host bridge.
18 */ 29 */
19static void __init quirk_sb1250_ht(struct pci_dev *dev) 30static void __init quirk_sb1250_ht(struct pci_dev *dev)
@@ -22,3 +33,13 @@ static void __init quirk_sb1250_ht(struct pci_dev *dev)
22} 33}
23DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIBYTE, PCI_DEVICE_ID_BCM1250_HT, 34DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIBYTE, PCI_DEVICE_ID_BCM1250_HT,
24 quirk_sb1250_ht); 35 quirk_sb1250_ht);
36
37/*
38 * Set the the SP1011 HT/PCI bridge's TRDY timeout to the finite max.
39 */
40static void __init quirk_sp1011(struct pci_dev *dev)
41{
42 pci_write_config_byte(dev, 0x64, 0xff);
43}
44DECLARE_PCI_FIXUP_EARLY(PCI_VENDOR_ID_SIPACKETS, PCI_DEVICE_ID_SP1011,
45 quirk_sp1011);
diff --git a/arch/mips/pci/ops-it8172.c b/arch/mips/pci/ops-it8172.c
deleted file mode 100644
index ba8328505a0a..000000000000
--- a/arch/mips/pci/ops-it8172.c
+++ /dev/null
@@ -1,213 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 system controller specific pci support.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32#include <linux/types.h>
33#include <linux/pci.h>
34#include <linux/kernel.h>
35#include <linux/init.h>
36
37#include <asm/it8172/it8172.h>
38#include <asm/it8172/it8172_pci.h>
39
40#define PCI_ACCESS_READ 0
41#define PCI_ACCESS_WRITE 1
42
43#undef DEBUG
44#ifdef DEBUG
45#define DBG(x...) printk(x)
46#else
47#define DBG(x...)
48#endif
49
50static struct resource pci_mem_resource_1;
51
52static struct resource pci_io_resource = {
53 .start = 0x14018000,
54 .end = 0x17FFFFFF,
55 .name = "io pci IO space",
56 .flags = IORESOURCE_IO
57};
58
59static struct resource pci_mem_resource_0 = {
60 .start = 0x10101000,
61 .end = 0x13FFFFFF,
62 .name = "ext pci memory space 0/1",
63 .flags = IORESOURCE_MEM,
64 .parent = &pci_mem_resource_0,
65 .sibling = NULL,
66 .child = &pci_mem_resource_1
67};
68
69static struct resource pci_mem_resource_1 = {
70 .start = 0x1A000000,
71 .end = 0x1FBFFFFF,
72 .name = "ext pci memory space 2/3",
73 .flags = IORESOURCE_MEM,
74 .parent = &pci_mem_resource_0
75};
76
77extern struct pci_ops it8172_pci_ops;
78
79struct pci_controller it8172_controller = {
80 .pci_ops = &it8172_pci_ops,
81 .io_resource = &pci_io_resource,
82 .mem_resource = &pci_mem_resource_0,
83};
84
85static int it8172_pcibios_config_access(unsigned char access_type,
86 struct pci_bus *bus,
87 unsigned int devfn, int where,
88 u32 * data)
89{
90 /*
91 * config cycles are on 4 byte boundary only
92 */
93
94 /* Setup address */
95 IT_WRITE(IT_CONFADDR, (bus->number << IT_BUSNUM_SHF) |
96 (devfn << IT_FUNCNUM_SHF) | (where & ~0x3));
97
98 if (access_type == PCI_ACCESS_WRITE) {
99 IT_WRITE(IT_CONFDATA, *data);
100 } else {
101 IT_READ(IT_CONFDATA, *data);
102 }
103
104 /*
105 * Revisit: check for master or target abort.
106 */
107 return 0;
108}
109
110
111/*
112 * We can't address 8 and 16 bit words directly. Instead we have to
113 * read/write a 32bit word and mask/modify the data we actually want.
114 */
115static write_config(struct pci_bus *bus, unsigned int devfn, int where,
116 int size, u32 val)
117{
118 u32 data = 0;
119
120 switch (size) {
121 case 1:
122 if (it8172_pcibios_config_access
123 (PCI_ACCESS_READ, dev, where, &data))
124 return -1;
125
126 *val = (data >> ((where & 3) << 3)) & 0xff;
127
128 return PCIBIOS_SUCCESSFUL;
129
130 case 2:
131
132 if (where & 1)
133 return PCIBIOS_BAD_REGISTER_NUMBER;
134
135 if (it8172_pcibios_config_access
136 (PCI_ACCESS_READ, dev, where, &data))
137 return -1;
138
139 *val = (data >> ((where & 3) << 3)) & 0xffff;
140 DBG("cfg read word: bus %d dev_fn %x where %x: val %x\n",
141 dev->bus->number, dev->devfn, where, *val);
142
143 return PCIBIOS_SUCCESSFUL;
144
145 case 4:
146
147 if (where & 3)
148 return PCIBIOS_BAD_REGISTER_NUMBER;
149
150 if (it8172_pcibios_config_access
151 (PCI_ACCESS_READ, dev, where, &data))
152 return -1;
153
154 *val = data;
155
156 return PCIBIOS_SUCCESSFUL;
157 }
158}
159
160
161static write_config(struct pci_bus *bus, unsigned int devfn, int where,
162 int size, u32 val)
163{
164 u32 data = 0;
165
166 switch (size) {
167 case 1:
168 if (it8172_pcibios_config_access
169 (PCI_ACCESS_READ, dev, where, &data))
170 return -1;
171
172 data = (data & ~(0xff << ((where & 3) << 3))) |
173 (val << ((where & 3) << 3));
174
175 if (it8172_pcibios_config_access
176 (PCI_ACCESS_WRITE, dev, where, &data))
177 return -1;
178
179 return PCIBIOS_SUCCESSFUL;
180
181 case 2:
182 if (where & 1)
183 return PCIBIOS_BAD_REGISTER_NUMBER;
184
185 if (it8172_pcibios_config_access
186 (PCI_ACCESS_READ, dev, where, &data))
187 eturn - 1;
188
189 data = (data & ~(0xffff << ((where & 3) << 3))) |
190 (val << ((where & 3) << 3));
191
192 if (it8172_pcibios_config_access
193 (PCI_ACCESS_WRITE, dev, where, &data))
194 return -1;
195
196 return PCIBIOS_SUCCESSFUL;
197
198 case 4:
199 if (where & 3)
200 return PCIBIOS_BAD_REGISTER_NUMBER;
201
202 if (it8172_pcibios_config_access
203 (PCI_ACCESS_WRITE, dev, where, &val))
204 return -1;
205
206 return PCIBIOS_SUCCESSFUL;
207 }
208}
209
210struct pci_ops it8172_pci_ops = {
211 .read = read_config,
212 .write = write_config,
213};
diff --git a/arch/mips/sibyte/bcm1480/irq.c b/arch/mips/sibyte/bcm1480/irq.c
index a0222fa4416c..a46b75b23ecb 100644
--- a/arch/mips/sibyte/bcm1480/irq.c
+++ b/arch/mips/sibyte/bcm1480/irq.c
@@ -482,7 +482,7 @@ asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
482 write_c0_compare(read_c0_count()); 482 write_c0_compare(read_c0_count());
483#endif 483#endif
484 484
485 pending = read_c0_cause(); 485 pending = read_c0_cause() & read_c0_status();
486 486
487#ifdef CONFIG_SIBYTE_BCM1480_PROF 487#ifdef CONFIG_SIBYTE_BCM1480_PROF
488 if (pending & CAUSEF_IP7) /* Cpu performance counter interrupt */ 488 if (pending & CAUSEF_IP7) /* Cpu performance counter interrupt */
diff --git a/arch/mips/sibyte/sb1250/irq.c b/arch/mips/sibyte/sb1250/irq.c
index a451b4c7732d..f9bd9f074517 100644
--- a/arch/mips/sibyte/sb1250/irq.c
+++ b/arch/mips/sibyte/sb1250/irq.c
@@ -442,7 +442,7 @@ asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
442 * blasting the high 32 bits. 442 * blasting the high 32 bits.
443 */ 443 */
444 444
445 pending = read_c0_cause(); 445 pending = read_c0_cause() & read_c0_status();
446 446
447#ifdef CONFIG_SIBYTE_SB1250_PROF 447#ifdef CONFIG_SIBYTE_SB1250_PROF
448 if (pending & CAUSEF_IP7) /* Cpu performance counter interrupt */ 448 if (pending & CAUSEF_IP7) /* Cpu performance counter interrupt */
@@ -476,5 +476,8 @@ asmlinkage void plat_irq_dispatch(struct pt_regs *regs)
476 R_IMR_INTERRUPT_STATUS_BASE))); 476 R_IMR_INTERRUPT_STATUS_BASE)));
477 if (mask) 477 if (mask)
478 do_IRQ(fls64(mask) - 1, regs); 478 do_IRQ(fls64(mask) - 1, regs);
479 } 479 else
480 spurious_interrupt(regs);
481 } else
482 spurious_interrupt(regs);
480} 483}
diff --git a/drivers/char/.gitignore b/drivers/char/.gitignore
index 73dfdcebfbba..83683a2d8e6a 100644
--- a/drivers/char/.gitignore
+++ b/drivers/char/.gitignore
@@ -1,3 +1,2 @@
1consolemap_deftbl.c 1consolemap_deftbl.c
2defkeymap.c 2defkeymap.c
3qtronixmap.c
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig
index bde1c665d9f4..0e6f35fcc2eb 100644
--- a/drivers/char/Kconfig
+++ b/drivers/char/Kconfig
@@ -371,36 +371,6 @@ config AU1000_SERIAL_CONSOLE
371 If you have an Alchemy AU1000 processor (MIPS based) and you want 371 If you have an Alchemy AU1000 processor (MIPS based) and you want
372 to use a console on a serial port, say Y. Otherwise, say N. 372 to use a console on a serial port, say Y. Otherwise, say N.
373 373
374config QTRONIX_KEYBOARD
375 bool "Enable Qtronix 990P Keyboard Support"
376 depends on IT8712
377 help
378 Images of Qtronix keyboards are at
379 <http://www.qtronix.com/keyboard.html>.
380
381config IT8172_CIR
382 bool
383 depends on QTRONIX_KEYBOARD
384 default y
385
386config IT8172_SCR0
387 bool "Enable Smart Card Reader 0 Support "
388 depends on IT8712
389 help
390 Say Y here to support smart-card reader 0 (SCR0) on the Integrated
391 Technology Express, Inc. ITE8172 SBC. Vendor page at
392 <http://www.ite.com.tw/ia/brief_it8172bsp.htm>; picture of the
393 board at <http://www.mvista.com/partners/semiconductor/ite.html>.
394
395config IT8172_SCR1
396 bool "Enable Smart Card Reader 1 Support "
397 depends on IT8712
398 help
399 Say Y here to support smart-card reader 1 (SCR1) on the Integrated
400 Technology Express, Inc. ITE8172 SBC. Vendor page at
401 <http://www.ite.com.tw/ia/brief_it8172bsp.htm>; picture of the
402 board at <http://www.mvista.com/partners/semiconductor/ite.html>.
403
404config A2232 374config A2232
405 tristate "Commodore A2232 serial support (EXPERIMENTAL)" 375 tristate "Commodore A2232 serial support (EXPERIMENTAL)"
406 depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP 376 depends on EXPERIMENTAL && ZORRO && BROKEN_ON_SMP
diff --git a/drivers/char/Makefile b/drivers/char/Makefile
index 19114df59bbd..777cad045094 100644
--- a/drivers/char/Makefile
+++ b/drivers/char/Makefile
@@ -102,7 +102,7 @@ obj-$(CONFIG_HANGCHECK_TIMER) += hangcheck-timer.o
102obj-$(CONFIG_TCG_TPM) += tpm/ 102obj-$(CONFIG_TCG_TPM) += tpm/
103 103
104# Files generated that shall be removed upon make clean 104# Files generated that shall be removed upon make clean
105clean-files := consolemap_deftbl.c defkeymap.c qtronixmap.c 105clean-files := consolemap_deftbl.c defkeymap.c
106 106
107quiet_cmd_conmk = CONMK $@ 107quiet_cmd_conmk = CONMK $@
108 cmd_conmk = scripts/conmakehash $< > $@ 108 cmd_conmk = scripts/conmakehash $< > $@
@@ -112,8 +112,6 @@ $(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE)
112 112
113$(obj)/defkeymap.o: $(obj)/defkeymap.c 113$(obj)/defkeymap.o: $(obj)/defkeymap.c
114 114
115$(obj)/qtronixmap.o: $(obj)/qtronixmap.c
116
117# Uncomment if you're changing the keymap and have an appropriate 115# Uncomment if you're changing the keymap and have an appropriate
118# loadkeys version for the map. By default, we'll use the shipped 116# loadkeys version for the map. By default, we'll use the shipped
119# versions. 117# versions.
@@ -121,7 +119,7 @@ $(obj)/qtronixmap.o: $(obj)/qtronixmap.c
121 119
122ifdef GENERATE_KEYMAP 120ifdef GENERATE_KEYMAP
123 121
124$(obj)/defkeymap.c $(obj)/qtronixmap.c: $(obj)/%.c: $(src)/%.map 122$(obj)/defkeymap.c $(obj)/%.c: $(src)/%.map
125 loadkeys --mktable $< > $@.tmp 123 loadkeys --mktable $< > $@.tmp
126 sed -e 's/^static *//' $@.tmp > $@ 124 sed -e 's/^static *//' $@.tmp > $@
127 rm $@.tmp 125 rm $@.tmp
diff --git a/drivers/char/ite_gpio.c b/drivers/char/ite_gpio.c
deleted file mode 100644
index ef14b6d1bc74..000000000000
--- a/drivers/char/ite_gpio.c
+++ /dev/null
@@ -1,419 +0,0 @@
1/*
2 * FILE NAME ite_gpio.c
3 *
4 * BRIEF MODULE DESCRIPTION
5 * API for ITE GPIO device.
6 * Driver for ITE GPIO device.
7 *
8 * Author: MontaVista Software, Inc. <source@mvista.com>
9 * Hai-Pao Fan <haipao@mvista.com>
10 *
11 * Copyright 2001 MontaVista Software Inc.
12 *
13 * This program is free software; you can redistribute it and/or modify it
14 * under the terms of the GNU General Public License as published by the
15 * Free Software Foundation; either version 2 of the License, or (at your
16 * option) any later version.
17 *
18 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
19 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
20 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
21 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
22 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
23 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
24 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
25 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 *
29 * You should have received a copy of the GNU General Public License along
30 * with this program; if not, write to the Free Software Foundation, Inc.,
31 * 675 Mass Ave, Cambridge, MA 02139, USA.
32 */
33#include <linux/module.h>
34#include <linux/types.h>
35#include <linux/kernel.h>
36#include <linux/miscdevice.h>
37#include <linux/init.h>
38#include <linux/ioport.h>
39#include <asm/uaccess.h>
40#include <asm/addrspace.h>
41#include <asm/it8172/it8172_int.h>
42#include <linux/sched.h>
43#include <linux/ite_gpio.h>
44
45#define ite_gpio_base 0x14013800
46
47#define ITE_GPADR (*(volatile __u8 *)(0x14013800 + KSEG1))
48#define ITE_GPBDR (*(volatile __u8 *)(0x14013808 + KSEG1))
49#define ITE_GPCDR (*(volatile __u8 *)(0x14013810 + KSEG1))
50#define ITE_GPACR (*(volatile __u16 *)(0x14013802 + KSEG1))
51#define ITE_GPBCR (*(volatile __u16 *)(0x1401380a + KSEG1))
52#define ITE_GPCCR (*(volatile __u16 *)(0x14013812 + KSEG1))
53#define ITE_GPAICR (*(volatile __u16 *)(0x14013804 + KSEG1))
54#define ITE_GPBICR (*(volatile __u16 *)(0x1401380c + KSEG1))
55#define ITE_GPCICR (*(volatile __u16 *)(0x14013814 + KSEG1))
56#define ITE_GPAISR (*(volatile __u8 *)(0x14013806 + KSEG1))
57#define ITE_GPBISR (*(volatile __u8 *)(0x1401380e + KSEG1))
58#define ITE_GPCISR (*(volatile __u8 *)(0x14013816 + KSEG1))
59#define ITE_GCR (*(volatile __u8 *)(0x14013818 + KSEG1))
60
61#define MAX_GPIO_LINE 21
62static int ite_gpio_irq=IT8172_GPIO_IRQ;
63
64static long ite_irq_counter[MAX_GPIO_LINE];
65wait_queue_head_t ite_gpio_wait[MAX_GPIO_LINE];
66static int ite_gpio_irq_pending[MAX_GPIO_LINE];
67
68static int ite_gpio_debug=0;
69#define DEB(x) if (ite_gpio_debug>=1) x
70
71int ite_gpio_in(__u32 device, __u32 mask, volatile __u32 *data)
72{
73 DEB(printk("ite_gpio_in mask=0x%x\n",mask));
74
75 switch (device) {
76 case ITE_GPIO_PORTA:
77 ITE_GPACR = (__u16)mask; /* 0xffff */
78 *data = ITE_GPADR;
79 break;
80 case ITE_GPIO_PORTB:
81 ITE_GPBCR = (__u16)mask; /* 0xffff */
82 *data = ITE_GPBDR;
83 break;
84 case ITE_GPIO_PORTC:
85 ITE_GPCCR = (__u16)mask; /* 0x03ff */
86 *data = ITE_GPCDR;
87 break;
88 default:
89 return -EFAULT;
90 }
91
92 return 0;
93}
94
95
96int ite_gpio_out(__u32 device, __u32 mask, __u32 data)
97{
98 switch (device) {
99 case ITE_GPIO_PORTA:
100 ITE_GPACR = (__u16)mask; /* 0x5555 */
101 ITE_GPADR = (__u8)data;
102 break;
103 case ITE_GPIO_PORTB:
104 ITE_GPBCR = (__u16)mask; /* 0x5555 */
105 ITE_GPBDR = (__u8)data;
106 break;
107 case ITE_GPIO_PORTC:
108 ITE_GPCCR = (__u16)mask; /* 0x0155 */
109 ITE_GPCDR = (__u8)data;
110 break;
111 default:
112 return -EFAULT;
113 }
114
115 return 0;
116}
117
118int ite_gpio_int_ctrl(__u32 device, __u32 mask, __u32 data)
119{
120 switch (device) {
121 case ITE_GPIO_PORTA:
122 ITE_GPAICR = (ITE_GPAICR & ~mask) | (data & mask);
123 break;
124 case ITE_GPIO_PORTB:
125 ITE_GPBICR = (ITE_GPBICR & ~mask) | (data & mask);
126 break;
127 case ITE_GPIO_PORTC:
128 ITE_GPCICR = (ITE_GPCICR & ~mask) | (data & mask);
129 break;
130 default:
131 return -EFAULT;
132 }
133
134 return 0;
135}
136
137int ite_gpio_in_status(__u32 device, __u32 mask, volatile __u32 *data)
138{
139 int ret=-1;
140
141 if ((MAX_GPIO_LINE > *data) && (*data >= 0))
142 ret=ite_gpio_irq_pending[*data];
143
144 DEB(printk("ite_gpio_in_status %d ret=%d\n",*data, ret));
145
146 switch (device) {
147 case ITE_GPIO_PORTA:
148 *data = ITE_GPAISR & mask;
149 break;
150 case ITE_GPIO_PORTB:
151 *data = ITE_GPBISR & mask;
152 break;
153 case ITE_GPIO_PORTC:
154 *data = ITE_GPCISR & mask;
155 break;
156 default:
157 return -EFAULT;
158 }
159
160 return ret;
161}
162
163int ite_gpio_out_status(__u32 device, __u32 mask, __u32 data)
164{
165 switch (device) {
166 case ITE_GPIO_PORTA:
167 ITE_GPAISR = (ITE_GPAISR & ~mask) | (data & mask);
168 break;
169 case ITE_GPIO_PORTB:
170 ITE_GPBISR = (ITE_GPBISR & ~mask) | (data & mask);
171 break;
172 case ITE_GPIO_PORTC:
173 ITE_GPCISR = (ITE_GPCISR & ~mask) | (data & mask);
174 break;
175 default:
176 return -EFAULT;
177 }
178
179 return 0;
180}
181
182int ite_gpio_gen_ctrl(__u32 device, __u32 mask, __u32 data)
183{
184 ITE_GCR = (ITE_GCR & ~mask) | (data & mask);
185
186 return 0;
187}
188
189int ite_gpio_int_wait (__u32 device, __u32 mask, __u32 data)
190{
191 int i,line=0, ret=0;
192 unsigned long flags;
193
194 switch (device) {
195 case ITE_GPIO_PORTA:
196 line = data & mask;
197 break;
198 case ITE_GPIO_PORTB:
199 line = (data & mask) <<8;
200 break;
201 case ITE_GPIO_PORTC:
202 line = (data & mask) <<16;
203 break;
204 }
205 for (i=MAX_GPIO_LINE-1; i >= 0; i--) {
206 if ( (line) & (1 << i))
207 break;
208 }
209
210 DEB(printk("wait device=0x%d mask=0x%x data=0x%x index %d\n",
211 device, mask, data, i));
212
213 if (line & ~(1<<i))
214 return -EFAULT;
215
216 if (ite_gpio_irq_pending[i]==1)
217 return -EFAULT;
218
219 save_flags (flags);
220 cli();
221 ite_gpio_irq_pending[i] = 1;
222 ret = interruptible_sleep_on_timeout(&ite_gpio_wait[i], 3*HZ);
223 restore_flags (flags);
224 ite_gpio_irq_pending[i] = 0;
225
226 return ret;
227}
228
229EXPORT_SYMBOL(ite_gpio_in);
230EXPORT_SYMBOL(ite_gpio_out);
231EXPORT_SYMBOL(ite_gpio_int_ctrl);
232EXPORT_SYMBOL(ite_gpio_in_status);
233EXPORT_SYMBOL(ite_gpio_out_status);
234EXPORT_SYMBOL(ite_gpio_gen_ctrl);
235EXPORT_SYMBOL(ite_gpio_int_wait);
236
237static int ite_gpio_open(struct inode *inode, struct file *file)
238{
239 return 0;
240}
241
242
243static int ite_gpio_release(struct inode *inode, struct file *file)
244{
245 return 0;
246}
247
248
249static int ite_gpio_ioctl(struct inode *inode, struct file *file,
250 unsigned int cmd, unsigned long arg)
251{
252 static struct ite_gpio_ioctl_data ioctl_data;
253
254 if (copy_from_user(&ioctl_data, (struct ite_gpio_ioctl_data *)arg,
255 sizeof(ioctl_data)))
256 return -EFAULT;
257 if ((ioctl_data.device < ITE_GPIO_PORTA) ||
258 (ioctl_data.device > ITE_GPIO_PORTC) )
259 return -EFAULT;
260
261 switch(cmd) {
262 case ITE_GPIO_IN:
263 if (ite_gpio_in(ioctl_data.device, ioctl_data.mask,
264 &ioctl_data.data))
265 return -EFAULT;
266
267 if (copy_to_user((struct ite_gpio_ioctl_data *)arg,
268 &ioctl_data, sizeof(ioctl_data)))
269 return -EFAULT;
270 break;
271
272 case ITE_GPIO_OUT:
273 return ite_gpio_out(ioctl_data.device,
274 ioctl_data.mask, ioctl_data.data);
275 break;
276
277 case ITE_GPIO_INT_CTRL:
278 return ite_gpio_int_ctrl(ioctl_data.device,
279 ioctl_data.mask, ioctl_data.data);
280 break;
281
282 case ITE_GPIO_IN_STATUS:
283 if (ite_gpio_in_status(ioctl_data.device, ioctl_data.mask,
284 &ioctl_data.data))
285 return -EFAULT;
286 if (copy_to_user((struct ite_gpio_ioctl_data *)arg,
287 &ioctl_data, sizeof(ioctl_data)))
288 return -EFAULT;
289 break;
290
291 case ITE_GPIO_OUT_STATUS:
292 return ite_gpio_out_status(ioctl_data.device,
293 ioctl_data.mask, ioctl_data.data);
294 break;
295
296 case ITE_GPIO_GEN_CTRL:
297 return ite_gpio_gen_ctrl(ioctl_data.device,
298 ioctl_data.mask, ioctl_data.data);
299 break;
300
301 case ITE_GPIO_INT_WAIT:
302 return ite_gpio_int_wait(ioctl_data.device,
303 ioctl_data.mask, ioctl_data.data);
304 break;
305
306 default:
307 return -ENOIOCTLCMD;
308
309 }
310
311 return 0;
312}
313
314static void ite_gpio_irq_handler(int this_irq, void *dev_id,
315 struct pt_regs *regs)
316{
317 int i,line;
318
319 line = ITE_GPCISR & 0x1f;
320 for (i=4; i >=0; i--) {
321 if ( line & (1 << i)) {
322 ++ite_irq_counter[i+16];
323 ite_gpio_irq_pending[i+16] = 2;
324 wake_up_interruptible(&ite_gpio_wait[i+16]);
325
326DEB(printk("interrupt 0x%x %d\n", &ite_gpio_wait[i+16], i+16));
327
328 ITE_GPCISR = ITE_GPCISR & (1<<i);
329 return;
330 }
331 }
332 line = ITE_GPBISR;
333 for (i=7; i >= 0; i--) {
334 if ( line & (1 << i)) {
335 ++ite_irq_counter[i+8];
336 ite_gpio_irq_pending[i+8] = 2;
337 wake_up_interruptible(&ite_gpio_wait[i+8]);
338
339DEB(printk("interrupt 0x%x %d\n",ITE_GPBISR, i+8));
340
341 ITE_GPBISR = ITE_GPBISR & (1<<i);
342 return;
343 }
344 }
345 line = ITE_GPAISR;
346 for (i=7; i >= 0; i--) {
347 if ( line & (1 << i)) {
348 ++ite_irq_counter[i];
349 ite_gpio_irq_pending[i] = 2;
350 wake_up_interruptible(&ite_gpio_wait[i]);
351
352DEB(printk("interrupt 0x%x %d\n",ITE_GPAISR, i));
353
354 ITE_GPAISR = ITE_GPAISR & (1<<i);
355 return;
356 }
357 }
358}
359
360static const struct file_operations ite_gpio_fops = {
361 .owner = THIS_MODULE,
362 .ioctl = ite_gpio_ioctl,
363 .open = ite_gpio_open,
364 .release = ite_gpio_release,
365};
366
367static struct miscdevice ite_gpio_miscdev = {
368 MISC_DYNAMIC_MINOR,
369 "ite_gpio",
370 &ite_gpio_fops
371};
372
373int __init ite_gpio_init(void)
374{
375 int i;
376
377 if (misc_register(&ite_gpio_miscdev))
378 return -ENODEV;
379
380 if (!request_region(ite_gpio_base, 0x1c, "ITE GPIO"))
381 {
382 misc_deregister(&ite_gpio_miscdev);
383 return -EIO;
384 }
385
386 /* initialize registers */
387 ITE_GPACR = 0xffff;
388 ITE_GPBCR = 0xffff;
389 ITE_GPCCR = 0xffff;
390 ITE_GPAICR = 0x00ff;
391 ITE_GPBICR = 0x00ff;
392 ITE_GPCICR = 0x00ff;
393 ITE_GCR = 0;
394
395 for (i = 0; i < MAX_GPIO_LINE; i++) {
396 ite_gpio_irq_pending[i]=0;
397 init_waitqueue_head(&ite_gpio_wait[i]);
398 }
399
400 if (request_irq(ite_gpio_irq, ite_gpio_irq_handler, IRQF_SHARED, "gpio", 0) < 0) {
401 misc_deregister(&ite_gpio_miscdev);
402 release_region(ite_gpio_base, 0x1c);
403 return 0;
404 }
405
406 printk("GPIO at 0x%x (irq = %d)\n", ite_gpio_base, ite_gpio_irq);
407
408 return 0;
409}
410
411static void __exit ite_gpio_exit(void)
412{
413 misc_deregister(&ite_gpio_miscdev);
414}
415
416module_init(ite_gpio_init);
417module_exit(ite_gpio_exit);
418
419MODULE_LICENSE("GPL");
diff --git a/drivers/char/qtronixmap.c_shipped b/drivers/char/qtronixmap.c_shipped
deleted file mode 100644
index 1e2b92b7d57a..000000000000
--- a/drivers/char/qtronixmap.c_shipped
+++ /dev/null
@@ -1,265 +0,0 @@
1
2/* Do not edit this file! It was automatically generated by */
3/* loadkeys --mktable defkeymap.map > defkeymap.c */
4
5#include <linux/types.h>
6#include <linux/keyboard.h>
7#include <linux/kd.h>
8
9u_short plain_map[NR_KEYS] = {
10 0xf200, 0xf060, 0xf031, 0xf032, 0xf033, 0xf034, 0xf035, 0xf036,
11 0xf037, 0xf038, 0xf039, 0xf030, 0xf02d, 0xf03d, 0xf200, 0xf07f,
12 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75,
13 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf05c, 0xf207, 0xfb61,
14 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c,
15 0xf03b, 0xf027, 0xf060, 0xf201, 0xf700, 0xf200, 0xfb7a, 0xfb78,
16 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f,
17 0xf200, 0xf700, 0xf702, 0xf200, 0xf703, 0xf020, 0xf703, 0xf200,
18 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
19 0xf200, 0xf200, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf601,
20 0xf200, 0xf200, 0xf200, 0xf603, 0xf600, 0xf118, 0xf119, 0xf200,
21 0xf200, 0xf602, 0xf208, 0xf02d, 0xf02b, 0xf30c, 0xf02e, 0xf30d,
22 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
23 0xf200, 0xf200, 0xf200, 0xf117, 0xf600, 0xf200, 0xf01b, 0xf200,
24 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107,
25 0xf108, 0xf109, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200,
26};
27
28u_short shift_map[NR_KEYS] = {
29 0xf200, 0xf07e, 0xf021, 0xf040, 0xf023, 0xf024, 0xf025, 0xf05e,
30 0xf026, 0xf02a, 0xf028, 0xf029, 0xf05f, 0xf02b, 0xf200, 0xf07f,
31 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, 0xfb59, 0xfb55,
32 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf07c, 0xf207, 0xfb41,
33 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, 0xfb4b, 0xfb4c,
34 0xf03a, 0xf022, 0xf07e, 0xf201, 0xf700, 0xf200, 0xfb5a, 0xfb58,
35 0xfb43, 0xfb56, 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f,
36 0xf200, 0xf700, 0xf702, 0xf200, 0xf703, 0xf020, 0xf703, 0xf200,
37 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
38 0xf200, 0xf200, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf601,
39 0xf200, 0xf200, 0xf200, 0xf603, 0xf600, 0xf20b, 0xf20a, 0xf200,
40 0xf200, 0xf602, 0xf213, 0xf02d, 0xf02b, 0xf30c, 0xf02e, 0xf30d,
41 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
42 0xf200, 0xf200, 0xf200, 0xf117, 0xf600, 0xf200, 0xf01b, 0xf200,
43 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf10e, 0xf10f, 0xf110, 0xf111,
44 0xf112, 0xf113, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200,
45};
46
47u_short altgr_map[NR_KEYS] = {
48 0xf200, 0xf200, 0xf200, 0xf040, 0xf200, 0xf024, 0xf200, 0xf200,
49 0xf07b, 0xf05b, 0xf05d, 0xf07d, 0xf05c, 0xf200, 0xf200, 0xf200,
50 0xf200, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, 0xfb79, 0xfb75,
51 0xfb69, 0xfb6f, 0xfb70, 0xf200, 0xf200, 0xf200, 0xf207, 0xfb61,
52 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, 0xfb6b, 0xfb6c,
53 0xf200, 0xf200, 0xf200, 0xf201, 0xf700, 0xf200, 0xfb7a, 0xfb78,
54 0xfb63, 0xfb76, 0xfb62, 0xfb6e, 0xfb6d, 0xf200, 0xf200, 0xf200,
55 0xf200, 0xf700, 0xf702, 0xf200, 0xf703, 0xf200, 0xf703, 0xf200,
56 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
57 0xf200, 0xf200, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf601,
58 0xf200, 0xf200, 0xf200, 0xf603, 0xf600, 0xf118, 0xf119, 0xf200,
59 0xf200, 0xf602, 0xf208, 0xf02d, 0xf02b, 0xf30c, 0xf02e, 0xf30d,
60 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
61 0xf200, 0xf200, 0xf200, 0xf117, 0xf600, 0xf200, 0xf200, 0xf200,
62 0xf50c, 0xf50d, 0xf50e, 0xf50f, 0xf510, 0xf511, 0xf512, 0xf513,
63 0xf514, 0xf515, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200,
64};
65
66u_short ctrl_map[NR_KEYS] = {
67 0xf200, 0xf200, 0xf200, 0xf000, 0xf01b, 0xf01c, 0xf01d, 0xf01e,
68 0xf01f, 0xf07f, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf200, 0xf008,
69 0xf200, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015,
70 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf01c, 0xf207, 0xf001,
71 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c,
72 0xf007, 0xf000, 0xf200, 0xf201, 0xf700, 0xf200, 0xf01a, 0xf018,
73 0xf003, 0xf016, 0xf002, 0xf00e, 0xf20e, 0xf07f, 0xf200, 0xf200,
74 0xf200, 0xf700, 0xf702, 0xf200, 0xf703, 0xf000, 0xf703, 0xf200,
75 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
76 0xf200, 0xf200, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf601,
77 0xf200, 0xf200, 0xf200, 0xf603, 0xf600, 0xf118, 0xf119, 0xf200,
78 0xf200, 0xf602, 0xf208, 0xf02d, 0xf02b, 0xf30c, 0xf02e, 0xf30d,
79 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
80 0xf200, 0xf200, 0xf200, 0xf117, 0xf600, 0xf200, 0xf200, 0xf200,
81 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, 0xf107,
82 0xf108, 0xf109, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200,
83};
84
85u_short shift_ctrl_map[NR_KEYS] = {
86 0xf200, 0xf200, 0xf200, 0xf000, 0xf200, 0xf200, 0xf200, 0xf200,
87 0xf200, 0xf200, 0xf200, 0xf200, 0xf01f, 0xf200, 0xf200, 0xf200,
88 0xf200, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, 0xf019, 0xf015,
89 0xf009, 0xf00f, 0xf010, 0xf200, 0xf200, 0xf200, 0xf207, 0xf001,
90 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, 0xf00b, 0xf00c,
91 0xf200, 0xf200, 0xf200, 0xf201, 0xf700, 0xf200, 0xf01a, 0xf018,
92 0xf003, 0xf016, 0xf002, 0xf00e, 0xf00d, 0xf200, 0xf200, 0xf200,
93 0xf200, 0xf700, 0xf702, 0xf200, 0xf703, 0xf200, 0xf703, 0xf200,
94 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
95 0xf200, 0xf200, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf601,
96 0xf200, 0xf200, 0xf200, 0xf603, 0xf600, 0xf118, 0xf119, 0xf200,
97 0xf200, 0xf602, 0xf208, 0xf02d, 0xf02b, 0xf30c, 0xf02e, 0xf30d,
98 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
99 0xf200, 0xf200, 0xf200, 0xf117, 0xf600, 0xf200, 0xf200, 0xf200,
100 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
101 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200,
102};
103
104u_short alt_map[NR_KEYS] = {
105 0xf200, 0xf81b, 0xf831, 0xf832, 0xf833, 0xf834, 0xf835, 0xf836,
106 0xf837, 0xf838, 0xf839, 0xf830, 0xf82d, 0xf83d, 0xf200, 0xf87f,
107 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, 0xf879, 0xf875,
108 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf85c, 0xf207, 0xf861,
109 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, 0xf86b, 0xf83b,
110 0xf827, 0xf860, 0xf200, 0xf80d, 0xf700, 0xf200, 0xf87a, 0xf878,
111 0xf863, 0xf876, 0xf862, 0xf82c, 0xf82e, 0xf82f, 0xf200, 0xf200,
112 0xf200, 0xf700, 0xf702, 0xf200, 0xf703, 0xf820, 0xf703, 0xf200,
113 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
114 0xf200, 0xf200, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf210,
115 0xf200, 0xf200, 0xf200, 0xf603, 0xf600, 0xf118, 0xf119, 0xf200,
116 0xf200, 0xf211, 0xf208, 0xf02d, 0xf02b, 0xf30c, 0xf02e, 0xf30d,
117 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
118 0xf200, 0xf200, 0xf200, 0xf117, 0xf600, 0xf200, 0xf200, 0xf200,
119 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507,
120 0xf508, 0xf509, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200,
121};
122
123u_short ctrl_alt_map[NR_KEYS] = {
124 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
125 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
126 0xf200, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, 0xf819, 0xf815,
127 0xf809, 0xf80f, 0xf810, 0xf200, 0xf200, 0xf200, 0xf207, 0xf801,
128 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, 0xf80b, 0xf80c,
129 0xf200, 0xf200, 0xf200, 0xf201, 0xf700, 0xf200, 0xf81a, 0xf818,
130 0xf803, 0xf816, 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf200, 0xf200,
131 0xf200, 0xf700, 0xf702, 0xf200, 0xf703, 0xf200, 0xf703, 0xf200,
132 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
133 0xf200, 0xf200, 0xf200, 0xf115, 0xf07f, 0xf200, 0xf200, 0xf601,
134 0xf200, 0xf200, 0xf200, 0xf603, 0xf600, 0xf118, 0xf119, 0xf200,
135 0xf200, 0xf602, 0xf208, 0xf02d, 0xf02b, 0xf30c, 0xf02e, 0xf30d,
136 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200,
137 0xf200, 0xf200, 0xf200, 0xf117, 0xf600, 0xf200, 0xf200, 0xf200,
138 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, 0xf507,
139 0xf508, 0xf509, 0xf200, 0xf200, 0xf200, 0xf200, 0xf11d, 0xf200,
140};
141
142ushort *key_maps[MAX_NR_KEYMAPS] = {
143 plain_map, shift_map, altgr_map, 0,
144 ctrl_map, shift_ctrl_map, 0, 0,
145 alt_map, 0, 0, 0,
146 ctrl_alt_map, 0
147};
148
149unsigned int keymap_count = 7;
150
151
152/*
153 * Philosophy: most people do not define more strings, but they who do
154 * often want quite a lot of string space. So, we statically allocate
155 * the default and allocate dynamically in chunks of 512 bytes.
156 */
157
158char func_buf[] = {
159 '\033', '[', '[', 'A', 0,
160 '\033', '[', '[', 'B', 0,
161 '\033', '[', '[', 'C', 0,
162 '\033', '[', '[', 'D', 0,
163 '\033', '[', '[', 'E', 0,
164 '\033', '[', '1', '7', '~', 0,
165 '\033', '[', '1', '8', '~', 0,
166 '\033', '[', '1', '9', '~', 0,
167 '\033', '[', '2', '0', '~', 0,
168 '\033', '[', '2', '1', '~', 0,
169 '\033', '[', '2', '3', '~', 0,
170 '\033', '[', '2', '4', '~', 0,
171 '\033', '[', '2', '5', '~', 0,
172 '\033', '[', '2', '6', '~', 0,
173 '\033', '[', '2', '8', '~', 0,
174 '\033', '[', '2', '9', '~', 0,
175 '\033', '[', '3', '1', '~', 0,
176 '\033', '[', '3', '2', '~', 0,
177 '\033', '[', '3', '3', '~', 0,
178 '\033', '[', '3', '4', '~', 0,
179 '\033', '[', '1', '~', 0,
180 '\033', '[', '2', '~', 0,
181 '\033', '[', '3', '~', 0,
182 '\033', '[', '4', '~', 0,
183 '\033', '[', '5', '~', 0,
184 '\033', '[', '6', '~', 0,
185 '\033', '[', 'M', 0,
186 '\033', '[', 'P', 0,
187};
188
189
190char *funcbufptr = func_buf;
191int funcbufsize = sizeof(func_buf);
192int funcbufleft = 0; /* space left */
193
194char *func_table[MAX_NR_FUNC] = {
195 func_buf + 0,
196 func_buf + 5,
197 func_buf + 10,
198 func_buf + 15,
199 func_buf + 20,
200 func_buf + 25,
201 func_buf + 31,
202 func_buf + 37,
203 func_buf + 43,
204 func_buf + 49,
205 func_buf + 55,
206 func_buf + 61,
207 func_buf + 67,
208 func_buf + 73,
209 func_buf + 79,
210 func_buf + 85,
211 func_buf + 91,
212 func_buf + 97,
213 func_buf + 103,
214 func_buf + 109,
215 func_buf + 115,
216 func_buf + 120,
217 func_buf + 125,
218 func_buf + 130,
219 func_buf + 135,
220 func_buf + 140,
221 func_buf + 145,
222 0,
223 0,
224 func_buf + 149,
225 0,
226};
227
228struct kbdiacr accent_table[MAX_DIACR] = {
229 {'`', 'A', 'À'}, {'`', 'a', 'à'},
230 {'\'', 'A', 'Á'}, {'\'', 'a', 'á'},
231 {'^', 'A', 'Â'}, {'^', 'a', 'â'},
232 {'~', 'A', 'Ã'}, {'~', 'a', 'ã'},
233 {'"', 'A', 'Ä'}, {'"', 'a', 'ä'},
234 {'O', 'A', 'Å'}, {'o', 'a', 'å'},
235 {'0', 'A', 'Å'}, {'0', 'a', 'å'},
236 {'A', 'A', 'Å'}, {'a', 'a', 'å'},
237 {'A', 'E', 'Æ'}, {'a', 'e', 'æ'},
238 {',', 'C', 'Ç'}, {',', 'c', 'ç'},
239 {'`', 'E', 'È'}, {'`', 'e', 'è'},
240 {'\'', 'E', 'É'}, {'\'', 'e', 'é'},
241 {'^', 'E', 'Ê'}, {'^', 'e', 'ê'},
242 {'"', 'E', 'Ë'}, {'"', 'e', 'ë'},
243 {'`', 'I', 'Ì'}, {'`', 'i', 'ì'},
244 {'\'', 'I', 'Í'}, {'\'', 'i', 'í'},
245 {'^', 'I', 'Î'}, {'^', 'i', 'î'},
246 {'"', 'I', 'Ï'}, {'"', 'i', 'ï'},
247 {'-', 'D', 'Ð'}, {'-', 'd', 'ð'},
248 {'~', 'N', 'Ñ'}, {'~', 'n', 'ñ'},
249 {'`', 'O', 'Ò'}, {'`', 'o', 'ò'},
250 {'\'', 'O', 'Ó'}, {'\'', 'o', 'ó'},
251 {'^', 'O', 'Ô'}, {'^', 'o', 'ô'},
252 {'~', 'O', 'Õ'}, {'~', 'o', 'õ'},
253 {'"', 'O', 'Ö'}, {'"', 'o', 'ö'},
254 {'/', 'O', 'Ø'}, {'/', 'o', 'ø'},
255 {'`', 'U', 'Ù'}, {'`', 'u', 'ù'},
256 {'\'', 'U', 'Ú'}, {'\'', 'u', 'ú'},
257 {'^', 'U', 'Û'}, {'^', 'u', 'û'},
258 {'"', 'U', 'Ü'}, {'"', 'u', 'ü'},
259 {'\'', 'Y', 'Ý'}, {'\'', 'y', 'ý'},
260 {'T', 'H', 'Þ'}, {'t', 'h', 'þ'},
261 {'s', 's', 'ß'}, {'"', 'y', 'ÿ'},
262 {'s', 'z', 'ß'}, {'i', 'j', 'ÿ'},
263};
264
265unsigned int accent_table_size = 68;
diff --git a/drivers/char/qtronixmap.map b/drivers/char/qtronixmap.map
deleted file mode 100644
index 8d1ff5c1e281..000000000000
--- a/drivers/char/qtronixmap.map
+++ /dev/null
@@ -1,287 +0,0 @@
1# Default kernel keymap. This uses 7 modifier combinations.
2keymaps 0-2,4-5,8,12
3# Change the above line into
4# keymaps 0-2,4-6,8,12
5# in case you want the entries
6# altgr control keycode 83 = Boot
7# altgr control keycode 111 = Boot
8# below.
9#
10# In fact AltGr is used very little, and one more keymap can
11# be saved by mapping AltGr to Alt (and adapting a few entries):
12# keycode 100 = Alt
13#
14keycode 1 = grave asciitilde
15 alt keycode 1 = Meta_Escape
16keycode 2 = one exclam
17 alt keycode 2 = Meta_one
18keycode 3 = two at at
19 control keycode 3 = nul
20 shift control keycode 3 = nul
21 alt keycode 3 = Meta_two
22keycode 4 = three numbersign
23 control keycode 4 = Escape
24 alt keycode 4 = Meta_three
25keycode 5 = four dollar dollar
26 control keycode 5 = Control_backslash
27 alt keycode 5 = Meta_four
28keycode 6 = five percent
29 control keycode 6 = Control_bracketright
30 alt keycode 6 = Meta_five
31keycode 7 = six asciicircum
32 control keycode 7 = Control_asciicircum
33 alt keycode 7 = Meta_six
34keycode 8 = seven ampersand braceleft
35 control keycode 8 = Control_underscore
36 alt keycode 8 = Meta_seven
37keycode 9 = eight asterisk bracketleft
38 control keycode 9 = Delete
39 alt keycode 9 = Meta_eight
40keycode 10 = nine parenleft bracketright
41 alt keycode 10 = Meta_nine
42keycode 11 = zero parenright braceright
43 alt keycode 11 = Meta_zero
44keycode 12 = minus underscore backslash
45 control keycode 12 = Control_underscore
46 shift control keycode 12 = Control_underscore
47 alt keycode 12 = Meta_minus
48keycode 13 = equal plus
49 alt keycode 13 = Meta_equal
50keycode 15 = Delete Delete
51 control keycode 15 = BackSpace
52 alt keycode 15 = Meta_Delete
53keycode 16 = Tab Tab
54 alt keycode 16 = Meta_Tab
55keycode 17 = q
56keycode 18 = w
57keycode 19 = e
58keycode 20 = r
59keycode 21 = t
60keycode 22 = y
61keycode 23 = u
62keycode 24 = i
63keycode 25 = o
64keycode 26 = p
65keycode 27 = bracketleft braceleft
66 control keycode 27 = Escape
67 alt keycode 27 = Meta_bracketleft
68keycode 28 = bracketright braceright
69 control keycode 28 = Control_bracketright
70 alt keycode 28 = Meta_bracketright
71keycode 29 = backslash bar
72 control keycode 29 = Control_backslash
73 alt keycode 29 = Meta_backslash
74keycode 30 = Caps_Lock
75keycode 31 = a
76keycode 32 = s
77keycode 33 = d
78keycode 34 = f
79keycode 35 = g
80keycode 36 = h
81keycode 37 = j
82keycode 38 = k
83keycode 39 = l
84keycode 40 = semicolon colon
85 alt keycode 39 = Meta_semicolon
86keycode 41 = apostrophe quotedbl
87 control keycode 40 = Control_g
88 alt keycode 40 = Meta_apostrophe
89keycode 42 = grave asciitilde
90 control keycode 41 = nul
91 alt keycode 41 = Meta_grave
92keycode 43 = Return
93 alt keycode 43 = Meta_Control_m
94keycode 44 = Shift
95keycode 46 = z
96keycode 47 = x
97keycode 48 = c
98keycode 49 = v
99keycode 50 = b
100keycode 51 = n
101keycode 52 = m
102keycode 53 = comma less
103 alt keycode 51 = Meta_comma
104keycode 54 = period greater
105 control keycode 52 = Compose
106 alt keycode 52 = Meta_period
107keycode 55 = slash question
108 control keycode 53 = Delete
109 alt keycode 53 = Meta_slash
110keycode 57 = Shift
111keycode 58 = Control
112keycode 60 = Alt
113keycode 61 = space space
114 control keycode 61 = nul
115 alt keycode 61 = Meta_space
116keycode 62 = Alt
117
118keycode 75 = Insert
119keycode 76 = Delete
120
121keycode 83 = Up
122keycode 84 = Down
123
124keycode 85 = Prior
125 shift keycode 85 = Scroll_Backward
126keycode 86 = Next
127 shift keycode 86 = Scroll_Forward
128keycode 89 = Right
129 alt keycode 89 = Incr_Console
130keycode 79 = Left
131 alt keycode 79 = Decr_Console
132
133keycode 90 = Num_Lock
134 shift keycode 90 = Bare_Num_Lock
135
136keycode 91 = minus
137keycode 92 = plus
138keycode 93 = KP_Multiply
139keycode 94 = period
140keycode 95 = KP_Divide
141
142keycode 107 = Select
143keycode 108 = Down
144
145keycode 110 = Escape Escape
146 alt keycode 1 = Meta_Escape
147
148keycode 112 = F1 F11 Console_13
149 control keycode 112 = F1
150 alt keycode 112 = Console_1
151 control alt keycode 112 = Console_1
152keycode 113 = F2 F12 Console_14
153 control keycode 113 = F2
154 alt keycode 113 = Console_2
155 control alt keycode 113 = Console_2
156keycode 114 = F3 F13 Console_15
157 control keycode 114 = F3
158 alt keycode 114 = Console_3
159 control alt keycode 114 = Console_3
160keycode 115 = F4 F14 Console_16
161 control keycode 115 = F4
162 alt keycode 115 = Console_4
163 control alt keycode 115 = Console_4
164keycode 116 = F5 F15 Console_17
165 control keycode 116 = F5
166 alt keycode 116 = Console_5
167 control alt keycode 116 = Console_5
168keycode 117 = F6 F16 Console_18
169 control keycode 117 = F6
170 alt keycode 117 = Console_6
171 control alt keycode 117 = Console_6
172keycode 118 = F7 F17 Console_19
173 control keycode 118 = F7
174 alt keycode 118 = Console_7
175 control alt keycode 118 = Console_7
176keycode 119 = F8 F18 Console_20
177 control keycode 119 = F8
178 alt keycode 119 = Console_8
179 control alt keycode 119 = Console_8
180keycode 120 = F9 F19 Console_21
181 control keycode 120 = F9
182 alt keycode 120 = Console_9
183 control alt keycode 120 = Console_9
184keycode 121 = F10 F20 Console_22
185 control keycode 121 = F10
186 alt keycode 121 = Console_10
187 control alt keycode 121 = Console_10
188
189keycode 126 = Pause
190
191
192string F1 = "\033[[A"
193string F2 = "\033[[B"
194string F3 = "\033[[C"
195string F4 = "\033[[D"
196string F5 = "\033[[E"
197string F6 = "\033[17~"
198string F7 = "\033[18~"
199string F8 = "\033[19~"
200string F9 = "\033[20~"
201string F10 = "\033[21~"
202string F11 = "\033[23~"
203string F12 = "\033[24~"
204string F13 = "\033[25~"
205string F14 = "\033[26~"
206string F15 = "\033[28~"
207string F16 = "\033[29~"
208string F17 = "\033[31~"
209string F18 = "\033[32~"
210string F19 = "\033[33~"
211string F20 = "\033[34~"
212string Find = "\033[1~"
213string Insert = "\033[2~"
214string Remove = "\033[3~"
215string Select = "\033[4~"
216string Prior = "\033[5~"
217string Next = "\033[6~"
218string Macro = "\033[M"
219string Pause = "\033[P"
220compose '`' 'A' to 'À'
221compose '`' 'a' to 'à'
222compose '\'' 'A' to 'Á'
223compose '\'' 'a' to 'á'
224compose '^' 'A' to 'Â'
225compose '^' 'a' to 'â'
226compose '~' 'A' to 'Ã'
227compose '~' 'a' to 'ã'
228compose '"' 'A' to 'Ä'
229compose '"' 'a' to 'ä'
230compose 'O' 'A' to 'Å'
231compose 'o' 'a' to 'å'
232compose '0' 'A' to 'Å'
233compose '0' 'a' to 'å'
234compose 'A' 'A' to 'Å'
235compose 'a' 'a' to 'å'
236compose 'A' 'E' to 'Æ'
237compose 'a' 'e' to 'æ'
238compose ',' 'C' to 'Ç'
239compose ',' 'c' to 'ç'
240compose '`' 'E' to 'È'
241compose '`' 'e' to 'è'
242compose '\'' 'E' to 'É'
243compose '\'' 'e' to 'é'
244compose '^' 'E' to 'Ê'
245compose '^' 'e' to 'ê'
246compose '"' 'E' to 'Ë'
247compose '"' 'e' to 'ë'
248compose '`' 'I' to 'Ì'
249compose '`' 'i' to 'ì'
250compose '\'' 'I' to 'Í'
251compose '\'' 'i' to 'í'
252compose '^' 'I' to 'Î'
253compose '^' 'i' to 'î'
254compose '"' 'I' to 'Ï'
255compose '"' 'i' to 'ï'
256compose '-' 'D' to 'Ð'
257compose '-' 'd' to 'ð'
258compose '~' 'N' to 'Ñ'
259compose '~' 'n' to 'ñ'
260compose '`' 'O' to 'Ò'
261compose '`' 'o' to 'ò'
262compose '\'' 'O' to 'Ó'
263compose '\'' 'o' to 'ó'
264compose '^' 'O' to 'Ô'
265compose '^' 'o' to 'ô'
266compose '~' 'O' to 'Õ'
267compose '~' 'o' to 'õ'
268compose '"' 'O' to 'Ö'
269compose '"' 'o' to 'ö'
270compose '/' 'O' to 'Ø'
271compose '/' 'o' to 'ø'
272compose '`' 'U' to 'Ù'
273compose '`' 'u' to 'ù'
274compose '\'' 'U' to 'Ú'
275compose '\'' 'u' to 'ú'
276compose '^' 'U' to 'Û'
277compose '^' 'u' to 'û'
278compose '"' 'U' to 'Ü'
279compose '"' 'u' to 'ü'
280compose '\'' 'Y' to 'Ý'
281compose '\'' 'y' to 'ý'
282compose 'T' 'H' to 'Þ'
283compose 't' 'h' to 'þ'
284compose 's' 's' to 'ß'
285compose '"' 'y' to 'ÿ'
286compose 's' 'z' to 'ß'
287compose 'i' 'j' to 'ÿ'
diff --git a/drivers/char/watchdog/Kconfig b/drivers/char/watchdog/Kconfig
index 06f3fa2fe877..89e46d6dfc4e 100644
--- a/drivers/char/watchdog/Kconfig
+++ b/drivers/char/watchdog/Kconfig
@@ -316,6 +316,27 @@ config I8XX_TCO
316 To compile this driver as a module, choose M here: the 316 To compile this driver as a module, choose M here: the
317 module will be called i8xx_tco. 317 module will be called i8xx_tco.
318 318
319config ITCO_WDT
320 tristate "Intel TCO Timer/Watchdog (EXPERIMENTAL)"
321 depends on WATCHDOG && (X86 || IA64) && PCI && EXPERIMENTAL
322 ---help---
323 Hardware driver for the intel TCO timer based watchdog devices.
324 These drivers are included in the Intel 82801 I/O Controller
325 Hub family 'from ICH0 up to ICH7) and in the Intel 6300ESB
326 controller hub.
327
328 The TCO (Total Cost of Ownership) timer is a watchdog timer
329 that will reboot the machine after its second expiration. The
330 expiration time can be configured with the "heartbeat" parameter.
331
332 On some motherboards the driver may fail to reset the chipset's
333 NO_REBOOT flag which prevents the watchdog from rebooting the
334 machine. If this is the case you will get a kernel message like
335 "failed to reset NO_REBOOT flag, reboot disabled by hardware".
336
337 To compile this driver as a module, choose M here: the
338 module will be called iTCO_wdt.
339
319config SC1200_WDT 340config SC1200_WDT
320 tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog" 341 tristate "National Semiconductor PC87307/PC97307 (ala SC1200) Watchdog"
321 depends on WATCHDOG && X86 342 depends on WATCHDOG && X86
diff --git a/drivers/char/watchdog/Makefile b/drivers/char/watchdog/Makefile
index 6ffca7cb56ab..7f70abad465a 100644
--- a/drivers/char/watchdog/Makefile
+++ b/drivers/char/watchdog/Makefile
@@ -47,6 +47,7 @@ obj-$(CONFIG_IBMASR) += ibmasr.o
47obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o 47obj-$(CONFIG_WAFER_WDT) += wafer5823wdt.o
48obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o 48obj-$(CONFIG_I6300ESB_WDT) += i6300esb.o
49obj-$(CONFIG_I8XX_TCO) += i8xx_tco.o 49obj-$(CONFIG_I8XX_TCO) += i8xx_tco.o
50obj-$(CONFIG_ITCO_WDT) += iTCO_wdt.o
50obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o 51obj-$(CONFIG_SC1200_WDT) += sc1200wdt.o
51obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o 52obj-$(CONFIG_SCx200_WDT) += scx200_wdt.o
52obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o 53obj-$(CONFIG_60XX_WDT) += sbc60xxwdt.o
diff --git a/drivers/char/watchdog/iTCO_wdt.c b/drivers/char/watchdog/iTCO_wdt.c
new file mode 100644
index 000000000000..8f89948832fc
--- /dev/null
+++ b/drivers/char/watchdog/iTCO_wdt.c
@@ -0,0 +1,735 @@
1/*
2 * intel TCO Watchdog Driver (Used in i82801 and i6300ESB chipsets)
3 *
4 * (c) Copyright 2006 Wim Van Sebroeck <wim@iguana.be>.
5 *
6 * This program is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU General Public License
8 * as published by the Free Software Foundation; either version
9 * 2 of the License, or (at your option) any later version.
10 *
11 * Neither Wim Van Sebroeck nor Iguana vzw. admit liability nor
12 * provide warranty for any of this software. This material is
13 * provided "AS-IS" and at no charge.
14 *
15 * The TCO watchdog is implemented in the following I/O controller hubs:
16 * (See the intel documentation on http://developer.intel.com.)
17 * 82801AA (ICH) : document number 290655-003, 290677-014,
18 * 82801AB (ICHO) : document number 290655-003, 290677-014,
19 * 82801BA (ICH2) : document number 290687-002, 298242-027,
20 * 82801BAM (ICH2-M) : document number 290687-002, 298242-027,
21 * 82801CA (ICH3-S) : document number 290733-003, 290739-013,
22 * 82801CAM (ICH3-M) : document number 290716-001, 290718-007,
23 * 82801DB (ICH4) : document number 290744-001, 290745-020,
24 * 82801DBM (ICH4-M) : document number 252337-001, 252663-005,
25 * 82801E (C-ICH) : document number 273599-001, 273645-002,
26 * 82801EB (ICH5) : document number 252516-001, 252517-003,
27 * 82801ER (ICH5R) : document number 252516-001, 252517-003,
28 * 82801FB (ICH6) : document number 301473-002, 301474-007,
29 * 82801FR (ICH6R) : document number 301473-002, 301474-007,
30 * 82801FBM (ICH6-M) : document number 301473-002, 301474-007,
31 * 82801FW (ICH6W) : document number 301473-001, 301474-007,
32 * 82801FRW (ICH6RW) : document number 301473-001, 301474-007,
33 * 82801GB (ICH7) : document number 307013-002, 307014-009,
34 * 82801GR (ICH7R) : document number 307013-002, 307014-009,
35 * 82801GDH (ICH7DH) : document number 307013-002, 307014-009,
36 * 82801GBM (ICH7-M) : document number 307013-002, 307014-009,
37 * 82801GHM (ICH7-M DH) : document number 307013-002, 307014-009,
38 * 6300ESB (6300ESB) : document number 300641-003
39 */
40
41/*
42 * Includes, defines, variables, module parameters, ...
43 */
44
45/* Module and version information */
46#define DRV_NAME "iTCO_wdt"
47#define DRV_VERSION "1.00"
48#define DRV_RELDATE "30-Jul-2006"
49#define PFX DRV_NAME ": "
50
51/* Includes */
52#include <linux/config.h> /* For CONFIG_WATCHDOG_NOWAYOUT/... */
53#include <linux/module.h> /* For module specific items */
54#include <linux/moduleparam.h> /* For new moduleparam's */
55#include <linux/types.h> /* For standard types (like size_t) */
56#include <linux/errno.h> /* For the -ENODEV/... values */
57#include <linux/kernel.h> /* For printk/panic/... */
58#include <linux/miscdevice.h> /* For MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR) */
59#include <linux/watchdog.h> /* For the watchdog specific items */
60#include <linux/init.h> /* For __init/__exit/... */
61#include <linux/fs.h> /* For file operations */
62#include <linux/platform_device.h> /* For platform_driver framework */
63#include <linux/pci.h> /* For pci functions */
64#include <linux/ioport.h> /* For io-port access */
65#include <linux/spinlock.h> /* For spin_lock/spin_unlock/... */
66
67#include <asm/uaccess.h> /* For copy_to_user/put_user/... */
68#include <asm/io.h> /* For inb/outb/... */
69
70/* TCO related info */
71enum iTCO_chipsets {
72 TCO_ICH = 0, /* ICH */
73 TCO_ICH0, /* ICH0 */
74 TCO_ICH2, /* ICH2 */
75 TCO_ICH2M, /* ICH2-M */
76 TCO_ICH3, /* ICH3-S */
77 TCO_ICH3M, /* ICH3-M */
78 TCO_ICH4, /* ICH4 */
79 TCO_ICH4M, /* ICH4-M */
80 TCO_CICH, /* C-ICH */
81 TCO_ICH5, /* ICH5 & ICH5R */
82 TCO_6300ESB, /* 6300ESB */
83 TCO_ICH6, /* ICH6 & ICH6R */
84 TCO_ICH6M, /* ICH6-M */
85 TCO_ICH6W, /* ICH6W & ICH6RW */
86 TCO_ICH7, /* ICH7 & ICH7R */
87 TCO_ICH7M, /* ICH7-M */
88 TCO_ICH7MDH, /* ICH7-M DH */
89};
90
91static struct {
92 char *name;
93 unsigned int iTCO_version;
94} iTCO_chipset_info[] __devinitdata = {
95 {"ICH", 1},
96 {"ICH0", 1},
97 {"ICH2", 1},
98 {"ICH2-M", 1},
99 {"ICH3-S", 1},
100 {"ICH3-M", 1},
101 {"ICH4", 1},
102 {"ICH4-M", 1},
103 {"C-ICH", 1},
104 {"ICH5 or ICH5R", 1},
105 {"6300ESB", 1},
106 {"ICH6 or ICH6R", 2},
107 {"ICH6-M", 2},
108 {"ICH6W or ICH6RW", 2},
109 {"ICH7 or ICH7R", 2},
110 {"ICH7-M", 2},
111 {"ICH7-M DH", 2},
112 {NULL,0}
113};
114
115/*
116 * This data only exists for exporting the supported PCI ids
117 * via MODULE_DEVICE_TABLE. We do not actually register a
118 * pci_driver, because the I/O Controller Hub has also other
119 * functions that probably will be registered by other drivers.
120 */
121static struct pci_device_id iTCO_wdt_pci_tbl[] = {
122 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AA_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH },
123 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801AB_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH0 },
124 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH2 },
125 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801BA_10, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH2M },
126 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH3 },
127 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801CA_12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH3M },
128 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH4 },
129 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801DB_12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH4M },
130 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801E_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_CICH },
131 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82801EB_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH5 },
132 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_6300ESB },
133 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH6 },
134 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH6M },
135 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH6_2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH6W },
136 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_0, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7 },
137 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_1, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7M },
138 { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH7_31, PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH7MDH },
139 { 0, }, /* End of list */
140};
141MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl);
142
143/* Address definitions for the TCO */
144#define TCOBASE iTCO_wdt_private.ACPIBASE + 0x60 /* TCO base address */
145#define SMI_EN iTCO_wdt_private.ACPIBASE + 0x30 /* SMI Control and Enable Register */
146
147#define TCO_RLD TCOBASE + 0x00 /* TCO Timer Reload and Current Value */
148#define TCOv1_TMR TCOBASE + 0x01 /* TCOv1 Timer Initial Value */
149#define TCO_DAT_IN TCOBASE + 0x02 /* TCO Data In Register */
150#define TCO_DAT_OUT TCOBASE + 0x03 /* TCO Data Out Register */
151#define TCO1_STS TCOBASE + 0x04 /* TCO1 Status Register */
152#define TCO2_STS TCOBASE + 0x06 /* TCO2 Status Register */
153#define TCO1_CNT TCOBASE + 0x08 /* TCO1 Control Register */
154#define TCO2_CNT TCOBASE + 0x0a /* TCO2 Control Register */
155#define TCOv2_TMR TCOBASE + 0x12 /* TCOv2 Timer Initial Value */
156
157/* internal variables */
158static unsigned long is_active;
159static char expect_release;
160static struct { /* this is private data for the iTCO_wdt device */
161 unsigned int iTCO_version; /* TCO version/generation */
162 unsigned long ACPIBASE; /* The cards ACPIBASE address (TCOBASE = ACPIBASE+0x60) */
163 unsigned long __iomem *gcs; /* NO_REBOOT flag is Memory-Mapped GCS register bit 5 (TCO version 2) */
164 spinlock_t io_lock; /* the lock for io operations */
165 struct pci_dev *pdev; /* the PCI-device */
166} iTCO_wdt_private;
167
168static struct platform_device *iTCO_wdt_platform_device; /* the watchdog platform device */
169
170/* module parameters */
171#define WATCHDOG_HEARTBEAT 30 /* 30 sec default heartbeat */
172static int heartbeat = WATCHDOG_HEARTBEAT; /* in seconds */
173module_param(heartbeat, int, 0);
174MODULE_PARM_DESC(heartbeat, "Watchdog heartbeat in seconds. (2<heartbeat<39 (TCO v1) or 613 (TCO v2), default=" __MODULE_STRING(WATCHDOG_HEARTBEAT) ")");
175
176static int nowayout = WATCHDOG_NOWAYOUT;
177module_param(nowayout, int, 0);
178MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=CONFIG_WATCHDOG_NOWAYOUT)");
179
180/*
181 * Some TCO specific functions
182 */
183
184static inline unsigned int seconds_to_ticks(int seconds)
185{
186 /* the internal timer is stored as ticks which decrement
187 * every 0.6 seconds */
188 return (seconds * 10) / 6;
189}
190
191static void iTCO_wdt_set_NO_REBOOT_bit(void)
192{
193 u32 val32;
194
195 /* Set the NO_REBOOT bit: this disables reboots */
196 if (iTCO_wdt_private.iTCO_version == 2) {
197 val32 = readl(iTCO_wdt_private.gcs);
198 val32 |= 0x00000020;
199 writel(val32, iTCO_wdt_private.gcs);
200 } else if (iTCO_wdt_private.iTCO_version == 1) {
201 pci_read_config_dword(iTCO_wdt_private.pdev, 0xd4, &val32);
202 val32 |= 0x00000002;
203 pci_write_config_dword(iTCO_wdt_private.pdev, 0xd4, val32);
204 }
205}
206
207static int iTCO_wdt_unset_NO_REBOOT_bit(void)
208{
209 int ret = 0;
210 u32 val32;
211
212 /* Unset the NO_REBOOT bit: this enables reboots */
213 if (iTCO_wdt_private.iTCO_version == 2) {
214 val32 = readl(iTCO_wdt_private.gcs);
215 val32 &= 0xffffffdf;
216 writel(val32, iTCO_wdt_private.gcs);
217
218 val32 = readl(iTCO_wdt_private.gcs);
219 if (val32 & 0x00000020)
220 ret = -EIO;
221 } else if (iTCO_wdt_private.iTCO_version == 1) {
222 pci_read_config_dword(iTCO_wdt_private.pdev, 0xd4, &val32);
223 val32 &= 0xfffffffd;
224 pci_write_config_dword(iTCO_wdt_private.pdev, 0xd4, val32);
225
226 pci_read_config_dword(iTCO_wdt_private.pdev, 0xd4, &val32);
227 if (val32 & 0x00000002)
228 ret = -EIO;
229 }
230
231 return ret; /* returns: 0 = OK, -EIO = Error */
232}
233
234static int iTCO_wdt_start(void)
235{
236 unsigned int val;
237
238 spin_lock(&iTCO_wdt_private.io_lock);
239
240 /* disable chipset's NO_REBOOT bit */
241 if (iTCO_wdt_unset_NO_REBOOT_bit()) {
242 printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n");
243 return -EIO;
244 }
245
246 /* Bit 11: TCO Timer Halt -> 0 = The TCO timer is enabled to count */
247 val = inw(TCO1_CNT);
248 val &= 0xf7ff;
249 outw(val, TCO1_CNT);
250 val = inw(TCO1_CNT);
251 spin_unlock(&iTCO_wdt_private.io_lock);
252
253 if (val & 0x0800)
254 return -1;
255 return 0;
256}
257
258static int iTCO_wdt_stop(void)
259{
260 unsigned int val;
261
262 spin_lock(&iTCO_wdt_private.io_lock);
263
264 /* Bit 11: TCO Timer Halt -> 1 = The TCO timer is disabled */
265 val = inw(TCO1_CNT);
266 val |= 0x0800;
267 outw(val, TCO1_CNT);
268 val = inw(TCO1_CNT);
269
270 /* Set the NO_REBOOT bit to prevent later reboots, just for sure */
271 iTCO_wdt_set_NO_REBOOT_bit();
272
273 spin_unlock(&iTCO_wdt_private.io_lock);
274
275 if ((val & 0x0800) == 0)
276 return -1;
277 return 0;
278}
279
280static int iTCO_wdt_keepalive(void)
281{
282 spin_lock(&iTCO_wdt_private.io_lock);
283
284 /* Reload the timer by writing to the TCO Timer Counter register */
285 if (iTCO_wdt_private.iTCO_version == 2) {
286 outw(0x01, TCO_RLD);
287 } else if (iTCO_wdt_private.iTCO_version == 1) {
288 outb(0x01, TCO_RLD);
289 }
290
291 spin_unlock(&iTCO_wdt_private.io_lock);
292 return 0;
293}
294
295static int iTCO_wdt_set_heartbeat(int t)
296{
297 unsigned int val16;
298 unsigned char val8;
299 unsigned int tmrval;
300
301 tmrval = seconds_to_ticks(t);
302 /* from the specs: */
303 /* "Values of 0h-3h are ignored and should not be attempted" */
304 if (tmrval < 0x04)
305 return -EINVAL;
306 if (((iTCO_wdt_private.iTCO_version == 2) && (tmrval > 0x3ff)) ||
307 ((iTCO_wdt_private.iTCO_version == 1) && (tmrval > 0x03f)))
308 return -EINVAL;
309
310 /* Write new heartbeat to watchdog */
311 if (iTCO_wdt_private.iTCO_version == 2) {
312 spin_lock(&iTCO_wdt_private.io_lock);
313 val16 = inw(TCOv2_TMR);
314 val16 &= 0xfc00;
315 val16 |= tmrval;
316 outw(val16, TCOv2_TMR);
317 val16 = inw(TCOv2_TMR);
318 spin_unlock(&iTCO_wdt_private.io_lock);
319
320 if ((val16 & 0x3ff) != tmrval)
321 return -EINVAL;
322 } else if (iTCO_wdt_private.iTCO_version == 1) {
323 spin_lock(&iTCO_wdt_private.io_lock);
324 val8 = inb(TCOv1_TMR);
325 val8 &= 0xc0;
326 val8 |= (tmrval & 0xff);
327 outb(val8, TCOv1_TMR);
328 val8 = inb(TCOv1_TMR);
329 spin_unlock(&iTCO_wdt_private.io_lock);
330
331 if ((val8 & 0x3f) != tmrval)
332 return -EINVAL;
333 }
334
335 heartbeat = t;
336 return 0;
337}
338
339static int iTCO_wdt_get_timeleft (int *time_left)
340{
341 unsigned int val16;
342 unsigned char val8;
343
344 /* read the TCO Timer */
345 if (iTCO_wdt_private.iTCO_version == 2) {
346 spin_lock(&iTCO_wdt_private.io_lock);
347 val16 = inw(TCO_RLD);
348 val16 &= 0x3ff;
349 spin_unlock(&iTCO_wdt_private.io_lock);
350
351 *time_left = (val16 * 6) / 10;
352 } else if (iTCO_wdt_private.iTCO_version == 1) {
353 spin_lock(&iTCO_wdt_private.io_lock);
354 val8 = inb(TCO_RLD);
355 val8 &= 0x3f;
356 spin_unlock(&iTCO_wdt_private.io_lock);
357
358 *time_left = (val8 * 6) / 10;
359 }
360 return 0;
361}
362
363/*
364 * /dev/watchdog handling
365 */
366
367static int iTCO_wdt_open (struct inode *inode, struct file *file)
368{
369 /* /dev/watchdog can only be opened once */
370 if (test_and_set_bit(0, &is_active))
371 return -EBUSY;
372
373 /*
374 * Reload and activate timer
375 */
376 iTCO_wdt_keepalive();
377 iTCO_wdt_start();
378 return nonseekable_open(inode, file);
379}
380
381static int iTCO_wdt_release (struct inode *inode, struct file *file)
382{
383 /*
384 * Shut off the timer.
385 */
386 if (expect_release == 42) {
387 iTCO_wdt_stop();
388 } else {
389 printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
390 iTCO_wdt_keepalive();
391 }
392 clear_bit(0, &is_active);
393 expect_release = 0;
394 return 0;
395}
396
397static ssize_t iTCO_wdt_write (struct file *file, const char __user *data,
398 size_t len, loff_t * ppos)
399{
400 /* See if we got the magic character 'V' and reload the timer */
401 if (len) {
402 if (!nowayout) {
403 size_t i;
404
405 /* note: just in case someone wrote the magic character
406 * five months ago... */
407 expect_release = 0;
408
409 /* scan to see whether or not we got the magic character */
410 for (i = 0; i != len; i++) {
411 char c;
412 if (get_user(c, data+i))
413 return -EFAULT;
414 if (c == 'V')
415 expect_release = 42;
416 }
417 }
418
419 /* someone wrote to us, we should reload the timer */
420 iTCO_wdt_keepalive();
421 }
422 return len;
423}
424
425static int iTCO_wdt_ioctl (struct inode *inode, struct file *file,
426 unsigned int cmd, unsigned long arg)
427{
428 int new_options, retval = -EINVAL;
429 int new_heartbeat;
430 int time_left;
431 void __user *argp = (void __user *)arg;
432 int __user *p = argp;
433 static struct watchdog_info ident = {
434 .options = WDIOF_SETTIMEOUT |
435 WDIOF_KEEPALIVEPING |
436 WDIOF_MAGICCLOSE,
437 .firmware_version = 0,
438 .identity = DRV_NAME,
439 };
440
441 switch (cmd) {
442 case WDIOC_GETSUPPORT:
443 return copy_to_user(argp, &ident,
444 sizeof (ident)) ? -EFAULT : 0;
445
446 case WDIOC_GETSTATUS:
447 case WDIOC_GETBOOTSTATUS:
448 return put_user(0, p);
449
450 case WDIOC_KEEPALIVE:
451 iTCO_wdt_keepalive();
452 return 0;
453
454 case WDIOC_SETOPTIONS:
455 {
456 if (get_user(new_options, p))
457 return -EFAULT;
458
459 if (new_options & WDIOS_DISABLECARD) {
460 iTCO_wdt_stop();
461 retval = 0;
462 }
463
464 if (new_options & WDIOS_ENABLECARD) {
465 iTCO_wdt_keepalive();
466 iTCO_wdt_start();
467 retval = 0;
468 }
469
470 return retval;
471 }
472
473 case WDIOC_SETTIMEOUT:
474 {
475 if (get_user(new_heartbeat, p))
476 return -EFAULT;
477
478 if (iTCO_wdt_set_heartbeat(new_heartbeat))
479 return -EINVAL;
480
481 iTCO_wdt_keepalive();
482 /* Fall */
483 }
484
485 case WDIOC_GETTIMEOUT:
486 return put_user(heartbeat, p);
487
488 case WDIOC_GETTIMELEFT:
489 {
490 if (iTCO_wdt_get_timeleft(&time_left))
491 return -EINVAL;
492
493 return put_user(time_left, p);
494 }
495
496 default:
497 return -ENOTTY;
498 }
499}
500
501/*
502 * Kernel Interfaces
503 */
504
505static struct file_operations iTCO_wdt_fops = {
506 .owner = THIS_MODULE,
507 .llseek = no_llseek,
508 .write = iTCO_wdt_write,
509 .ioctl = iTCO_wdt_ioctl,
510 .open = iTCO_wdt_open,
511 .release = iTCO_wdt_release,
512};
513
514static struct miscdevice iTCO_wdt_miscdev = {
515 .minor = WATCHDOG_MINOR,
516 .name = "watchdog",
517 .fops = &iTCO_wdt_fops,
518};
519
520/*
521 * Init & exit routines
522 */
523
524static int iTCO_wdt_init(struct pci_dev *pdev, const struct pci_device_id *ent, struct platform_device *dev)
525{
526 int ret;
527 u32 base_address;
528 unsigned long RCBA;
529 unsigned long val32;
530
531 /*
532 * Find the ACPI/PM base I/O address which is the base
533 * for the TCO registers (TCOBASE=ACPIBASE + 0x60)
534 * ACPIBASE is bits [15:7] from 0x40-0x43
535 */
536 pci_read_config_dword(pdev, 0x40, &base_address);
537 base_address &= 0x00007f80;
538 if (base_address == 0x00000000) {
539 /* Something's wrong here, ACPIBASE has to be set */
540 printk(KERN_ERR PFX "failed to get TCOBASE address\n");
541 pci_dev_put(pdev);
542 return -ENODEV;
543 }
544 iTCO_wdt_private.iTCO_version = iTCO_chipset_info[ent->driver_data].iTCO_version;
545 iTCO_wdt_private.ACPIBASE = base_address;
546 iTCO_wdt_private.pdev = pdev;
547
548 /* Get the Memory-Mapped GCS register, we need it for the NO_REBOOT flag (TCO v2) */
549 /* To get access to it you have to read RCBA from PCI Config space 0xf0
550 and use it as base. GCS = RCBA + ICH6_GCS(0x3410). */
551 if (iTCO_wdt_private.iTCO_version == 2) {
552 pci_read_config_dword(pdev, 0xf0, &base_address);
553 RCBA = base_address & 0xffffc000;
554 iTCO_wdt_private.gcs = ioremap((RCBA + 0x3410),4);
555 }
556
557 /* Check chipset's NO_REBOOT bit */
558 if (iTCO_wdt_unset_NO_REBOOT_bit()) {
559 printk(KERN_ERR PFX "failed to reset NO_REBOOT flag, reboot disabled by hardware\n");
560 ret = -ENODEV; /* Cannot reset NO_REBOOT bit */
561 goto out;
562 }
563
564 /* Set the NO_REBOOT bit to prevent later reboots, just for sure */
565 iTCO_wdt_set_NO_REBOOT_bit();
566
567 /* Set the TCO_EN bit in SMI_EN register */
568 if (!request_region(SMI_EN, 4, "iTCO_wdt")) {
569 printk(KERN_ERR PFX "I/O address 0x%04lx already in use\n",
570 SMI_EN );
571 ret = -EIO;
572 goto out;
573 }
574 val32 = inl(SMI_EN);
575 val32 &= 0xffffdfff; /* Turn off SMI clearing watchdog */
576 outl(val32, SMI_EN);
577 release_region(SMI_EN, 4);
578
579 /* The TCO I/O registers reside in a 32-byte range pointed to by the TCOBASE value */
580 if (!request_region (TCOBASE, 0x20, "iTCO_wdt")) {
581 printk (KERN_ERR PFX "I/O address 0x%04lx already in use\n",
582 TCOBASE);
583 ret = -EIO;
584 goto out;
585 }
586
587 printk(KERN_INFO PFX "Found a %s TCO device (Version=%d, TCOBASE=0x%04lx)\n",
588 iTCO_chipset_info[ent->driver_data].name,
589 iTCO_chipset_info[ent->driver_data].iTCO_version,
590 TCOBASE);
591
592 /* Clear out the (probably old) status */
593 outb(0, TCO1_STS);
594 outb(3, TCO2_STS);
595
596 /* Make sure the watchdog is not running */
597 iTCO_wdt_stop();
598
599 /* Check that the heartbeat value is within it's range ; if not reset to the default */
600 if (iTCO_wdt_set_heartbeat(heartbeat)) {
601 iTCO_wdt_set_heartbeat(WATCHDOG_HEARTBEAT);
602 printk(KERN_INFO PFX "heartbeat value must be 2<heartbeat<39 (TCO v1) or 613 (TCO v2), using %d\n",
603 heartbeat);
604 }
605
606 ret = misc_register(&iTCO_wdt_miscdev);
607 if (ret != 0) {
608 printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
609 WATCHDOG_MINOR, ret);
610 goto unreg_region;
611 }
612
613 printk (KERN_INFO PFX "initialized. heartbeat=%d sec (nowayout=%d)\n",
614 heartbeat, nowayout);
615
616 return 0;
617
618unreg_region:
619 release_region (TCOBASE, 0x20);
620out:
621 if (iTCO_wdt_private.iTCO_version == 2)
622 iounmap(iTCO_wdt_private.gcs);
623 pci_dev_put(iTCO_wdt_private.pdev);
624 iTCO_wdt_private.ACPIBASE = 0;
625 return ret;
626}
627
628static void iTCO_wdt_cleanup(void)
629{
630 /* Stop the timer before we leave */
631 if (!nowayout)
632 iTCO_wdt_stop();
633
634 /* Deregister */
635 misc_deregister(&iTCO_wdt_miscdev);
636 release_region(TCOBASE, 0x20);
637 if (iTCO_wdt_private.iTCO_version == 2)
638 iounmap(iTCO_wdt_private.gcs);
639 pci_dev_put(iTCO_wdt_private.pdev);
640 iTCO_wdt_private.ACPIBASE = 0;
641}
642
643static int iTCO_wdt_probe(struct platform_device *dev)
644{
645 int found = 0;
646 struct pci_dev *pdev = NULL;
647 const struct pci_device_id *ent;
648
649 spin_lock_init(&iTCO_wdt_private.io_lock);
650
651 for_each_pci_dev(pdev) {
652 ent = pci_match_id(iTCO_wdt_pci_tbl, pdev);
653 if (ent) {
654 if (!(iTCO_wdt_init(pdev, ent, dev))) {
655 found++;
656 break;
657 }
658 }
659 }
660
661 if (!found) {
662 printk(KERN_INFO PFX "No card detected\n");
663 return -ENODEV;
664 }
665
666 return 0;
667}
668
669static int iTCO_wdt_remove(struct platform_device *dev)
670{
671 if (iTCO_wdt_private.ACPIBASE)
672 iTCO_wdt_cleanup();
673
674 return 0;
675}
676
677static void iTCO_wdt_shutdown(struct platform_device *dev)
678{
679 iTCO_wdt_stop();
680}
681
682#define iTCO_wdt_suspend NULL
683#define iTCO_wdt_resume NULL
684
685static struct platform_driver iTCO_wdt_driver = {
686 .probe = iTCO_wdt_probe,
687 .remove = iTCO_wdt_remove,
688 .shutdown = iTCO_wdt_shutdown,
689 .suspend = iTCO_wdt_suspend,
690 .resume = iTCO_wdt_resume,
691 .driver = {
692 .owner = THIS_MODULE,
693 .name = DRV_NAME,
694 },
695};
696
697static int __init iTCO_wdt_init_module(void)
698{
699 int err;
700
701 printk(KERN_INFO PFX "Intel TCO WatchDog Timer Driver v%s (%s)\n",
702 DRV_VERSION, DRV_RELDATE);
703
704 err = platform_driver_register(&iTCO_wdt_driver);
705 if (err)
706 return err;
707
708 iTCO_wdt_platform_device = platform_device_register_simple(DRV_NAME, -1, NULL, 0);
709 if (IS_ERR(iTCO_wdt_platform_device)) {
710 err = PTR_ERR(iTCO_wdt_platform_device);
711 goto unreg_platform_driver;
712 }
713
714 return 0;
715
716unreg_platform_driver:
717 platform_driver_unregister(&iTCO_wdt_driver);
718 return err;
719}
720
721static void __exit iTCO_wdt_cleanup_module(void)
722{
723 platform_device_unregister(iTCO_wdt_platform_device);
724 platform_driver_unregister(&iTCO_wdt_driver);
725 printk(KERN_INFO PFX "Watchdog Module Unloaded.\n");
726}
727
728module_init(iTCO_wdt_init_module);
729module_exit(iTCO_wdt_cleanup_module);
730
731MODULE_AUTHOR("Wim Van Sebroeck <wim@iguana.be>");
732MODULE_DESCRIPTION("Intel TCO WatchDog Timer Driver");
733MODULE_VERSION(DRV_VERSION);
734MODULE_LICENSE("GPL");
735MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
diff --git a/drivers/char/watchdog/pnx4008_wdt.c b/drivers/char/watchdog/pnx4008_wdt.c
index e7f0450a939d..db2731ba88e3 100644
--- a/drivers/char/watchdog/pnx4008_wdt.c
+++ b/drivers/char/watchdog/pnx4008_wdt.c
@@ -184,7 +184,7 @@ static int
184pnx4008_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd, 184pnx4008_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
185 unsigned long arg) 185 unsigned long arg)
186{ 186{
187 int ret = -ENOIOCTLCMD; 187 int ret = -ENOTTY;
188 int time; 188 int time;
189 189
190 switch (cmd) { 190 switch (cmd) {
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig
index abcabb295592..0c68d0f0d8e5 100644
--- a/drivers/ide/Kconfig
+++ b/drivers/ide/Kconfig
@@ -614,15 +614,6 @@ config BLK_DEV_PIIX
614 the kernel to change PIO, DMA and UDMA speeds and to configure 614 the kernel to change PIO, DMA and UDMA speeds and to configure
615 the chip to optimum performance. 615 the chip to optimum performance.
616 616
617config BLK_DEV_IT8172
618 bool "IT8172 IDE support"
619 depends on (MIPS_ITE8172 || MIPS_IVR)
620 help
621 Say Y here to support the on-board IDE controller on the Integrated
622 Technology Express, Inc. ITE8172 SBC. Vendor page at
623 <http://www.ite.com.tw/ia/brief_it8172bsp.htm>; picture of the
624 board at <http://www.mvista.com/partners/semiconductor/ite.html>.
625
626config BLK_DEV_IT821X 617config BLK_DEV_IT821X
627 tristate "IT821X IDE support" 618 tristate "IT821X IDE support"
628 help 619 help
diff --git a/drivers/ide/pci/Makefile b/drivers/ide/pci/Makefile
index 640a54b09b5a..fef08960aa4c 100644
--- a/drivers/ide/pci/Makefile
+++ b/drivers/ide/pci/Makefile
@@ -12,7 +12,6 @@ obj-$(CONFIG_BLK_DEV_CY82C693) += cy82c693.o
12obj-$(CONFIG_BLK_DEV_HPT34X) += hpt34x.o 12obj-$(CONFIG_BLK_DEV_HPT34X) += hpt34x.o
13obj-$(CONFIG_BLK_DEV_HPT366) += hpt366.o 13obj-$(CONFIG_BLK_DEV_HPT366) += hpt366.o
14#obj-$(CONFIG_BLK_DEV_HPT37X) += hpt37x.o 14#obj-$(CONFIG_BLK_DEV_HPT37X) += hpt37x.o
15obj-$(CONFIG_BLK_DEV_IT8172) += it8172.o
16obj-$(CONFIG_BLK_DEV_IT821X) += it821x.o 15obj-$(CONFIG_BLK_DEV_IT821X) += it821x.o
17obj-$(CONFIG_BLK_DEV_JMICRON) += jmicron.o 16obj-$(CONFIG_BLK_DEV_JMICRON) += jmicron.o
18obj-$(CONFIG_BLK_DEV_NS87415) += ns87415.o 17obj-$(CONFIG_BLK_DEV_NS87415) += ns87415.o
diff --git a/drivers/ide/pci/it8172.c b/drivers/ide/pci/it8172.c
deleted file mode 100644
index 0fc89fafad65..000000000000
--- a/drivers/ide/pci/it8172.c
+++ /dev/null
@@ -1,307 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 IDE controller support
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * stevel@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#include <linux/module.h>
32#include <linux/types.h>
33#include <linux/kernel.h>
34#include <linux/ioport.h>
35#include <linux/pci.h>
36#include <linux/hdreg.h>
37#include <linux/ide.h>
38#include <linux/delay.h>
39#include <linux/init.h>
40
41#include <asm/io.h>
42#include <asm/it8172/it8172_int.h>
43
44/*
45 * Prototypes
46 */
47static u8 it8172_ratemask (ide_drive_t *drive)
48{
49 return 1;
50}
51
52static void it8172_tune_drive (ide_drive_t *drive, u8 pio)
53{
54 ide_hwif_t *hwif = HWIF(drive);
55 struct pci_dev *dev = hwif->pci_dev;
56 int is_slave = (&hwif->drives[1] == drive);
57 unsigned long flags;
58 u16 drive_enables;
59 u32 drive_timing;
60
61 pio = ide_get_best_pio_mode(drive, pio, 4, NULL);
62 spin_lock_irqsave(&ide_lock, flags);
63 pci_read_config_word(dev, 0x40, &drive_enables);
64 pci_read_config_dword(dev, 0x44, &drive_timing);
65
66 /*
67 * FIX! The DIOR/DIOW pulse width and recovery times in port 0x44
68 * are being left at the default values of 8 PCI clocks (242 nsec
69 * for a 33 MHz clock). These can be safely shortened at higher
70 * PIO modes. The DIOR/DIOW pulse width and recovery times only
71 * apply to PIO modes, not to the DMA modes.
72 */
73
74 /*
75 * Enable port 0x44. The IT8172G spec is confused; it calls
76 * this register the "Slave IDE Timing Register", but in fact,
77 * it controls timing for both master and slave drives.
78 */
79 drive_enables |= 0x4000;
80
81 if (is_slave) {
82 drive_enables &= 0xc006;
83 if (pio > 1)
84 /* enable prefetch and IORDY sample-point */
85 drive_enables |= 0x0060;
86 } else {
87 drive_enables &= 0xc060;
88 if (pio > 1)
89 /* enable prefetch and IORDY sample-point */
90 drive_enables |= 0x0006;
91 }
92
93 pci_write_config_word(dev, 0x40, drive_enables);
94 spin_unlock_irqrestore(&ide_lock, flags);
95}
96
97static u8 it8172_dma_2_pio (u8 xfer_rate)
98{
99 switch(xfer_rate) {
100 case XFER_UDMA_5:
101 case XFER_UDMA_4:
102 case XFER_UDMA_3:
103 case XFER_UDMA_2:
104 case XFER_UDMA_1:
105 case XFER_UDMA_0:
106 case XFER_MW_DMA_2:
107 case XFER_PIO_4:
108 return 4;
109 case XFER_MW_DMA_1:
110 case XFER_PIO_3:
111 return 3;
112 case XFER_SW_DMA_2:
113 case XFER_PIO_2:
114 return 2;
115 case XFER_MW_DMA_0:
116 case XFER_SW_DMA_1:
117 case XFER_SW_DMA_0:
118 case XFER_PIO_1:
119 case XFER_PIO_0:
120 case XFER_PIO_SLOW:
121 default:
122 return 0;
123 }
124}
125
126static int it8172_tune_chipset (ide_drive_t *drive, u8 xferspeed)
127{
128 ide_hwif_t *hwif = HWIF(drive);
129 struct pci_dev *dev = hwif->pci_dev;
130 u8 speed = ide_rate_filter(it8172_ratemask(drive), xferspeed);
131 int a_speed = 3 << (drive->dn * 4);
132 int u_flag = 1 << drive->dn;
133 int u_speed = 0;
134 u8 reg48, reg4a;
135
136 pci_read_config_byte(dev, 0x48, &reg48);
137 pci_read_config_byte(dev, 0x4a, &reg4a);
138
139 /*
140 * Setting the DMA cycle time to 2 or 3 PCI clocks (60 and 91 nsec
141 * at 33 MHz PCI clock) seems to cause BadCRC errors during DMA
142 * transfers on some drives, even though both numbers meet the minimum
143 * ATAPI-4 spec of 73 and 54 nsec for UDMA 1 and 2 respectively.
144 * So the faster times are just commented out here. The good news is
145 * that the slower cycle time has very little affect on transfer
146 * performance.
147 */
148
149 switch(speed) {
150 case XFER_UDMA_4:
151 case XFER_UDMA_2: //u_speed = 2 << (drive->dn * 4); break;
152 case XFER_UDMA_5:
153 case XFER_UDMA_3:
154 case XFER_UDMA_1: //u_speed = 1 << (drive->dn * 4); break;
155 case XFER_UDMA_0: u_speed = 0 << (drive->dn * 4); break;
156 case XFER_MW_DMA_2:
157 case XFER_MW_DMA_1:
158 case XFER_MW_DMA_0:
159 case XFER_SW_DMA_2: break;
160 case XFER_PIO_4:
161 case XFER_PIO_3:
162 case XFER_PIO_2:
163 case XFER_PIO_0: break;
164 default: return -1;
165 }
166
167 if (speed >= XFER_UDMA_0) {
168 pci_write_config_byte(dev, 0x48, reg48 | u_flag);
169 reg4a &= ~a_speed;
170 pci_write_config_byte(dev, 0x4a, reg4a | u_speed);
171 } else {
172 pci_write_config_byte(dev, 0x48, reg48 & ~u_flag);
173 pci_write_config_byte(dev, 0x4a, reg4a & ~a_speed);
174 }
175
176 it8172_tune_drive(drive, it8172_dma_2_pio(speed));
177 return (ide_config_drive_speed(drive, speed));
178}
179
180static int it8172_config_chipset_for_dma (ide_drive_t *drive)
181{
182 u8 speed = ide_dma_speed(drive, it8172_ratemask(drive));
183
184 if (!(speed)) {
185 u8 tspeed = ide_get_best_pio_mode(drive, 255, 4, NULL);
186 speed = it8172_dma_2_pio(XFER_PIO_0 + tspeed);
187 }
188
189 (void) it8172_tune_chipset(drive, speed);
190 return ide_dma_enable(drive);
191}
192
193static int it8172_config_drive_xfer_rate (ide_drive_t *drive)
194{
195 ide_hwif_t *hwif = HWIF(drive);
196 struct hd_driveid *id = drive->id;
197
198 drive->init_speed = 0;
199
200 if (id && (id->capability & 1) && drive->autodma) {
201
202 if (ide_use_dma(drive)) {
203 if (it8172_config_chipset_for_dma(drive))
204 return hwif->ide_dma_on(drive);
205 }
206
207 goto fast_ata_pio;
208
209 } else if ((id->capability & 8) || (id->field_valid & 2)) {
210fast_ata_pio:
211 it8172_tune_drive(drive, 5);
212 return hwif->ide_dma_off_quietly(drive);
213 }
214 /* IORDY not supported */
215 return 0;
216}
217
218static unsigned int __devinit init_chipset_it8172 (struct pci_dev *dev, const char *name)
219{
220 unsigned char progif;
221
222 /*
223 * Place both IDE interfaces into PCI "native" mode
224 */
225 pci_read_config_byte(dev, PCI_CLASS_PROG, &progif);
226 pci_write_config_byte(dev, PCI_CLASS_PROG, progif | 0x05);
227
228 return IT8172_IDE_IRQ;
229}
230
231
232static void __devinit init_hwif_it8172 (ide_hwif_t *hwif)
233{
234 struct pci_dev* dev = hwif->pci_dev;
235 unsigned long cmdBase, ctrlBase;
236
237 hwif->autodma = 0;
238 hwif->tuneproc = &it8172_tune_drive;
239 hwif->speedproc = &it8172_tune_chipset;
240
241 cmdBase = dev->resource[0].start;
242 ctrlBase = dev->resource[1].start;
243
244 ide_init_hwif_ports(&hwif->hw, cmdBase, ctrlBase | 2, NULL);
245 memcpy(hwif->io_ports, hwif->hw.io_ports, sizeof(hwif->io_ports));
246 hwif->noprobe = 0;
247
248 if (!hwif->dma_base) {
249 hwif->drives[0].autotune = 1;
250 hwif->drives[1].autotune = 1;
251 return;
252 }
253
254 hwif->atapi_dma = 1;
255 hwif->ultra_mask = 0x07;
256 hwif->mwdma_mask = 0x06;
257 hwif->swdma_mask = 0x04;
258
259 hwif->ide_dma_check = &it8172_config_drive_xfer_rate;
260 if (!noautodma)
261 hwif->autodma = 1;
262 hwif->drives[0].autodma = hwif->autodma;
263 hwif->drives[1].autodma = hwif->autodma;
264}
265
266static ide_pci_device_t it8172_chipsets[] __devinitdata = {
267 { /* 0 */
268 .name = "IT8172G",
269 .init_chipset = init_chipset_it8172,
270 .init_hwif = init_hwif_it8172,
271 .channels = 2,
272 .autodma = AUTODMA,
273 .enablebits = {{0x00,0x00,0x00}, {0x40,0x00,0x01}},
274 .bootable = ON_BOARD,
275 }
276};
277
278static int __devinit it8172_init_one(struct pci_dev *dev, const struct pci_device_id *id)
279{
280 if ((!(PCI_FUNC(dev->devfn) & 1) ||
281 (!((dev->class >> 8) == PCI_CLASS_STORAGE_IDE))))
282 return -ENODEV; /* IT8172 is more than an IDE controller */
283 return ide_setup_pci_device(dev, &it8172_chipsets[id->driver_data]);
284}
285
286static struct pci_device_id it8172_pci_tbl[] = {
287 { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_IT8172G, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
288 { 0, },
289};
290MODULE_DEVICE_TABLE(pci, it8172_pci_tbl);
291
292static struct pci_driver driver = {
293 .name = "IT8172_IDE",
294 .id_table = it8172_pci_tbl,
295 .probe = it8172_init_one,
296};
297
298static int it8172_ide_init(void)
299{
300 return ide_pci_register_driver(&driver);
301}
302
303module_init(it8172_ide_init);
304
305MODULE_AUTHOR("SteveL@mvista.com");
306MODULE_DESCRIPTION("PCI driver module for ITE 8172 IDE");
307MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.c b/drivers/media/dvb/dvb-core/dvb_frontend.c
index 3dd5dbafb330..53304e6991ac 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.c
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.c
@@ -1014,6 +1014,13 @@ static int dvb_frontend_open(struct inode *inode, struct file *file)
1014 if ((ret = dvb_generic_open (inode, file)) < 0) 1014 if ((ret = dvb_generic_open (inode, file)) < 0)
1015 return ret; 1015 return ret;
1016 1016
1017 if (fe->ops.ts_bus_ctrl) {
1018 if ((ret = fe->ops.ts_bus_ctrl (fe, 1)) < 0) {
1019 dvb_generic_release (inode, file);
1020 return ret;
1021 }
1022 }
1023
1017 if ((file->f_flags & O_ACCMODE) != O_RDONLY) { 1024 if ((file->f_flags & O_ACCMODE) != O_RDONLY) {
1018 1025
1019 /* normal tune mode when opened R/W */ 1026 /* normal tune mode when opened R/W */
@@ -1043,6 +1050,9 @@ static int dvb_frontend_release(struct inode *inode, struct file *file)
1043 if ((file->f_flags & O_ACCMODE) != O_RDONLY) 1050 if ((file->f_flags & O_ACCMODE) != O_RDONLY)
1044 fepriv->release_jiffies = jiffies; 1051 fepriv->release_jiffies = jiffies;
1045 1052
1053 if (fe->ops.ts_bus_ctrl)
1054 fe->ops.ts_bus_ctrl (fe, 0);
1055
1046 return dvb_generic_release (inode, file); 1056 return dvb_generic_release (inode, file);
1047} 1057}
1048 1058
diff --git a/drivers/media/dvb/dvb-core/dvb_frontend.h b/drivers/media/dvb/dvb-core/dvb_frontend.h
index e5d5028b3694..f233d78bc364 100644
--- a/drivers/media/dvb/dvb-core/dvb_frontend.h
+++ b/drivers/media/dvb/dvb-core/dvb_frontend.h
@@ -129,6 +129,7 @@ struct dvb_frontend_ops {
129 int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg); 129 int (*enable_high_lnb_voltage)(struct dvb_frontend* fe, long arg);
130 int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd); 130 int (*dishnetwork_send_legacy_command)(struct dvb_frontend* fe, unsigned long cmd);
131 int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable); 131 int (*i2c_gate_ctrl)(struct dvb_frontend* fe, int enable);
132 int (*ts_bus_ctrl)(struct dvb_frontend* fe, int acquire);
132 133
133 struct dvb_tuner_ops tuner_ops; 134 struct dvb_tuner_ops tuner_ops;
134}; 135};
diff --git a/drivers/media/dvb/dvb-usb/Kconfig b/drivers/media/dvb/dvb-usb/Kconfig
index 0a3c35399bea..67cefdd2334a 100644
--- a/drivers/media/dvb/dvb-usb/Kconfig
+++ b/drivers/media/dvb/dvb-usb/Kconfig
@@ -39,20 +39,8 @@ config DVB_USB_DIBUSB_MB
39 Support for USB 1.1 and 2.0 DVB-T receivers based on reference designs made by 39 Support for USB 1.1 and 2.0 DVB-T receivers based on reference designs made by
40 DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-B demodulator. 40 DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-B demodulator.
41 41
42 Devices supported by this driver: 42 For an up-to-date list of devices supported by this driver, have a look
43 Artec T1 USB1.1 boxes 43 on the Linux-DVB Wiki at www.linuxtv.org.
44 Avermedia AverTV DVBT USB1.1
45 Compro Videomate DVB-U2000 - DVB-T USB
46 DiBcom USB1.1 reference devices (non-public)
47 Grandtec DVB-T USB
48 Hama DVB-T USB1.1-Box
49 KWorld/JetWay/ADSTech V-Stream XPERT DTV - DVB-T USB1.1 and USB2.0
50 TwinhanDTV Magic Box (VP7041e)
51 TwinhanDTV USB-Ter (VP7041)
52 Ultima Electronic/Artec T1 USB TVBOX
53
54 The VP7041 seems to be identical to "CTS Portable" (Chinese
55 Television System).
56 44
57 Say Y if you own such a device and want to use it. You should build it as 45 Say Y if you own such a device and want to use it. You should build it as
58 a module. 46 a module.
@@ -69,12 +57,29 @@ config DVB_USB_DIBUSB_MC
69 select DVB_DIB3000MC 57 select DVB_DIB3000MC
70 select DVB_TUNER_MT2060 58 select DVB_TUNER_MT2060
71 help 59 help
72 Support for 2.0 DVB-T receivers based on reference designs made by 60 Support for USB2.0 DVB-T receivers based on reference designs made by
73 DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-C/P demodulator. 61 DiBcom (<http://www.dibcom.fr>) equipped with a DiB3000M-C/P demodulator.
74 62
75 Devices supported by this driver: 63 For an up-to-date list of devices supported by this driver, have a look
76 Artec T1 USB2.0 boxes 64 on the Linux-DVB Wiki at www.linuxtv.org.
77 DiBcom USB2.0 reference devices (non-public) 65
66 Say Y if you own such a device and want to use it. You should build it as
67 a module.
68
69config DVB_USB_DIB0700
70 tristate "DiBcom DiB0700 USB DVB devices (see help for supported devices)"
71 depends on DVB_USB
72 select DVB_DIB7000M
73 select DVB_DIB3000MC
74 select DVB_TUNER_MT2060
75 help
76 Support for USB2.0/1.1 DVB receivers based on the DiB0700 USB bridge. The
77 USB bridge is also present in devices having the DiB7700 DVB-T-USB
78 silicon. This chip can be found in devices offered by Hauppauge,
79 Avermedia and other big and small companies.
80
81 For an up-to-date list of devices supported by this driver, have a look
82 on the Linux-DVB Wiki at www.linuxtv.org.
78 83
79 Say Y if you own such a device and want to use it. You should build it as 84 Say Y if you own such a device and want to use it. You should build it as
80 a module. 85 a module.
diff --git a/drivers/media/dvb/dvb-usb/Makefile b/drivers/media/dvb/dvb-usb/Makefile
index 9643f56c7fe9..e239107998e5 100644
--- a/drivers/media/dvb/dvb-usb/Makefile
+++ b/drivers/media/dvb/dvb-usb/Makefile
@@ -1,4 +1,4 @@
1dvb-usb-objs = dvb-usb-firmware.o dvb-usb-init.o dvb-usb-urb.o dvb-usb-i2c.o dvb-usb-dvb.o dvb-usb-remote.o 1dvb-usb-objs = dvb-usb-firmware.o dvb-usb-init.o dvb-usb-urb.o dvb-usb-i2c.o dvb-usb-dvb.o dvb-usb-remote.o usb-urb.o
2obj-$(CONFIG_DVB_USB) += dvb-usb.o 2obj-$(CONFIG_DVB_USB) += dvb-usb.o
3 3
4dvb-usb-vp7045-objs = vp7045.o vp7045-fe.o 4dvb-usb-vp7045-objs = vp7045.o vp7045-fe.o
@@ -36,4 +36,7 @@ obj-$(CONFIG_DVB_USB_DIGITV) += dvb-usb-digitv.o
36dvb-usb-cxusb-objs = cxusb.o 36dvb-usb-cxusb-objs = cxusb.o
37obj-$(CONFIG_DVB_USB_CXUSB) += dvb-usb-cxusb.o 37obj-$(CONFIG_DVB_USB_CXUSB) += dvb-usb-cxusb.o
38 38
39dvb-usb-dib0700-objs = dib0700_core.o dib0700_devices.o
40obj-$(CONFIG_DVB_USB_DIB0700) += dvb-usb-dib0700.o
41
39EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/ 42EXTRA_CFLAGS = -Idrivers/media/dvb/dvb-core/ -Idrivers/media/dvb/frontends/
diff --git a/drivers/media/dvb/dvb-usb/a800.c b/drivers/media/dvb/dvb-usb/a800.c
index df0c384bd4ca..2ed3eb62d787 100644
--- a/drivers/media/dvb/dvb-usb/a800.c
+++ b/drivers/media/dvb/dvb-usb/a800.c
@@ -27,7 +27,8 @@ static int a800_power_ctrl(struct dvb_usb_device *d, int onoff)
27} 27}
28 28
29/* assure to put cold to 0 for iManufacturer == 1 */ 29/* assure to put cold to 0 for iManufacturer == 1 */
30static int a800_identify_state(struct usb_device *udev, struct dvb_usb_properties *props,struct dvb_usb_device_description **desc, int *cold) 30static int a800_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props,
31 struct dvb_usb_device_description **desc, int *cold)
31{ 32{
32 *cold = udev->descriptor.iManufacturer != 1; 33 *cold = udev->descriptor.iManufacturer != 1;
33 return 0; 34 return 0;
@@ -88,7 +89,7 @@ static int a800_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
88} 89}
89 90
90/* USB Driver stuff */ 91/* USB Driver stuff */
91static struct dvb_usb_properties a800_properties; 92static struct dvb_usb_device_properties a800_properties;
92 93
93static int a800_probe(struct usb_interface *intf, 94static int a800_probe(struct usb_interface *intf,
94 const struct usb_device_id *id) 95 const struct usb_device_id *id)
@@ -104,35 +105,27 @@ static struct usb_device_id a800_table [] = {
104}; 105};
105MODULE_DEVICE_TABLE (usb, a800_table); 106MODULE_DEVICE_TABLE (usb, a800_table);
106 107
107static struct dvb_usb_properties a800_properties = { 108static struct dvb_usb_device_properties a800_properties = {
108 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, 109 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
109 .pid_filter_count = 32,
110 110
111 .usb_ctrl = CYPRESS_FX2, 111 .usb_ctrl = CYPRESS_FX2,
112
113 .firmware = "dvb-usb-avertv-a800-02.fw", 112 .firmware = "dvb-usb-avertv-a800-02.fw",
114 113
115 .size_of_priv = sizeof(struct dibusb_state), 114 .num_adapters = 1,
116 115 .adapter = {
116 {
117 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
118 .pid_filter_count = 32,
117 .streaming_ctrl = dibusb2_0_streaming_ctrl, 119 .streaming_ctrl = dibusb2_0_streaming_ctrl,
118 .pid_filter = dibusb_pid_filter, 120 .pid_filter = dibusb_pid_filter,
119 .pid_filter_ctrl = dibusb_pid_filter_ctrl, 121 .pid_filter_ctrl = dibusb_pid_filter_ctrl,
120 .power_ctrl = a800_power_ctrl, 122
121 .frontend_attach = dibusb_dib3000mc_frontend_attach, 123 .frontend_attach = dibusb_dib3000mc_frontend_attach,
122 .tuner_attach = dibusb_dib3000mc_tuner_attach, 124 .tuner_attach = dibusb_dib3000mc_tuner_attach,
123 .identify_state = a800_identify_state,
124
125 .rc_interval = DEFAULT_RC_INTERVAL,
126 .rc_key_map = a800_rc_keys,
127 .rc_key_map_size = ARRAY_SIZE(a800_rc_keys),
128 .rc_query = a800_rc_query,
129 125
130 .i2c_algo = &dibusb_i2c_algo,
131
132 .generic_bulk_ctrl_endpoint = 0x01,
133 /* parameter for the MPEG2-data transfer */ 126 /* parameter for the MPEG2-data transfer */
134 .urb = { 127 .stream = {
135 .type = DVB_USB_BULK, 128 .type = USB_BULK,
136 .count = 7, 129 .count = 7,
137 .endpoint = 0x06, 130 .endpoint = 0x06,
138 .u = { 131 .u = {
@@ -142,6 +135,21 @@ static struct dvb_usb_properties a800_properties = {
142 } 135 }
143 }, 136 },
144 137
138 .size_of_priv = sizeof(struct dibusb_state),
139 },
140 },
141
142 .power_ctrl = a800_power_ctrl,
143 .identify_state = a800_identify_state,
144
145 .rc_interval = DEFAULT_RC_INTERVAL,
146 .rc_key_map = a800_rc_keys,
147 .rc_key_map_size = ARRAY_SIZE(a800_rc_keys),
148 .rc_query = a800_rc_query,
149
150 .i2c_algo = &dibusb_i2c_algo,
151
152 .generic_bulk_ctrl_endpoint = 0x01,
145 .num_device_descs = 1, 153 .num_device_descs = 1,
146 .devices = { 154 .devices = {
147 { "AVerMedia AverTV DVB-T USB 2.0 (A800)", 155 { "AVerMedia AverTV DVB-T USB 2.0 (A800)",
diff --git a/drivers/media/dvb/dvb-usb/cxusb.c b/drivers/media/dvb/dvb-usb/cxusb.c
index c710c0176e07..43f39069ef34 100644
--- a/drivers/media/dvb/dvb-usb/cxusb.c
+++ b/drivers/media/dvb/dvb-usb/cxusb.c
@@ -161,13 +161,13 @@ static int cxusb_bluebird_power_ctrl(struct dvb_usb_device *d, int onoff)
161 return 0; 161 return 0;
162} 162}
163 163
164static int cxusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) 164static int cxusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
165{ 165{
166 u8 buf[2] = { 0x03, 0x00 }; 166 u8 buf[2] = { 0x03, 0x00 };
167 if (onoff) 167 if (onoff)
168 cxusb_ctrl_msg(d,CMD_STREAMING_ON, buf, 2, NULL, 0); 168 cxusb_ctrl_msg(adap->dev, CMD_STREAMING_ON, buf, 2, NULL, 0);
169 else 169 else
170 cxusb_ctrl_msg(d,CMD_STREAMING_OFF, NULL, 0, NULL, 0); 170 cxusb_ctrl_msg(adap->dev, CMD_STREAMING_OFF, NULL, 0, NULL, 0);
171 171
172 return 0; 172 return 0;
173} 173}
@@ -327,8 +327,8 @@ static int cxusb_mt352_demod_init(struct dvb_frontend* fe)
327static int cxusb_lgh064f_tuner_set_params(struct dvb_frontend *fe, 327static int cxusb_lgh064f_tuner_set_params(struct dvb_frontend *fe,
328 struct dvb_frontend_parameters *fep) 328 struct dvb_frontend_parameters *fep)
329{ 329{
330 struct dvb_usb_device *d = fe->dvb->priv; 330 struct dvb_usb_adapter *adap = fe->dvb->priv;
331 return lg_h06xf_pll_set(fe, &d->i2c_adap, fep); 331 return lg_h06xf_pll_set(fe, &adap->dev->i2c_adap, fep);
332} 332}
333 333
334static struct cx22702_config cxusb_cx22702_config = { 334static struct cx22702_config cxusb_cx22702_config = {
@@ -359,98 +359,99 @@ static struct mt352_config cxusb_mt352_config = {
359}; 359};
360 360
361/* Callbacks for DVB USB */ 361/* Callbacks for DVB USB */
362static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_device *d) 362static int cxusb_fmd1216me_tuner_attach(struct dvb_usb_adapter *adap)
363{ 363{
364 u8 bpll[4] = { 0x0b, 0xdc, 0x9c, 0xa0 }; 364 u8 bpll[4] = { 0x0b, 0xdc, 0x9c, 0xa0 };
365 d->pll_addr = 0x61; 365 adap->pll_addr = 0x61;
366 memcpy(d->pll_init, bpll, 4); 366 memcpy(adap->pll_init, bpll, 4);
367 d->pll_desc = &dvb_pll_fmd1216me; 367 adap->pll_desc = &dvb_pll_fmd1216me;
368 368
369 d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c; 369 adap->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c;
370 d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; 370 adap->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c;
371 371
372 return 0; 372 return 0;
373} 373}
374 374
375static int cxusb_dee1601_tuner_attach(struct dvb_usb_device *d) 375static int cxusb_dee1601_tuner_attach(struct dvb_usb_adapter *adap)
376{ 376{
377 d->pll_addr = 0x61; 377 adap->pll_addr = 0x61;
378 d->pll_desc = &dvb_pll_thomson_dtt7579; 378 adap->pll_desc = &dvb_pll_thomson_dtt7579;
379 d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; 379 adap->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
380 return 0; 380 return 0;
381} 381}
382 382
383static int cxusb_lgz201_tuner_attach(struct dvb_usb_device *d) 383static int cxusb_lgz201_tuner_attach(struct dvb_usb_adapter *adap)
384{ 384{
385 d->pll_addr = 0x61; 385 adap->pll_addr = 0x61;
386 d->pll_desc = &dvb_pll_lg_z201; 386 adap->pll_desc = &dvb_pll_lg_z201;
387 d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; 387 adap->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
388 return 0; 388 return 0;
389} 389}
390 390
391static int cxusb_dtt7579_tuner_attach(struct dvb_usb_device *d) 391static int cxusb_dtt7579_tuner_attach(struct dvb_usb_adapter *adap)
392{ 392{
393 d->pll_addr = 0x60; 393 adap->pll_addr = 0x60;
394 d->pll_desc = &dvb_pll_thomson_dtt7579; 394 adap->pll_desc = &dvb_pll_thomson_dtt7579;
395 d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; 395 adap->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
396 return 0; 396 return 0;
397} 397}
398 398
399static int cxusb_lgdt3303_tuner_attach(struct dvb_usb_device *d) 399static int cxusb_lgdt3303_tuner_attach(struct dvb_usb_adapter *adap)
400{ 400{
401 d->fe->ops.tuner_ops.set_params = cxusb_lgh064f_tuner_set_params; 401 adap->fe->ops.tuner_ops.set_params = cxusb_lgh064f_tuner_set_params;
402 return 0; 402 return 0;
403} 403}
404 404
405static int cxusb_cx22702_frontend_attach(struct dvb_usb_device *d) 405static int cxusb_cx22702_frontend_attach(struct dvb_usb_adapter *adap)
406{ 406{
407 u8 b; 407 u8 b;
408 if (usb_set_interface(d->udev,0,6) < 0) 408 if (usb_set_interface(adap->dev->udev, 0, 6) < 0)
409 err("set interface failed"); 409 err("set interface failed");
410 410
411 cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, &b, 1); 411 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, &b, 1);
412 412
413 if ((d->fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config, &d->i2c_adap)) != NULL) 413 if ((adap->fe = dvb_attach(cx22702_attach, &cxusb_cx22702_config, &adap->dev->i2c_adap)) != NULL)
414 return 0; 414 return 0;
415 415
416 return -EIO; 416 return -EIO;
417} 417}
418 418
419static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_device *d) 419static int cxusb_lgdt3303_frontend_attach(struct dvb_usb_adapter *adap)
420{ 420{
421 if (usb_set_interface(d->udev,0,7) < 0) 421 if (usb_set_interface(adap->dev->udev, 0, 7) < 0)
422 err("set interface failed"); 422 err("set interface failed");
423 423
424 cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0); 424 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
425 425
426 if ((d->fe = dvb_attach(lgdt330x_attach, &cxusb_lgdt3303_config, &d->i2c_adap)) != NULL) 426 if ((adap->fe = dvb_attach(lgdt330x_attach, &cxusb_lgdt3303_config, &adap->dev->i2c_adap)) != NULL)
427 return 0; 427 return 0;
428 428
429 return -EIO; 429 return -EIO;
430} 430}
431 431
432static int cxusb_mt352_frontend_attach(struct dvb_usb_device *d) 432static int cxusb_mt352_frontend_attach(struct dvb_usb_adapter *adap)
433{ /* used in both lgz201 and th7579 */ 433{
434 if (usb_set_interface(d->udev,0,0) < 0) 434 /* used in both lgz201 and th7579 */
435 if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
435 err("set interface failed"); 436 err("set interface failed");
436 437
437 cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0); 438 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
438 439
439 if ((d->fe = dvb_attach(mt352_attach, &cxusb_mt352_config, &d->i2c_adap)) != NULL) 440 if ((adap->fe = dvb_attach(mt352_attach, &cxusb_mt352_config, &adap->dev->i2c_adap)) != NULL)
440 return 0; 441 return 0;
441 442
442 return -EIO; 443 return -EIO;
443} 444}
444 445
445static int cxusb_dee1601_frontend_attach(struct dvb_usb_device *d) 446static int cxusb_dee1601_frontend_attach(struct dvb_usb_adapter *adap)
446{ 447{
447 if (usb_set_interface(d->udev,0,0) < 0) 448 if (usb_set_interface(adap->dev->udev, 0, 0) < 0)
448 err("set interface failed"); 449 err("set interface failed");
449 450
450 cxusb_ctrl_msg(d,CMD_DIGITAL, NULL, 0, NULL, 0); 451 cxusb_ctrl_msg(adap->dev, CMD_DIGITAL, NULL, 0, NULL, 0);
451 452
452 if (((d->fe = dvb_attach(mt352_attach, &cxusb_dee1601_config, &d->i2c_adap)) != NULL) || 453 if (((adap->fe = dvb_attach(mt352_attach, &cxusb_dee1601_config, &adap->dev->i2c_adap)) != NULL) ||
453 ((d->fe = dvb_attach(zl10353_attach, &cxusb_zl10353_dee1601_config, &d->i2c_adap)) != NULL)) 454 ((adap->fe = dvb_attach(zl10353_attach, &cxusb_zl10353_dee1601_config, &adap->dev->i2c_adap)) != NULL))
454 return 0; 455 return 0;
455 456
456 return -EIO; 457 return -EIO;
@@ -480,11 +481,11 @@ static int bluebird_patch_dvico_firmware_download(struct usb_device *udev, const
480} 481}
481 482
482/* DVB USB Driver stuff */ 483/* DVB USB Driver stuff */
483static struct dvb_usb_properties cxusb_medion_properties; 484static struct dvb_usb_device_properties cxusb_medion_properties;
484static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties; 485static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties;
485static struct dvb_usb_properties cxusb_bluebird_dee1601_properties; 486static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties;
486static struct dvb_usb_properties cxusb_bluebird_lgz201_properties; 487static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties;
487static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties; 488static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties;
488 489
489static int cxusb_probe(struct usb_interface *intf, 490static int cxusb_probe(struct usb_interface *intf,
490 const struct usb_device_id *id) 491 const struct usb_device_id *id)
@@ -504,36 +505,36 @@ static struct usb_device_id cxusb_table [] = {
504 { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) }, 505 { USB_DEVICE(USB_VID_MEDION, USB_PID_MEDION_MD95700) },
505 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) }, 506 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_COLD) },
506 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) }, 507 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LG064F_WARM) },
507 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_COLD) }, 508 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD) },
508 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DEE1601_WARM) }, 509 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM) },
509 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) }, 510 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_COLD) },
510 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) }, 511 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_LGZ201_WARM) },
511 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) }, 512 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_COLD) },
512 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) }, 513 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_TH7579_WARM) },
513 { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_COLD) }, 514 { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD) },
514 { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_WARM) }, 515 { USB_DEVICE(USB_VID_DVICO, USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM) },
516 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD) },
517 { USB_DEVICE(USB_VID_DVICO, USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM) },
515 {} /* Terminating entry */ 518 {} /* Terminating entry */
516}; 519};
517MODULE_DEVICE_TABLE (usb, cxusb_table); 520MODULE_DEVICE_TABLE (usb, cxusb_table);
518 521
519static struct dvb_usb_properties cxusb_medion_properties = { 522static struct dvb_usb_device_properties cxusb_medion_properties = {
520 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 523 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
521 524
522 .usb_ctrl = CYPRESS_FX2, 525 .usb_ctrl = CYPRESS_FX2,
523 526
524 .size_of_priv = sizeof(struct cxusb_state), 527 .size_of_priv = sizeof(struct cxusb_state),
525 528
529 .num_adapters = 1,
530 .adapter = {
531 {
526 .streaming_ctrl = cxusb_streaming_ctrl, 532 .streaming_ctrl = cxusb_streaming_ctrl,
527 .power_ctrl = cxusb_power_ctrl,
528 .frontend_attach = cxusb_cx22702_frontend_attach, 533 .frontend_attach = cxusb_cx22702_frontend_attach,
529 .tuner_attach = cxusb_fmd1216me_tuner_attach, 534 .tuner_attach = cxusb_fmd1216me_tuner_attach,
530
531 .i2c_algo = &cxusb_i2c_algo,
532
533 .generic_bulk_ctrl_endpoint = 0x01,
534 /* parameter for the MPEG2-data transfer */ 535 /* parameter for the MPEG2-data transfer */
535 .urb = { 536 .stream = {
536 .type = DVB_USB_BULK, 537 .type = USB_BULK,
537 .count = 5, 538 .count = 5,
538 .endpoint = 0x02, 539 .endpoint = 0x02,
539 .u = { 540 .u = {
@@ -543,6 +544,14 @@ static struct dvb_usb_properties cxusb_medion_properties = {
543 } 544 }
544 }, 545 },
545 546
547 },
548 },
549 .power_ctrl = cxusb_power_ctrl,
550
551 .i2c_algo = &cxusb_i2c_algo,
552
553 .generic_bulk_ctrl_endpoint = 0x01,
554
546 .num_device_descs = 1, 555 .num_device_descs = 1,
547 .devices = { 556 .devices = {
548 { "Medion MD95700 (MDUSBTV-HYBRID)", 557 { "Medion MD95700 (MDUSBTV-HYBRID)",
@@ -552,7 +561,7 @@ static struct dvb_usb_properties cxusb_medion_properties = {
552 } 561 }
553}; 562};
554 563
555static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = { 564static struct dvb_usb_device_properties cxusb_bluebird_lgh064f_properties = {
556 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 565 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
557 566
558 .usb_ctrl = DEVICE_SPECIFIC, 567 .usb_ctrl = DEVICE_SPECIFIC,
@@ -563,22 +572,16 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
563 572
564 .size_of_priv = sizeof(struct cxusb_state), 573 .size_of_priv = sizeof(struct cxusb_state),
565 574
575 .num_adapters = 1,
576 .adapter = {
577 {
566 .streaming_ctrl = cxusb_streaming_ctrl, 578 .streaming_ctrl = cxusb_streaming_ctrl,
567 .power_ctrl = cxusb_bluebird_power_ctrl,
568 .frontend_attach = cxusb_lgdt3303_frontend_attach, 579 .frontend_attach = cxusb_lgdt3303_frontend_attach,
569 .tuner_attach = cxusb_lgdt3303_tuner_attach, 580 .tuner_attach = cxusb_lgdt3303_tuner_attach,
570 581
571 .i2c_algo = &cxusb_i2c_algo,
572
573 .rc_interval = 100,
574 .rc_key_map = dvico_portable_rc_keys,
575 .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
576 .rc_query = cxusb_rc_query,
577
578 .generic_bulk_ctrl_endpoint = 0x01,
579 /* parameter for the MPEG2-data transfer */ 582 /* parameter for the MPEG2-data transfer */
580 .urb = { 583 .stream = {
581 .type = DVB_USB_BULK, 584 .type = USB_BULK,
582 .count = 5, 585 .count = 5,
583 .endpoint = 0x02, 586 .endpoint = 0x02,
584 .u = { 587 .u = {
@@ -587,6 +590,19 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
587 } 590 }
588 } 591 }
589 }, 592 },
593 },
594 },
595
596 .power_ctrl = cxusb_bluebird_power_ctrl,
597
598 .i2c_algo = &cxusb_i2c_algo,
599
600 .rc_interval = 100,
601 .rc_key_map = dvico_portable_rc_keys,
602 .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
603 .rc_query = cxusb_rc_query,
604
605 .generic_bulk_ctrl_endpoint = 0x01,
590 606
591 .num_device_descs = 1, 607 .num_device_descs = 1,
592 .devices = { 608 .devices = {
@@ -597,7 +613,7 @@ static struct dvb_usb_properties cxusb_bluebird_lgh064f_properties = {
597 } 613 }
598}; 614};
599 615
600static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = { 616static struct dvb_usb_device_properties cxusb_bluebird_dee1601_properties = {
601 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 617 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
602 618
603 .usb_ctrl = DEVICE_SPECIFIC, 619 .usb_ctrl = DEVICE_SPECIFIC,
@@ -608,22 +624,15 @@ static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
608 624
609 .size_of_priv = sizeof(struct cxusb_state), 625 .size_of_priv = sizeof(struct cxusb_state),
610 626
627 .num_adapters = 1,
628 .adapter = {
629 {
611 .streaming_ctrl = cxusb_streaming_ctrl, 630 .streaming_ctrl = cxusb_streaming_ctrl,
612 .power_ctrl = cxusb_bluebird_power_ctrl,
613 .frontend_attach = cxusb_dee1601_frontend_attach, 631 .frontend_attach = cxusb_dee1601_frontend_attach,
614 .tuner_attach = cxusb_dee1601_tuner_attach, 632 .tuner_attach = cxusb_dee1601_tuner_attach,
615
616 .i2c_algo = &cxusb_i2c_algo,
617
618 .rc_interval = 150,
619 .rc_key_map = dvico_mce_rc_keys,
620 .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys),
621 .rc_query = cxusb_rc_query,
622
623 .generic_bulk_ctrl_endpoint = 0x01,
624 /* parameter for the MPEG2-data transfer */ 633 /* parameter for the MPEG2-data transfer */
625 .urb = { 634 .stream = {
626 .type = DVB_USB_BULK, 635 .type = USB_BULK,
627 .count = 5, 636 .count = 5,
628 .endpoint = 0x04, 637 .endpoint = 0x04,
629 .u = { 638 .u = {
@@ -632,8 +641,21 @@ static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
632 } 641 }
633 } 642 }
634 }, 643 },
644 },
645 },
646
647 .power_ctrl = cxusb_bluebird_power_ctrl,
635 648
636 .num_device_descs = 2, 649 .i2c_algo = &cxusb_i2c_algo,
650
651 .rc_interval = 150,
652 .rc_key_map = dvico_mce_rc_keys,
653 .rc_key_map_size = ARRAY_SIZE(dvico_mce_rc_keys),
654 .rc_query = cxusb_rc_query,
655
656 .generic_bulk_ctrl_endpoint = 0x01,
657
658 .num_device_descs = 3,
637 .devices = { 659 .devices = {
638 { "DViCO FusionHDTV DVB-T Dual USB", 660 { "DViCO FusionHDTV DVB-T Dual USB",
639 { &cxusb_table[3], NULL }, 661 { &cxusb_table[3], NULL },
@@ -643,10 +665,14 @@ static struct dvb_usb_properties cxusb_bluebird_dee1601_properties = {
643 { &cxusb_table[9], NULL }, 665 { &cxusb_table[9], NULL },
644 { &cxusb_table[10], NULL }, 666 { &cxusb_table[10], NULL },
645 }, 667 },
668 { "DViCO FusionHDTV DVB-T Dual Digital 2",
669 { &cxusb_table[11], NULL },
670 { &cxusb_table[12], NULL },
671 },
646 } 672 }
647}; 673};
648 674
649static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = { 675static struct dvb_usb_device_properties cxusb_bluebird_lgz201_properties = {
650 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 676 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
651 677
652 .usb_ctrl = DEVICE_SPECIFIC, 678 .usb_ctrl = DEVICE_SPECIFIC,
@@ -657,22 +683,16 @@ static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = {
657 683
658 .size_of_priv = sizeof(struct cxusb_state), 684 .size_of_priv = sizeof(struct cxusb_state),
659 685
686 .num_adapters = 2,
687 .adapter = {
688 {
660 .streaming_ctrl = cxusb_streaming_ctrl, 689 .streaming_ctrl = cxusb_streaming_ctrl,
661 .power_ctrl = cxusb_bluebird_power_ctrl,
662 .frontend_attach = cxusb_mt352_frontend_attach, 690 .frontend_attach = cxusb_mt352_frontend_attach,
663 .tuner_attach = cxusb_lgz201_tuner_attach, 691 .tuner_attach = cxusb_lgz201_tuner_attach,
664 692
665 .i2c_algo = &cxusb_i2c_algo,
666
667 .rc_interval = 100,
668 .rc_key_map = dvico_portable_rc_keys,
669 .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
670 .rc_query = cxusb_rc_query,
671
672 .generic_bulk_ctrl_endpoint = 0x01,
673 /* parameter for the MPEG2-data transfer */ 693 /* parameter for the MPEG2-data transfer */
674 .urb = { 694 .stream = {
675 .type = DVB_USB_BULK, 695 .type = USB_BULK,
676 .count = 5, 696 .count = 5,
677 .endpoint = 0x04, 697 .endpoint = 0x04,
678 .u = { 698 .u = {
@@ -681,7 +701,18 @@ static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = {
681 } 701 }
682 } 702 }
683 }, 703 },
704 },
705 },
706 .power_ctrl = cxusb_bluebird_power_ctrl,
707
708 .i2c_algo = &cxusb_i2c_algo,
684 709
710 .rc_interval = 100,
711 .rc_key_map = dvico_portable_rc_keys,
712 .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
713 .rc_query = cxusb_rc_query,
714
715 .generic_bulk_ctrl_endpoint = 0x01,
685 .num_device_descs = 1, 716 .num_device_descs = 1,
686 .devices = { 717 .devices = {
687 { "DViCO FusionHDTV DVB-T USB (LGZ201)", 718 { "DViCO FusionHDTV DVB-T USB (LGZ201)",
@@ -691,7 +722,7 @@ static struct dvb_usb_properties cxusb_bluebird_lgz201_properties = {
691 } 722 }
692}; 723};
693 724
694static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = { 725static struct dvb_usb_device_properties cxusb_bluebird_dtt7579_properties = {
695 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 726 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
696 727
697 .usb_ctrl = DEVICE_SPECIFIC, 728 .usb_ctrl = DEVICE_SPECIFIC,
@@ -702,22 +733,16 @@ static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = {
702 733
703 .size_of_priv = sizeof(struct cxusb_state), 734 .size_of_priv = sizeof(struct cxusb_state),
704 735
736 .num_adapters = 1,
737 .adapter = {
738 {
705 .streaming_ctrl = cxusb_streaming_ctrl, 739 .streaming_ctrl = cxusb_streaming_ctrl,
706 .power_ctrl = cxusb_bluebird_power_ctrl,
707 .frontend_attach = cxusb_mt352_frontend_attach, 740 .frontend_attach = cxusb_mt352_frontend_attach,
708 .tuner_attach = cxusb_dtt7579_tuner_attach, 741 .tuner_attach = cxusb_dtt7579_tuner_attach,
709 742
710 .i2c_algo = &cxusb_i2c_algo,
711
712 .rc_interval = 100,
713 .rc_key_map = dvico_portable_rc_keys,
714 .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
715 .rc_query = cxusb_rc_query,
716
717 .generic_bulk_ctrl_endpoint = 0x01,
718 /* parameter for the MPEG2-data transfer */ 743 /* parameter for the MPEG2-data transfer */
719 .urb = { 744 .stream = {
720 .type = DVB_USB_BULK, 745 .type = USB_BULK,
721 .count = 5, 746 .count = 5,
722 .endpoint = 0x04, 747 .endpoint = 0x04,
723 .u = { 748 .u = {
@@ -726,6 +751,18 @@ static struct dvb_usb_properties cxusb_bluebird_dtt7579_properties = {
726 } 751 }
727 } 752 }
728 }, 753 },
754 },
755 },
756 .power_ctrl = cxusb_bluebird_power_ctrl,
757
758 .i2c_algo = &cxusb_i2c_algo,
759
760 .rc_interval = 100,
761 .rc_key_map = dvico_portable_rc_keys,
762 .rc_key_map_size = ARRAY_SIZE(dvico_portable_rc_keys),
763 .rc_query = cxusb_rc_query,
764
765 .generic_bulk_ctrl_endpoint = 0x01,
729 766
730 .num_device_descs = 1, 767 .num_device_descs = 1,
731 .devices = { 768 .devices = {
diff --git a/drivers/media/dvb/dvb-usb/dib0700.h b/drivers/media/dvb/dvb-usb/dib0700.h
new file mode 100644
index 000000000000..ac84347f9d4c
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/dib0700.h
@@ -0,0 +1,49 @@
1/* Linux driver for devices based on the DiBcom DiB0700 USB bridge
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation, version 2.
6 *
7 * Copyright (C) 2005-6 DiBcom, SA
8 */
9#ifndef _DIB0700_H_
10#define _DIB0700_H_
11
12#define DVB_USB_LOG_PREFIX "dib0700"
13#include "dvb-usb.h"
14
15#include "dib07x0.h"
16
17extern int dvb_usb_dib0700_debug;
18#define deb_info(args...) dprintk(dvb_usb_dib0700_debug,0x01,args)
19#define deb_fw(args...) dprintk(dvb_usb_dib0700_debug,0x02,args)
20#define deb_fwdata(args...) dprintk(dvb_usb_dib0700_debug,0x04,args)
21#define deb_data(args...) dprintk(dvb_usb_dib0700_debug,0x08,args)
22
23#define REQUEST_I2C_READ 0x2
24#define REQUEST_I2C_WRITE 0x3
25#define REQUEST_POLL_RC 0x4
26#define REQUEST_JUMPRAM 0x8
27#define REQUEST_SET_GPIO 0xC
28#define REQUEST_ENABLE_VIDEO 0xF
29 // 1 Byte: 4MSB(1 = enable streaming, 0 = disable streaming) 4LSB(Video Mode: 0 = MPEG2 188Bytes, 1 = Analog)
30 // 2 Byte: MPEG2 mode: 4MSB(1 = Master Mode, 0 = Slave Mode) 4LSB(Channel 1 = bit0, Channel 2 = bit1)
31 // 2 Byte: Analog mode: 4MSB(0 = 625 lines, 1 = 525 lines) 4LSB( " " )
32
33struct dib0700_state {
34 u8 channel_state;
35 u16 mt2060_if1[2];
36};
37
38extern int dib0700_set_gpio(struct dvb_usb_device *, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val);
39extern int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw);
40extern int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff);
41extern struct i2c_algorithm dib0700_i2c_algo;
42extern int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props,
43 struct dvb_usb_device_description **desc, int *cold);
44
45extern int dib0700_device_count;
46extern struct dvb_usb_device_properties dib0700_devices[];
47extern struct usb_device_id dib0700_usb_id_table[];
48
49#endif
diff --git a/drivers/media/dvb/dvb-usb/dib0700_core.c b/drivers/media/dvb/dvb-usb/dib0700_core.c
new file mode 100644
index 000000000000..dca6c6985661
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/dib0700_core.c
@@ -0,0 +1,279 @@
1/* Linux driver for devices based on the DiBcom DiB0700 USB bridge
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation, version 2.
6 *
7 * Copyright (C) 2005-6 DiBcom, SA
8 */
9#include "dib0700.h"
10
11/* debug */
12int dvb_usb_dib0700_debug;
13module_param_named(debug,dvb_usb_dib0700_debug, int, 0644);
14MODULE_PARM_DESC(debug, "set debugging level (1=info,2=fw,4=fwdata,8=data (or-able))." DVB_USB_DEBUG_STATUS);
15
16/* expecting rx buffer: request data[0] data[1] ... data[2] */
17static int dib0700_ctrl_wr(struct dvb_usb_device *d, u8 *tx, u8 txlen)
18{
19 int status;
20
21 deb_data(">>> ");
22 debug_dump(tx,txlen,deb_data);
23
24 status = usb_control_msg(d->udev, usb_sndctrlpipe(d->udev,0),
25 tx[0], USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, tx, txlen,
26 USB_CTRL_GET_TIMEOUT);
27
28 if (status != txlen)
29 deb_data("ep 0 write error (status = %d, len: %d)\n",status,txlen);
30
31 return status < 0 ? status : 0;
32}
33
34/* expecting tx buffer: request data[0] ... data[n] (n <= 4) */
35static int dib0700_ctrl_rd(struct dvb_usb_device *d, u8 *tx, u8 txlen, u8 *rx, u8 rxlen)
36{
37 u16 index, value;
38 int status;
39
40 if (txlen < 2) {
41 err("tx buffer length is smaller than 2. Makes no sense.");
42 return -EINVAL;
43 }
44 if (txlen > 4) {
45 err("tx buffer length is larger than 4. Not supported.");
46 return -EINVAL;
47 }
48
49 deb_data(">>> ");
50 debug_dump(tx,txlen,deb_data);
51
52 value = ((txlen - 2) << 8) | tx[1];
53 index = 0;
54 if (txlen > 2)
55 index |= (tx[2] << 8);
56 if (txlen > 3)
57 index |= tx[3];
58
59 /* think about swapping here */
60 value = le16_to_cpu(value);
61 index = le16_to_cpu(index);
62
63 status = usb_control_msg(d->udev, usb_rcvctrlpipe(d->udev,0), tx[0],
64 USB_TYPE_VENDOR | USB_DIR_IN, value, index, rx, rxlen,
65 USB_CTRL_GET_TIMEOUT);
66
67 if (status < 0)
68 deb_info("ep 0 read error (status = %d)\n",status);
69
70 deb_data("<<< ");
71 debug_dump(rx,rxlen,deb_data);
72
73 return status; /* length in case of success */
74}
75
76int dib0700_set_gpio(struct dvb_usb_device *d, enum dib07x0_gpios gpio, u8 gpio_dir, u8 gpio_val)
77{
78 u8 buf[3] = { REQUEST_SET_GPIO, gpio, ((gpio_dir & 0x01) << 7) | ((gpio_val & 0x01) << 6) };
79 return dib0700_ctrl_wr(d,buf,3);
80}
81
82/*
83 * I2C master xfer function
84 */
85static int dib0700_i2c_xfer(struct i2c_adapter *adap,struct i2c_msg *msg,int num)
86{
87 struct dvb_usb_device *d = i2c_get_adapdata(adap);
88 int i,len;
89 u8 buf[255];
90
91 if (mutex_lock_interruptible(&d->i2c_mutex) < 0)
92 return -EAGAIN;
93
94 for (i = 0; i < num; i++) {
95 /* fill in the address */
96 buf[1] = (msg[i].addr << 1);
97 /* fill the buffer */
98 memcpy(&buf[2], msg[i].buf, msg[i].len);
99
100 /* write/read request */
101 if (i+1 < num && (msg[i+1].flags & I2C_M_RD)) {
102 buf[0] = REQUEST_I2C_READ;
103 buf[1] |= 1;
104
105 /* special thing in the current firmware: when length is zero the read-failed */
106 if ((len = dib0700_ctrl_rd(d, buf, msg[i].len + 2, msg[i+1].buf, msg[i+1].len)) <= 0) {
107 deb_info("I2C read failed on address %x\n", msg[i].addr);
108 break;
109 }
110
111 msg[i+1].len = len;
112
113 i++;
114 } else {
115 buf[0] = REQUEST_I2C_WRITE;
116 if (dib0700_ctrl_wr(d, buf, msg[i].len + 2) < 0)
117 break;
118 }
119 }
120
121 mutex_unlock(&d->i2c_mutex);
122 return i;
123}
124
125static u32 dib0700_i2c_func(struct i2c_adapter *adapter)
126{
127 return I2C_FUNC_I2C;
128}
129
130struct i2c_algorithm dib0700_i2c_algo = {
131 .master_xfer = dib0700_i2c_xfer,
132 .functionality = dib0700_i2c_func,
133};
134
135int dib0700_identify_state(struct usb_device *udev, struct dvb_usb_device_properties *props,
136 struct dvb_usb_device_description **desc, int *cold)
137{
138 u8 buf[3] = { REQUEST_SET_GPIO, 4, (GPIO_IN << 7) | (0 << 6) }; // GPIO4 is save - used for I2C
139 *cold = usb_control_msg(udev, usb_sndctrlpipe(udev,0),
140 buf[0], USB_TYPE_VENDOR | USB_DIR_OUT, 0, 0, buf, 3, USB_CTRL_GET_TIMEOUT) != 3;
141
142 deb_info("cold: %d\n", *cold);
143 return 0;
144}
145
146static int dib0700_jumpram(struct usb_device *udev, u32 address)
147{
148 int ret, actlen;
149 u8 buf[8] = { REQUEST_JUMPRAM, 0, 0, 0,
150 (address >> 24) & 0xff,
151 (address >> 16) & 0xff,
152 (address >> 8) & 0xff,
153 address & 0xff };
154
155 if ((ret = usb_bulk_msg(udev, usb_sndbulkpipe(udev, 0x01),buf,8,&actlen,1000)) < 0) {
156 deb_fw("jumpram to 0x%x failed\n",address);
157 return ret;
158 }
159 if (actlen != 8) {
160 deb_fw("jumpram to 0x%x failed\n",address);
161 return -EIO;
162 }
163 return 0;
164}
165
166int dib0700_download_firmware(struct usb_device *udev, const struct firmware *fw)
167{
168 struct hexline hx;
169 int pos = 0, ret, act_len;
170
171 u8 buf[260];
172
173 while ((ret = dvb_usb_get_hexline(fw, &hx, &pos)) > 0) {
174 deb_fwdata("writing to address 0x%08x (buffer: 0x%02x %02x)\n",hx.addr, hx.len, hx.chk);
175
176 buf[0] = hx.len;
177 buf[1] = (hx.addr >> 8) & 0xff;
178 buf[2] = hx.addr & 0xff;
179 buf[3] = hx.type;
180 memcpy(&buf[4],hx.data,hx.len);
181 buf[4+hx.len] = hx.chk;
182
183 ret = usb_bulk_msg(udev,
184 usb_sndbulkpipe(udev, 0x01),
185 buf,
186 hx.len + 5,
187 &act_len,
188 1000);
189
190 if (ret < 0) {
191 err("firmware download failed at %d with %d",pos,ret);
192 return ret;
193 }
194 }
195
196 if (ret == 0) {
197 /* start the firmware */
198 if ((ret = dib0700_jumpram(udev, 0x70000000)) == 0) {
199 info("firmware started successfully.");
200 msleep(100);
201 }
202 } else
203 ret = -EIO;
204
205 return ret;
206}
207
208int dib0700_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
209{
210 struct dib0700_state *st = adap->dev->priv;
211 u8 b[4];
212
213 b[0] = REQUEST_ENABLE_VIDEO;
214 b[1] = 0x00;
215 b[2] = (0x01 << 4); /* Master mode */
216 b[3] = 0x00;
217
218 deb_info("modifying (%d) streaming state for %d\n", onoff, adap->id);
219
220 if (onoff)
221 st->channel_state |= 1 << adap->id;
222 else
223 st->channel_state &= ~(1 << adap->id);
224
225 b[2] |= st->channel_state;
226
227 if (st->channel_state) /* if at least one channel is active */
228 b[1] = (0x01 << 4) | 0x00;
229
230 deb_info("data for streaming: %x %x\n",b[1],b[2]);
231
232 return dib0700_ctrl_wr(adap->dev, b, 4);
233}
234
235static int dib0700_probe(struct usb_interface *intf,
236 const struct usb_device_id *id)
237{
238 int i;
239
240 for (i = 0; i < dib0700_device_count; i++)
241 if (dvb_usb_device_init(intf, &dib0700_devices[i], THIS_MODULE, NULL) == 0)
242 return 0;
243
244 return -ENODEV;
245}
246
247static struct usb_driver dib0700_driver = {
248 .name = "dvb_usb_dib0700",
249 .probe = dib0700_probe,
250 .disconnect = dvb_usb_device_exit,
251 .id_table = dib0700_usb_id_table,
252};
253
254/* module stuff */
255static int __init dib0700_module_init(void)
256{
257 int result;
258 info("loaded with support for %d different device-types", dib0700_device_count);
259 if ((result = usb_register(&dib0700_driver))) {
260 err("usb_register failed. Error number %d",result);
261 return result;
262 }
263
264 return 0;
265}
266
267static void __exit dib0700_module_exit(void)
268{
269 /* deregister this driver from the USB subsystem */
270 usb_deregister(&dib0700_driver);
271}
272
273module_init (dib0700_module_init);
274module_exit (dib0700_module_exit);
275
276MODULE_AUTHOR("Patrick Boettcher <pboettcher@dibcom.fr>");
277MODULE_DESCRIPTION("Driver for devices based on DiBcom DiB0700 - USB bridge");
278MODULE_VERSION("1.0");
279MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/dib0700_devices.c b/drivers/media/dvb/dvb-usb/dib0700_devices.c
new file mode 100644
index 000000000000..e473bfed226b
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/dib0700_devices.c
@@ -0,0 +1,212 @@
1/* Linux driver for devices based on the DiBcom DiB0700 USB bridge
2 *
3 * This program is free software; you can redistribute it and/or modify it
4 * under the terms of the GNU General Public License as published by the Free
5 * Software Foundation, version 2.
6 *
7 * Copyright (C) 2005-6 DiBcom, SA
8 */
9#include "dib0700.h"
10
11#include "dib3000mc.h"
12#include "mt2060.h"
13
14static int force_lna_activation;
15module_param(force_lna_activation, int, 0644);
16MODULE_PARM_DESC(force_lna_activation, "force the activation of Low-Noise-Amplifyer(s) (LNA), "
17 "if applicable for the device (default: 0=automatic/off).");
18
19/* Hauppauge Nova-T 500
20 * has a LNA on GPIO0 which is enabled by setting 1 */
21static struct mt2060_config bristol_mt2060_config[2] = {
22 {
23 .i2c_address = 0x60,
24 .clock_out = 3,
25 }, {
26 .i2c_address = 0x61,
27 }
28};
29
30static struct dibx000_agc_config bristol_dib3000p_mt2060_agc_config = {
31 .band_caps = BAND_VHF | BAND_UHF,
32 .setup = (1 << 8) | (5 << 5) | (0 << 4) | (0 << 3) | (0 << 2) | (2 << 0),
33
34 .agc1_max = 42598,
35 .agc1_min = 17694,
36 .agc2_max = 45875,
37 .agc2_min = 0,
38
39 .agc1_pt1 = 0,
40 .agc1_pt2 = 59,
41
42 .agc1_slope1 = 0,
43 .agc1_slope2 = 69,
44
45 .agc2_pt1 = 0,
46 .agc2_pt2 = 59,
47
48 .agc2_slope1 = 111,
49 .agc2_slope2 = 28,
50};
51
52static struct dib3000mc_config bristol_dib3000mc_config[2] = {
53 { .agc = &bristol_dib3000p_mt2060_agc_config,
54 .max_time = 0x196,
55 .ln_adc_level = 0x1cc7,
56 .output_mpeg2_in_188_bytes = 1,
57 },
58 { .agc = &bristol_dib3000p_mt2060_agc_config,
59 .max_time = 0x196,
60 .ln_adc_level = 0x1cc7,
61 .output_mpeg2_in_188_bytes = 1,
62 }
63};
64
65static int bristol_frontend_attach(struct dvb_usb_adapter *adap)
66{
67 struct dib0700_state *st = adap->dev->priv;
68 if (adap->id == 0) {
69 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
70 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
71 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
72 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
73
74 if (force_lna_activation)
75 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1);
76 else
77 dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 0);
78
79 if (dib3000mc_i2c_enumeration(&adap->dev->i2c_adap, 2, DEFAULT_DIB3000P_I2C_ADDRESS, bristol_dib3000mc_config) != 0) {
80 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
81 return -ENODEV;
82 }
83 }
84 st->mt2060_if1[adap->id] = 1220;
85 return (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap,
86 (10 + adap->id) << 1, &bristol_dib3000mc_config[adap->id])) == NULL ? -ENODEV : 0;
87}
88
89static int bristol_tuner_attach(struct dvb_usb_adapter *adap)
90{
91 struct dib0700_state *st = adap->dev->priv;
92 struct i2c_adapter *tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
93 return dvb_attach(mt2060_attach,adap->fe, tun_i2c, &bristol_mt2060_config[adap->id],
94 st->mt2060_if1[adap->id]) == NULL ? -ENODEV : 0;
95}
96
97/* STK7700P: Hauppauge Nova-T Stick, AVerMedia Volar */
98/*
99static struct mt2060_config stk7000p_mt2060_config = {
100 0x60
101};
102*/
103
104static int stk7700p_frontend_attach(struct dvb_usb_adapter *adap)
105{
106 /* unless there is no real power management in DVB - we leave the device on GPIO6 */
107 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 0); msleep(10);
108 dib0700_set_gpio(adap->dev, GPIO6, GPIO_OUT, 1); msleep(10);
109 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10);
110 dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 0); msleep(10);
111
112// adap->fe = dib7000m_attach(&adap->dev->i2c_adap, &stk7700p_dib7000m_config, 18);
113 return 0;
114}
115
116static int stk7700p_tuner_attach(struct dvb_usb_adapter *adap)
117{
118// tun_i2c = dib7000m_get_tuner_i2c_master(adap->fe, 1);
119// return mt2060_attach(adap->fe, tun_i2c, &stk3000p_mt2060_config, if1);
120 return 0;
121}
122
123struct usb_device_id dib0700_usb_id_table[] = {
124 { USB_DEVICE(USB_VID_DIBCOM, USB_PID_DIBCOM_STK7700P) },
125 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500) },
126 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_500_2) },
127 { USB_DEVICE(USB_VID_HAUPPAUGE, USB_PID_HAUPPAUGE_NOVA_T_STICK) },
128 { USB_DEVICE(USB_VID_AVERMEDIA, USB_PID_AVERMEDIA_VOLAR) },
129 { } /* Terminating entry */
130};
131MODULE_DEVICE_TABLE(usb, dib0700_usb_id_table);
132
133#define DIB0700_DEFAULT_DEVICE_PROPERTIES \
134 .caps = DVB_USB_IS_AN_I2C_ADAPTER, \
135 .usb_ctrl = DEVICE_SPECIFIC, \
136 .firmware = "dvb-usb-dib0700-01.fw", \
137 .download_firmware = dib0700_download_firmware, \
138 .no_reconnect = 1, \
139 .size_of_priv = sizeof(struct dib0700_state), \
140 .i2c_algo = &dib0700_i2c_algo, \
141 .identify_state = dib0700_identify_state
142
143#define DIB0700_DEFAULT_STREAMING_CONFIG(ep) \
144 .streaming_ctrl = dib0700_streaming_ctrl, \
145 .stream = { \
146 .type = USB_BULK, \
147 .count = 4, \
148 .endpoint = ep, \
149 .u = { \
150 .bulk = { \
151 .buffersize = 39480, \
152 } \
153 } \
154 }
155
156struct dvb_usb_device_properties dib0700_devices[] = {
157 {
158 DIB0700_DEFAULT_DEVICE_PROPERTIES,
159
160 .num_adapters = 1,
161 .adapter = {
162 {
163 .frontend_attach = stk7700p_frontend_attach,
164 .tuner_attach = stk7700p_tuner_attach,
165
166 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
167 },
168 },
169
170 .num_device_descs = 3,
171 .devices = {
172 { "DiBcom STK7700P reference design",
173 { &dib0700_usb_id_table[0], NULL },
174 { NULL },
175 },
176 { "Hauppauge Nova-T Stick",
177 { &dib0700_usb_id_table[3], NULL },
178 { NULL },
179 },
180 { "AVerMedia AVerTV DVB-T Volar",
181 { &dib0700_usb_id_table[4], NULL },
182 { NULL },
183 },
184 }
185 }, { DIB0700_DEFAULT_DEVICE_PROPERTIES,
186
187 .num_adapters = 2,
188 .adapter = {
189 {
190 .frontend_attach = bristol_frontend_attach,
191 .tuner_attach = bristol_tuner_attach,
192
193 DIB0700_DEFAULT_STREAMING_CONFIG(0x02),
194 }, {
195 .frontend_attach = bristol_frontend_attach,
196 .tuner_attach = bristol_tuner_attach,
197
198 DIB0700_DEFAULT_STREAMING_CONFIG(0x03),
199 }
200 },
201
202 .num_device_descs = 1,
203 .devices = {
204 { "Hauppauge Nova-T 500 Dual DVB-T",
205 { &dib0700_usb_id_table[1], &dib0700_usb_id_table[2], NULL },
206 { NULL },
207 },
208 }
209 }
210};
211
212int dib0700_device_count = ARRAY_SIZE(dib0700_devices);
diff --git a/drivers/media/dvb/dvb-usb/dib07x0.h b/drivers/media/dvb/dvb-usb/dib07x0.h
new file mode 100644
index 000000000000..7e62c1018520
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/dib07x0.h
@@ -0,0 +1,21 @@
1#ifndef _DIB07X0_H_
2#define _DIB07X0_H_
3
4enum dib07x0_gpios {
5 GPIO0 = 0,
6 GPIO1 = 2,
7 GPIO2 = 3,
8 GPIO3 = 4,
9 GPIO4 = 5,
10 GPIO5 = 6,
11 GPIO6 = 8,
12 GPIO7 = 10,
13 GPIO8 = 11,
14 GPIO9 = 14,
15 GPIO10 = 15,
16};
17
18#define GPIO_IN 0
19#define GPIO_OUT 1
20
21#endif
diff --git a/drivers/media/dvb/dvb-usb/dibusb-common.c b/drivers/media/dvb/dvb-usb/dibusb-common.c
index 124e25ac53b3..fd3a9902f98d 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-common.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-common.c
@@ -18,12 +18,12 @@ MODULE_LICENSE("GPL");
18#define deb_info(args...) dprintk(debug,0x01,args) 18#define deb_info(args...) dprintk(debug,0x01,args)
19 19
20/* common stuff used by the different dibusb modules */ 20/* common stuff used by the different dibusb modules */
21int dibusb_streaming_ctrl(struct dvb_usb_device *d, int onoff) 21int dibusb_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
22{ 22{
23 if (d->priv != NULL) { 23 if (adap->priv != NULL) {
24 struct dibusb_state *st = d->priv; 24 struct dibusb_state *st = adap->priv;
25 if (st->ops.fifo_ctrl != NULL) 25 if (st->ops.fifo_ctrl != NULL)
26 if (st->ops.fifo_ctrl(d->fe,onoff)) { 26 if (st->ops.fifo_ctrl(adap->fe,onoff)) {
27 err("error while controlling the fifo of the demod."); 27 err("error while controlling the fifo of the demod.");
28 return -ENODEV; 28 return -ENODEV;
29 } 29 }
@@ -32,23 +32,23 @@ int dibusb_streaming_ctrl(struct dvb_usb_device *d, int onoff)
32} 32}
33EXPORT_SYMBOL(dibusb_streaming_ctrl); 33EXPORT_SYMBOL(dibusb_streaming_ctrl);
34 34
35int dibusb_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int onoff) 35int dibusb_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
36{ 36{
37 if (d->priv != NULL) { 37 if (adap->priv != NULL) {
38 struct dibusb_state *st = d->priv; 38 struct dibusb_state *st = adap->priv;
39 if (st->ops.pid_ctrl != NULL) 39 if (st->ops.pid_ctrl != NULL)
40 st->ops.pid_ctrl(d->fe,index,pid,onoff); 40 st->ops.pid_ctrl(adap->fe,index,pid,onoff);
41 } 41 }
42 return 0; 42 return 0;
43} 43}
44EXPORT_SYMBOL(dibusb_pid_filter); 44EXPORT_SYMBOL(dibusb_pid_filter);
45 45
46int dibusb_pid_filter_ctrl(struct dvb_usb_device *d, int onoff) 46int dibusb_pid_filter_ctrl(struct dvb_usb_adapter *adap, int onoff)
47{ 47{
48 if (d->priv != NULL) { 48 if (adap->priv != NULL) {
49 struct dibusb_state *st = d->priv; 49 struct dibusb_state *st = adap->priv;
50 if (st->ops.pid_parse != NULL) 50 if (st->ops.pid_parse != NULL)
51 if (st->ops.pid_parse(d->fe,onoff) < 0) 51 if (st->ops.pid_parse(adap->fe,onoff) < 0)
52 err("could not handle pid_parser"); 52 err("could not handle pid_parser");
53 } 53 }
54 return 0; 54 return 0;
@@ -68,24 +68,24 @@ int dibusb_power_ctrl(struct dvb_usb_device *d, int onoff)
68} 68}
69EXPORT_SYMBOL(dibusb_power_ctrl); 69EXPORT_SYMBOL(dibusb_power_ctrl);
70 70
71int dibusb2_0_streaming_ctrl(struct dvb_usb_device *d, int onoff) 71int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
72{ 72{
73 u8 b[3] = { 0 }; 73 u8 b[3] = { 0 };
74 int ret; 74 int ret;
75 75
76 if ((ret = dibusb_streaming_ctrl(d,onoff)) < 0) 76 if ((ret = dibusb_streaming_ctrl(adap,onoff)) < 0)
77 return ret; 77 return ret;
78 78
79 if (onoff) { 79 if (onoff) {
80 b[0] = DIBUSB_REQ_SET_STREAMING_MODE; 80 b[0] = DIBUSB_REQ_SET_STREAMING_MODE;
81 b[1] = 0x00; 81 b[1] = 0x00;
82 if ((ret = dvb_usb_generic_write(d,b,2)) < 0) 82 if ((ret = dvb_usb_generic_write(adap->dev,b,2)) < 0)
83 return ret; 83 return ret;
84 } 84 }
85 85
86 b[0] = DIBUSB_REQ_SET_IOCTL; 86 b[0] = DIBUSB_REQ_SET_IOCTL;
87 b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM; 87 b[1] = onoff ? DIBUSB_IOCTL_CMD_ENABLE_STREAM : DIBUSB_IOCTL_CMD_DISABLE_STREAM;
88 return dvb_usb_generic_write(d,b,3); 88 return dvb_usb_generic_write(adap->dev,b,3);
89} 89}
90EXPORT_SYMBOL(dibusb2_0_streaming_ctrl); 90EXPORT_SYMBOL(dibusb2_0_streaming_ctrl);
91 91
@@ -228,12 +228,12 @@ static struct dib3000mc_config mod3000p_dib3000p_config = {
228 .output_mpeg2_in_188_bytes = 1, 228 .output_mpeg2_in_188_bytes = 1,
229}; 229};
230 230
231int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *d) 231int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *adap)
232{ 232{
233 if (dib3000mc_attach(&d->i2c_adap, 1, DEFAULT_DIB3000P_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &d->fe) == 0 || 233 if ((adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, DEFAULT_DIB3000P_I2C_ADDRESS, &mod3000p_dib3000p_config)) != NULL ||
234 dib3000mc_attach(&d->i2c_adap, 1, DEFAULT_DIB3000MC_I2C_ADDRESS, 0, &mod3000p_dib3000p_config, &d->fe) == 0) { 234 (adap->fe = dvb_attach(dib3000mc_attach, &adap->dev->i2c_adap, DEFAULT_DIB3000MC_I2C_ADDRESS, &mod3000p_dib3000p_config)) != NULL) {
235 if (d->priv != NULL) { 235 if (adap->priv != NULL) {
236 struct dibusb_state *st = d->priv; 236 struct dibusb_state *st = adap->priv;
237 st->ops.pid_parse = dib3000mc_pid_parse; 237 st->ops.pid_parse = dib3000mc_pid_parse;
238 st->ops.pid_ctrl = dib3000mc_pid_control; 238 st->ops.pid_ctrl = dib3000mc_pid_control;
239 } 239 }
@@ -247,20 +247,19 @@ static struct mt2060_config stk3000p_mt2060_config = {
247 0x60 247 0x60
248}; 248};
249 249
250int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d) 250int dibusb_dib3000mc_tuner_attach(struct dvb_usb_adapter *adap)
251{ 251{
252 struct dibusb_state *st = d->priv; 252 struct dibusb_state *st = adap->priv;
253 int ret;
254 u8 a,b; 253 u8 a,b;
255 u16 if1 = 1220; 254 u16 if1 = 1220;
256 struct i2c_adapter *tun_i2c; 255 struct i2c_adapter *tun_i2c;
257 256
258 // First IF calibration for Liteon Sticks 257 // First IF calibration for Liteon Sticks
259 if (d->udev->descriptor.idVendor == USB_VID_LITEON && 258 if (adap->dev->udev->descriptor.idVendor == USB_VID_LITEON &&
260 d->udev->descriptor.idProduct == USB_PID_LITEON_DVB_T_WARM) { 259 adap->dev->udev->descriptor.idProduct == USB_PID_LITEON_DVB_T_WARM) {
261 260
262 dibusb_read_eeprom_byte(d,0x7E,&a); 261 dibusb_read_eeprom_byte(adap->dev,0x7E,&a);
263 dibusb_read_eeprom_byte(d,0x7F,&b); 262 dibusb_read_eeprom_byte(adap->dev,0x7F,&b);
264 263
265 if (a == 0x00) 264 if (a == 0x00)
266 if1 += b; 265 if1 += b;
@@ -269,14 +268,14 @@ int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d)
269 else 268 else
270 warn("LITE-ON DVB-T: Strange IF1 calibration :%2X %2X\n", a, b); 269 warn("LITE-ON DVB-T: Strange IF1 calibration :%2X %2X\n", a, b);
271 270
272 } else if (d->udev->descriptor.idVendor == USB_VID_DIBCOM && 271 } else if (adap->dev->udev->descriptor.idVendor == USB_VID_DIBCOM &&
273 d->udev->descriptor.idProduct == USB_PID_DIBCOM_MOD3001_WARM) { 272 adap->dev->udev->descriptor.idProduct == USB_PID_DIBCOM_MOD3001_WARM) {
274 u8 desc; 273 u8 desc;
275 dibusb_read_eeprom_byte(d, 7, &desc); 274 dibusb_read_eeprom_byte(adap->dev, 7, &desc);
276 if (desc == 2) { 275 if (desc == 2) {
277 a = 127; 276 a = 127;
278 do { 277 do {
279 dibusb_read_eeprom_byte(d, a, &desc); 278 dibusb_read_eeprom_byte(adap->dev, a, &desc);
280 a--; 279 a--;
281 } while (a > 7 && (desc == 0xff || desc == 0x00)); 280 } while (a > 7 && (desc == 0xff || desc == 0x00));
282 if (desc & 0x80) 281 if (desc & 0x80)
@@ -286,15 +285,15 @@ int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *d)
286 } 285 }
287 } 286 }
288 287
289 tun_i2c = dib3000mc_get_tuner_i2c_master(d->fe, 1); 288 tun_i2c = dib3000mc_get_tuner_i2c_master(adap->fe, 1);
290 if ((ret = mt2060_attach(d->fe, tun_i2c, &stk3000p_mt2060_config, if1)) != 0) { 289 if (dvb_attach(mt2060_attach, adap->fe, tun_i2c, &stk3000p_mt2060_config, if1) == NULL) {
291 /* not found - use panasonic pll parameters */ 290 /* not found - use panasonic pll parameters */
292 if (dvb_pll_attach(d->fe, 0x60, tun_i2c, &dvb_pll_env57h1xd5) == NULL) 291 if (dvb_attach(dvb_pll_attach, adap->fe, 0x60, tun_i2c, &dvb_pll_env57h1xd5) == NULL)
293 return -ENOMEM; 292 return -ENOMEM;
294 } else { 293 } else {
295 st->mt2060_present = 1; 294 st->mt2060_present = 1;
296 /* set the correct parameters for the dib3000p */ 295 /* set the correct parameters for the dib3000p */
297 dib3000mc_set_config(d->fe, &stk3000p_dib3000p_config); 296 dib3000mc_set_config(adap->fe, &stk3000p_dib3000p_config);
298 } 297 }
299 return 0; 298 return 0;
300} 299}
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mb.c b/drivers/media/dvb/dvb-usb/dibusb-mb.c
index effd34cc4b02..4fe363e48352 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-mb.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-mb.c
@@ -14,35 +14,35 @@
14 */ 14 */
15#include "dibusb.h" 15#include "dibusb.h"
16 16
17static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_device *d) 17static int dibusb_dib3000mb_frontend_attach(struct dvb_usb_adapter *adap)
18{ 18{
19 struct dib3000_config demod_cfg; 19 struct dib3000_config demod_cfg;
20 struct dibusb_state *st = d->priv; 20 struct dibusb_state *st = adap->priv;
21 21
22 demod_cfg.demod_address = 0x8; 22 demod_cfg.demod_address = 0x8;
23 23
24 if ((d->fe = dib3000mb_attach(&demod_cfg,&d->i2c_adap,&st->ops)) == NULL) 24 if ((adap->fe = dib3000mb_attach(&demod_cfg,&adap->dev->i2c_adap,&st->ops)) == NULL)
25 return -ENODEV; 25 return -ENODEV;
26 26
27 d->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c; 27 adap->fe->ops.tuner_ops.init = dvb_usb_tuner_init_i2c;
28 d->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c; 28 adap->fe->ops.tuner_ops.set_params = dvb_usb_tuner_set_params_i2c;
29 29
30 d->tuner_pass_ctrl = st->ops.tuner_pass_ctrl; 30 adap->tuner_pass_ctrl = st->ops.tuner_pass_ctrl;
31 31
32 return 0; 32 return 0;
33} 33}
34 34
35static int dibusb_thomson_tuner_attach(struct dvb_usb_device *d) 35static int dibusb_thomson_tuner_attach(struct dvb_usb_adapter *adap)
36{ 36{
37 d->pll_addr = 0x61; 37 adap->pll_addr = 0x61;
38 d->pll_desc = &dvb_pll_tua6010xs; 38 adap->pll_desc = &dvb_pll_tua6010xs;
39 return 0; 39 return 0;
40} 40}
41 41
42/* Some of the Artec 1.1 device aren't equipped with the default tuner 42/* Some of the Artec 1.1 device aren't equipped with the default tuner
43 * (Thomson Cable), but with a Panasonic ENV77H11D5. This function figures 43 * (Thomson Cable), but with a Panasonic ENV77H11D5. This function figures
44 * this out. */ 44 * this out. */
45static int dibusb_tuner_probe_and_attach(struct dvb_usb_device *d) 45static int dibusb_tuner_probe_and_attach(struct dvb_usb_adapter *adap)
46{ 46{
47 u8 b[2] = { 0,0 }, b2[1]; 47 u8 b[2] = { 0,0 }, b2[1];
48 int ret = 0; 48 int ret = 0;
@@ -54,36 +54,36 @@ static int dibusb_tuner_probe_and_attach(struct dvb_usb_device *d)
54 /* the Panasonic sits on I2C addrass 0x60, the Thomson on 0x61 */ 54 /* the Panasonic sits on I2C addrass 0x60, the Thomson on 0x61 */
55 msg[0].addr = msg[1].addr = 0x60; 55 msg[0].addr = msg[1].addr = 0x60;
56 56
57 if (d->tuner_pass_ctrl) 57 if (adap->tuner_pass_ctrl)
58 d->tuner_pass_ctrl(d->fe,1,msg[0].addr); 58 adap->tuner_pass_ctrl(adap->fe,1,msg[0].addr);
59 59
60 if (i2c_transfer (&d->i2c_adap, msg, 2) != 2) { 60 if (i2c_transfer(&adap->dev->i2c_adap, msg, 2) != 2) {
61 err("tuner i2c write failed."); 61 err("tuner i2c write failed.");
62 ret = -EREMOTEIO; 62 ret = -EREMOTEIO;
63 } 63 }
64 64
65 if (d->tuner_pass_ctrl) 65 if (adap->tuner_pass_ctrl)
66 d->tuner_pass_ctrl(d->fe,0,msg[0].addr); 66 adap->tuner_pass_ctrl(adap->fe,0,msg[0].addr);
67 67
68 if (b2[0] == 0xfe) { 68 if (b2[0] == 0xfe) {
69 info("This device has the Thomson Cable onboard. Which is default."); 69 info("This device has the Thomson Cable onboard. Which is default.");
70 dibusb_thomson_tuner_attach(d); 70 dibusb_thomson_tuner_attach(adap);
71 } else { 71 } else {
72 u8 bpll[4] = { 0x0b, 0xf5, 0x85, 0xab }; 72 u8 bpll[4] = { 0x0b, 0xf5, 0x85, 0xab };
73 info("This device has the Panasonic ENV77H11D5 onboard."); 73 info("This device has the Panasonic ENV77H11D5 onboard.");
74 d->pll_addr = 0x60; 74 adap->pll_addr = 0x60;
75 memcpy(d->pll_init,bpll,4); 75 memcpy(adap->pll_init,bpll,4);
76 d->pll_desc = &dvb_pll_tda665x; 76 adap->pll_desc = &dvb_pll_tda665x;
77 } 77 }
78 78
79 return ret; 79 return ret;
80} 80}
81 81
82/* USB Driver stuff */ 82/* USB Driver stuff */
83static struct dvb_usb_properties dibusb1_1_properties; 83static struct dvb_usb_device_properties dibusb1_1_properties;
84static struct dvb_usb_properties dibusb1_1_an2235_properties; 84static struct dvb_usb_device_properties dibusb1_1_an2235_properties;
85static struct dvb_usb_properties dibusb2_0b_properties; 85static struct dvb_usb_device_properties dibusb2_0b_properties;
86static struct dvb_usb_properties artec_t1_usb2_properties; 86static struct dvb_usb_device_properties artec_t1_usb2_properties;
87 87
88static int dibusb_probe(struct usb_interface *intf, 88static int dibusb_probe(struct usb_interface *intf,
89 const struct usb_device_id *id) 89 const struct usb_device_id *id)
@@ -150,34 +150,28 @@ static struct usb_device_id dibusb_dib3000mb_table [] = {
150}; 150};
151MODULE_DEVICE_TABLE (usb, dibusb_dib3000mb_table); 151MODULE_DEVICE_TABLE (usb, dibusb_dib3000mb_table);
152 152
153static struct dvb_usb_properties dibusb1_1_properties = { 153static struct dvb_usb_device_properties dibusb1_1_properties = {
154 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, 154 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
155 .pid_filter_count = 16,
156 155
157 .usb_ctrl = CYPRESS_AN2135, 156 .usb_ctrl = CYPRESS_AN2135,
158 157
159 .firmware = "dvb-usb-dibusb-5.0.0.11.fw", 158 .firmware = "dvb-usb-dibusb-5.0.0.11.fw",
160 159
161 .size_of_priv = sizeof(struct dibusb_state), 160 .num_adapters = 1,
161 .adapter = {
162 {
163 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
164 .pid_filter_count = 16,
162 165
163 .streaming_ctrl = dibusb_streaming_ctrl, 166 .streaming_ctrl = dibusb_streaming_ctrl,
164 .pid_filter = dibusb_pid_filter, 167 .pid_filter = dibusb_pid_filter,
165 .pid_filter_ctrl = dibusb_pid_filter_ctrl, 168 .pid_filter_ctrl = dibusb_pid_filter_ctrl,
166 .power_ctrl = dibusb_power_ctrl,
167 .frontend_attach = dibusb_dib3000mb_frontend_attach, 169 .frontend_attach = dibusb_dib3000mb_frontend_attach,
168 .tuner_attach = dibusb_tuner_probe_and_attach, 170 .tuner_attach = dibusb_tuner_probe_and_attach,
169 171
170 .rc_interval = DEFAULT_RC_INTERVAL,
171 .rc_key_map = dibusb_rc_keys,
172 .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
173 .rc_query = dibusb_rc_query,
174
175 .i2c_algo = &dibusb_i2c_algo,
176
177 .generic_bulk_ctrl_endpoint = 0x01,
178 /* parameter for the MPEG2-data transfer */ 172 /* parameter for the MPEG2-data transfer */
179 .urb = { 173 .stream = {
180 .type = DVB_USB_BULK, 174 .type = USB_BULK,
181 .count = 7, 175 .count = 7,
182 .endpoint = 0x02, 176 .endpoint = 0x02,
183 .u = { 177 .u = {
@@ -186,6 +180,20 @@ static struct dvb_usb_properties dibusb1_1_properties = {
186 } 180 }
187 } 181 }
188 }, 182 },
183 .size_of_priv = sizeof(struct dibusb_state),
184 }
185 },
186
187 .power_ctrl = dibusb_power_ctrl,
188
189 .rc_interval = DEFAULT_RC_INTERVAL,
190 .rc_key_map = dibusb_rc_keys,
191 .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
192 .rc_query = dibusb_rc_query,
193
194 .i2c_algo = &dibusb_i2c_algo,
195
196 .generic_bulk_ctrl_endpoint = 0x01,
189 197
190 .num_device_descs = 9, 198 .num_device_descs = 9,
191 .devices = { 199 .devices = {
@@ -228,34 +236,27 @@ static struct dvb_usb_properties dibusb1_1_properties = {
228 } 236 }
229}; 237};
230 238
231static struct dvb_usb_properties dibusb1_1_an2235_properties = { 239static struct dvb_usb_device_properties dibusb1_1_an2235_properties = {
232 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, 240 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
233 .pid_filter_count = 16,
234
235 .usb_ctrl = CYPRESS_AN2235, 241 .usb_ctrl = CYPRESS_AN2235,
236 242
237 .firmware = "dvb-usb-dibusb-an2235-01.fw", 243 .firmware = "dvb-usb-dibusb-an2235-01.fw",
238 244
239 .size_of_priv = sizeof(struct dibusb_state), 245 .num_adapters = 1,
246 .adapter = {
247 {
248 .caps = DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_ADAP_HAS_PID_FILTER,
249 .pid_filter_count = 16,
240 250
241 .streaming_ctrl = dibusb_streaming_ctrl, 251 .streaming_ctrl = dibusb_streaming_ctrl,
242 .pid_filter = dibusb_pid_filter, 252 .pid_filter = dibusb_pid_filter,
243 .pid_filter_ctrl = dibusb_pid_filter_ctrl, 253 .pid_filter_ctrl = dibusb_pid_filter_ctrl,
244 .power_ctrl = dibusb_power_ctrl,
245 .frontend_attach = dibusb_dib3000mb_frontend_attach, 254 .frontend_attach = dibusb_dib3000mb_frontend_attach,
246 .tuner_attach = dibusb_tuner_probe_and_attach, 255 .tuner_attach = dibusb_tuner_probe_and_attach,
247 256
248 .rc_interval = DEFAULT_RC_INTERVAL,
249 .rc_key_map = dibusb_rc_keys,
250 .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
251 .rc_query = dibusb_rc_query,
252
253 .i2c_algo = &dibusb_i2c_algo,
254
255 .generic_bulk_ctrl_endpoint = 0x01,
256 /* parameter for the MPEG2-data transfer */ 257 /* parameter for the MPEG2-data transfer */
257 .urb = { 258 .stream = {
258 .type = DVB_USB_BULK, 259 .type = USB_BULK,
259 .count = 7, 260 .count = 7,
260 .endpoint = 0x02, 261 .endpoint = 0x02,
261 .u = { 262 .u = {
@@ -264,6 +265,19 @@ static struct dvb_usb_properties dibusb1_1_an2235_properties = {
264 } 265 }
265 } 266 }
266 }, 267 },
268 .size_of_priv = sizeof(struct dibusb_state),
269 },
270 },
271 .power_ctrl = dibusb_power_ctrl,
272
273 .rc_interval = DEFAULT_RC_INTERVAL,
274 .rc_key_map = dibusb_rc_keys,
275 .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
276 .rc_query = dibusb_rc_query,
277
278 .i2c_algo = &dibusb_i2c_algo,
279
280 .generic_bulk_ctrl_endpoint = 0x01,
267 281
268#ifdef CONFIG_DVB_USB_DIBUSB_MB_FAULTY 282#ifdef CONFIG_DVB_USB_DIBUSB_MB_FAULTY
269 .num_device_descs = 2, 283 .num_device_descs = 2,
@@ -285,34 +299,27 @@ static struct dvb_usb_properties dibusb1_1_an2235_properties = {
285 } 299 }
286}; 300};
287 301
288static struct dvb_usb_properties dibusb2_0b_properties = { 302static struct dvb_usb_device_properties dibusb2_0b_properties = {
289 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, 303 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
290 .pid_filter_count = 16,
291 304
292 .usb_ctrl = CYPRESS_FX2, 305 .usb_ctrl = CYPRESS_FX2,
293 306
294 .firmware = "dvb-usb-adstech-usb2-02.fw", 307 .firmware = "dvb-usb-adstech-usb2-02.fw",
295 308
296 .size_of_priv = sizeof(struct dibusb_state), 309 .num_adapters = 1,
310 .adapter = {
311 {
312 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
313 .pid_filter_count = 16,
297 314
298 .streaming_ctrl = dibusb2_0_streaming_ctrl, 315 .streaming_ctrl = dibusb2_0_streaming_ctrl,
299 .pid_filter = dibusb_pid_filter, 316 .pid_filter = dibusb_pid_filter,
300 .pid_filter_ctrl = dibusb_pid_filter_ctrl, 317 .pid_filter_ctrl = dibusb_pid_filter_ctrl,
301 .power_ctrl = dibusb2_0_power_ctrl,
302 .frontend_attach = dibusb_dib3000mb_frontend_attach, 318 .frontend_attach = dibusb_dib3000mb_frontend_attach,
303 .tuner_attach = dibusb_thomson_tuner_attach, 319 .tuner_attach = dibusb_thomson_tuner_attach,
304
305 .rc_interval = DEFAULT_RC_INTERVAL,
306 .rc_key_map = dibusb_rc_keys,
307 .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
308 .rc_query = dibusb_rc_query,
309
310 .i2c_algo = &dibusb_i2c_algo,
311
312 .generic_bulk_ctrl_endpoint = 0x01,
313 /* parameter for the MPEG2-data transfer */ 320 /* parameter for the MPEG2-data transfer */
314 .urb = { 321 .stream = {
315 .type = DVB_USB_BULK, 322 .type = USB_BULK,
316 .count = 7, 323 .count = 7,
317 .endpoint = 0x06, 324 .endpoint = 0x06,
318 .u = { 325 .u = {
@@ -321,6 +328,19 @@ static struct dvb_usb_properties dibusb2_0b_properties = {
321 } 328 }
322 } 329 }
323 }, 330 },
331 .size_of_priv = sizeof(struct dibusb_state),
332 }
333 },
334 .power_ctrl = dibusb2_0_power_ctrl,
335
336 .rc_interval = DEFAULT_RC_INTERVAL,
337 .rc_key_map = dibusb_rc_keys,
338 .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
339 .rc_query = dibusb_rc_query,
340
341 .i2c_algo = &dibusb_i2c_algo,
342
343 .generic_bulk_ctrl_endpoint = 0x01,
324 344
325 .num_device_descs = 2, 345 .num_device_descs = 2,
326 .devices = { 346 .devices = {
@@ -336,34 +356,27 @@ static struct dvb_usb_properties dibusb2_0b_properties = {
336 } 356 }
337}; 357};
338 358
339static struct dvb_usb_properties artec_t1_usb2_properties = { 359static struct dvb_usb_device_properties artec_t1_usb2_properties = {
340 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, 360 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
341 .pid_filter_count = 16,
342 361
343 .usb_ctrl = CYPRESS_FX2, 362 .usb_ctrl = CYPRESS_FX2,
344 363
345 .firmware = "dvb-usb-dibusb-6.0.0.8.fw", 364 .firmware = "dvb-usb-dibusb-6.0.0.8.fw",
346 365
347 .size_of_priv = sizeof(struct dibusb_state), 366 .num_adapters = 1,
367 .adapter = {
368 {
369 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
370 .pid_filter_count = 16,
348 371
349 .streaming_ctrl = dibusb2_0_streaming_ctrl, 372 .streaming_ctrl = dibusb2_0_streaming_ctrl,
350 .pid_filter = dibusb_pid_filter, 373 .pid_filter = dibusb_pid_filter,
351 .pid_filter_ctrl = dibusb_pid_filter_ctrl, 374 .pid_filter_ctrl = dibusb_pid_filter_ctrl,
352 .power_ctrl = dibusb2_0_power_ctrl,
353 .frontend_attach = dibusb_dib3000mb_frontend_attach, 375 .frontend_attach = dibusb_dib3000mb_frontend_attach,
354 .tuner_attach = dibusb_tuner_probe_and_attach, 376 .tuner_attach = dibusb_tuner_probe_and_attach,
355
356 .rc_interval = DEFAULT_RC_INTERVAL,
357 .rc_key_map = dibusb_rc_keys,
358 .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
359 .rc_query = dibusb_rc_query,
360
361 .i2c_algo = &dibusb_i2c_algo,
362
363 .generic_bulk_ctrl_endpoint = 0x01,
364 /* parameter for the MPEG2-data transfer */ 377 /* parameter for the MPEG2-data transfer */
365 .urb = { 378 .stream = {
366 .type = DVB_USB_BULK, 379 .type = USB_BULK,
367 .count = 7, 380 .count = 7,
368 .endpoint = 0x06, 381 .endpoint = 0x06,
369 .u = { 382 .u = {
@@ -372,6 +385,19 @@ static struct dvb_usb_properties artec_t1_usb2_properties = {
372 } 385 }
373 } 386 }
374 }, 387 },
388 .size_of_priv = sizeof(struct dibusb_state),
389 }
390 },
391 .power_ctrl = dibusb2_0_power_ctrl,
392
393 .rc_interval = DEFAULT_RC_INTERVAL,
394 .rc_key_map = dibusb_rc_keys,
395 .rc_key_map_size = 111, /* wow, that is ugly ... I want to load it to the driver dynamically */
396 .rc_query = dibusb_rc_query,
397
398 .i2c_algo = &dibusb_i2c_algo,
399
400 .generic_bulk_ctrl_endpoint = 0x01,
375 401
376 .num_device_descs = 1, 402 .num_device_descs = 1,
377 .devices = { 403 .devices = {
diff --git a/drivers/media/dvb/dvb-usb/dibusb-mc.c b/drivers/media/dvb/dvb-usb/dibusb-mc.c
index eca4082a61ae..a0fd37efc04b 100644
--- a/drivers/media/dvb/dvb-usb/dibusb-mc.c
+++ b/drivers/media/dvb/dvb-usb/dibusb-mc.c
@@ -15,7 +15,7 @@
15#include "dibusb.h" 15#include "dibusb.h"
16 16
17/* USB Driver stuff */ 17/* USB Driver stuff */
18static struct dvb_usb_properties dibusb_mc_properties; 18static struct dvb_usb_device_properties dibusb_mc_properties;
19 19
20static int dibusb_mc_probe(struct usb_interface *intf, 20static int dibusb_mc_probe(struct usb_interface *intf,
21 const struct usb_device_id *id) 21 const struct usb_device_id *id)
@@ -43,33 +43,26 @@ static struct usb_device_id dibusb_dib3000mc_table [] = {
43}; 43};
44MODULE_DEVICE_TABLE (usb, dibusb_dib3000mc_table); 44MODULE_DEVICE_TABLE (usb, dibusb_dib3000mc_table);
45 45
46static struct dvb_usb_properties dibusb_mc_properties = { 46static struct dvb_usb_device_properties dibusb_mc_properties = {
47 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, 47 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
48 .pid_filter_count = 32,
49 48
50 .usb_ctrl = CYPRESS_FX2, 49 .usb_ctrl = CYPRESS_FX2,
51 .firmware = "dvb-usb-dibusb-6.0.0.8.fw", 50 .firmware = "dvb-usb-dibusb-6.0.0.8.fw",
52 51
53 .size_of_priv = sizeof(struct dibusb_state), 52 .num_adapters = 1,
54 53 .adapter = {
54 {
55 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
56 .pid_filter_count = 32,
55 .streaming_ctrl = dibusb2_0_streaming_ctrl, 57 .streaming_ctrl = dibusb2_0_streaming_ctrl,
56 .pid_filter = dibusb_pid_filter, 58 .pid_filter = dibusb_pid_filter,
57 .pid_filter_ctrl = dibusb_pid_filter_ctrl, 59 .pid_filter_ctrl = dibusb_pid_filter_ctrl,
58 .power_ctrl = dibusb2_0_power_ctrl,
59 .frontend_attach = dibusb_dib3000mc_frontend_attach, 60 .frontend_attach = dibusb_dib3000mc_frontend_attach,
60 .tuner_attach = dibusb_dib3000mc_tuner_attach, 61 .tuner_attach = dibusb_dib3000mc_tuner_attach,
61 62
62 .rc_interval = DEFAULT_RC_INTERVAL,
63 .rc_key_map = dibusb_rc_keys,
64 .rc_key_map_size = 111, /* FIXME */
65 .rc_query = dibusb_rc_query,
66
67 .i2c_algo = &dibusb_i2c_algo,
68
69 .generic_bulk_ctrl_endpoint = 0x01,
70 /* parameter for the MPEG2-data transfer */ 63 /* parameter for the MPEG2-data transfer */
71 .urb = { 64 .stream = {
72 .type = DVB_USB_BULK, 65 .type = USB_BULK,
73 .count = 7, 66 .count = 7,
74 .endpoint = 0x06, 67 .endpoint = 0x06,
75 .u = { 68 .u = {
@@ -78,6 +71,19 @@ static struct dvb_usb_properties dibusb_mc_properties = {
78 } 71 }
79 } 72 }
80 }, 73 },
74 .size_of_priv = sizeof(struct dibusb_state),
75 }
76 },
77 .power_ctrl = dibusb2_0_power_ctrl,
78
79 .rc_interval = DEFAULT_RC_INTERVAL,
80 .rc_key_map = dibusb_rc_keys,
81 .rc_key_map_size = 111, /* FIXME */
82 .rc_query = dibusb_rc_query,
83
84 .i2c_algo = &dibusb_i2c_algo,
85
86 .generic_bulk_ctrl_endpoint = 0x01,
81 87
82 .num_device_descs = 7, 88 .num_device_descs = 7,
83 .devices = { 89 .devices = {
diff --git a/drivers/media/dvb/dvb-usb/dibusb.h b/drivers/media/dvb/dvb-usb/dibusb.h
index a43f87480cf6..5153fb943da1 100644
--- a/drivers/media/dvb/dvb-usb/dibusb.h
+++ b/drivers/media/dvb/dvb-usb/dibusb.h
@@ -107,14 +107,15 @@ struct dibusb_state {
107 107
108extern struct i2c_algorithm dibusb_i2c_algo; 108extern struct i2c_algorithm dibusb_i2c_algo;
109 109
110extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_device *); 110extern int dibusb_dib3000mc_frontend_attach(struct dvb_usb_adapter *);
111extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_device *); 111extern int dibusb_dib3000mc_tuner_attach (struct dvb_usb_adapter *);
112
113extern int dibusb_streaming_ctrl(struct dvb_usb_adapter *, int);
114extern int dibusb_pid_filter(struct dvb_usb_adapter *, int, u16, int);
115extern int dibusb_pid_filter_ctrl(struct dvb_usb_adapter *, int);
116extern int dibusb2_0_streaming_ctrl(struct dvb_usb_adapter *, int);
112 117
113extern int dibusb_streaming_ctrl(struct dvb_usb_device *, int);
114extern int dibusb_pid_filter(struct dvb_usb_device *, int, u16, int);
115extern int dibusb_pid_filter_ctrl(struct dvb_usb_device *, int);
116extern int dibusb_power_ctrl(struct dvb_usb_device *, int); 118extern int dibusb_power_ctrl(struct dvb_usb_device *, int);
117extern int dibusb2_0_streaming_ctrl(struct dvb_usb_device *, int);
118extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int); 119extern int dibusb2_0_power_ctrl(struct dvb_usb_device *, int);
119 120
120#define DEFAULT_RC_INTERVAL 150 121#define DEFAULT_RC_INTERVAL 150
diff --git a/drivers/media/dvb/dvb-usb/digitv.c b/drivers/media/dvb/dvb-usb/digitv.c
index 015854487308..8fb34375c1fb 100644
--- a/drivers/media/dvb/dvb-usb/digitv.c
+++ b/drivers/media/dvb/dvb-usb/digitv.c
@@ -83,7 +83,7 @@ static struct i2c_algorithm digitv_i2c_algo = {
83 83
84/* Callbacks for DVB USB */ 84/* Callbacks for DVB USB */
85static int digitv_identify_state (struct usb_device *udev, struct 85static int digitv_identify_state (struct usb_device *udev, struct
86 dvb_usb_properties *props, struct dvb_usb_device_description **desc, 86 dvb_usb_device_properties *props, struct dvb_usb_device_description **desc,
87 int *cold) 87 int *cold)
88{ 88{
89 *cold = udev->descriptor.iManufacturer == 0 && udev->descriptor.iProduct == 0; 89 *cold = udev->descriptor.iManufacturer == 0 && udev->descriptor.iProduct == 0;
@@ -116,33 +116,33 @@ static struct mt352_config digitv_mt352_config = {
116 116
117static int digitv_nxt6000_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) 117static int digitv_nxt6000_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
118{ 118{
119 struct dvb_usb_device *d = fe->dvb->priv; 119 struct dvb_usb_adapter *adap = fe->dvb->priv;
120 u8 b[5]; 120 u8 b[5];
121 dvb_usb_tuner_calc_regs(fe,fep,b, 5); 121 dvb_usb_tuner_calc_regs(fe,fep,b, 5);
122 return digitv_ctrl_msg(d,USB_WRITE_TUNER,0,&b[1],4,NULL,0); 122 return digitv_ctrl_msg(adap->dev, USB_WRITE_TUNER, 0, &b[1], 4, NULL, 0);
123} 123}
124 124
125static struct nxt6000_config digitv_nxt6000_config = { 125static struct nxt6000_config digitv_nxt6000_config = {
126 .clock_inversion = 1, 126 .clock_inversion = 1,
127}; 127};
128 128
129static int digitv_frontend_attach(struct dvb_usb_device *d) 129static int digitv_frontend_attach(struct dvb_usb_adapter *adap)
130{ 130{
131 if ((d->fe = dvb_attach(mt352_attach, &digitv_mt352_config, &d->i2c_adap)) != NULL) { 131 if ((adap->fe = dvb_attach(mt352_attach, &digitv_mt352_config, &adap->dev->i2c_adap)) != NULL) {
132 d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; 132 adap->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
133 return 0; 133 return 0;
134 } 134 }
135 if ((d->fe = dvb_attach(nxt6000_attach, &digitv_nxt6000_config, &d->i2c_adap)) != NULL) { 135 if ((adap->fe = dvb_attach(nxt6000_attach, &digitv_nxt6000_config, &adap->dev->i2c_adap)) != NULL) {
136 d->fe->ops.tuner_ops.set_params = digitv_nxt6000_tuner_set_params; 136 adap->fe->ops.tuner_ops.set_params = digitv_nxt6000_tuner_set_params;
137 return 0; 137 return 0;
138 } 138 }
139 return -EIO; 139 return -EIO;
140} 140}
141 141
142static int digitv_tuner_attach(struct dvb_usb_device *d) 142static int digitv_tuner_attach(struct dvb_usb_adapter *adap)
143{ 143{
144 d->pll_addr = 0x60; 144 adap->pll_addr = 0x60;
145 d->pll_desc = &dvb_pll_tded4; 145 adap->pll_desc = &dvb_pll_tded4;
146 return 0; 146 return 0;
147} 147}
148 148
@@ -238,7 +238,7 @@ static int digitv_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
238} 238}
239 239
240/* DVB USB Driver stuff */ 240/* DVB USB Driver stuff */
241static struct dvb_usb_properties digitv_properties; 241static struct dvb_usb_device_properties digitv_properties;
242 242
243static int digitv_probe(struct usb_interface *intf, 243static int digitv_probe(struct usb_interface *intf,
244 const struct usb_device_id *id) 244 const struct usb_device_id *id)
@@ -265,30 +265,21 @@ static struct usb_device_id digitv_table [] = {
265}; 265};
266MODULE_DEVICE_TABLE (usb, digitv_table); 266MODULE_DEVICE_TABLE (usb, digitv_table);
267 267
268static struct dvb_usb_properties digitv_properties = { 268static struct dvb_usb_device_properties digitv_properties = {
269 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 269 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
270 270
271 .usb_ctrl = CYPRESS_FX2, 271 .usb_ctrl = CYPRESS_FX2,
272 .firmware = "dvb-usb-digitv-02.fw", 272 .firmware = "dvb-usb-digitv-02.fw",
273 273
274 .size_of_priv = 0, 274 .num_adapters = 1,
275 275 .adapter = {
276 {
276 .frontend_attach = digitv_frontend_attach, 277 .frontend_attach = digitv_frontend_attach,
277 .tuner_attach = digitv_tuner_attach, 278 .tuner_attach = digitv_tuner_attach,
278 279
279 .rc_interval = 1000,
280 .rc_key_map = digitv_rc_keys,
281 .rc_key_map_size = ARRAY_SIZE(digitv_rc_keys),
282 .rc_query = digitv_rc_query,
283
284 .identify_state = digitv_identify_state,
285
286 .i2c_algo = &digitv_i2c_algo,
287
288 .generic_bulk_ctrl_endpoint = 0x01,
289 /* parameter for the MPEG2-data transfer */ 280 /* parameter for the MPEG2-data transfer */
290 .urb = { 281 .stream = {
291 .type = DVB_USB_BULK, 282 .type = USB_BULK,
292 .count = 7, 283 .count = 7,
293 .endpoint = 0x02, 284 .endpoint = 0x02,
294 .u = { 285 .u = {
@@ -297,6 +288,18 @@ static struct dvb_usb_properties digitv_properties = {
297 } 288 }
298 } 289 }
299 }, 290 },
291 }
292 },
293 .identify_state = digitv_identify_state,
294
295 .rc_interval = 1000,
296 .rc_key_map = digitv_rc_keys,
297 .rc_key_map_size = ARRAY_SIZE(digitv_rc_keys),
298 .rc_query = digitv_rc_query,
299
300 .i2c_algo = &digitv_i2c_algo,
301
302 .generic_bulk_ctrl_endpoint = 0x01,
300 303
301 .num_device_descs = 1, 304 .num_device_descs = 1,
302 .devices = { 305 .devices = {
diff --git a/drivers/media/dvb/dvb-usb/dtt200u.c b/drivers/media/dvb/dvb-usb/dtt200u.c
index 27af4e436479..fa43a41d753b 100644
--- a/drivers/media/dvb/dvb-usb/dtt200u.c
+++ b/drivers/media/dvb/dvb-usb/dtt200u.c
@@ -28,19 +28,19 @@ static int dtt200u_power_ctrl(struct dvb_usb_device *d, int onoff)
28 return 0; 28 return 0;
29} 29}
30 30
31static int dtt200u_streaming_ctrl(struct dvb_usb_device *d, int onoff) 31static int dtt200u_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
32{ 32{
33 u8 b_streaming[2] = { SET_STREAMING, onoff }; 33 u8 b_streaming[2] = { SET_STREAMING, onoff };
34 u8 b_rst_pid = RESET_PID_FILTER; 34 u8 b_rst_pid = RESET_PID_FILTER;
35 35
36 dvb_usb_generic_write(d,b_streaming,2); 36 dvb_usb_generic_write(adap->dev, b_streaming, 2);
37 37
38 if (onoff == 0) 38 if (onoff == 0)
39 dvb_usb_generic_write(d,&b_rst_pid,1); 39 dvb_usb_generic_write(adap->dev, &b_rst_pid, 1);
40 return 0; 40 return 0;
41} 41}
42 42
43static int dtt200u_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int onoff) 43static int dtt200u_pid_filter(struct dvb_usb_adapter *adap, int index, u16 pid, int onoff)
44{ 44{
45 u8 b_pid[4]; 45 u8 b_pid[4];
46 pid = onoff ? pid : 0; 46 pid = onoff ? pid : 0;
@@ -50,7 +50,7 @@ static int dtt200u_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int
50 b_pid[2] = pid & 0xff; 50 b_pid[2] = pid & 0xff;
51 b_pid[3] = (pid >> 8) & 0x1f; 51 b_pid[3] = (pid >> 8) & 0x1f;
52 52
53 return dvb_usb_generic_write(d,b_pid,4); 53 return dvb_usb_generic_write(adap->dev, b_pid, 4);
54} 54}
55 55
56/* remote control */ 56/* remote control */
@@ -86,16 +86,16 @@ static int dtt200u_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
86 return 0; 86 return 0;
87} 87}
88 88
89static int dtt200u_frontend_attach(struct dvb_usb_device *d) 89static int dtt200u_frontend_attach(struct dvb_usb_adapter *adap)
90{ 90{
91 d->fe = dtt200u_fe_attach(d); 91 adap->fe = dtt200u_fe_attach(adap->dev);
92 return 0; 92 return 0;
93} 93}
94 94
95static struct dvb_usb_properties dtt200u_properties; 95static struct dvb_usb_device_properties dtt200u_properties;
96static struct dvb_usb_properties wt220u_fc_properties; 96static struct dvb_usb_device_properties wt220u_fc_properties;
97static struct dvb_usb_properties wt220u_properties; 97static struct dvb_usb_device_properties wt220u_properties;
98static struct dvb_usb_properties wt220u_zl0353_properties; 98static struct dvb_usb_device_properties wt220u_zl0353_properties;
99 99
100static int dtt200u_usb_probe(struct usb_interface *intf, 100static int dtt200u_usb_probe(struct usb_interface *intf,
101 const struct usb_device_id *id) 101 const struct usb_device_id *id)
@@ -123,28 +123,22 @@ static struct usb_device_id dtt200u_usb_table [] = {
123}; 123};
124MODULE_DEVICE_TABLE(usb, dtt200u_usb_table); 124MODULE_DEVICE_TABLE(usb, dtt200u_usb_table);
125 125
126static struct dvb_usb_properties dtt200u_properties = { 126static struct dvb_usb_device_properties dtt200u_properties = {
127 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING,
128 .pid_filter_count = 15,
129
130 .usb_ctrl = CYPRESS_FX2, 127 .usb_ctrl = CYPRESS_FX2,
131 .firmware = "dvb-usb-dtt200u-01.fw", 128 .firmware = "dvb-usb-dtt200u-01.fw",
132 129
133 .power_ctrl = dtt200u_power_ctrl, 130 .num_adapters = 1,
131 .adapter = {
132 {
133 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_NEED_PID_FILTERING,
134 .pid_filter_count = 15,
135
134 .streaming_ctrl = dtt200u_streaming_ctrl, 136 .streaming_ctrl = dtt200u_streaming_ctrl,
135 .pid_filter = dtt200u_pid_filter, 137 .pid_filter = dtt200u_pid_filter,
136 .frontend_attach = dtt200u_frontend_attach, 138 .frontend_attach = dtt200u_frontend_attach,
137
138 .rc_interval = 300,
139 .rc_key_map = dtt200u_rc_keys,
140 .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
141 .rc_query = dtt200u_rc_query,
142
143 .generic_bulk_ctrl_endpoint = 0x01,
144
145 /* parameter for the MPEG2-data transfer */ 139 /* parameter for the MPEG2-data transfer */
146 .urb = { 140 .stream = {
147 .type = DVB_USB_BULK, 141 .type = USB_BULK,
148 .count = 7, 142 .count = 7,
149 .endpoint = 0x02, 143 .endpoint = 0x02,
150 .u = { 144 .u = {
@@ -153,6 +147,16 @@ static struct dvb_usb_properties dtt200u_properties = {
153 } 147 }
154 } 148 }
155 }, 149 },
150 }
151 },
152 .power_ctrl = dtt200u_power_ctrl,
153
154 .rc_interval = 300,
155 .rc_key_map = dtt200u_rc_keys,
156 .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
157 .rc_query = dtt200u_rc_query,
158
159 .generic_bulk_ctrl_endpoint = 0x01,
156 160
157 .num_device_descs = 1, 161 .num_device_descs = 1,
158 .devices = { 162 .devices = {
@@ -164,28 +168,22 @@ static struct dvb_usb_properties dtt200u_properties = {
164 } 168 }
165}; 169};
166 170
167static struct dvb_usb_properties wt220u_properties = { 171static struct dvb_usb_device_properties wt220u_properties = {
168 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING,
169 .pid_filter_count = 15,
170
171 .usb_ctrl = CYPRESS_FX2, 172 .usb_ctrl = CYPRESS_FX2,
172 .firmware = "dvb-usb-wt220u-02.fw", 173 .firmware = "dvb-usb-wt220u-02.fw",
173 174
174 .power_ctrl = dtt200u_power_ctrl, 175 .num_adapters = 1,
176 .adapter = {
177 {
178 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_NEED_PID_FILTERING,
179 .pid_filter_count = 15,
180
175 .streaming_ctrl = dtt200u_streaming_ctrl, 181 .streaming_ctrl = dtt200u_streaming_ctrl,
176 .pid_filter = dtt200u_pid_filter, 182 .pid_filter = dtt200u_pid_filter,
177 .frontend_attach = dtt200u_frontend_attach, 183 .frontend_attach = dtt200u_frontend_attach,
178
179 .rc_interval = 300,
180 .rc_key_map = dtt200u_rc_keys,
181 .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
182 .rc_query = dtt200u_rc_query,
183
184 .generic_bulk_ctrl_endpoint = 0x01,
185
186 /* parameter for the MPEG2-data transfer */ 184 /* parameter for the MPEG2-data transfer */
187 .urb = { 185 .stream = {
188 .type = DVB_USB_BULK, 186 .type = USB_BULK,
189 .count = 7, 187 .count = 7,
190 .endpoint = 0x02, 188 .endpoint = 0x02,
191 .u = { 189 .u = {
@@ -194,6 +192,16 @@ static struct dvb_usb_properties wt220u_properties = {
194 } 192 }
195 } 193 }
196 }, 194 },
195 }
196 },
197 .power_ctrl = dtt200u_power_ctrl,
198
199 .rc_interval = 300,
200 .rc_key_map = dtt200u_rc_keys,
201 .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
202 .rc_query = dtt200u_rc_query,
203
204 .generic_bulk_ctrl_endpoint = 0x01,
197 205
198 .num_device_descs = 1, 206 .num_device_descs = 1,
199 .devices = { 207 .devices = {
@@ -205,36 +213,40 @@ static struct dvb_usb_properties wt220u_properties = {
205 } 213 }
206}; 214};
207 215
208static struct dvb_usb_properties wt220u_fc_properties = { 216static struct dvb_usb_device_properties wt220u_fc_properties = {
209 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING,
210 .pid_filter_count = 15,
211
212 .usb_ctrl = CYPRESS_FX2, 217 .usb_ctrl = CYPRESS_FX2,
213 .firmware = "dvb-usb-wt220u-fc03.fw", 218 .firmware = "dvb-usb-wt220u-fc03.fw",
214 219
215 .power_ctrl = dtt200u_power_ctrl, 220 .num_adapters = 1,
221 .adapter = {
222 {
223 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_NEED_PID_FILTERING,
224 .pid_filter_count = 15,
225
216 .streaming_ctrl = dtt200u_streaming_ctrl, 226 .streaming_ctrl = dtt200u_streaming_ctrl,
217 .pid_filter = dtt200u_pid_filter, 227 .pid_filter = dtt200u_pid_filter,
218 .frontend_attach = dtt200u_frontend_attach, 228 .frontend_attach = dtt200u_frontend_attach,
219
220 .rc_interval = 300,
221 .rc_key_map = dtt200u_rc_keys,
222 .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
223 .rc_query = dtt200u_rc_query,
224
225 .generic_bulk_ctrl_endpoint = 0x01,
226
227 /* parameter for the MPEG2-data transfer */ 229 /* parameter for the MPEG2-data transfer */
228 .urb = { 230 .stream = {
229 .type = DVB_USB_BULK, 231 .type = USB_BULK,
230 .count = 7, 232 .count = 7,
231 .endpoint = 0x86, 233 .endpoint = 0x06,
232 .u = { 234 .u = {
233 .bulk = { 235 .bulk = {
234 .buffersize = 4096, 236 .buffersize = 4096,
235 } 237 }
236 } 238 }
237 }, 239 },
240 }
241 },
242 .power_ctrl = dtt200u_power_ctrl,
243
244 .rc_interval = 300,
245 .rc_key_map = dtt200u_rc_keys,
246 .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
247 .rc_query = dtt200u_rc_query,
248
249 .generic_bulk_ctrl_endpoint = 0x01,
238 250
239 .num_device_descs = 1, 251 .num_device_descs = 1,
240 .devices = { 252 .devices = {
@@ -246,28 +258,22 @@ static struct dvb_usb_properties wt220u_fc_properties = {
246 } 258 }
247}; 259};
248 260
249static struct dvb_usb_properties wt220u_zl0353_properties = { 261static struct dvb_usb_device_properties wt220u_zl0353_properties = {
250 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING,
251 .pid_filter_count = 15,
252
253 .usb_ctrl = CYPRESS_FX2, 262 .usb_ctrl = CYPRESS_FX2,
254 .firmware = "dvb-usb-wt220u-zl0353-01.fw", 263 .firmware = "dvb-usb-wt220u-zl0353-01.fw",
255 264
256 .power_ctrl = dtt200u_power_ctrl, 265 .num_adapters = 1,
266 .adapter = {
267 {
268 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_NEED_PID_FILTERING,
269 .pid_filter_count = 15,
270
257 .streaming_ctrl = dtt200u_streaming_ctrl, 271 .streaming_ctrl = dtt200u_streaming_ctrl,
258 .pid_filter = dtt200u_pid_filter, 272 .pid_filter = dtt200u_pid_filter,
259 .frontend_attach = dtt200u_frontend_attach, 273 .frontend_attach = dtt200u_frontend_attach,
260
261 .rc_interval = 300,
262 .rc_key_map = dtt200u_rc_keys,
263 .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
264 .rc_query = dtt200u_rc_query,
265
266 .generic_bulk_ctrl_endpoint = 0x01,
267
268 /* parameter for the MPEG2-data transfer */ 274 /* parameter for the MPEG2-data transfer */
269 .urb = { 275 .stream = {
270 .type = DVB_USB_BULK, 276 .type = USB_BULK,
271 .count = 7, 277 .count = 7,
272 .endpoint = 0x02, 278 .endpoint = 0x02,
273 .u = { 279 .u = {
@@ -276,6 +282,16 @@ static struct dvb_usb_properties wt220u_zl0353_properties = {
276 } 282 }
277 } 283 }
278 }, 284 },
285 }
286 },
287 .power_ctrl = dtt200u_power_ctrl,
288
289 .rc_interval = 300,
290 .rc_key_map = dtt200u_rc_keys,
291 .rc_key_map_size = ARRAY_SIZE(dtt200u_rc_keys),
292 .rc_query = dtt200u_rc_query,
293
294 .generic_bulk_ctrl_endpoint = 0x01,
279 295
280 .num_device_descs = 1, 296 .num_device_descs = 1,
281 .devices = { 297 .devices = {
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-common.h b/drivers/media/dvb/dvb-usb/dvb-usb-common.h
index a3460bf2d9fa..35ab68f6dcf6 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-common.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-common.h
@@ -14,31 +14,36 @@
14extern int dvb_usb_debug; 14extern int dvb_usb_debug;
15extern int dvb_usb_disable_rc_polling; 15extern int dvb_usb_disable_rc_polling;
16 16
17#define deb_info(args...) dprintk(dvb_usb_debug,0x01,args) 17#define deb_info(args...) dprintk(dvb_usb_debug,0x001,args)
18#define deb_xfer(args...) dprintk(dvb_usb_debug,0x02,args) 18#define deb_xfer(args...) dprintk(dvb_usb_debug,0x002,args)
19#define deb_pll(args...) dprintk(dvb_usb_debug,0x04,args) 19#define deb_pll(args...) dprintk(dvb_usb_debug,0x004,args)
20#define deb_ts(args...) dprintk(dvb_usb_debug,0x08,args) 20#define deb_ts(args...) dprintk(dvb_usb_debug,0x008,args)
21#define deb_err(args...) dprintk(dvb_usb_debug,0x10,args) 21#define deb_err(args...) dprintk(dvb_usb_debug,0x010,args)
22#define deb_rc(args...) dprintk(dvb_usb_debug,0x20,args) 22#define deb_rc(args...) dprintk(dvb_usb_debug,0x020,args)
23#define deb_fw(args...) dprintk(dvb_usb_debug,0x40,args) 23#define deb_fw(args...) dprintk(dvb_usb_debug,0x040,args)
24#define deb_mem(args...) dprintk(dvb_usb_debug,0x80,args) 24#define deb_mem(args...) dprintk(dvb_usb_debug,0x080,args)
25#define deb_uxfer(args...) dprintk(dvb_usb_debug,0x100,args)
25 26
26/* commonly used methods */ 27/* commonly used methods */
27extern int dvb_usb_download_firmware(struct usb_device *, struct dvb_usb_properties *); 28extern int dvb_usb_download_firmware(struct usb_device *, struct dvb_usb_device_properties *);
28 29
29extern int dvb_usb_urb_submit(struct dvb_usb_device *); 30extern int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff);
30extern int dvb_usb_urb_kill(struct dvb_usb_device *); 31
31extern int dvb_usb_urb_init(struct dvb_usb_device *); 32extern int usb_urb_init(struct usb_data_stream *stream, struct usb_data_stream_properties *props);
32extern int dvb_usb_urb_exit(struct dvb_usb_device *); 33extern int usb_urb_exit(struct usb_data_stream *stream);
34extern int usb_urb_submit(struct usb_data_stream *stream);
35extern int usb_urb_kill(struct usb_data_stream *stream);
36
37extern int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap);
38extern int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap);
33 39
34extern int dvb_usb_i2c_init(struct dvb_usb_device *); 40extern int dvb_usb_i2c_init(struct dvb_usb_device *);
35extern int dvb_usb_i2c_exit(struct dvb_usb_device *); 41extern int dvb_usb_i2c_exit(struct dvb_usb_device *);
36 42
37extern int dvb_usb_dvb_init(struct dvb_usb_device *); 43extern int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap);
38extern int dvb_usb_dvb_exit(struct dvb_usb_device *); 44extern int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap);
39 45extern int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap);
40extern int dvb_usb_fe_init(struct dvb_usb_device *); 46extern int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap);
41extern int dvb_usb_fe_exit(struct dvb_usb_device *);
42 47
43extern int dvb_usb_remote_init(struct dvb_usb_device *); 48extern int dvb_usb_remote_init(struct dvb_usb_device *);
44extern int dvb_usb_remote_exit(struct dvb_usb_device *); 49extern int dvb_usb_remote_exit(struct dvb_usb_device *);
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
index fe6208ada903..4561a672da92 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-dvb.c
@@ -1,6 +1,6 @@
1/* dvb-usb-dvb.c is part of the DVB USB library. 1/* dvb-usb-dvb.c is part of the DVB USB library.
2 * 2 *
3 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) 3 * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de)
4 * see dvb-usb-init.c for copyright information. 4 * see dvb-usb-init.c for copyright information.
5 * 5 *
6 * This file contains functions for initializing and handling the 6 * This file contains functions for initializing and handling the
@@ -8,55 +8,55 @@
8 */ 8 */
9#include "dvb-usb-common.h" 9#include "dvb-usb-common.h"
10 10
11/* does the complete input transfer handling */
11static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff) 12static int dvb_usb_ctrl_feed(struct dvb_demux_feed *dvbdmxfeed, int onoff)
12{ 13{
13 struct dvb_usb_device *d = dvbdmxfeed->demux->priv; 14 struct dvb_usb_adapter *adap = dvbdmxfeed->demux->priv;
14 int newfeedcount,ret; 15 int newfeedcount,ret;
15 16
16 if (d == NULL) 17 if (adap == NULL)
17 return -ENODEV; 18 return -ENODEV;
18 19
19 newfeedcount = d->feedcount + (onoff ? 1 : -1); 20 newfeedcount = adap->feedcount + (onoff ? 1 : -1);
20 21
21 /* 22 /* stop feed before setting a new pid if there will be no pid anymore */
22 * stop feed before setting a new pid if there will be no pid anymore
23 */
24 if (newfeedcount == 0) { 23 if (newfeedcount == 0) {
25 deb_ts("stop feeding\n"); 24 deb_ts("stop feeding\n");
26 dvb_usb_urb_kill(d); 25 usb_urb_kill(&adap->stream);
27 26
28 if (d->props.streaming_ctrl != NULL) 27 if (adap->props.streaming_ctrl != NULL)
29 if ((ret = d->props.streaming_ctrl(d,0))) 28 if ((ret = adap->props.streaming_ctrl(adap,0)))
30 err("error while stopping stream."); 29 err("error while stopping stream.");
31
32 } 30 }
33 31
34 d->feedcount = newfeedcount; 32 adap->feedcount = newfeedcount;
35 33
36 /* activate the pid on the device specific pid_filter */ 34 /* activate the pid on the device specific pid_filter */
37 deb_ts("setting pid: %5d %04x at index %d '%s'\n",dvbdmxfeed->pid,dvbdmxfeed->pid,dvbdmxfeed->index,onoff ? "on" : "off"); 35 deb_ts("setting pid (%s): %5d %04x at index %d '%s'\n",adap->pid_filtering ?
38 if (d->props.caps & DVB_USB_HAS_PID_FILTER && 36 "yes" : "no", dvbdmxfeed->pid,dvbdmxfeed->pid,dvbdmxfeed->index,onoff ?
39 d->pid_filtering && 37 "on" : "off");
40 d->props.pid_filter != NULL) 38 if (adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER &&
41 d->props.pid_filter(d,dvbdmxfeed->index,dvbdmxfeed->pid,onoff); 39 adap->pid_filtering &&
40 adap->props.pid_filter != NULL)
41 adap->props.pid_filter(adap, dvbdmxfeed->index, dvbdmxfeed->pid,onoff);
42 42
43 /* start the feed if this was the first feed and there is still a feed 43 /* start the feed if this was the first feed and there is still a feed
44 * for reception. 44 * for reception.
45 */ 45 */
46 if (d->feedcount == onoff && d->feedcount > 0) { 46 if (adap->feedcount == onoff && adap->feedcount > 0) {
47 deb_ts("submitting all URBs\n"); 47 deb_ts("submitting all URBs\n");
48 dvb_usb_urb_submit(d); 48 usb_urb_submit(&adap->stream);
49 49
50 deb_ts("controlling pid parser\n"); 50 deb_ts("controlling pid parser\n");
51 if (d->props.caps & DVB_USB_HAS_PID_FILTER && 51 if (adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER &&
52 d->props.caps & DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF && 52 adap->props.caps & DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF &&
53 d->props.pid_filter_ctrl != NULL) 53 adap->props.pid_filter_ctrl != NULL)
54 if (d->props.pid_filter_ctrl(d,d->pid_filtering) < 0) 54 if (adap->props.pid_filter_ctrl(adap,adap->pid_filtering) < 0)
55 err("could not handle pid_parser"); 55 err("could not handle pid_parser");
56 56
57 deb_ts("start feeding\n"); 57 deb_ts("start feeding\n");
58 if (d->props.streaming_ctrl != NULL) 58 if (adap->props.streaming_ctrl != NULL)
59 if (d->props.streaming_ctrl(d,1)) { 59 if (adap->props.streaming_ctrl(adap,1)) {
60 err("error while enabling fifo."); 60 err("error while enabling fifo.");
61 return -ENODEV; 61 return -ENODEV;
62 } 62 }
@@ -77,134 +77,130 @@ static int dvb_usb_stop_feed(struct dvb_demux_feed *dvbdmxfeed)
77 return dvb_usb_ctrl_feed(dvbdmxfeed,0); 77 return dvb_usb_ctrl_feed(dvbdmxfeed,0);
78} 78}
79 79
80int dvb_usb_dvb_init(struct dvb_usb_device *d) 80int dvb_usb_adapter_dvb_init(struct dvb_usb_adapter *adap)
81{ 81{
82 int ret; 82 int ret;
83 83
84 if ((ret = dvb_register_adapter(&d->dvb_adap, d->desc->name, 84 if ((ret = dvb_register_adapter(&adap->dvb_adap, adap->dev->desc->name,
85 d->owner, &d->udev->dev)) < 0) { 85 adap->dev->owner, &adap->dev->udev->dev)) < 0) {
86 deb_info("dvb_register_adapter failed: error %d", ret); 86 deb_info("dvb_register_adapter failed: error %d", ret);
87 goto err; 87 goto err;
88 } 88 }
89 d->dvb_adap.priv = d; 89 adap->dvb_adap.priv = adap;
90 90
91 if (d->props.read_mac_address) { 91 if (adap->dev->props.read_mac_address) {
92 if (d->props.read_mac_address(d,d->dvb_adap.proposed_mac) == 0) 92 if (adap->dev->props.read_mac_address(adap->dev,adap->dvb_adap.proposed_mac) == 0)
93 info("MAC address: %02x:%02x:%02x:%02x:%02x:%02x",d->dvb_adap.proposed_mac[0], 93 info("MAC address: %02x:%02x:%02x:%02x:%02x:%02x",adap->dvb_adap.proposed_mac[0],
94 d->dvb_adap.proposed_mac[1],d->dvb_adap.proposed_mac[2], 94 adap->dvb_adap.proposed_mac[1], adap->dvb_adap.proposed_mac[2],
95 d->dvb_adap.proposed_mac[3],d->dvb_adap.proposed_mac[4], 95 adap->dvb_adap.proposed_mac[3], adap->dvb_adap.proposed_mac[4],
96 d->dvb_adap.proposed_mac[5]); 96 adap->dvb_adap.proposed_mac[5]);
97 else 97 else
98 err("MAC address reading failed."); 98 err("MAC address reading failed.");
99 } 99 }
100 100
101 101
102 d->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING; 102 adap->demux.dmx.capabilities = DMX_TS_FILTERING | DMX_SECTION_FILTERING;
103 d->demux.priv = d; 103 adap->demux.priv = adap;
104 104
105 d->demux.feednum = d->demux.filternum = d->max_feed_count; 105 adap->demux.feednum = adap->demux.filternum = adap->max_feed_count;
106 d->demux.start_feed = dvb_usb_start_feed; 106 adap->demux.start_feed = dvb_usb_start_feed;
107 d->demux.stop_feed = dvb_usb_stop_feed; 107 adap->demux.stop_feed = dvb_usb_stop_feed;
108 d->demux.write_to_decoder = NULL; 108 adap->demux.write_to_decoder = NULL;
109 if ((ret = dvb_dmx_init(&d->demux)) < 0) { 109 if ((ret = dvb_dmx_init(&adap->demux)) < 0) {
110 err("dvb_dmx_init failed: error %d",ret); 110 err("dvb_dmx_init failed: error %d",ret);
111 goto err_dmx; 111 goto err_dmx;
112 } 112 }
113 113
114 d->dmxdev.filternum = d->demux.filternum; 114 adap->dmxdev.filternum = adap->demux.filternum;
115 d->dmxdev.demux = &d->demux.dmx; 115 adap->dmxdev.demux = &adap->demux.dmx;
116 d->dmxdev.capabilities = 0; 116 adap->dmxdev.capabilities = 0;
117 if ((ret = dvb_dmxdev_init(&d->dmxdev, &d->dvb_adap)) < 0) { 117 if ((ret = dvb_dmxdev_init(&adap->dmxdev, &adap->dvb_adap)) < 0) {
118 err("dvb_dmxdev_init failed: error %d",ret); 118 err("dvb_dmxdev_init failed: error %d",ret);
119 goto err_dmx_dev; 119 goto err_dmx_dev;
120 } 120 }
121 121
122 dvb_net_init(&d->dvb_adap, &d->dvb_net, &d->demux.dmx); 122 dvb_net_init(&adap->dvb_adap, &adap->dvb_net, &adap->demux.dmx);
123 123
124 d->state |= DVB_USB_STATE_DVB; 124 adap->state |= DVB_USB_ADAP_STATE_DVB;
125 return 0; 125 return 0;
126 126
127err_dmx_dev: 127err_dmx_dev:
128 dvb_dmx_release(&d->demux); 128 dvb_dmx_release(&adap->demux);
129err_dmx: 129err_dmx:
130 dvb_unregister_adapter(&d->dvb_adap); 130 dvb_unregister_adapter(&adap->dvb_adap);
131err: 131err:
132 return ret; 132 return ret;
133} 133}
134 134
135int dvb_usb_dvb_exit(struct dvb_usb_device *d) 135int dvb_usb_adapter_dvb_exit(struct dvb_usb_adapter *adap)
136{ 136{
137 if (d->state & DVB_USB_STATE_DVB) { 137 if (adap->state & DVB_USB_ADAP_STATE_DVB) {
138 deb_info("unregistering DVB part\n"); 138 deb_info("unregistering DVB part\n");
139 dvb_net_release(&d->dvb_net); 139 dvb_net_release(&adap->dvb_net);
140 d->demux.dmx.close(&d->demux.dmx); 140 adap->demux.dmx.close(&adap->demux.dmx);
141 dvb_dmxdev_release(&d->dmxdev); 141 dvb_dmxdev_release(&adap->dmxdev);
142 dvb_dmx_release(&d->demux); 142 dvb_dmx_release(&adap->demux);
143 dvb_unregister_adapter(&d->dvb_adap); 143 dvb_unregister_adapter(&adap->dvb_adap);
144 d->state &= ~DVB_USB_STATE_DVB; 144 adap->state &= ~DVB_USB_ADAP_STATE_DVB;
145 } 145 }
146 return 0; 146 return 0;
147} 147}
148 148
149static int dvb_usb_fe_wakeup(struct dvb_frontend *fe) 149static int dvb_usb_fe_wakeup(struct dvb_frontend *fe)
150{ 150{
151 struct dvb_usb_device *d = fe->dvb->priv; 151 struct dvb_usb_adapter *adap = fe->dvb->priv;
152 152
153 if (d->props.power_ctrl) 153 dvb_usb_device_power_ctrl(adap->dev, 1);
154 d->props.power_ctrl(d,1);
155 154
156 if (d->fe_init) 155 if (adap->fe_init)
157 d->fe_init(fe); 156 adap->fe_init(fe);
158 157
159 return 0; 158 return 0;
160} 159}
161 160
162static int dvb_usb_fe_sleep(struct dvb_frontend *fe) 161static int dvb_usb_fe_sleep(struct dvb_frontend *fe)
163{ 162{
164 struct dvb_usb_device *d = fe->dvb->priv; 163 struct dvb_usb_adapter *adap = fe->dvb->priv;
165 164
166 if (d->fe_sleep) 165 if (adap->fe_sleep)
167 d->fe_sleep(fe); 166 adap->fe_sleep(fe);
168 167
169 if (d->props.power_ctrl) 168 return dvb_usb_device_power_ctrl(adap->dev, 0);
170 d->props.power_ctrl(d,0);
171
172 return 0;
173} 169}
174 170
175int dvb_usb_fe_init(struct dvb_usb_device* d) 171int dvb_usb_adapter_frontend_init(struct dvb_usb_adapter *adap)
176{ 172{
177 if (d->props.frontend_attach == NULL) { 173 if (adap->props.frontend_attach == NULL) {
178 err("strange: '%s' doesn't want to attach a frontend.",d->desc->name); 174 err("strange: '%s' #%d doesn't want to attach a frontend.",adap->dev->desc->name, adap->id);
179 return 0; 175 return 0;
180 } 176 }
181 177
182 /* re-assign sleep and wakeup functions */ 178 /* re-assign sleep and wakeup functions */
183 if (d->props.frontend_attach(d) == 0 && d->fe != NULL) { 179 if (adap->props.frontend_attach(adap) == 0 && adap->fe != NULL) {
184 d->fe_init = d->fe->ops.init; d->fe->ops.init = dvb_usb_fe_wakeup; 180 adap->fe_init = adap->fe->ops.init; adap->fe->ops.init = dvb_usb_fe_wakeup;
185 d->fe_sleep = d->fe->ops.sleep; d->fe->ops.sleep = dvb_usb_fe_sleep; 181 adap->fe_sleep = adap->fe->ops.sleep; adap->fe->ops.sleep = dvb_usb_fe_sleep;
186 182
187 if (dvb_register_frontend(&d->dvb_adap, d->fe)) { 183 if (dvb_register_frontend(&adap->dvb_adap, adap->fe)) {
188 err("Frontend registration failed."); 184 err("Frontend registration failed.");
189 dvb_frontend_detach(d->fe); 185 dvb_frontend_detach(adap->fe);
190 d->fe = NULL; 186 adap->fe = NULL;
191 return -ENODEV; 187 return -ENODEV;
192 } 188 }
193 189
194 /* only attach the tuner if the demod is there */ 190 /* only attach the tuner if the demod is there */
195 if (d->props.tuner_attach != NULL) 191 if (adap->props.tuner_attach != NULL)
196 d->props.tuner_attach(d); 192 adap->props.tuner_attach(adap);
197 } else 193 } else
198 err("no frontend was attached by '%s'",d->desc->name); 194 err("no frontend was attached by '%s'",adap->dev->desc->name);
199 195
200 return 0; 196 return 0;
201} 197}
202 198
203int dvb_usb_fe_exit(struct dvb_usb_device *d) 199int dvb_usb_adapter_frontend_exit(struct dvb_usb_adapter *adap)
204{ 200{
205 if (d->fe != NULL) { 201 if (adap->fe != NULL) {
206 dvb_unregister_frontend(d->fe); 202 dvb_unregister_frontend(adap->fe);
207 dvb_frontend_detach(d->fe); 203 dvb_frontend_detach(adap->fe);
208 } 204 }
209 return 0; 205 return 0;
210} 206}
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
index 9222b0a81f74..e1112e39fb63 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-firmware.c
@@ -1,6 +1,6 @@
1/* dvb-usb-firmware.c is part of the DVB USB library. 1/* dvb-usb-firmware.c is part of the DVB USB library.
2 * 2 *
3 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) 3 * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de)
4 * see dvb-usb-init.c for copyright information. 4 * see dvb-usb-init.c for copyright information.
5 * 5 *
6 * This file contains functions for downloading the firmware to Cypress FX 1 and 2 based devices. 6 * This file contains functions for downloading the firmware to Cypress FX 1 and 2 based devices.
@@ -24,9 +24,6 @@ static struct usb_cypress_controller cypress[] = {
24 { .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 }, 24 { .id = CYPRESS_FX2, .name = "Cypress FX2", .cpu_cs_register = 0xe600 },
25}; 25};
26 26
27static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx,
28 int *pos);
29
30/* 27/*
31 * load a firmware packet to the device 28 * load a firmware packet to the device
32 */ 29 */
@@ -78,7 +75,7 @@ int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw
78} 75}
79EXPORT_SYMBOL(usb_cypress_load_firmware); 76EXPORT_SYMBOL(usb_cypress_load_firmware);
80 77
81int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties *props) 78int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_device_properties *props)
82{ 79{
83 int ret; 80 int ret;
84 const struct firmware *fw = NULL; 81 const struct firmware *fw = NULL;
@@ -115,7 +112,7 @@ int dvb_usb_download_firmware(struct usb_device *udev, struct dvb_usb_properties
115 return ret; 112 return ret;
116} 113}
117 114
118static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, 115int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx,
119 int *pos) 116 int *pos)
120{ 117{
121 u8 *b = (u8 *) &fw->data[*pos]; 118 u8 *b = (u8 *) &fw->data[*pos];
@@ -146,3 +143,4 @@ static int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx,
146 143
147 return *pos; 144 return *pos;
148} 145}
146EXPORT_SYMBOL(dvb_usb_get_hexline);
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
index 6b611a725093..55ba020386c9 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-i2c.c
@@ -1,6 +1,6 @@
1/* dvb-usb-i2c.c is part of the DVB USB library. 1/* dvb-usb-i2c.c is part of the DVB USB library.
2 * 2 *
3 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) 3 * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de)
4 * see dvb-usb-init.c for copyright information. 4 * see dvb-usb-init.c for copyright information.
5 * 5 *
6 * This file contains functions for (de-)initializing an I2C adapter. 6 * This file contains functions for (de-)initializing an I2C adapter.
@@ -48,48 +48,48 @@ int dvb_usb_i2c_exit(struct dvb_usb_device *d)
48 48
49int dvb_usb_tuner_init_i2c(struct dvb_frontend *fe) 49int dvb_usb_tuner_init_i2c(struct dvb_frontend *fe)
50{ 50{
51 struct dvb_usb_device *d = fe->dvb->priv; 51 struct dvb_usb_adapter *adap = fe->dvb->priv;
52 struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = d->pll_init, .len = 4 }; 52 struct i2c_msg msg = { .addr = adap->pll_addr, .flags = 0, .buf = adap->pll_init, .len = 4 };
53 int ret = 0; 53 int ret = 0;
54 54
55 /* if pll_desc is not used */ 55 /* if pll_desc is not used */
56 if (d->pll_desc == NULL) 56 if (adap->pll_desc == NULL)
57 return 0; 57 return 0;
58 58
59 if (d->tuner_pass_ctrl) 59 if (adap->tuner_pass_ctrl)
60 d->tuner_pass_ctrl(fe,1,d->pll_addr); 60 adap->tuner_pass_ctrl(fe, 1, adap->pll_addr);
61 61
62 deb_pll("pll init: %x\n",d->pll_addr); 62 deb_pll("pll init: %x\n",adap->pll_addr);
63 deb_pll("pll-buf: %x %x %x %x\n",d->pll_init[0],d->pll_init[1], 63 deb_pll("pll-buf: %x %x %x %x\n",adap->pll_init[0], adap->pll_init[1],
64 d->pll_init[2],d->pll_init[3]); 64 adap->pll_init[2], adap->pll_init[3]);
65 65
66 if (fe->ops.i2c_gate_ctrl) 66 if (fe->ops.i2c_gate_ctrl)
67 fe->ops.i2c_gate_ctrl(fe, 1); 67 fe->ops.i2c_gate_ctrl(fe, 1);
68 if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { 68 if (i2c_transfer (&adap->dev->i2c_adap, &msg, 1) != 1) {
69 err("tuner i2c write failed for pll_init."); 69 err("tuner i2c write failed for pll_init.");
70 ret = -EREMOTEIO; 70 ret = -EREMOTEIO;
71 } 71 }
72 msleep(1); 72 msleep(1);
73 73
74 if (d->tuner_pass_ctrl) 74 if (adap->tuner_pass_ctrl)
75 d->tuner_pass_ctrl(fe,0,d->pll_addr); 75 adap->tuner_pass_ctrl(fe,0,adap->pll_addr);
76 return ret; 76 return ret;
77} 77}
78EXPORT_SYMBOL(dvb_usb_tuner_init_i2c); 78EXPORT_SYMBOL(dvb_usb_tuner_init_i2c);
79 79
80int dvb_usb_tuner_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep, u8 *b, int buf_len) 80int dvb_usb_tuner_calc_regs(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep, u8 *b, int buf_len)
81{ 81{
82 struct dvb_usb_device *d = fe->dvb->priv; 82 struct dvb_usb_adapter *adap = fe->dvb->priv;
83 83
84 if (buf_len != 5) 84 if (buf_len != 5)
85 return -EINVAL; 85 return -EINVAL;
86 if (d->pll_desc == NULL) 86 if (adap->pll_desc == NULL)
87 return 0; 87 return 0;
88 88
89 deb_pll("pll addr: %x, freq: %d %p\n",d->pll_addr,fep->frequency,d->pll_desc); 89 deb_pll("pll addr: %x, freq: %d %p\n",adap->pll_addr, fep->frequency, adap->pll_desc);
90 90
91 b[0] = d->pll_addr; 91 b[0] = adap->pll_addr;
92 dvb_pll_configure(d->pll_desc,&b[1],fep->frequency,fep->u.ofdm.bandwidth); 92 dvb_pll_configure(adap->pll_desc, &b[1], fep->frequency, fep->u.ofdm.bandwidth);
93 93
94 deb_pll("pll-buf: %x %x %x %x %x\n",b[0],b[1],b[2],b[3],b[4]); 94 deb_pll("pll-buf: %x %x %x %x %x\n",b[0],b[1],b[2],b[3],b[4]);
95 95
@@ -99,26 +99,27 @@ EXPORT_SYMBOL(dvb_usb_tuner_calc_regs);
99 99
100int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep) 100int dvb_usb_tuner_set_params_i2c(struct dvb_frontend *fe, struct dvb_frontend_parameters *fep)
101{ 101{
102 struct dvb_usb_device *d = fe->dvb->priv; 102 struct dvb_usb_adapter *adap = fe->dvb->priv;
103 int ret = 0; 103 int ret = 0;
104 u8 b[5]; 104 u8 b[5];
105 struct i2c_msg msg = { .addr = d->pll_addr, .flags = 0, .buf = &b[1], .len = 4 }; 105 struct i2c_msg msg = { .addr = adap->pll_addr, .flags = 0, .buf = &b[1], .len = 4 };
106 106
107 dvb_usb_tuner_calc_regs(fe,fep,b,5); 107 dvb_usb_tuner_calc_regs(fe,fep,b,5);
108 108
109 if (d->tuner_pass_ctrl) 109 if (adap->tuner_pass_ctrl)
110 d->tuner_pass_ctrl(fe,1,d->pll_addr); 110 adap->tuner_pass_ctrl(fe, 1, adap->pll_addr);
111 111
112 if (fe->ops.i2c_gate_ctrl) 112 if (fe->ops.i2c_gate_ctrl)
113 fe->ops.i2c_gate_ctrl(fe, 1); 113 fe->ops.i2c_gate_ctrl(fe, 1);
114 if (i2c_transfer (&d->i2c_adap, &msg, 1) != 1) { 114
115 if (i2c_transfer(&adap->dev->i2c_adap, &msg, 1) != 1) {
115 err("tuner i2c write failed for pll_set."); 116 err("tuner i2c write failed for pll_set.");
116 ret = -EREMOTEIO; 117 ret = -EREMOTEIO;
117 } 118 }
118 msleep(1); 119 msleep(1);
119 120
120 if (d->tuner_pass_ctrl) 121 if (adap->tuner_pass_ctrl)
121 d->tuner_pass_ctrl(fe,0,d->pll_addr); 122 adap->tuner_pass_ctrl(fe, 0, adap->pll_addr);
122 123
123 return ret; 124 return ret;
124} 125}
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
index 57a10de1d3dd..4d6b069536ce 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-ids.h
@@ -52,8 +52,7 @@
52#define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9 52#define USB_PID_DIBCOM_MOD3000_WARM 0x0bb9
53#define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6 53#define USB_PID_DIBCOM_MOD3001_COLD 0x0bc6
54#define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7 54#define USB_PID_DIBCOM_MOD3001_WARM 0x0bc7
55#define USB_PID_DIBCOM_STK7700 0x1e14 55#define USB_PID_DIBCOM_STK7700P 0x1e14
56#define USB_PID_DIBCOM_STK7700_REENUM 0x1e15
57#define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131 56#define USB_PID_DIBCOM_ANCHOR_2135_COLD 0x2131
58#define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0 57#define USB_PID_GRANDTEC_DVBT_USB_COLD 0x0fa0
59#define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1 58#define USB_PID_GRANDTEC_DVBT_USB_WARM 0x0fa1
@@ -95,6 +94,10 @@
95#define USB_PID_WT220U_ZL0353_WARM 0x022b 94#define USB_PID_WT220U_ZL0353_WARM 0x022b
96#define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300 95#define USB_PID_WINTV_NOVA_T_USB2_COLD 0x9300
97#define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301 96#define USB_PID_WINTV_NOVA_T_USB2_WARM 0x9301
97#define USB_PID_HAUPPAUGE_NOVA_T_500 0x9941
98#define USB_PID_HAUPPAUGE_NOVA_T_500_2 0x9950
99#define USB_PID_HAUPPAUGE_NOVA_T_STICK 0x7050
100#define USB_PID_AVERMEDIA_VOLAR 0x1234
98#define USB_PID_NEBULA_DIGITV 0x0201 101#define USB_PID_NEBULA_DIGITV 0x0201
99#define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820 102#define USB_PID_DVICO_BLUEBIRD_LGDT 0xd820
100#define USB_PID_DVICO_BLUEBIRD_LG064F_COLD 0xd500 103#define USB_PID_DVICO_BLUEBIRD_LG064F_COLD 0xd500
@@ -103,10 +106,12 @@
103#define USB_PID_DVICO_BLUEBIRD_LGZ201_WARM 0xdb01 106#define USB_PID_DVICO_BLUEBIRD_LGZ201_WARM 0xdb01
104#define USB_PID_DVICO_BLUEBIRD_TH7579_COLD 0xdb10 107#define USB_PID_DVICO_BLUEBIRD_TH7579_COLD 0xdb10
105#define USB_PID_DVICO_BLUEBIRD_TH7579_WARM 0xdb11 108#define USB_PID_DVICO_BLUEBIRD_TH7579_WARM 0xdb11
106#define USB_PID_DVICO_BLUEBIRD_DEE1601_COLD 0xdb50 109#define USB_PID_DVICO_BLUEBIRD_DUAL_1_COLD 0xdb50
107#define USB_PID_DVICO_BLUEBIRD_DEE1601_WARM 0xdb51 110#define USB_PID_DVICO_BLUEBIRD_DUAL_1_WARM 0xdb51
108#define USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_COLD 0xdb54 111#define USB_PID_DVICO_BLUEBIRD_DUAL_2_COLD 0xdb58
109#define USB_PID_DIGITALNOW_BLUEBIRD_DEE1601_WARM 0xdb55 112#define USB_PID_DVICO_BLUEBIRD_DUAL_2_WARM 0xdb59
113#define USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_COLD 0xdb54
114#define USB_PID_DIGITALNOW_BLUEBIRD_DUAL_1_WARM 0xdb55
110#define USB_PID_MEDION_MD95700 0x0932 115#define USB_PID_MEDION_MD95700 0x0932
111#define USB_PID_KYE_DVB_T_COLD 0x701e 116#define USB_PID_KYE_DVB_T_COLD 0x701e
112#define USB_PID_KYE_DVB_T_WARM 0x701f 117#define USB_PID_KYE_DVB_T_WARM 0x701f
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-init.c b/drivers/media/dvb/dvb-usb/dvb-usb-init.c
index a1705ecb9a54..ffdde83d1e77 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-init.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-init.c
@@ -3,7 +3,7 @@
3 * 3 *
4 * dvb-usb-init.c 4 * dvb-usb-init.c
5 * 5 *
6 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) 6 * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de)
7 * 7 *
8 * This program is free software; you can redistribute it and/or modify it 8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the Free 9 * under the terms of the GNU General Public License as published by the Free
@@ -16,21 +16,105 @@
16/* debug */ 16/* debug */
17int dvb_usb_debug; 17int dvb_usb_debug;
18module_param_named(debug,dvb_usb_debug, int, 0644); 18module_param_named(debug,dvb_usb_debug, int, 0644);
19MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64 (or-able))." DVB_USB_DEBUG_STATUS); 19MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,pll=4,ts=8,err=16,rc=32,fw=64,mem=128,uxfer=256 (or-able))." DVB_USB_DEBUG_STATUS);
20 20
21int dvb_usb_disable_rc_polling; 21int dvb_usb_disable_rc_polling;
22module_param_named(disable_rc_polling, dvb_usb_disable_rc_polling, int, 0644); 22module_param_named(disable_rc_polling, dvb_usb_disable_rc_polling, int, 0644);
23MODULE_PARM_DESC(disable_rc_polling, "disable remote control polling (default: 0)."); 23MODULE_PARM_DESC(disable_rc_polling, "disable remote control polling (default: 0).");
24 24
25static int dvb_usb_force_pid_filter_usage;
26module_param_named(force_pid_filter_usage, dvb_usb_force_pid_filter_usage, int, 0444);
27MODULE_PARM_DESC(disable_rc_polling, "force all dvb-usb-devices to use a PID filter, if any (default: 0).");
28
29static int dvb_usb_adapter_init(struct dvb_usb_device *d)
30{
31 struct dvb_usb_adapter *adap;
32 int ret,n;
33
34 for (n = 0; n < d->props.num_adapters; n++) {
35 adap = &d->adapter[n];
36 adap->dev = d;
37 adap->id = n;
38
39 memcpy(&adap->props, &d->props.adapter[n], sizeof(struct dvb_usb_adapter_properties));
40
41/* speed - when running at FULL speed we need a HW PID filter */
42 if (d->udev->speed == USB_SPEED_FULL && !(adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER)) {
43 err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a hardware PID filter)");
44 return -ENODEV;
45 }
46
47 if ((d->udev->speed == USB_SPEED_FULL && adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER) ||
48 (adap->props.caps & DVB_USB_ADAP_NEED_PID_FILTERING)) {
49 info("will use the device's hardware PID filter (table count: %d).",adap->props.pid_filter_count);
50 adap->pid_filtering = 1;
51 adap->max_feed_count = adap->props.pid_filter_count;
52 } else {
53 info("will pass the complete MPEG2 transport stream to the software demuxer.");
54 adap->pid_filtering = 0;
55 adap->max_feed_count = 255;
56 }
57
58 if (!adap->pid_filtering &&
59 dvb_usb_force_pid_filter_usage &&
60 adap->props.caps & DVB_USB_ADAP_HAS_PID_FILTER) {
61 info("pid filter enabled by module option.");
62 adap->pid_filtering = 1;
63 adap->max_feed_count = adap->props.pid_filter_count;
64 }
65
66 if (adap->props.size_of_priv > 0) {
67 adap->priv = kzalloc(adap->props.size_of_priv,GFP_KERNEL);
68 if (adap->priv == NULL) {
69 err("no memory for priv for adapter %d.",n);
70 return -ENOMEM;
71 }
72 }
73
74 if ((ret = dvb_usb_adapter_stream_init(adap)) ||
75 (ret = dvb_usb_adapter_dvb_init(adap)) ||
76 (ret = dvb_usb_adapter_frontend_init(adap))) {
77 return ret;
78 }
79
80 d->num_adapters_initialized++;
81 d->state |= DVB_USB_STATE_DVB;
82 }
83
84 /*
85 * when reloading the driver w/o replugging the device
86 * sometimes a timeout occures, this helps
87 */
88 if (d->props.generic_bulk_ctrl_endpoint != 0) {
89 usb_clear_halt(d->udev,usb_sndbulkpipe(d->udev,d->props.generic_bulk_ctrl_endpoint));
90 usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.generic_bulk_ctrl_endpoint));
91 }
92
93 return 0;
94}
95
96static int dvb_usb_adapter_exit(struct dvb_usb_device *d)
97{
98 int n;
99 for (n = 0; n < d->num_adapters_initialized; n++) {
100 dvb_usb_adapter_frontend_exit(&d->adapter[n]);
101 dvb_usb_adapter_dvb_exit(&d->adapter[n]);
102 dvb_usb_adapter_stream_exit(&d->adapter[n]);
103 kfree(d->adapter[n].priv);
104 }
105 d->num_adapters_initialized = 0;
106 d->state &= ~DVB_USB_STATE_DVB;
107 return 0;
108}
109
110
25/* general initialization functions */ 111/* general initialization functions */
26static int dvb_usb_exit(struct dvb_usb_device *d) 112static int dvb_usb_exit(struct dvb_usb_device *d)
27{ 113{
28 deb_info("state before exiting everything: %x\n",d->state); 114 deb_info("state before exiting everything: %x\n",d->state);
29 dvb_usb_remote_exit(d); 115 dvb_usb_remote_exit(d);
30 dvb_usb_fe_exit(d); 116 dvb_usb_adapter_exit(d);
31 dvb_usb_i2c_exit(d); 117 dvb_usb_i2c_exit(d);
32 dvb_usb_dvb_exit(d);
33 dvb_usb_urb_exit(d);
34 deb_info("state should be zero now: %x\n",d->state); 118 deb_info("state should be zero now: %x\n",d->state);
35 d->state = DVB_USB_STATE_INIT; 119 d->state = DVB_USB_STATE_INIT;
36 kfree(d->priv); 120 kfree(d->priv);
@@ -47,32 +131,19 @@ static int dvb_usb_init(struct dvb_usb_device *d)
47 131
48 d->state = DVB_USB_STATE_INIT; 132 d->state = DVB_USB_STATE_INIT;
49 133
50/* check the capabilities and set appropriate variables */ 134 if (d->props.size_of_priv > 0) {
51 135 d->priv = kzalloc(d->props.size_of_priv,GFP_KERNEL);
52/* speed - when running at FULL speed we need a HW PID filter */ 136 if (d->priv == NULL) {
53 if (d->udev->speed == USB_SPEED_FULL && !(d->props.caps & DVB_USB_HAS_PID_FILTER)) { 137 err("no memory for priv in 'struct dvb_usb_device'");
54 err("This USB2.0 device cannot be run on a USB1.1 port. (it lacks a hardware PID filter)"); 138 return -ENOMEM;
55 return -ENODEV; 139 }
56 }
57
58 if ((d->udev->speed == USB_SPEED_FULL && d->props.caps & DVB_USB_HAS_PID_FILTER) ||
59 (d->props.caps & DVB_USB_NEED_PID_FILTERING)) {
60 info("will use the device's hardware PID filter (table count: %d).",d->props.pid_filter_count);
61 d->pid_filtering = 1;
62 d->max_feed_count = d->props.pid_filter_count;
63 } else {
64 info("will pass the complete MPEG2 transport stream to the software demuxer.");
65 d->pid_filtering = 0;
66 d->max_feed_count = 255;
67 } 140 }
68 141
69 if (d->props.power_ctrl) 142/* check the capabilities and set appropriate variables */
70 d->props.power_ctrl(d,1); 143 dvb_usb_device_power_ctrl(d, 1);
71 144
72 if ((ret = dvb_usb_urb_init(d)) || 145 if ((ret = dvb_usb_i2c_init(d)) ||
73 (ret = dvb_usb_dvb_init(d)) || 146 (ret = dvb_usb_adapter_init(d))) {
74 (ret = dvb_usb_i2c_init(d)) ||
75 (ret = dvb_usb_fe_init(d))) {
76 dvb_usb_exit(d); 147 dvb_usb_exit(d);
77 return ret; 148 return ret;
78 } 149 }
@@ -80,14 +151,13 @@ static int dvb_usb_init(struct dvb_usb_device *d)
80 if ((ret = dvb_usb_remote_init(d))) 151 if ((ret = dvb_usb_remote_init(d)))
81 err("could not initialize remote control."); 152 err("could not initialize remote control.");
82 153
83 if (d->props.power_ctrl) 154 dvb_usb_device_power_ctrl(d, 0);
84 d->props.power_ctrl(d,0);
85 155
86 return 0; 156 return 0;
87} 157}
88 158
89/* determine the name and the state of the just found USB device */ 159/* determine the name and the state of the just found USB device */
90static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device *udev,struct dvb_usb_properties *props, int *cold) 160static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device *udev,struct dvb_usb_device_properties *props, int *cold)
91{ 161{
92 int i,j; 162 int i,j;
93 struct dvb_usb_device_description *desc = NULL; 163 struct dvb_usb_device_description *desc = NULL;
@@ -125,11 +195,25 @@ static struct dvb_usb_device_description * dvb_usb_find_device(struct usb_device
125 return desc; 195 return desc;
126} 196}
127 197
198int dvb_usb_device_power_ctrl(struct dvb_usb_device *d, int onoff)
199{
200 if (onoff)
201 d->powered++;
202 else
203 d->powered--;
204
205 if (d->powered == 0 || (onoff && d->powered == 1)) { // when switching from 1 to 0 or from 0 to 1
206 deb_info("power control: %d\n", onoff);
207 if (d->props.power_ctrl)
208 return d->props.power_ctrl(d, onoff);
209 }
210 return 0;
211}
212
128/* 213/*
129 * USB 214 * USB
130 */ 215 */
131 216int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_device_properties
132int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties
133 *props, struct module *owner,struct dvb_usb_device **du) 217 *props, struct module *owner,struct dvb_usb_device **du)
134{ 218{
135 struct usb_device *udev = interface_to_usbdev(intf); 219 struct usb_device *udev = interface_to_usbdev(intf);
@@ -149,7 +233,7 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties
149 if (cold) { 233 if (cold) {
150 info("found a '%s' in cold state, will try to load a firmware",desc->name); 234 info("found a '%s' in cold state, will try to load a firmware",desc->name);
151 ret = dvb_usb_download_firmware(udev,props); 235 ret = dvb_usb_download_firmware(udev,props);
152 if (!props->no_reconnect) 236 if (!props->no_reconnect || ret != 0)
153 return ret; 237 return ret;
154 } 238 }
155 239
@@ -161,19 +245,10 @@ int dvb_usb_device_init(struct usb_interface *intf, struct dvb_usb_properties
161 } 245 }
162 246
163 d->udev = udev; 247 d->udev = udev;
164 memcpy(&d->props,props,sizeof(struct dvb_usb_properties)); 248 memcpy(&d->props,props,sizeof(struct dvb_usb_device_properties));
165 d->desc = desc; 249 d->desc = desc;
166 d->owner = owner; 250 d->owner = owner;
167 251
168 if (d->props.size_of_priv > 0) {
169 d->priv = kzalloc(d->props.size_of_priv,GFP_KERNEL);
170 if (d->priv == NULL) {
171 err("no memory for priv in 'struct dvb_usb_device'");
172 kfree(d);
173 return -ENOMEM;
174 }
175 }
176
177 usb_set_intfdata(intf, d); 252 usb_set_intfdata(intf, d);
178 253
179 if (du != NULL) 254 if (du != NULL)
@@ -204,7 +279,7 @@ void dvb_usb_device_exit(struct usb_interface *intf)
204} 279}
205EXPORT_SYMBOL(dvb_usb_device_exit); 280EXPORT_SYMBOL(dvb_usb_device_exit);
206 281
207MODULE_VERSION("0.3"); 282MODULE_VERSION("1.0");
208MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 283MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
209MODULE_DESCRIPTION("A library module containing commonly used USB and DVB function USB DVB devices"); 284MODULE_DESCRIPTION("A library module containing commonly used USB and DVB function USB DVB devices");
210MODULE_LICENSE("GPL"); 285MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
index 380b2a45ee4c..0a3a0b6c2350 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-remote.c
@@ -1,6 +1,6 @@
1/* dvb-usb-remote.c is part of the DVB USB library. 1/* dvb-usb-remote.c is part of the DVB USB library.
2 * 2 *
3 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) 3 * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de)
4 * see dvb-usb-init.c for copyright information. 4 * see dvb-usb-init.c for copyright information.
5 * 5 *
6 * This file contains functions for initializing the the input-device and for handling remote-control-queries. 6 * This file contains functions for initializing the the input-device and for handling remote-control-queries.
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c
index 88b283731bb8..5cef12a07f72 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb-urb.c
+++ b/drivers/media/dvb/dvb-usb/dvb-usb-urb.c
@@ -1,9 +1,9 @@
1/* dvb-usb-urb.c is part of the DVB USB library. 1/* dvb-usb-urb.c is part of the DVB USB library.
2 * 2 *
3 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) 3 * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de)
4 * see dvb-usb-init.c for copyright information. 4 * see dvb-usb-init.c for copyright information.
5 * 5 *
6 * This file contains functions for initializing and handling the 6 * This file keeps functions for initializing and handling the
7 * USB and URB stuff. 7 * USB and URB stuff.
8 */ 8 */
9#include "dvb-usb-common.h" 9#include "dvb-usb-common.h"
@@ -64,260 +64,32 @@ int dvb_usb_generic_write(struct dvb_usb_device *d, u8 *buf, u16 len)
64} 64}
65EXPORT_SYMBOL(dvb_usb_generic_write); 65EXPORT_SYMBOL(dvb_usb_generic_write);
66 66
67 67static void dvb_usb_data_complete(struct usb_data_stream *stream, u8 *buffer, size_t length)
68/* URB stuff for streaming */
69static void dvb_usb_urb_complete(struct urb *urb, struct pt_regs *ptregs)
70{
71 struct dvb_usb_device *d = urb->context;
72 int ptype = usb_pipetype(urb->pipe);
73 int i;
74 u8 *b;
75
76 deb_ts("'%s' urb completed. feedcount: %d, status: %d, length: %d/%d, pack_num: %d, errors: %d\n",
77 ptype == PIPE_ISOCHRONOUS ? "isoc" : "bulk", d->feedcount,
78 urb->status,urb->actual_length,urb->transfer_buffer_length,
79 urb->number_of_packets,urb->error_count);
80
81 switch (urb->status) {
82 case 0: /* success */
83 break;
84 case -ECONNRESET: /* kill */
85 case -ENOENT:
86 case -ESHUTDOWN:
87 return;
88 default: /* error */
89 deb_ts("urb completition error %d.", urb->status);
90 break;
91 }
92
93 if (d->feedcount > 0) {
94 if (d->state & DVB_USB_STATE_DVB) {
95 switch (ptype) {
96 case PIPE_ISOCHRONOUS:
97 b = (u8 *) urb->transfer_buffer;
98 for (i = 0; i < urb->number_of_packets; i++) {
99 if (urb->iso_frame_desc[i].status != 0)
100 deb_ts("iso frame descriptor has an error: %d\n",urb->iso_frame_desc[i].status);
101 else if (urb->iso_frame_desc[i].actual_length > 0) {
102 dvb_dmx_swfilter(&d->demux,b + urb->iso_frame_desc[i].offset,
103 urb->iso_frame_desc[i].actual_length);
104 }
105 urb->iso_frame_desc[i].status = 0;
106 urb->iso_frame_desc[i].actual_length = 0;
107 }
108 debug_dump(b,20,deb_ts);
109 break;
110 case PIPE_BULK:
111 if (urb->actual_length > 0)
112 dvb_dmx_swfilter(&d->demux, (u8 *) urb->transfer_buffer,urb->actual_length);
113 break;
114 default:
115 err("unkown endpoint type in completition handler.");
116 return;
117 }
118 }
119 }
120
121 usb_submit_urb(urb,GFP_ATOMIC);
122}
123
124int dvb_usb_urb_kill(struct dvb_usb_device *d)
125{
126 int i;
127 for (i = 0; i < d->urbs_submitted; i++) {
128 deb_ts("killing URB no. %d.\n",i);
129
130 /* stop the URB */
131 usb_kill_urb(d->urb_list[i]);
132 }
133 d->urbs_submitted = 0;
134 return 0;
135}
136
137int dvb_usb_urb_submit(struct dvb_usb_device *d)
138{
139 int i,ret;
140 for (i = 0; i < d->urbs_initialized; i++) {
141 deb_ts("submitting URB no. %d\n",i);
142 if ((ret = usb_submit_urb(d->urb_list[i],GFP_ATOMIC))) {
143 err("could not submit URB no. %d - get them all back",i);
144 dvb_usb_urb_kill(d);
145 return ret;
146 }
147 d->urbs_submitted++;
148 }
149 return 0;
150}
151
152static int dvb_usb_free_stream_buffers(struct dvb_usb_device *d)
153{
154 if (d->state & DVB_USB_STATE_URB_BUF) {
155 while (d->buf_num) {
156 d->buf_num--;
157 deb_mem("freeing buffer %d\n",d->buf_num);
158 usb_buffer_free(d->udev, d->buf_size,
159 d->buf_list[d->buf_num], d->dma_addr[d->buf_num]);
160 }
161 kfree(d->buf_list);
162 kfree(d->dma_addr);
163 }
164
165 d->state &= ~DVB_USB_STATE_URB_BUF;
166
167 return 0;
168}
169
170static int dvb_usb_allocate_stream_buffers(struct dvb_usb_device *d, int num, unsigned long size)
171{
172 d->buf_num = 0;
173 d->buf_size = size;
174
175 deb_mem("all in all I will use %lu bytes for streaming\n",num*size);
176
177 if ((d->buf_list = kcalloc(num, sizeof(u8 *), GFP_ATOMIC)) == NULL)
178 return -ENOMEM;
179
180 if ((d->dma_addr = kcalloc(num, sizeof(dma_addr_t), GFP_ATOMIC)) == NULL) {
181 kfree(d->buf_list);
182 return -ENOMEM;
183 }
184
185 d->state |= DVB_USB_STATE_URB_BUF;
186
187 for (d->buf_num = 0; d->buf_num < num; d->buf_num++) {
188 deb_mem("allocating buffer %d\n",d->buf_num);
189 if (( d->buf_list[d->buf_num] =
190 usb_buffer_alloc(d->udev, size, SLAB_ATOMIC,
191 &d->dma_addr[d->buf_num]) ) == NULL) {
192 deb_mem("not enough memory for urb-buffer allocation.\n");
193 dvb_usb_free_stream_buffers(d);
194 return -ENOMEM;
195 }
196 deb_mem("buffer %d: %p (dma: %llu)\n",
197 d->buf_num, d->buf_list[d->buf_num],
198 (unsigned long long)d->dma_addr[d->buf_num]);
199 memset(d->buf_list[d->buf_num],0,size);
200 }
201 deb_mem("allocation successful\n");
202
203 return 0;
204}
205
206static int dvb_usb_bulk_urb_init(struct dvb_usb_device *d)
207{ 68{
208 int i; 69 struct dvb_usb_adapter *adap = stream->user_priv;
209 70 if (adap->feedcount > 0 && adap->state & DVB_USB_ADAP_STATE_DVB)
210 if ((i = dvb_usb_allocate_stream_buffers(d,d->props.urb.count, 71 dvb_dmx_swfilter(&adap->demux, buffer, length);
211 d->props.urb.u.bulk.buffersize)) < 0)
212 return i;
213
214 /* allocate the URBs */
215 for (i = 0; i < d->props.urb.count; i++) {
216 if ((d->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC)) == NULL)
217 return -ENOMEM;
218
219 usb_fill_bulk_urb( d->urb_list[i], d->udev,
220 usb_rcvbulkpipe(d->udev,d->props.urb.endpoint),
221 d->buf_list[i],
222 d->props.urb.u.bulk.buffersize,
223 dvb_usb_urb_complete, d);
224
225 d->urb_list[i]->transfer_flags = 0;
226 d->urbs_initialized++;
227 }
228 return 0;
229} 72}
230 73
231static int dvb_usb_isoc_urb_init(struct dvb_usb_device *d) 74static void dvb_usb_data_complete_204(struct usb_data_stream *stream, u8 *buffer, size_t length)
232{ 75{
233 int i,j; 76 struct dvb_usb_adapter *adap = stream->user_priv;
234 77 if (adap->feedcount > 0 && adap->state & DVB_USB_ADAP_STATE_DVB)
235 if ((i = dvb_usb_allocate_stream_buffers(d,d->props.urb.count, 78 dvb_dmx_swfilter_204(&adap->demux, buffer, length);
236 d->props.urb.u.isoc.framesize*d->props.urb.u.isoc.framesperurb)) < 0)
237 return i;
238
239 /* allocate the URBs */
240 for (i = 0; i < d->props.urb.count; i++) {
241 struct urb *urb;
242 int frame_offset = 0;
243 if ((d->urb_list[i] =
244 usb_alloc_urb(d->props.urb.u.isoc.framesperurb,GFP_ATOMIC)) == NULL)
245 return -ENOMEM;
246
247 urb = d->urb_list[i];
248
249 urb->dev = d->udev;
250 urb->context = d;
251 urb->complete = dvb_usb_urb_complete;
252 urb->pipe = usb_rcvisocpipe(d->udev,d->props.urb.endpoint);
253 urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
254 urb->interval = d->props.urb.u.isoc.interval;
255 urb->number_of_packets = d->props.urb.u.isoc.framesperurb;
256 urb->transfer_buffer_length = d->buf_size;
257 urb->transfer_buffer = d->buf_list[i];
258 urb->transfer_dma = d->dma_addr[i];
259
260 for (j = 0; j < d->props.urb.u.isoc.framesperurb; j++) {
261 urb->iso_frame_desc[j].offset = frame_offset;
262 urb->iso_frame_desc[j].length = d->props.urb.u.isoc.framesize;
263 frame_offset += d->props.urb.u.isoc.framesize;
264 }
265
266 d->urbs_initialized++;
267 }
268 return 0;
269
270} 79}
271 80
272int dvb_usb_urb_init(struct dvb_usb_device *d) 81int dvb_usb_adapter_stream_init(struct dvb_usb_adapter *adap)
273{ 82{
274 /* 83 adap->stream.udev = adap->dev->udev;
275 * when reloading the driver w/o replugging the device 84 if (adap->props.caps & DVB_USB_ADAP_RECEIVES_204_BYTE_TS)
276 * sometimes a timeout occures, this helps 85 adap->stream.complete = dvb_usb_data_complete_204;
277 */ 86 else
278 if (d->props.generic_bulk_ctrl_endpoint != 0) { 87 adap->stream.complete = dvb_usb_data_complete;
279 usb_clear_halt(d->udev,usb_sndbulkpipe(d->udev,d->props.generic_bulk_ctrl_endpoint)); 88 adap->stream.user_priv = adap;
280 usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.generic_bulk_ctrl_endpoint)); 89 return usb_urb_init(&adap->stream, &adap->props.stream);
281 }
282 usb_clear_halt(d->udev,usb_rcvbulkpipe(d->udev,d->props.urb.endpoint));
283
284 /* allocate the array for the data transfer URBs */
285 d->urb_list = kzalloc(d->props.urb.count * sizeof(struct urb *),GFP_KERNEL);
286 if (d->urb_list == NULL)
287 return -ENOMEM;
288 d->state |= DVB_USB_STATE_URB_LIST;
289
290 switch (d->props.urb.type) {
291 case DVB_USB_BULK:
292 return dvb_usb_bulk_urb_init(d);
293 case DVB_USB_ISOC:
294 return dvb_usb_isoc_urb_init(d);
295 default:
296 err("unkown URB-type for data transfer.");
297 return -EINVAL;
298 }
299} 90}
300 91
301int dvb_usb_urb_exit(struct dvb_usb_device *d) 92int dvb_usb_adapter_stream_exit(struct dvb_usb_adapter *adap)
302{ 93{
303 int i; 94 return usb_urb_exit(&adap->stream);
304
305 dvb_usb_urb_kill(d);
306
307 if (d->state & DVB_USB_STATE_URB_LIST) {
308 for (i = 0; i < d->urbs_initialized; i++) {
309 if (d->urb_list[i] != NULL) {
310 deb_mem("freeing URB no. %d.\n",i);
311 /* free the URBs */
312 usb_free_urb(d->urb_list[i]);
313 }
314 }
315 d->urbs_initialized = 0;
316 /* free the urb array */
317 kfree(d->urb_list);
318 d->state &= ~DVB_USB_STATE_URB_LIST;
319 }
320
321 dvb_usb_free_stream_buffers(d);
322 return 0;
323} 95}
diff --git a/drivers/media/dvb/dvb-usb/dvb-usb.h b/drivers/media/dvb/dvb-usb/dvb-usb.h
index 97f8ea962438..376c45a8e779 100644
--- a/drivers/media/dvb/dvb-usb/dvb-usb.h
+++ b/drivers/media/dvb/dvb-usb/dvb-usb.h
@@ -1,9 +1,11 @@
1/* dvb-usb.h is part of the DVB USB library. 1/* dvb-usb.h is part of the DVB USB library.
2 * 2 *
3 * Copyright (C) 2004-5 Patrick Boettcher (patrick.boettcher@desy.de) 3 * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de)
4 * see dvb-usb-init.c for copyright information. 4 * see dvb-usb-init.c for copyright information.
5 * 5 *
6 * the headerfile, all dvb-usb-drivers have to include. 6 * the headerfile, all dvb-usb-drivers have to include.
7 *
8 * TODO: clean-up the structures for unused fields and update the comments
7 */ 9 */
8#ifndef __DVB_USB_H__ 10#ifndef __DVB_USB_H__
9#define __DVB_USB_H__ 11#define __DVB_USB_H__
@@ -84,36 +86,84 @@ struct dvb_usb_rc_key {
84}; 86};
85 87
86struct dvb_usb_device; 88struct dvb_usb_device;
89struct dvb_usb_adapter;
90struct usb_data_stream;
91
92/**
93 * Properties of USB streaming - TODO this structure should be somewhere else
94 * describes the kind of USB transfer used for data-streaming.
95 * (BULK or ISOC)
96 */
97struct usb_data_stream_properties {
98#define USB_BULK 1
99#define USB_ISOC 2
100 int type;
101 int count;
102 int endpoint;
103
104 union {
105 struct {
106 int buffersize; /* per URB */
107 } bulk;
108 struct {
109 int framesperurb;
110 int framesize;
111 int interval;
112 } isoc;
113 } u;
114};
87 115
88/** 116/**
89 * struct dvb_usb_properties - properties of a dvb-usb-device 117 * struct dvb_usb_adapter_properties - properties of a dvb-usb-adapter.
118 * A DVB-USB-Adapter is basically a dvb_adapter which is present on a USB-device.
90 * @caps: capabilities of the DVB USB device. 119 * @caps: capabilities of the DVB USB device.
91 * @pid_filter_count: number of PID filter position in the optional hardware 120 * @pid_filter_count: number of PID filter position in the optional hardware
92 * PID-filter. 121 * PID-filter.
93 * 122 * @streaming_crtl: called to start and stop the MPEG2-TS streaming of the
123 * device (not URB submitting/killing).
124 * @pid_filter_ctrl: called to en/disable the PID filter, if any.
125 * @pid_filter: called to set/unset a PID for filtering.
126 * @frontend_attach: called to attach the possible frontends (fill fe-field
127 * of struct dvb_usb_device).
128 * @tuner_attach: called to attach the correct tuner and to fill pll_addr,
129 * pll_desc and pll_init_buf of struct dvb_usb_device).
130 * @stream: configuration of the USB streaming
131 */
132struct dvb_usb_adapter_properties {
133#define DVB_USB_ADAP_HAS_PID_FILTER 0x01
134#define DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF 0x02
135#define DVB_USB_ADAP_NEED_PID_FILTERING 0x04
136#define DVB_USB_ADAP_RECEIVES_204_BYTE_TS 0x08
137 int caps;
138 int pid_filter_count;
139
140 int (*streaming_ctrl) (struct dvb_usb_adapter *, int);
141 int (*pid_filter_ctrl) (struct dvb_usb_adapter *, int);
142 int (*pid_filter) (struct dvb_usb_adapter *, int, u16, int);
143
144 int (*frontend_attach) (struct dvb_usb_adapter *);
145 int (*tuner_attach) (struct dvb_usb_adapter *);
146
147 struct usb_data_stream_properties stream;
148
149 int size_of_priv;
150};
151
152/**
153 * struct dvb_usb_device_properties - properties of a dvb-usb-device
94 * @usb_ctrl: which USB device-side controller is in use. Needed for firmware 154 * @usb_ctrl: which USB device-side controller is in use. Needed for firmware
95 * download. 155 * download.
96 * @firmware: name of the firmware file. 156 * @firmware: name of the firmware file.
97 * @download_firmware: called to download the firmware when the usb_ctrl is 157 * @download_firmware: called to download the firmware when the usb_ctrl is
98 * DEVICE_SPECIFIC. 158 * DEVICE_SPECIFIC.
99 * @no_reconnect: device doesn't do a reconnect after downloading the firmware, 159 * @no_reconnect: device doesn't do a reconnect after downloading the firmware,
100 so do the warm initialization right after it 160 * so do the warm initialization right after it
101 161 *
102 * @size_of_priv: how many bytes shall be allocated for the private field 162 * @size_of_priv: how many bytes shall be allocated for the private field
103 * of struct dvb_usb_device. 163 * of struct dvb_usb_device.
104 * 164 *
105 * @power_ctrl: called to enable/disable power of the device. 165 * @power_ctrl: called to enable/disable power of the device.
106 * @streaming_crtl: called to start and stop the MPEG2-TS streaming of the
107 * device (not URB submitting/killing).
108 * @pid_filter_ctrl: called to en/disable the PID filter, if any.
109 * @pid_filter: called to set/unset a PID for filtering.
110 *
111 * @read_mac_address: called to read the MAC address of the device. 166 * @read_mac_address: called to read the MAC address of the device.
112 *
113 * @frontend_attach: called to attach the possible frontends (fill fe-field
114 * of struct dvb_usb_device).
115 * @tuner_attach: called to attach the correct tuner and to fill pll_addr,
116 * pll_desc and pll_init_buf of struct dvb_usb_device).
117 * @identify_state: called to determine the state (cold or warm), when it 167 * @identify_state: called to determine the state (cold or warm), when it
118 * is not distinguishable by the USB IDs. 168 * is not distinguishable by the USB IDs.
119 * 169 *
@@ -130,50 +180,40 @@ struct dvb_usb_device;
130 * is non-zero, one can use dvb_usb_generic_rw and dvb_usb_generic_write- 180 * is non-zero, one can use dvb_usb_generic_rw and dvb_usb_generic_write-
131 * helper functions. 181 * helper functions.
132 * 182 *
133 * @urb: describes the kind of USB transfer used for MPEG2-TS-streaming.
134 * (BULK or ISOC)
135 *
136 * @num_device_descs: number of struct dvb_usb_device_description in @devices 183 * @num_device_descs: number of struct dvb_usb_device_description in @devices
137 * @devices: array of struct dvb_usb_device_description compatibles with these 184 * @devices: array of struct dvb_usb_device_description compatibles with these
138 * properties. 185 * properties.
139 */ 186 */
140struct dvb_usb_properties { 187#define MAX_NO_OF_ADAPTER_PER_DEVICE 2
188struct dvb_usb_device_properties {
141 189
142#define DVB_USB_HAS_PID_FILTER 0x01 190#define DVB_USB_IS_AN_I2C_ADAPTER 0x01
143#define DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF 0x02
144#define DVB_USB_NEED_PID_FILTERING 0x04
145#define DVB_USB_IS_AN_I2C_ADAPTER 0x08
146 int caps; 191 int caps;
147 int pid_filter_count;
148 192
149#define DEVICE_SPECIFIC 0 193#define DEVICE_SPECIFIC 0
150#define CYPRESS_AN2135 1 194#define CYPRESS_AN2135 1
151#define CYPRESS_AN2235 2 195#define CYPRESS_AN2235 2
152#define CYPRESS_FX2 3 196#define CYPRESS_FX2 3
153 int usb_ctrl; 197 int usb_ctrl;
198 int (*download_firmware) (struct usb_device *, const struct firmware *);
154 const char firmware[FIRMWARE_NAME_MAX]; 199 const char firmware[FIRMWARE_NAME_MAX];
155 int (*download_firmware) (struct usb_device *, const struct firmware *); 200 int no_reconnect;
156 int no_reconnect;
157 201
158 int size_of_priv; 202 int size_of_priv;
159 203
160 int (*power_ctrl) (struct dvb_usb_device *, int); 204 int num_adapters;
161 int (*streaming_ctrl) (struct dvb_usb_device *, int); 205 struct dvb_usb_adapter_properties adapter[MAX_NO_OF_ADAPTER_PER_DEVICE];
162 int (*pid_filter_ctrl) (struct dvb_usb_device *, int);
163 int (*pid_filter) (struct dvb_usb_device *, int, u16, int);
164 206
207 int (*power_ctrl) (struct dvb_usb_device *, int);
165 int (*read_mac_address) (struct dvb_usb_device *, u8 []); 208 int (*read_mac_address) (struct dvb_usb_device *, u8 []);
166 int (*frontend_attach) (struct dvb_usb_device *); 209 int (*identify_state) (struct usb_device *, struct dvb_usb_device_properties *,
167 int (*tuner_attach) (struct dvb_usb_device *);
168
169 int (*identify_state) (struct usb_device *, struct dvb_usb_properties *,
170 struct dvb_usb_device_description **, int *); 210 struct dvb_usb_device_description **, int *);
171 211
172/* remote control properties */ 212/* remote control properties */
173#define REMOTE_NO_KEY_PRESSED 0x00 213#define REMOTE_NO_KEY_PRESSED 0x00
174#define REMOTE_KEY_PRESSED 0x01 214#define REMOTE_KEY_PRESSED 0x01
175#define REMOTE_KEY_REPEAT 0x02 215#define REMOTE_KEY_REPEAT 0x02
176 struct dvb_usb_rc_key *rc_key_map; 216 struct dvb_usb_rc_key *rc_key_map;
177 int rc_key_map_size; 217 int rc_key_map_size;
178 int (*rc_query) (struct dvb_usb_device *, u32 *, int *); 218 int (*rc_query) (struct dvb_usb_device *, u32 *, int *);
179 int rc_interval; 219 int rc_interval;
@@ -182,40 +222,12 @@ struct dvb_usb_properties {
182 222
183 int generic_bulk_ctrl_endpoint; 223 int generic_bulk_ctrl_endpoint;
184 224
185 struct {
186#define DVB_USB_BULK 1
187#define DVB_USB_ISOC 2
188 int type;
189 int count;
190 int endpoint;
191
192 union {
193 struct {
194 int buffersize; /* per URB */
195 } bulk;
196 struct {
197 int framesperurb;
198 int framesize;
199 int interval;
200 } isoc;
201 } u;
202 } urb;
203
204 int num_device_descs; 225 int num_device_descs;
205 struct dvb_usb_device_description devices[9]; 226 struct dvb_usb_device_description devices[9];
206}; 227};
207 228
208
209/** 229/**
210 * struct dvb_usb_device - object of a DVB USB device 230 * struct usb_data_stream - generic object of an USB stream
211 * @props: copy of the struct dvb_usb_properties this device belongs to.
212 * @desc: pointer to the device's struct dvb_usb_device_description.
213 * @state: initialization and runtime state of the device.
214 *
215 * @udev: pointer to the device's struct usb_device.
216 * @urb_list: array of dynamically allocated struct urb for the MPEG2-TS-
217 * streaming.
218 *
219 * @buf_num: number of buffer allocated. 231 * @buf_num: number of buffer allocated.
220 * @buf_size: size of each buffer in buf_list. 232 * @buf_size: size of each buffer in buf_list.
221 * @buf_list: array containing all allocate buffers for streaming. 233 * @buf_list: array containing all allocate buffers for streaming.
@@ -223,18 +235,40 @@ struct dvb_usb_properties {
223 * 235 *
224 * @urbs_initialized: number of URBs initialized. 236 * @urbs_initialized: number of URBs initialized.
225 * @urbs_submitted: number of URBs submitted. 237 * @urbs_submitted: number of URBs submitted.
238 */
239#define MAX_NO_URBS_FOR_DATA_STREAM 10
240struct usb_data_stream {
241 struct usb_device *udev;
242 struct usb_data_stream_properties props;
243
244#define USB_STATE_INIT 0x00
245#define USB_STATE_URB_BUF 0x01
246 int state;
247
248 void (*complete) (struct usb_data_stream *, u8 *, size_t);
249
250 struct urb *urb_list[MAX_NO_URBS_FOR_DATA_STREAM];
251 int buf_num;
252 unsigned long buf_size;
253 u8 *buf_list[MAX_NO_URBS_FOR_DATA_STREAM];
254 dma_addr_t dma_addr[MAX_NO_URBS_FOR_DATA_STREAM];
255
256 int urbs_initialized;
257 int urbs_submitted;
258
259 void *user_priv;
260};
261
262/**
263 * struct dvb_usb_adapter - a DVB adapter on a USB device
264 * @id: index of this adapter (starting with 0).
226 * 265 *
227 * @feedcount: number of reqested feeds (used for streaming-activation) 266 * @feedcount: number of reqested feeds (used for streaming-activation)
228 * @pid_filtering: is hardware pid_filtering used or not. 267 * @pid_filtering: is hardware pid_filtering used or not.
229 * 268 *
230 * @usb_mutex: semaphore of USB control messages (reading needs two messages)
231 * @i2c_mutex: semaphore for i2c-transfers
232 *
233 * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB
234 * @pll_addr: I2C address of the tuner for programming 269 * @pll_addr: I2C address of the tuner for programming
235 * @pll_init: array containing the initialization buffer 270 * @pll_init: array containing the initialization buffer
236 * @pll_desc: pointer to the appropriate struct dvb_pll_desc 271 * @pll_desc: pointer to the appropriate struct dvb_pll_desc
237 *
238 * @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod or the board 272 * @tuner_pass_ctrl: called to (de)activate tuner passthru of the demod or the board
239 * 273 *
240 * @dvb_adap: device's dvb_adapter. 274 * @dvb_adap: device's dvb_adapter.
@@ -244,8 +278,62 @@ struct dvb_usb_properties {
244 * @dvb_frontend: device's frontend. 278 * @dvb_frontend: device's frontend.
245 * @max_feed_count: how many feeds can be handled simultaneously by this 279 * @max_feed_count: how many feeds can be handled simultaneously by this
246 * device 280 * device
281 *
282 * @fe_init: rerouted frontend-init (wakeup) function.
247 * @fe_sleep: rerouted frontend-sleep function. 283 * @fe_sleep: rerouted frontend-sleep function.
248 * @fe_init: rerouted frontend-init (wakeup) function. 284 *
285 * @stream: the usb data stream.
286 */
287struct dvb_usb_adapter {
288 struct dvb_usb_device *dev;
289 struct dvb_usb_adapter_properties props;
290
291#define DVB_USB_ADAP_STATE_INIT 0x000
292#define DVB_USB_ADAP_STATE_DVB 0x001
293 int state;
294
295 u8 id;
296
297 int feedcount;
298 int pid_filtering;
299
300 /* tuner programming information */
301 u8 pll_addr;
302 u8 pll_init[4];
303 struct dvb_pll_desc *pll_desc;
304 int (*tuner_pass_ctrl) (struct dvb_frontend *, int, u8);
305
306 /* dvb */
307 struct dvb_adapter dvb_adap;
308 struct dmxdev dmxdev;
309 struct dvb_demux demux;
310 struct dvb_net dvb_net;
311 struct dvb_frontend *fe;
312 int max_feed_count;
313
314 int (*fe_init) (struct dvb_frontend *);
315 int (*fe_sleep) (struct dvb_frontend *);
316
317 struct usb_data_stream stream;
318
319 void *priv;
320};
321
322/**
323 * struct dvb_usb_device - object of a DVB USB device
324 * @props: copy of the struct dvb_usb_properties this device belongs to.
325 * @desc: pointer to the device's struct dvb_usb_device_description.
326 * @state: initialization and runtime state of the device.
327 *
328 * @powered: indicated whether the device is power or not.
329 * Powered is in/decremented for each call to modify the state.
330 * @udev: pointer to the device's struct usb_device.
331 *
332 * @usb_mutex: semaphore of USB control messages (reading needs two messages)
333 * @i2c_mutex: semaphore for i2c-transfers
334 *
335 * @i2c_adap: device's i2c_adapter if it uses I2CoverUSB
336 *
249 * @rc_input_dev: input device for the remote control. 337 * @rc_input_dev: input device for the remote control.
250 * @rc_query_work: struct work_struct frequent rc queries 338 * @rc_query_work: struct work_struct frequent rc queries
251 * @last_event: last triggered event 339 * @last_event: last triggered event
@@ -255,32 +343,18 @@ struct dvb_usb_properties {
255 * in size_of_priv of dvb_usb_properties). 343 * in size_of_priv of dvb_usb_properties).
256 */ 344 */
257struct dvb_usb_device { 345struct dvb_usb_device {
258 struct dvb_usb_properties props; 346 struct dvb_usb_device_properties props;
259 struct dvb_usb_device_description *desc; 347 struct dvb_usb_device_description *desc;
260 348
261#define DVB_USB_STATE_INIT 0x000
262#define DVB_USB_STATE_URB_LIST 0x001
263#define DVB_USB_STATE_URB_BUF 0x002
264#define DVB_USB_STATE_DVB 0x004
265#define DVB_USB_STATE_I2C 0x008
266#define DVB_USB_STATE_REMOTE 0x010
267#define DVB_USB_STATE_URB_SUBMIT 0x020
268 int state;
269
270 /* usb */
271 struct usb_device *udev; 349 struct usb_device *udev;
272 struct urb **urb_list;
273 350
274 int buf_num; 351#define DVB_USB_STATE_INIT 0x000
275 unsigned long buf_size; 352#define DVB_USB_STATE_I2C 0x001
276 u8 **buf_list; 353#define DVB_USB_STATE_DVB 0x002
277 dma_addr_t *dma_addr; 354#define DVB_USB_STATE_REMOTE 0x004
278 355 int state;
279 int urbs_initialized;
280 int urbs_submitted;
281 356
282 int feedcount; 357 int powered;
283 int pid_filtering;
284 358
285 /* locking */ 359 /* locking */
286 struct mutex usb_mutex; 360 struct mutex usb_mutex;
@@ -289,22 +363,8 @@ struct dvb_usb_device {
289 struct mutex i2c_mutex; 363 struct mutex i2c_mutex;
290 struct i2c_adapter i2c_adap; 364 struct i2c_adapter i2c_adap;
291 365
292 /* tuner programming information */ 366 int num_adapters_initialized;
293 u8 pll_addr; 367 struct dvb_usb_adapter adapter[MAX_NO_OF_ADAPTER_PER_DEVICE];
294 u8 pll_init[4];
295 struct dvb_pll_desc *pll_desc;
296 int (*tuner_pass_ctrl)(struct dvb_frontend *, int, u8);
297
298 /* dvb */
299 struct dvb_adapter dvb_adap;
300 struct dmxdev dmxdev;
301 struct dvb_demux demux;
302 struct dvb_net dvb_net;
303 struct dvb_frontend* fe;
304 int max_feed_count;
305
306 int (*fe_sleep) (struct dvb_frontend *);
307 int (*fe_init) (struct dvb_frontend *);
308 368
309 /* remote control */ 369 /* remote control */
310 struct input_dev *rc_input_dev; 370 struct input_dev *rc_input_dev;
@@ -318,7 +378,7 @@ struct dvb_usb_device {
318 void *priv; 378 void *priv;
319}; 379};
320 380
321extern int dvb_usb_device_init(struct usb_interface *, struct dvb_usb_properties *, struct module *, struct dvb_usb_device **); 381extern int dvb_usb_device_init(struct usb_interface *, struct dvb_usb_device_properties *, struct module *, struct dvb_usb_device **);
322extern void dvb_usb_device_exit(struct usb_interface *); 382extern void dvb_usb_device_exit(struct usb_interface *);
323 383
324/* the generic read/write method for device control */ 384/* the generic read/write method for device control */
@@ -342,5 +402,7 @@ struct hexline {
342 u8 chk; 402 u8 chk;
343}; 403};
344extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type); 404extern int usb_cypress_load_firmware(struct usb_device *udev, const struct firmware *fw, int type);
405extern int dvb_usb_get_hexline(const struct firmware *fw, struct hexline *hx, int *pos);
406
345 407
346#endif 408#endif
diff --git a/drivers/media/dvb/dvb-usb/gp8psk.c b/drivers/media/dvb/dvb-usb/gp8psk.c
index 9a98f3fdae31..7375eb20166d 100644
--- a/drivers/media/dvb/dvb-usb/gp8psk.c
+++ b/drivers/media/dvb/dvb-usb/gp8psk.c
@@ -161,19 +161,18 @@ static int gp8psk_power_ctrl(struct dvb_usb_device *d, int onoff)
161} 161}
162 162
163 163
164static int gp8psk_streaming_ctrl(struct dvb_usb_device *d, int onoff) 164static int gp8psk_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
165{ 165{
166 return gp8psk_usb_out_op(d, ARM_TRANSFER, onoff, 0 , NULL, 0); 166 return gp8psk_usb_out_op(adap->dev, ARM_TRANSFER, onoff, 0 , NULL, 0);
167} 167}
168 168
169static int gp8psk_frontend_attach(struct dvb_usb_device *d) 169static int gp8psk_frontend_attach(struct dvb_usb_adapter *adap)
170{ 170{
171 d->fe = gp8psk_fe_attach(d); 171 adap->fe = gp8psk_fe_attach(adap->dev);
172
173 return 0; 172 return 0;
174} 173}
175 174
176static struct dvb_usb_properties gp8psk_properties; 175static struct dvb_usb_device_properties gp8psk_properties;
177 176
178static int gp8psk_usb_probe(struct usb_interface *intf, 177static int gp8psk_usb_probe(struct usb_interface *intf,
179 const struct usb_device_id *id) 178 const struct usb_device_id *id)
@@ -188,20 +187,18 @@ static struct usb_device_id gp8psk_usb_table [] = {
188}; 187};
189MODULE_DEVICE_TABLE(usb, gp8psk_usb_table); 188MODULE_DEVICE_TABLE(usb, gp8psk_usb_table);
190 189
191static struct dvb_usb_properties gp8psk_properties = { 190static struct dvb_usb_device_properties gp8psk_properties = {
192 .caps = 0,
193
194 .usb_ctrl = CYPRESS_FX2, 191 .usb_ctrl = CYPRESS_FX2,
195 .firmware = "dvb-usb-gp8psk-01.fw", 192 .firmware = "dvb-usb-gp8psk-01.fw",
196 193
194 .num_adapters = 1,
195 .adapter = {
196 {
197 .streaming_ctrl = gp8psk_streaming_ctrl, 197 .streaming_ctrl = gp8psk_streaming_ctrl,
198 .power_ctrl = gp8psk_power_ctrl,
199 .frontend_attach = gp8psk_frontend_attach, 198 .frontend_attach = gp8psk_frontend_attach,
200
201 .generic_bulk_ctrl_endpoint = 0x01,
202 /* parameter for the MPEG2-data transfer */ 199 /* parameter for the MPEG2-data transfer */
203 .urb = { 200 .stream = {
204 .type = DVB_USB_BULK, 201 .type = USB_BULK,
205 .count = 7, 202 .count = 7,
206 .endpoint = 0x82, 203 .endpoint = 0x82,
207 .u = { 204 .u = {
@@ -210,6 +207,11 @@ static struct dvb_usb_properties gp8psk_properties = {
210 } 207 }
211 } 208 }
212 }, 209 },
210 }
211 },
212 .power_ctrl = gp8psk_power_ctrl,
213
214 .generic_bulk_ctrl_endpoint = 0x01,
213 215
214 .num_device_descs = 1, 216 .num_device_descs = 1,
215 .devices = { 217 .devices = {
@@ -217,7 +219,7 @@ static struct dvb_usb_properties gp8psk_properties = {
217 .cold_ids = { &gp8psk_usb_table[0], NULL }, 219 .cold_ids = { &gp8psk_usb_table[0], NULL },
218 .warm_ids = { &gp8psk_usb_table[1], NULL }, 220 .warm_ids = { &gp8psk_usb_table[1], NULL },
219 }, 221 },
220 { 0 }, 222 { NULL },
221 } 223 }
222}; 224};
223 225
diff --git a/drivers/media/dvb/dvb-usb/nova-t-usb2.c b/drivers/media/dvb/dvb-usb/nova-t-usb2.c
index 79f0a02ce987..a9219bf69b89 100644
--- a/drivers/media/dvb/dvb-usb/nova-t-usb2.c
+++ b/drivers/media/dvb/dvb-usb/nova-t-usb2.c
@@ -135,7 +135,7 @@ static int nova_t_read_mac_address (struct dvb_usb_device *d, u8 mac[6])
135} 135}
136 136
137/* USB Driver stuff */ 137/* USB Driver stuff */
138static struct dvb_usb_properties nova_t_properties; 138static struct dvb_usb_device_properties nova_t_properties;
139 139
140static int nova_t_probe(struct usb_interface *intf, 140static int nova_t_probe(struct usb_interface *intf,
141 const struct usb_device_id *id) 141 const struct usb_device_id *id)
@@ -151,34 +151,27 @@ static struct usb_device_id nova_t_table [] = {
151}; 151};
152MODULE_DEVICE_TABLE(usb, nova_t_table); 152MODULE_DEVICE_TABLE(usb, nova_t_table);
153 153
154static struct dvb_usb_properties nova_t_properties = { 154static struct dvb_usb_device_properties nova_t_properties = {
155 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_PID_FILTER_CAN_BE_TURNED_OFF | DVB_USB_IS_AN_I2C_ADAPTER, 155 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
156 .pid_filter_count = 32,
157 156
158 .usb_ctrl = CYPRESS_FX2, 157 .usb_ctrl = CYPRESS_FX2,
159 .firmware = "dvb-usb-nova-t-usb2-02.fw", 158 .firmware = "dvb-usb-nova-t-usb2-02.fw",
160 159
161 .size_of_priv = sizeof(struct dibusb_state), 160 .num_adapters = 1,
161 .adapter = {
162 {
163 .caps = DVB_USB_ADAP_HAS_PID_FILTER | DVB_USB_ADAP_PID_FILTER_CAN_BE_TURNED_OFF,
164 .pid_filter_count = 32,
162 165
163 .streaming_ctrl = dibusb2_0_streaming_ctrl, 166 .streaming_ctrl = dibusb2_0_streaming_ctrl,
164 .pid_filter = dibusb_pid_filter, 167 .pid_filter = dibusb_pid_filter,
165 .pid_filter_ctrl = dibusb_pid_filter_ctrl, 168 .pid_filter_ctrl = dibusb_pid_filter_ctrl,
166 .power_ctrl = dibusb2_0_power_ctrl,
167 .frontend_attach = dibusb_dib3000mc_frontend_attach, 169 .frontend_attach = dibusb_dib3000mc_frontend_attach,
168 .tuner_attach = dibusb_dib3000mc_tuner_attach, 170 .tuner_attach = dibusb_dib3000mc_tuner_attach,
169 .read_mac_address = nova_t_read_mac_address,
170
171 .rc_interval = 100,
172 .rc_key_map = haupp_rc_keys,
173 .rc_key_map_size = ARRAY_SIZE(haupp_rc_keys),
174 .rc_query = nova_t_rc_query,
175 171
176 .i2c_algo = &dibusb_i2c_algo,
177
178 .generic_bulk_ctrl_endpoint = 0x01,
179 /* parameter for the MPEG2-data transfer */ 172 /* parameter for the MPEG2-data transfer */
180 .urb = { 173 .stream = {
181 .type = DVB_USB_BULK, 174 .type = USB_BULK,
182 .count = 7, 175 .count = 7,
183 .endpoint = 0x06, 176 .endpoint = 0x06,
184 .u = { 177 .u = {
@@ -188,6 +181,22 @@ static struct dvb_usb_properties nova_t_properties = {
188 } 181 }
189 }, 182 },
190 183
184 .size_of_priv = sizeof(struct dibusb_state),
185 }
186 },
187
188 .power_ctrl = dibusb2_0_power_ctrl,
189 .read_mac_address = nova_t_read_mac_address,
190
191 .rc_interval = 100,
192 .rc_key_map = haupp_rc_keys,
193 .rc_key_map_size = ARRAY_SIZE(haupp_rc_keys),
194 .rc_query = nova_t_rc_query,
195
196 .i2c_algo = &dibusb_i2c_algo,
197
198 .generic_bulk_ctrl_endpoint = 0x01,
199
191 .num_device_descs = 1, 200 .num_device_descs = 1,
192 .devices = { 201 .devices = {
193 { "Hauppauge WinTV-NOVA-T usb2", 202 { "Hauppauge WinTV-NOVA-T usb2",
diff --git a/drivers/media/dvb/dvb-usb/umt-010.c b/drivers/media/dvb/dvb-usb/umt-010.c
index 418a0b707151..f9941ea88b3e 100644
--- a/drivers/media/dvb/dvb-usb/umt-010.c
+++ b/drivers/media/dvb/dvb-usb/umt-010.c
@@ -50,7 +50,7 @@ static int umt_mt352_demod_init(struct dvb_frontend *fe)
50 return 0; 50 return 0;
51} 51}
52 52
53static int umt_mt352_frontend_attach(struct dvb_usb_device *d) 53static int umt_mt352_frontend_attach(struct dvb_usb_adapter *adap)
54{ 54{
55 struct mt352_config umt_config; 55 struct mt352_config umt_config;
56 56
@@ -58,21 +58,21 @@ static int umt_mt352_frontend_attach(struct dvb_usb_device *d)
58 umt_config.demod_init = umt_mt352_demod_init; 58 umt_config.demod_init = umt_mt352_demod_init;
59 umt_config.demod_address = 0xf; 59 umt_config.demod_address = 0xf;
60 60
61 d->fe = dvb_attach(mt352_attach, &umt_config, &d->i2c_adap); 61 adap->fe = dvb_attach(mt352_attach, &umt_config, &adap->dev->i2c_adap);
62 62
63 return 0; 63 return 0;
64} 64}
65 65
66static int umt_tuner_attach (struct dvb_usb_device *d) 66static int umt_tuner_attach (struct dvb_usb_adapter *adap)
67{ 67{
68 d->pll_addr = 0x61; 68 adap->pll_addr = 0x61;
69 d->pll_desc = &dvb_pll_tua6034; 69 adap->pll_desc = &dvb_pll_tua6034;
70 d->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs; 70 adap->fe->ops.tuner_ops.calc_regs = dvb_usb_tuner_calc_regs;
71 return 0; 71 return 0;
72} 72}
73 73
74/* USB Driver stuff */ 74/* USB Driver stuff */
75static struct dvb_usb_properties umt_properties; 75static struct dvb_usb_device_properties umt_properties;
76 76
77static int umt_probe(struct usb_interface *intf, 77static int umt_probe(struct usb_interface *intf,
78 const struct usb_device_id *id) 78 const struct usb_device_id *id)
@@ -90,25 +90,22 @@ static struct usb_device_id umt_table [] = {
90}; 90};
91MODULE_DEVICE_TABLE (usb, umt_table); 91MODULE_DEVICE_TABLE (usb, umt_table);
92 92
93static struct dvb_usb_properties umt_properties = { 93static struct dvb_usb_device_properties umt_properties = {
94 .caps = DVB_USB_IS_AN_I2C_ADAPTER, 94 .caps = DVB_USB_IS_AN_I2C_ADAPTER,
95 95
96 .usb_ctrl = CYPRESS_FX2, 96 .usb_ctrl = CYPRESS_FX2,
97 .firmware = "dvb-usb-umt-010-02.fw", 97 .firmware = "dvb-usb-umt-010-02.fw",
98 98
99 .size_of_priv = sizeof(struct dibusb_state), 99 .num_adapters = 1,
100 100 .adapter = {
101 {
101 .streaming_ctrl = dibusb2_0_streaming_ctrl, 102 .streaming_ctrl = dibusb2_0_streaming_ctrl,
102 .power_ctrl = dibusb_power_ctrl,
103 .frontend_attach = umt_mt352_frontend_attach, 103 .frontend_attach = umt_mt352_frontend_attach,
104 .tuner_attach = umt_tuner_attach, 104 .tuner_attach = umt_tuner_attach,
105 105
106 .i2c_algo = &dibusb_i2c_algo,
107
108 .generic_bulk_ctrl_endpoint = 0x01,
109 /* parameter for the MPEG2-data transfer */ 106 /* parameter for the MPEG2-data transfer */
110 .urb = { 107 .stream = {
111 .type = DVB_USB_BULK, 108 .type = USB_BULK,
112 .count = 20, 109 .count = 20,
113 .endpoint = 0x06, 110 .endpoint = 0x06,
114 .u = { 111 .u = {
@@ -118,6 +115,15 @@ static struct dvb_usb_properties umt_properties = {
118 } 115 }
119 }, 116 },
120 117
118 .size_of_priv = sizeof(struct dibusb_state),
119 }
120 },
121 .power_ctrl = dibusb_power_ctrl,
122
123 .i2c_algo = &dibusb_i2c_algo,
124
125 .generic_bulk_ctrl_endpoint = 0x01,
126
121 .num_device_descs = 1, 127 .num_device_descs = 1,
122 .devices = { 128 .devices = {
123 { "Hanftek UMT-010 DVB-T USB2.0", 129 { "Hanftek UMT-010 DVB-T USB2.0",
diff --git a/drivers/media/dvb/dvb-usb/usb-urb.c b/drivers/media/dvb/dvb-usb/usb-urb.c
new file mode 100644
index 000000000000..8728cf347a71
--- /dev/null
+++ b/drivers/media/dvb/dvb-usb/usb-urb.c
@@ -0,0 +1,242 @@
1/* usb-urb.c is part of the DVB USB library.
2 *
3 * Copyright (C) 2004-6 Patrick Boettcher (patrick.boettcher@desy.de)
4 * see dvb-usb-init.c for copyright information.
5 *
6 * This file keeps functions for initializing and handling the
7 * BULK and ISOC USB data transfers in a generic way.
8 * Can be used for DVB-only and also, that's the plan, for
9 * Hybrid USB devices (analog and DVB).
10 */
11#include "dvb-usb-common.h"
12
13/* URB stuff for streaming */
14static void usb_urb_complete(struct urb *urb, struct pt_regs *ptregs)
15{
16 struct usb_data_stream *stream = urb->context;
17 int ptype = usb_pipetype(urb->pipe);
18 int i;
19 u8 *b;
20
21 deb_uxfer("'%s' urb completed. status: %d, length: %d/%d, pack_num: %d, errors: %d\n",
22 ptype == PIPE_ISOCHRONOUS ? "isoc" : "bulk",
23 urb->status,urb->actual_length,urb->transfer_buffer_length,
24 urb->number_of_packets,urb->error_count);
25
26 switch (urb->status) {
27 case 0: /* success */
28 case -ETIMEDOUT: /* NAK */
29 break;
30 case -ECONNRESET: /* kill */
31 case -ENOENT:
32 case -ESHUTDOWN:
33 return;
34 default: /* error */
35 deb_ts("urb completition error %d.\n", urb->status);
36 break;
37 }
38
39 b = (u8 *) urb->transfer_buffer;
40 switch (ptype) {
41 case PIPE_ISOCHRONOUS:
42 for (i = 0; i < urb->number_of_packets; i++) {
43
44 if (urb->iso_frame_desc[i].status != 0)
45 deb_ts("iso frame descriptor has an error: %d\n",urb->iso_frame_desc[i].status);
46 else if (urb->iso_frame_desc[i].actual_length > 0)
47 stream->complete(stream, b + urb->iso_frame_desc[i].offset, urb->iso_frame_desc[i].actual_length);
48
49 urb->iso_frame_desc[i].status = 0;
50 urb->iso_frame_desc[i].actual_length = 0;
51 }
52 debug_dump(b,20,deb_uxfer);
53 break;
54 case PIPE_BULK:
55 if (urb->actual_length > 0)
56 stream->complete(stream, b, urb->actual_length);
57 break;
58 default:
59 err("unkown endpoint type in completition handler.");
60 return;
61 }
62 usb_submit_urb(urb,GFP_ATOMIC);
63}
64
65int usb_urb_kill(struct usb_data_stream *stream)
66{
67 int i;
68 for (i = 0; i < stream->urbs_submitted; i++) {
69 deb_ts("killing URB no. %d.\n",i);
70
71 /* stop the URB */
72 usb_kill_urb(stream->urb_list[i]);
73 }
74 stream->urbs_submitted = 0;
75 return 0;
76}
77
78int usb_urb_submit(struct usb_data_stream *stream)
79{
80 int i,ret;
81 for (i = 0; i < stream->urbs_initialized; i++) {
82 deb_ts("submitting URB no. %d\n",i);
83 if ((ret = usb_submit_urb(stream->urb_list[i],GFP_ATOMIC))) {
84 err("could not submit URB no. %d - get them all back",i);
85 usb_urb_kill(stream);
86 return ret;
87 }
88 stream->urbs_submitted++;
89 }
90 return 0;
91}
92
93static int usb_free_stream_buffers(struct usb_data_stream *stream)
94{
95 if (stream->state & USB_STATE_URB_BUF) {
96 while (stream->buf_num) {
97 stream->buf_num--;
98 deb_mem("freeing buffer %d\n",stream->buf_num);
99 usb_buffer_free(stream->udev, stream->buf_size,
100 stream->buf_list[stream->buf_num], stream->dma_addr[stream->buf_num]);
101 }
102 }
103
104 stream->state &= ~USB_STATE_URB_BUF;
105
106 return 0;
107}
108
109static int usb_allocate_stream_buffers(struct usb_data_stream *stream, int num, unsigned long size)
110{
111 stream->buf_num = 0;
112 stream->buf_size = size;
113
114 deb_mem("all in all I will use %lu bytes for streaming\n",num*size);
115
116 for (stream->buf_num = 0; stream->buf_num < num; stream->buf_num++) {
117 deb_mem("allocating buffer %d\n",stream->buf_num);
118 if (( stream->buf_list[stream->buf_num] =
119 usb_buffer_alloc(stream->udev, size, SLAB_ATOMIC,
120 &stream->dma_addr[stream->buf_num]) ) == NULL) {
121 deb_mem("not enough memory for urb-buffer allocation.\n");
122 usb_free_stream_buffers(stream);
123 return -ENOMEM;
124 }
125 deb_mem("buffer %d: %p (dma: %u)\n",
126 stream->buf_num, stream->buf_list[stream->buf_num], stream->dma_addr[stream->buf_num]);
127 memset(stream->buf_list[stream->buf_num],0,size);
128 stream->state |= USB_STATE_URB_BUF;
129 }
130 deb_mem("allocation successful\n");
131
132 return 0;
133}
134
135static int usb_bulk_urb_init(struct usb_data_stream *stream)
136{
137 int i;
138
139 if ((i = usb_allocate_stream_buffers(stream,stream->props.count,
140 stream->props.u.bulk.buffersize)) < 0)
141 return i;
142
143 /* allocate the URBs */
144 for (i = 0; i < stream->props.count; i++) {
145 if ((stream->urb_list[i] = usb_alloc_urb(0,GFP_ATOMIC)) == NULL)
146 return -ENOMEM;
147
148 usb_fill_bulk_urb( stream->urb_list[i], stream->udev,
149 usb_rcvbulkpipe(stream->udev,stream->props.endpoint),
150 stream->buf_list[i],
151 stream->props.u.bulk.buffersize,
152 usb_urb_complete, stream);
153
154 stream->urb_list[i]->transfer_flags = 0;
155 stream->urbs_initialized++;
156 }
157 return 0;
158}
159
160static int usb_isoc_urb_init(struct usb_data_stream *stream)
161{
162 int i,j;
163
164 if ((i = usb_allocate_stream_buffers(stream,stream->props.count,
165 stream->props.u.isoc.framesize*stream->props.u.isoc.framesperurb)) < 0)
166 return i;
167
168 /* allocate the URBs */
169 for (i = 0; i < stream->props.count; i++) {
170 struct urb *urb;
171 int frame_offset = 0;
172 if ((stream->urb_list[i] =
173 usb_alloc_urb(stream->props.u.isoc.framesperurb,GFP_ATOMIC)) == NULL)
174 return -ENOMEM;
175
176 urb = stream->urb_list[i];
177
178 urb->dev = stream->udev;
179 urb->context = stream;
180 urb->complete = usb_urb_complete;
181 urb->pipe = usb_rcvisocpipe(stream->udev,stream->props.endpoint);
182 urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP;
183 urb->interval = stream->props.u.isoc.interval;
184 urb->number_of_packets = stream->props.u.isoc.framesperurb;
185 urb->transfer_buffer_length = stream->buf_size;
186 urb->transfer_buffer = stream->buf_list[i];
187 urb->transfer_dma = stream->dma_addr[i];
188
189 for (j = 0; j < stream->props.u.isoc.framesperurb; j++) {
190 urb->iso_frame_desc[j].offset = frame_offset;
191 urb->iso_frame_desc[j].length = stream->props.u.isoc.framesize;
192 frame_offset += stream->props.u.isoc.framesize;
193 }
194
195 stream->urbs_initialized++;
196 }
197 return 0;
198}
199
200int usb_urb_init(struct usb_data_stream *stream, struct usb_data_stream_properties *props)
201{
202 if (stream == NULL || props == NULL)
203 return -EINVAL;
204
205 memcpy(&stream->props, props, sizeof(*props));
206
207 usb_clear_halt(stream->udev,usb_rcvbulkpipe(stream->udev,stream->props.endpoint));
208
209 if (stream->complete == NULL) {
210 err("there is no data callback - this doesn't make sense.");
211 return -EINVAL;
212 }
213
214 switch (stream->props.type) {
215 case USB_BULK:
216 return usb_bulk_urb_init(stream);
217 case USB_ISOC:
218 return usb_isoc_urb_init(stream);
219 default:
220 err("unkown URB-type for data transfer.");
221 return -EINVAL;
222 }
223}
224
225int usb_urb_exit(struct usb_data_stream *stream)
226{
227 int i;
228
229 usb_urb_kill(stream);
230
231 for (i = 0; i < stream->urbs_initialized; i++) {
232 if (stream->urb_list[i] != NULL) {
233 deb_mem("freeing URB no. %d.\n",i);
234 /* free the URBs */
235 usb_free_urb(stream->urb_list[i]);
236 }
237 }
238 stream->urbs_initialized = 0;
239
240 usb_free_stream_buffers(stream);
241 return 0;
242}
diff --git a/drivers/media/dvb/dvb-usb/vp702x-fe.c b/drivers/media/dvb/dvb-usb/vp702x-fe.c
index d4da494132ec..3ecb2e0ce80f 100644
--- a/drivers/media/dvb/dvb-usb/vp702x-fe.c
+++ b/drivers/media/dvb/dvb-usb/vp702x-fe.c
@@ -24,6 +24,8 @@ struct vp702x_fe_state {
24 struct dvb_frontend fe; 24 struct dvb_frontend fe;
25 struct dvb_usb_device *d; 25 struct dvb_usb_device *d;
26 26
27 struct dvb_frontend_ops ops;
28
27 fe_sec_voltage_t voltage; 29 fe_sec_voltage_t voltage;
28 fe_sec_tone_mode_t tone_mode; 30 fe_sec_tone_mode_t tone_mode;
29 31
@@ -72,9 +74,6 @@ static int vp702x_fe_read_status(struct dvb_frontend* fe, fe_status_t *status)
72 else 74 else
73 *status = 0; 75 *status = 0;
74 76
75 deb_fe("real state: %x\n",*status);
76 *status = 0x1f;
77
78 if (*status & FE_HAS_LOCK) 77 if (*status & FE_HAS_LOCK)
79 st->status_check_interval = 1000; 78 st->status_check_interval = 1000;
80 else 79 else
@@ -171,8 +170,6 @@ static int vp702x_fe_set_frontend(struct dvb_frontend* fe,
171 st->status_check_interval = 250; 170 st->status_check_interval = 250;
172 st->next_status_check = jiffies; 171 st->next_status_check = jiffies;
173 172
174 vp702x_usb_in_op(st->d, RESET_TUNER, 0, 0, NULL, 0);
175 msleep(30);
176 vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100); 173 vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100);
177 174
178 if (ibuf[2] == 0 && ibuf[3] == 0) 175 if (ibuf[2] == 0 && ibuf[3] == 0)
@@ -183,6 +180,20 @@ static int vp702x_fe_set_frontend(struct dvb_frontend* fe,
183 return 0; 180 return 0;
184} 181}
185 182
183static int vp702x_fe_init(struct dvb_frontend *fe)
184{
185 struct vp702x_fe_state *st = fe->demodulator_priv;
186 deb_fe("%s\n",__FUNCTION__);
187 vp702x_usb_in_op(st->d, RESET_TUNER, 0, 0, NULL, 0);
188 return 0;
189}
190
191static int vp702x_fe_sleep(struct dvb_frontend *fe)
192{
193 deb_fe("%s\n",__FUNCTION__);
194 return 0;
195}
196
186static int vp702x_fe_get_frontend(struct dvb_frontend* fe, 197static int vp702x_fe_get_frontend(struct dvb_frontend* fe,
187 struct dvb_frontend_parameters *fep) 198 struct dvb_frontend_parameters *fep)
188{ 199{
@@ -193,8 +204,8 @@ static int vp702x_fe_get_frontend(struct dvb_frontend* fe,
193static int vp702x_fe_send_diseqc_msg (struct dvb_frontend* fe, 204static int vp702x_fe_send_diseqc_msg (struct dvb_frontend* fe,
194 struct dvb_diseqc_master_cmd *m) 205 struct dvb_diseqc_master_cmd *m)
195{ 206{
196 struct vp702x_fe_state *st = fe->demodulator_priv; 207 //struct vp702x_fe_state *st = fe->demodulator_priv;
197 u8 cmd[8],ibuf[10]; 208 u8 cmd[8];//,ibuf[10];
198 memset(cmd,0,8); 209 memset(cmd,0,8);
199 210
200 deb_fe("%s\n",__FUNCTION__); 211 deb_fe("%s\n",__FUNCTION__);
@@ -207,12 +218,12 @@ static int vp702x_fe_send_diseqc_msg (struct dvb_frontend* fe,
207 memcpy(&cmd[3], m->msg, m->msg_len); 218 memcpy(&cmd[3], m->msg, m->msg_len);
208 cmd[7] = vp702x_chksum(cmd,0,7); 219 cmd[7] = vp702x_chksum(cmd,0,7);
209 220
210 vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100); 221// vp702x_usb_inout_op(st->d,cmd,8,ibuf,10,100);
211 222
212 if (ibuf[2] == 0 && ibuf[3] == 0) 223// if (ibuf[2] == 0 && ibuf[3] == 0)
213 deb_fe("diseqc cmd failed.\n"); 224// deb_fe("diseqc cmd failed.\n");
214 else 225// else
215 deb_fe("diseqc cmd succeeded.\n"); 226// deb_fe("diseqc cmd succeeded.\n");
216 227
217 return 0; 228 return 0;
218} 229}
@@ -318,8 +329,8 @@ static struct dvb_frontend_ops vp702x_fe_ops = {
318 }, 329 },
319 .release = vp702x_fe_release, 330 .release = vp702x_fe_release,
320 331
321 .init = NULL, 332 .init = vp702x_fe_init,
322 .sleep = NULL, 333 .sleep = vp702x_fe_sleep,
323 334
324 .set_frontend = vp702x_fe_set_frontend, 335 .set_frontend = vp702x_fe_set_frontend,
325 .get_frontend = vp702x_fe_get_frontend, 336 .get_frontend = vp702x_fe_get_frontend,
diff --git a/drivers/media/dvb/dvb-usb/vp702x.c b/drivers/media/dvb/dvb-usb/vp702x.c
index b2f098a2d5f7..02bd61aaac66 100644
--- a/drivers/media/dvb/dvb-usb/vp702x.c
+++ b/drivers/media/dvb/dvb-usb/vp702x.c
@@ -22,50 +22,54 @@ module_param_named(debug,dvb_usb_vp702x_debug, int, 0644);
22MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS); 22MODULE_PARM_DESC(debug, "set debugging level (1=info,xfer=2,rc=4 (or-able))." DVB_USB_DEBUG_STATUS);
23 23
24struct vp702x_state { 24struct vp702x_state {
25 u8 pid_table[17]; /* [16] controls the pid_table state */ 25 int pid_filter_count;
26 int pid_filter_can_bypass;
27 u8 pid_filter_state;
28};
29
30struct vp702x_device_state {
31 u8 power_state;
26}; 32};
27 33
28/* check for mutex FIXME */ 34/* check for mutex FIXME */
29int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen) 35int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen)
30{ 36{
31 int ret = 0,try = 0; 37 int ret = -1;
32 38
33 while (ret >= 0 && ret != blen && try < 3) {
34 ret = usb_control_msg(d->udev, 39 ret = usb_control_msg(d->udev,
35 usb_rcvctrlpipe(d->udev,0), 40 usb_rcvctrlpipe(d->udev,0),
36 req, 41 req,
37 USB_TYPE_VENDOR | USB_DIR_IN, 42 USB_TYPE_VENDOR | USB_DIR_IN,
38 value,index,b,blen, 43 value,index,b,blen,
39 2000); 44 2000);
40 deb_info("reading number %d (ret: %d)\n",try,ret);
41 try++;
42 }
43 45
44 if (ret < 0 || ret != blen) { 46 if (ret < 0) {
45 warn("usb in operation failed."); 47 warn("usb in operation failed. (%d)", ret);
46 ret = -EIO; 48 ret = -EIO;
47 } else 49 } else
48 ret = 0; 50 ret = 0;
49 51
50 deb_xfer("in: req. %x, val: %x, ind: %x, buffer: ",req,value,index); 52
53 deb_xfer("in: req. %02x, val: %04x, ind: %04x, buffer: ",req,value,index);
51 debug_dump(b,blen,deb_xfer); 54 debug_dump(b,blen,deb_xfer);
52 55
53 return ret; 56 return ret;
54} 57}
55 58
56static int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, 59int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value,
57 u16 index, u8 *b, int blen) 60 u16 index, u8 *b, int blen)
58{ 61{
59 deb_xfer("out: req. %x, val: %x, ind: %x, buffer: ",req,value,index); 62 int ret;
63 deb_xfer("out: req. %02x, val: %04x, ind: %04x, buffer: ",req,value,index);
60 debug_dump(b,blen,deb_xfer); 64 debug_dump(b,blen,deb_xfer);
61 65
62 if (usb_control_msg(d->udev, 66 if ((ret = usb_control_msg(d->udev,
63 usb_sndctrlpipe(d->udev,0), 67 usb_sndctrlpipe(d->udev,0),
64 req, 68 req,
65 USB_TYPE_VENDOR | USB_DIR_OUT, 69 USB_TYPE_VENDOR | USB_DIR_OUT,
66 value,index,b,blen, 70 value,index,b,blen,
67 2000) != blen) { 71 2000)) != blen) {
68 warn("usb out operation failed."); 72 warn("usb out operation failed. (%d)",ret);
69 return -EIO; 73 return -EIO;
70 } else 74 } else
71 return 0; 75 return 0;
@@ -78,12 +82,10 @@ int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int il
78 if ((ret = mutex_lock_interruptible(&d->usb_mutex))) 82 if ((ret = mutex_lock_interruptible(&d->usb_mutex)))
79 return ret; 83 return ret;
80 84
81 if ((ret = vp702x_usb_out_op(d,REQUEST_OUT,0,0,o,olen)) < 0) 85 ret = vp702x_usb_out_op(d,REQUEST_OUT,0,0,o,olen);
82 goto unlock;
83 msleep(msec); 86 msleep(msec);
84 ret = vp702x_usb_in_op(d,REQUEST_IN,0,0,i,ilen); 87 ret = vp702x_usb_in_op(d,REQUEST_IN,0,0,i,ilen);
85 88
86unlock:
87 mutex_unlock(&d->usb_mutex); 89 mutex_unlock(&d->usb_mutex);
88 90
89 return ret; 91 return ret;
@@ -108,29 +110,65 @@ static int vp702x_usb_inout_cmd(struct dvb_usb_device *d, u8 cmd, u8 *o,
108 return ret; 110 return ret;
109} 111}
110 112
111static int vp702x_pid_filter(struct dvb_usb_device *d, int index, u16 pid, int onoff) 113static int vp702x_set_pld_mode(struct dvb_usb_adapter *adap, u8 bypass)
114{
115 u8 buf[16] = { 0 };
116 return vp702x_usb_in_op(adap->dev, 0xe0, (bypass << 8) | 0x0e, 0, buf, 16);
117}
118
119static int vp702x_set_pld_state(struct dvb_usb_adapter *adap, u8 state)
120{
121 u8 buf[16] = { 0 };
122 return vp702x_usb_in_op(adap->dev, 0xe0, (state << 8) | 0x0f, 0, buf, 16);
123}
124
125static int vp702x_set_pid(struct dvb_usb_adapter *adap, u16 pid, u8 id, int onoff)
112{ 126{
113 struct vp702x_state *st = d->priv; 127 struct vp702x_state *st = adap->priv;
114 u8 buf[9]; 128 u8 buf[16] = { 0 };
115 129
116 if (onoff) { 130 if (onoff)
117 st->pid_table[16] |= 1 << index; 131 st->pid_filter_state |= (1 << id);
118 st->pid_table[index*2] = (pid >> 8) & 0xff; 132 else {
119 st->pid_table[index*2+1] = pid & 0xff; 133 st->pid_filter_state &= ~(1 << id);
120 } else { 134 pid = 0xffff;
121 st->pid_table[16] &= ~(1 << index);
122 st->pid_table[index*2] = st->pid_table[index*2+1] = 0;
123 } 135 }
124 136
125 return vp702x_usb_inout_cmd(d,SET_PID_FILTER,st->pid_table,17,buf,9,10); 137 id = 0x10 + id*2;
138
139 vp702x_set_pld_state(adap, st->pid_filter_state);
140 vp702x_usb_in_op(adap->dev, 0xe0, (((pid >> 8) & 0xff) << 8) | (id), 0, buf, 16);
141 vp702x_usb_in_op(adap->dev, 0xe0, (((pid ) & 0xff) << 8) | (id+1), 0, buf, 16);
142 return 0;
126} 143}
127 144
128static int vp702x_power_ctrl(struct dvb_usb_device *d, int onoff) 145
146static int vp702x_init_pid_filter(struct dvb_usb_adapter *adap)
129{ 147{
130 vp702x_usb_in_op(d,RESET_TUNER,0,0,NULL,0); 148 struct vp702x_state *st = adap->priv;
149 int i;
150 u8 b[10] = { 0 };
151
152 st->pid_filter_count = 8;
153 st->pid_filter_can_bypass = 1;
154 st->pid_filter_state = 0x00;
155
156 vp702x_set_pld_mode(adap, 1); // bypass
157
158 for (i = 0; i < st->pid_filter_count; i++)
159 vp702x_set_pid(adap, 0xffff, i, 1);
131 160
132 vp702x_usb_in_op(d,SET_TUNER_POWER_REQ,0,onoff,NULL,0); 161 vp702x_usb_in_op(adap->dev, 0xb5, 3, 0, b, 10);
133 return vp702x_usb_in_op(d,SET_TUNER_POWER_REQ,0,onoff,NULL,0); 162 vp702x_usb_in_op(adap->dev, 0xb5, 0, 0, b, 10);
163 vp702x_usb_in_op(adap->dev, 0xb5, 1, 0, b, 10);
164
165 //vp702x_set_pld_mode(d, 0); // filter
166 return 0;
167}
168
169static int vp702x_streaming_ctrl(struct dvb_usb_adapter *adap, int onoff)
170{
171 return 0;
134} 172}
135 173
136/* keys for the enclosed remote control */ 174/* keys for the enclosed remote control */
@@ -166,74 +204,83 @@ static int vp702x_rc_query(struct dvb_usb_device *d, u32 *event, int *state)
166 return 0; 204 return 0;
167} 205}
168 206
207int vp702x_power_ctrl(struct dvb_usb_device *d, int onoff)
208{
209 struct vp702x_device_state *st = d->priv;
210
211 if (st->power_state == 0 && onoff)
212 vp702x_usb_out_op(d, SET_TUNER_POWER_REQ, 1, 7, NULL, 0);
213 else if (st->power_state == 1 && onoff == 0)
214 vp702x_usb_out_op(d, SET_TUNER_POWER_REQ, 0, 7, NULL, 0);
215
216 st->power_state = onoff;
217
218 return 0;
219}
220
169static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6]) 221static int vp702x_read_mac_addr(struct dvb_usb_device *d,u8 mac[6])
170{ 222{
171 u8 macb[9]; 223 u8 i;
172 if (vp702x_usb_inout_cmd(d, GET_MAC_ADDRESS, NULL, 0, macb, 9, 10)) 224 for (i = 6; i < 12; i++)
173 return -EIO; 225 vp702x_usb_in_op(d, READ_EEPROM_REQ, i, 1, &mac[i - 6], 1);
174 memcpy(mac,&macb[3],6);
175 return 0; 226 return 0;
176} 227}
177 228
178static int vp702x_frontend_attach(struct dvb_usb_device *d) 229static int vp702x_frontend_attach(struct dvb_usb_adapter *adap)
179{ 230{
180 u8 buf[9] = { 0 }; 231 u8 buf[10] = { 0 };
232
233 vp702x_usb_out_op(adap->dev, SET_TUNER_POWER_REQ, 0, 7, NULL, 0);
181 234
182 if (vp702x_usb_inout_cmd(d, GET_SYSTEM_STRING, NULL, 0, buf, 9, 10)) 235 if (vp702x_usb_inout_cmd(adap->dev, GET_SYSTEM_STRING, NULL, 0, buf, 10, 10))
183 return -EIO; 236 return -EIO;
184 237
185 buf[8] = '\0'; 238 buf[9] = '\0';
186 info("system string: %s",&buf[1]); 239 info("system string: %s",&buf[1]);
187 240
188 d->fe = vp702x_fe_attach(d); 241 vp702x_init_pid_filter(adap);
242
243 adap->fe = vp702x_fe_attach(adap->dev);
244 vp702x_usb_out_op(adap->dev, SET_TUNER_POWER_REQ, 1, 7, NULL, 0);
245
189 return 0; 246 return 0;
190} 247}
191 248
192static struct dvb_usb_properties vp702x_properties; 249static struct dvb_usb_device_properties vp702x_properties;
193 250
194static int vp702x_usb_probe(struct usb_interface *intf, 251static int vp702x_usb_probe(struct usb_interface *intf,
195 const struct usb_device_id *id) 252 const struct usb_device_id *id)
196{ 253{
197 struct usb_device *udev = interface_to_usbdev(intf);
198
199 usb_clear_halt(udev,usb_sndctrlpipe(udev,0));
200 usb_clear_halt(udev,usb_rcvctrlpipe(udev,0));
201
202 return dvb_usb_device_init(intf,&vp702x_properties,THIS_MODULE,NULL); 254 return dvb_usb_device_init(intf,&vp702x_properties,THIS_MODULE,NULL);
203} 255}
204 256
205static struct usb_device_id vp702x_usb_table [] = { 257static struct usb_device_id vp702x_usb_table [] = {
206 { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7021_COLD) }, 258 { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7021_COLD) },
207 { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7021_WARM) }, 259// { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7020_COLD) },
208 { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7020_COLD) }, 260// { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7020_WARM) },
209 { USB_DEVICE(USB_VID_VISIONPLUS, USB_PID_TWINHAN_VP7020_WARM) },
210 { 0 }, 261 { 0 },
211}; 262};
212MODULE_DEVICE_TABLE(usb, vp702x_usb_table); 263MODULE_DEVICE_TABLE(usb, vp702x_usb_table);
213 264
214static struct dvb_usb_properties vp702x_properties = { 265static struct dvb_usb_device_properties vp702x_properties = {
215 .caps = DVB_USB_HAS_PID_FILTER | DVB_USB_NEED_PID_FILTERING,
216 .pid_filter_count = 8, /* !!! */
217
218 .usb_ctrl = CYPRESS_FX2, 266 .usb_ctrl = CYPRESS_FX2,
219 .firmware = "dvb-usb-vp702x-01.fw", 267 .firmware = "dvb-usb-vp702x-02.fw",
268 .no_reconnect = 1,
220 269
221 .pid_filter = vp702x_pid_filter, 270 .size_of_priv = sizeof(struct vp702x_device_state),
222 .power_ctrl = vp702x_power_ctrl,
223 .frontend_attach = vp702x_frontend_attach,
224 .read_mac_address = vp702x_read_mac_addr,
225 271
226 .rc_key_map = vp702x_rc_keys, 272 .num_adapters = 1,
227 .rc_key_map_size = ARRAY_SIZE(vp702x_rc_keys), 273 .adapter = {
228 .rc_interval = 400, 274 {
229 .rc_query = vp702x_rc_query, 275 .caps = DVB_USB_ADAP_RECEIVES_204_BYTE_TS,
230 276
231 .size_of_priv = sizeof(struct vp702x_state), 277 .streaming_ctrl = vp702x_streaming_ctrl,
278 .frontend_attach = vp702x_frontend_attach,
232 279
233 /* parameter for the MPEG2-data transfer */ 280 /* parameter for the MPEG2-data transfer */
234 .urb = { 281 .stream = {
235 .type = DVB_USB_BULK, 282 .type = USB_BULK,
236 .count = 7, 283 .count = 10,
237 .endpoint = 0x02, 284 .endpoint = 0x02,
238 .u = { 285 .u = {
239 .bulk = { 286 .bulk = {
@@ -241,24 +288,33 @@ static struct dvb_usb_properties vp702x_properties = {
241 } 288 }
242 } 289 }
243 }, 290 },
291 .size_of_priv = sizeof(struct vp702x_state),
292 }
293 },
294 .read_mac_address = vp702x_read_mac_addr,
295
296 .rc_key_map = vp702x_rc_keys,
297 .rc_key_map_size = ARRAY_SIZE(vp702x_rc_keys),
298 .rc_interval = 400,
299 .rc_query = vp702x_rc_query,
244 300
245 .num_device_descs = 2, 301 .num_device_descs = 1,
246 .devices = { 302 .devices = {
247 { .name = "TwinhanDTV StarBox DVB-S USB2.0 (VP7021)", 303 { .name = "TwinhanDTV StarBox DVB-S USB2.0 (VP7021)",
248 .cold_ids = { &vp702x_usb_table[0], NULL }, 304 .cold_ids = { &vp702x_usb_table[0], NULL },
249 .warm_ids = { &vp702x_usb_table[1], NULL }, 305 .warm_ids = { NULL },
250 }, 306 },
251 { .name = "TwinhanDTV StarBox DVB-S USB2.0 (VP7020)", 307/* { .name = "TwinhanDTV StarBox DVB-S USB2.0 (VP7020)",
252 .cold_ids = { &vp702x_usb_table[2], NULL }, 308 .cold_ids = { &vp702x_usb_table[2], NULL },
253 .warm_ids = { &vp702x_usb_table[3], NULL }, 309 .warm_ids = { &vp702x_usb_table[3], NULL },
254 }, 310 },
255 { 0 }, 311*/ { NULL },
256 } 312 }
257}; 313};
258 314
259/* usb specific object needed to register this driver with the usb subsystem */ 315/* usb specific object needed to register this driver with the usb subsystem */
260static struct usb_driver vp702x_usb_driver = { 316static struct usb_driver vp702x_usb_driver = {
261 .name = "dvb-usb-vp702x", 317 .name = "dvb_usb_vp702x",
262 .probe = vp702x_usb_probe, 318 .probe = vp702x_usb_probe,
263 .disconnect = dvb_usb_device_exit, 319 .disconnect = dvb_usb_device_exit,
264 .id_table = vp702x_usb_table, 320 .id_table = vp702x_usb_table,
@@ -287,5 +343,5 @@ module_exit(vp702x_usb_module_exit);
287 343
288MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>"); 344MODULE_AUTHOR("Patrick Boettcher <patrick.boettcher@desy.de>");
289MODULE_DESCRIPTION("Driver for Twinhan StarBox DVB-S USB2.0 and clones"); 345MODULE_DESCRIPTION("Driver for Twinhan StarBox DVB-S USB2.0 and clones");
290MODULE_VERSION("1.0-alpha"); 346MODULE_VERSION("1.0");
291MODULE_LICENSE("GPL"); 347MODULE_LICENSE("GPL");
diff --git a/drivers/media/dvb/dvb-usb/vp702x.h b/drivers/media/dvb/dvb-usb/vp702x.h
index c2f97f96c21f..25a9dee4c824 100644
--- a/drivers/media/dvb/dvb-usb/vp702x.h
+++ b/drivers/media/dvb/dvb-usb/vp702x.h
@@ -102,5 +102,7 @@ extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d);
102 102
103extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec); 103extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec);
104extern int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen); 104extern int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen);
105extern int vp702x_usb_out_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen);
106extern int vp702x_power_ctrl(struct dvb_usb_device *d, int onoff);
105 107
106#endif 108#endif
diff --git a/drivers/media/dvb/dvb-usb/vp7045.c b/drivers/media/dvb/dvb-usb/vp7045.c
index 8ea3834a6cf8..b4cf002703a7 100644
--- a/drivers/media/dvb/dvb-usb/vp7045.c
+++ b/drivers/media/dvb/dvb-usb/vp7045.c
@@ -169,31 +169,31 @@ static int vp7045_read_mac_addr(struct dvb_usb_device *d,u8 mac[6])
169 return vp7045_read_eeprom(d,mac, 6, MAC_0_ADDR); 169 return vp7045_read_eeprom(d,mac, 6, MAC_0_ADDR);
170} 170}
171 171
172static int vp7045_frontend_attach(struct dvb_usb_device *d) 172static int vp7045_frontend_attach(struct dvb_usb_adapter *adap)
173{ 173{
174 u8 buf[255] = { 0 }; 174 u8 buf[255] = { 0 };
175 175
176 vp7045_usb_op(d,VENDOR_STRING_READ,NULL,0,buf,20,0); 176 vp7045_usb_op(adap->dev,VENDOR_STRING_READ,NULL,0,buf,20,0);
177 buf[10] = '\0'; 177 buf[10] = '\0';
178 deb_info("firmware says: %s ",buf); 178 deb_info("firmware says: %s ",buf);
179 179
180 vp7045_usb_op(d,PRODUCT_STRING_READ,NULL,0,buf,20,0); 180 vp7045_usb_op(adap->dev,PRODUCT_STRING_READ,NULL,0,buf,20,0);
181 buf[10] = '\0'; 181 buf[10] = '\0';
182 deb_info("%s ",buf); 182 deb_info("%s ",buf);
183 183
184 vp7045_usb_op(d,FW_VERSION_READ,NULL,0,buf,20,0); 184 vp7045_usb_op(adap->dev,FW_VERSION_READ,NULL,0,buf,20,0);
185 buf[10] = '\0'; 185 buf[10] = '\0';
186 deb_info("v%s\n",buf); 186 deb_info("v%s\n",buf);
187 187
188/* Dump the EEPROM */ 188/* Dump the EEPROM */
189/* vp7045_read_eeprom(d,buf, 255, FX2_ID_ADDR); */ 189/* vp7045_read_eeprom(d,buf, 255, FX2_ID_ADDR); */
190 190
191 d->fe = vp7045_fe_attach(d); 191 adap->fe = vp7045_fe_attach(adap->dev);
192 192
193 return 0; 193 return 0;
194} 194}
195 195
196static struct dvb_usb_properties vp7045_properties; 196static struct dvb_usb_device_properties vp7045_properties;
197 197
198static int vp7045_usb_probe(struct usb_interface *intf, 198static int vp7045_usb_probe(struct usb_interface *intf,
199 const struct usb_device_id *id) 199 const struct usb_device_id *id)
@@ -210,24 +210,17 @@ static struct usb_device_id vp7045_usb_table [] = {
210}; 210};
211MODULE_DEVICE_TABLE(usb, vp7045_usb_table); 211MODULE_DEVICE_TABLE(usb, vp7045_usb_table);
212 212
213static struct dvb_usb_properties vp7045_properties = { 213static struct dvb_usb_device_properties vp7045_properties = {
214 .caps = 0,
215
216 .usb_ctrl = CYPRESS_FX2, 214 .usb_ctrl = CYPRESS_FX2,
217 .firmware = "dvb-usb-vp7045-01.fw", 215 .firmware = "dvb-usb-vp7045-01.fw",
218 216
219 .power_ctrl = vp7045_power_ctrl, 217 .num_adapters = 1,
218 .adapter = {
219 {
220 .frontend_attach = vp7045_frontend_attach, 220 .frontend_attach = vp7045_frontend_attach,
221 .read_mac_address = vp7045_read_mac_addr,
222
223 .rc_interval = 400,
224 .rc_key_map = vp7045_rc_keys,
225 .rc_key_map_size = ARRAY_SIZE(vp7045_rc_keys),
226 .rc_query = vp7045_rc_query,
227
228 /* parameter for the MPEG2-data transfer */ 221 /* parameter for the MPEG2-data transfer */
229 .urb = { 222 .stream = {
230 .type = DVB_USB_BULK, 223 .type = USB_BULK,
231 .count = 7, 224 .count = 7,
232 .endpoint = 0x02, 225 .endpoint = 0x02,
233 .u = { 226 .u = {
@@ -236,6 +229,15 @@ static struct dvb_usb_properties vp7045_properties = {
236 } 229 }
237 } 230 }
238 }, 231 },
232 }
233 },
234 .power_ctrl = vp7045_power_ctrl,
235 .read_mac_address = vp7045_read_mac_addr,
236
237 .rc_interval = 400,
238 .rc_key_map = vp7045_rc_keys,
239 .rc_key_map_size = ARRAY_SIZE(vp7045_rc_keys),
240 .rc_query = vp7045_rc_query,
239 241
240 .num_device_descs = 2, 242 .num_device_descs = 2,
241 .devices = { 243 .devices = {
diff --git a/drivers/media/dvb/frontends/cx24123.c b/drivers/media/dvb/frontends/cx24123.c
index 62d69a6ea699..a356d28fc3bb 100644
--- a/drivers/media/dvb/frontends/cx24123.c
+++ b/drivers/media/dvb/frontends/cx24123.c
@@ -553,8 +553,8 @@ static int cx24123_pll_calculate(struct dvb_frontend* fe, struct dvb_frontend_pa
553 ndiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) / 32) & 0x1ff; 553 ndiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) / 32) & 0x1ff;
554 adiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) % 32) & 0x1f; 554 adiv = ( ((p->frequency * vco_div * 10) / (2 * XTAL / 1000)) % 32) & 0x1f;
555 555
556 if (adiv == 0) 556 if (adiv == 0 && ndiv > 0)
557 ndiv++; 557 ndiv--;
558 558
559 /* control bits 11, refdiv 11, charge pump polarity 1, charge pump current, ndiv, adiv */ 559 /* control bits 11, refdiv 11, charge pump polarity 1, charge pump current, ndiv, adiv */
560 state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) | (pump << 14) | (ndiv << 5) | adiv; 560 state->pllarg = (3 << 19) | (3 << 17) | (1 << 16) | (pump << 14) | (ndiv << 5) | adiv;
diff --git a/drivers/media/dvb/frontends/dib3000mc.c b/drivers/media/dvb/frontends/dib3000mc.c
index cc28417fa33a..ccc813b525d6 100644
--- a/drivers/media/dvb/frontends/dib3000mc.c
+++ b/drivers/media/dvb/frontends/dib3000mc.c
@@ -37,6 +37,8 @@ struct dib3000mc_state {
37 37
38 struct dibx000_i2c_master i2c_master; 38 struct dibx000_i2c_master i2c_master;
39 39
40 u32 timf;
41
40 fe_bandwidth_t current_bandwidth; 42 fe_bandwidth_t current_bandwidth;
41 43
42 u16 dev_id; 44 u16 dev_id;
@@ -92,50 +94,31 @@ static int dib3000mc_identify(struct dib3000mc_state *state)
92 94
93static int dib3000mc_set_timing(struct dib3000mc_state *state, s16 nfft, u8 bw, u8 update_offset) 95static int dib3000mc_set_timing(struct dib3000mc_state *state, s16 nfft, u8 bw, u8 update_offset)
94{ 96{
95/* 97 u32 timf;
96 u32 timf_msb, timf_lsb, i;
97 int tim_sgn ;
98 LUInt comp1, comp2, comp ;
99// u32 tim_offset ;
100 comp = 27700 * BW_INDEX_TO_KHZ(bw) / 1000;
101 timf_msb = (comp >> 16) & 0x00FF;
102 timf_lsb = comp & 0xFFFF;
103
104 // Update the timing offset ;
105 if (update_offset) {
106 if (state->timing_offset_comp_done == 0) {
107 usleep(200000);
108 state->timing_offset_comp_done = 1;
109 }
110 tim_offset = dib3000mc_read_word(state, 416);
111 if ((tim_offset & 0x2000) == 0x2000)
112 tim_offset |= 0xC000; // PB: This only works if tim_offset is s16 - weird
113
114 if (nfft == 0)
115 tim_offset = tim_offset << 2; // PB: Do not store the offset for different things in one variable
116 state->timing_offset += tim_offset;
117 }
118 tim_offset = state->timing_offset;
119 98
120 if (tim_offset < 0) { 99 if (state->timf == 0) {
121 tim_sgn = 1; 100 timf = 1384402; // default value for 8MHz
122 tim_offset = -tim_offset; 101 if (update_offset)
102 msleep(200); // first time we do an update
123 } else 103 } else
124 tim_sgn = 0; 104 timf = state->timf;
125 105
126 comp1 = tim_offset * timf_lsb; 106 timf *= (BW_INDEX_TO_KHZ(bw) / 1000);
127 comp2 = tim_offset * timf_msb;
128 comp = ((comp1 >> 16) + comp2) >> 7;
129 107
130 if (tim_sgn == 0) 108 if (update_offset) {
131 comp = timf_msb * (1<<16) + timf_lsb + comp; 109 s16 tim_offs = dib3000mc_read_word(state, 416);
132 else 110
133 comp = timf_msb * (1<<16) + timf_lsb - comp; 111 if (tim_offs & 0x2000)
112 tim_offs -= 0x4000;
134 113
135 timf_msb = (comp>>16)&0xFF ; 114 if (nfft == 0)
136 timf_lsb = comp&0xFFFF; 115 tim_offs *= 4;
137*/ 116
138 u32 timf = 1384402 * (BW_INDEX_TO_KHZ(bw) / 1000); 117 timf += tim_offs;
118 state->timf = timf / (BW_INDEX_TO_KHZ(bw) / 1000);
119 }
120
121 dprintk("timf: %d\n", timf);
139 122
140 dib3000mc_write_word(state, 23, timf >> 16); 123 dib3000mc_write_word(state, 23, timf >> 16);
141 dib3000mc_write_word(state, 24, timf & 0xffff); 124 dib3000mc_write_word(state, 24, timf & 0xffff);
@@ -143,15 +126,18 @@ static int dib3000mc_set_timing(struct dib3000mc_state *state, s16 nfft, u8 bw,
143 return 0; 126 return 0;
144} 127}
145 128
146static int dib3000mc_setup_pwm3_state(struct dib3000mc_state *state) 129static int dib3000mc_setup_pwm_state(struct dib3000mc_state *state)
147{ 130{
131 u16 reg_51, reg_52 = state->cfg->agc->setup & 0xfefb;
148 if (state->cfg->pwm3_inversion) { 132 if (state->cfg->pwm3_inversion) {
149 dib3000mc_write_word(state, 51, (2 << 14) | (0 << 10) | (7 << 6) | (2 << 2) | (2 << 0)); 133 reg_51 = (2 << 14) | (0 << 10) | (7 << 6) | (2 << 2) | (2 << 0);
150 dib3000mc_write_word(state, 52, (0 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (1 << 2) | (2 << 0)); 134 reg_52 |= (1 << 2);
151 } else { 135 } else {
152 dib3000mc_write_word(state, 51, (2 << 14) | (4 << 10) | (7 << 6) | (2 << 2) | (2 << 0)); 136 reg_51 = (2 << 14) | (4 << 10) | (7 << 6) | (2 << 2) | (2 << 0);
153 dib3000mc_write_word(state, 52, (1 << 8) | (5 << 5) | (1 << 4) | (1 << 3) | (0 << 2) | (2 << 0)); 137 reg_52 |= (1 << 8);
154 } 138 }
139 dib3000mc_write_word(state, 51, reg_51);
140 dib3000mc_write_word(state, 52, reg_52);
155 141
156 if (state->cfg->use_pwm3) 142 if (state->cfg->use_pwm3)
157 dib3000mc_write_word(state, 245, (1 << 3) | (1 << 0)); 143 dib3000mc_write_word(state, 245, (1 << 3) | (1 << 0));
@@ -326,10 +312,10 @@ static int dib3000mc_init(struct dvb_frontend *demod)
326 dib3000mc_write_word(state, 175, 0x0000); 312 dib3000mc_write_word(state, 175, 0x0000);
327 dib3000mc_write_word(state, 1032, 0x012C); 313 dib3000mc_write_word(state, 1032, 0x012C);
328 } 314 }
329 dib3000mc_write_word(state, 1033, 0); 315 dib3000mc_write_word(state, 1033, 0x0000);
330 316
331 // P_clk_cfg 317 // P_clk_cfg
332 dib3000mc_write_word(state, 1037, 12592); 318 dib3000mc_write_word(state, 1037, 0x3130);
333 319
334 // other configurations 320 // other configurations
335 321
@@ -350,7 +336,7 @@ static int dib3000mc_init(struct dvb_frontend *demod)
350 dib3000mc_write_word(state, 50, 0x8000); 336 dib3000mc_write_word(state, 50, 0x8000);
351 337
352 // agc setup misc 338 // agc setup misc
353 dib3000mc_setup_pwm3_state(state); 339 dib3000mc_setup_pwm_state(state);
354 340
355 // P_agc_counter_lock 341 // P_agc_counter_lock
356 dib3000mc_write_word(state, 53, 0x87); 342 dib3000mc_write_word(state, 53, 0x87);
@@ -426,10 +412,9 @@ static int dib3000mc_sleep(struct dvb_frontend *demod)
426{ 412{
427 struct dib3000mc_state *state = demod->demodulator_priv; 413 struct dib3000mc_state *state = demod->demodulator_priv;
428 414
429 dib3000mc_write_word(state, 1037, dib3000mc_read_word(state, 1037) | 0x0003);
430 dib3000mc_write_word(state, 1031, 0xFFFF); 415 dib3000mc_write_word(state, 1031, 0xFFFF);
431 dib3000mc_write_word(state, 1032, 0xFFFF); 416 dib3000mc_write_word(state, 1032, 0xFFFF);
432 dib3000mc_write_word(state, 1033, 0xFFF4); // **** Bin2 417 dib3000mc_write_word(state, 1033, 0xFFF0);
433 418
434 return 0; 419 return 0;
435} 420}
@@ -539,6 +524,7 @@ static int dib3000mc_autosearch_start(struct dvb_frontend *demod, struct dibx000
539 524
540 reg = dib3000mc_read_word(state, 0); 525 reg = dib3000mc_read_word(state, 0);
541 dib3000mc_write_word(state, 0, reg | (1 << 8)); 526 dib3000mc_write_word(state, 0, reg | (1 << 8));
527 dib3000mc_read_word(state, 511);
542 dib3000mc_write_word(state, 0, reg); 528 dib3000mc_write_word(state, 0, reg);
543 529
544 return 0; 530 return 0;
@@ -578,59 +564,9 @@ static int dib3000mc_tune(struct dvb_frontend *demod, struct dibx000_ofdm_channe
578 dib3000mc_write_word(state, 33, 6); 564 dib3000mc_write_word(state, 33, 6);
579 } 565 }
580 566
581 // if (lock) 567 if (dib3000mc_read_word(state, 509) & 0x80)
582 // dib3000mc_set_timing(state, ch->nfft, ch->Bw, 1); 568 dib3000mc_set_timing(state, ch->nfft, ch->Bw, 1);
583
584 return 0;
585}
586
587static int dib3000mc_demod_output_mode(struct dvb_frontend *demod, int mode)
588{
589 struct dib3000mc_state *state = demod->demodulator_priv;
590 return dib3000mc_set_output_mode(state, mode);
591}
592
593static int dib3000mc_i2c_enumeration(struct dvb_frontend *demod[], int no_of_demods, u8 default_addr)
594{
595 struct dib3000mc_state *st;
596 int k,ret=0;
597 u8 new_addr;
598
599 static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26};
600
601 for (k = no_of_demods-1; k >= 0; k--) {
602 st = demod[k]->demodulator_priv;
603
604 /* designated i2c address */
605 new_addr = DIB3000MC_I2C_ADDRESS[k];
606
607 st->i2c_addr = new_addr;
608 if (dib3000mc_identify(st) != 0) {
609 st->i2c_addr = default_addr;
610 if (dib3000mc_identify(st) != 0) {
611 dprintk("-E- DiB3000P/MC #%d: not identified\n", k);
612 return -EINVAL;
613 }
614 }
615
616 /* turn on div_out */
617 dib3000mc_demod_output_mode(demod[k], OUTMODE_MPEG2_PAR_CONT_CLK);
618
619 // set new i2c address and force divstr (Bit 1) to value 0 (Bit 0)
620 ret |= dib3000mc_write_word(st, 1024, (new_addr << 3) | 0x1);
621 st->i2c_addr = new_addr;
622 }
623
624 for (k = 0; k < no_of_demods; k++) {
625 st = demod[k]->demodulator_priv;
626
627 ret |= dib3000mc_write_word(st, 1024, st->i2c_addr << 3);
628
629 /* turn off data output */
630 dib3000mc_demod_output_mode(demod[k],OUTMODE_HIGH_Z);
631 dib3000mc_write_word(st, 769, (1 << 7) );
632 569
633 }
634 return 0; 570 return 0;
635} 571}
636 572
@@ -826,61 +762,79 @@ void dib3000mc_set_config(struct dvb_frontend *fe, struct dib3000mc_config *cfg)
826} 762}
827EXPORT_SYMBOL(dib3000mc_set_config); 763EXPORT_SYMBOL(dib3000mc_set_config);
828 764
829static struct dvb_frontend_ops dib3000mc_ops; 765int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib3000mc_config cfg[])
830
831int dib3000mc_attach(struct i2c_adapter *i2c_adap, int no_of_demods, u8 default_addr, u8 do_i2c_enum, struct dib3000mc_config cfg[], struct dvb_frontend *demod[])
832{ 766{
833 struct dib3000mc_state *st; 767 struct dib3000mc_state st = { .i2c_adap = i2c };
834 int k, num=0; 768 int k;
835 769 u8 new_addr;
836 if (no_of_demods < 1)
837 return -EINVAL;
838 770
839 for (k = 0; k < no_of_demods; k++) { 771 static u8 DIB3000MC_I2C_ADDRESS[] = {20,22,24,26};
840 st = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL);
841 if (st == NULL)
842 goto error;
843 772
844 num++; 773 for (k = no_of_demods-1; k >= 0; k--) {
774 st.cfg = &cfg[k];
845 775
846 st->cfg = &cfg[k]; 776 /* designated i2c address */
847 // st->gpio_val = cfg[k].gpio_val; 777 new_addr = DIB3000MC_I2C_ADDRESS[k];
848 // st->gpio_dir = cfg[k].gpio_dir; 778 st.i2c_addr = new_addr;
849 st->i2c_adap = i2c_adap; 779 if (dib3000mc_identify(&st) != 0) {
780 st.i2c_addr = default_addr;
781 if (dib3000mc_identify(&st) != 0) {
782 dprintk("-E- DiB3000P/MC #%d: not identified\n", k);
783 return -ENODEV;
784 }
785 }
850 786
851 demod[k] = &st->demod; 787 dib3000mc_set_output_mode(&st, OUTMODE_MPEG2_PAR_CONT_CLK);
852 demod[k]->demodulator_priv = st;
853 memcpy(&st->demod.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops));
854 788
855// INIT_COMPONENT_REGISTER_ACCESS(&st->register_access, 12, 16, dib7000p_register_read, dib7000p_register_write, st); 789 // set new i2c address and force divstr (Bit 1) to value 0 (Bit 0)
856// demod[k]->register_access = &st->register_access; 790 dib3000mc_write_word(&st, 1024, (new_addr << 3) | 0x1);
791 st.i2c_addr = new_addr;
857 } 792 }
858 793
859 if (do_i2c_enum) { 794 for (k = 0; k < no_of_demods; k++) {
860 if (dib3000mc_i2c_enumeration(demod,no_of_demods,default_addr) != 0) 795 st.cfg = &cfg[k];
861 goto error; 796 st.i2c_addr = DIB3000MC_I2C_ADDRESS[k];
862 } else {
863 st = demod[0]->demodulator_priv;
864 st->i2c_addr = default_addr;
865 if (dib3000mc_identify(st) != 0)
866 goto error;
867 }
868 797
869 for (k = 0; k < num; k++) { 798 dib3000mc_write_word(&st, 1024, st.i2c_addr << 3);
870 st = demod[k]->demodulator_priv;
871 dibx000_init_i2c_master(&st->i2c_master, DIB3000MC, st->i2c_adap, st->i2c_addr);
872 }
873 799
800 /* turn off data output */
801 dib3000mc_set_output_mode(&st, OUTMODE_HIGH_Z);
802 }
874 return 0; 803 return 0;
804}
805EXPORT_SYMBOL(dib3000mc_i2c_enumeration);
806
807static struct dvb_frontend_ops dib3000mc_ops;
808
809struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg)
810{
811 struct dvb_frontend *demod;
812 struct dib3000mc_state *st;
813 st = kzalloc(sizeof(struct dib3000mc_state), GFP_KERNEL);
814 if (st == NULL)
815 return NULL;
816
817 st->cfg = cfg;
818 st->i2c_adap = i2c_adap;
819 st->i2c_addr = i2c_addr;
820
821 demod = &st->demod;
822 demod->demodulator_priv = st;
823 memcpy(&st->demod.ops, &dib3000mc_ops, sizeof(struct dvb_frontend_ops));
824
825 if (dib3000mc_identify(st) != 0)
826 goto error;
827
828 dibx000_init_i2c_master(&st->i2c_master, DIB3000MC, st->i2c_adap, st->i2c_addr);
829
830 dib3000mc_write_word(st, 1037, 0x3130);
831
832 return demod;
875 833
876error: 834error:
877 for (k = 0; k < num; k++) { 835 kfree(st);
878 kfree(demod[k]->demodulator_priv); 836 return NULL;
879 demod[k] = NULL;
880 }
881 return -EINVAL;
882} 837}
883
884EXPORT_SYMBOL(dib3000mc_attach); 838EXPORT_SYMBOL(dib3000mc_attach);
885 839
886static struct dvb_frontend_ops dib3000mc_ops = { 840static struct dvb_frontend_ops dib3000mc_ops = {
diff --git a/drivers/media/dvb/frontends/dib3000mc.h b/drivers/media/dvb/frontends/dib3000mc.h
index fd0b2e755993..b198cd5b1843 100644
--- a/drivers/media/dvb/frontends/dib3000mc.h
+++ b/drivers/media/dvb/frontends/dib3000mc.h
@@ -37,17 +37,17 @@ struct dib3000mc_config {
37#define DEFAULT_DIB3000P_I2C_ADDRESS 24 37#define DEFAULT_DIB3000P_I2C_ADDRESS 24
38 38
39#if defined(CONFIG_DVB_DIB3000MC) || defined(CONFIG_DVB_DIB3000MC_MODULE) 39#if defined(CONFIG_DVB_DIB3000MC) || defined(CONFIG_DVB_DIB3000MC_MODULE)
40extern int dib3000mc_attach(struct i2c_adapter *i2c_adap, int no_of_demods, u8 default_addr, 40extern struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg);
41 u8 do_i2c_enum, struct dib3000mc_config cfg[], struct dvb_frontend *demod[]);
42#else 41#else
43static inline struct dvb_frontend* dib3000mc_attach(const struct dib3000_config* config, 42static inline struct dvb_frontend * dib3000mc_attach(struct i2c_adapter *i2c_adap, u8 i2c_addr, struct dib3000mc_config *cfg)
44 struct i2c_adapter* i2c, struct dib_fe_xfer_ops *xfer_ops)
45{ 43{
46 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__); 44 printk(KERN_WARNING "%s: driver disabled by Kconfig\n", __FUNCTION__);
47 return NULL; 45 return NULL;
48} 46}
49#endif // CONFIG_DVB_DIB3000MC 47#endif // CONFIG_DVB_DIB3000MC
50 48
49extern int dib3000mc_i2c_enumeration(struct i2c_adapter *i2c, int no_of_demods, u8 default_addr, struct dib3000mc_config cfg[]);
50
51extern struct i2c_adapter * dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod, int gating); 51extern struct i2c_adapter * dib3000mc_get_tuner_i2c_master(struct dvb_frontend *demod, int gating);
52 52
53extern int dib3000mc_pid_control(struct dvb_frontend *fe, int index, int pid,int onoff); 53extern int dib3000mc_pid_control(struct dvb_frontend *fe, int index, int pid,int onoff);
diff --git a/drivers/media/dvb/frontends/mt2060.c b/drivers/media/dvb/frontends/mt2060.c
index 508ec1b6d1fb..450fad8d9b65 100644
--- a/drivers/media/dvb/frontends/mt2060.c
+++ b/drivers/media/dvb/frontends/mt2060.c
@@ -247,6 +247,9 @@ static void mt2060_calibrate(struct mt2060_priv *priv)
247 if (mt2060_writeregs(priv,mt2060_config2,sizeof(mt2060_config2))) 247 if (mt2060_writeregs(priv,mt2060_config2,sizeof(mt2060_config2)))
248 return; 248 return;
249 249
250 /* initialize the clock output */
251 mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30);
252
250 do { 253 do {
251 b |= (1 << 6); // FM1SS; 254 b |= (1 << 6); // FM1SS;
252 mt2060_writereg(priv, REG_LO2C1,b); 255 mt2060_writereg(priv, REG_LO2C1,b);
@@ -294,13 +297,13 @@ static int mt2060_get_bandwidth(struct dvb_frontend *fe, u32 *bandwidth)
294static int mt2060_init(struct dvb_frontend *fe) 297static int mt2060_init(struct dvb_frontend *fe)
295{ 298{
296 struct mt2060_priv *priv = fe->tuner_priv; 299 struct mt2060_priv *priv = fe->tuner_priv;
297 return mt2060_writereg(priv, REG_VGAG,0x33); 300 return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x33);
298} 301}
299 302
300static int mt2060_sleep(struct dvb_frontend *fe) 303static int mt2060_sleep(struct dvb_frontend *fe)
301{ 304{
302 struct mt2060_priv *priv = fe->tuner_priv; 305 struct mt2060_priv *priv = fe->tuner_priv;
303 return mt2060_writereg(priv, REG_VGAG,0x30); 306 return mt2060_writereg(priv, REG_VGAG, (priv->cfg->clock_out << 6) | 0x30);
304} 307}
305 308
306static int mt2060_release(struct dvb_frontend *fe) 309static int mt2060_release(struct dvb_frontend *fe)
@@ -329,14 +332,14 @@ static const struct dvb_tuner_ops mt2060_tuner_ops = {
329}; 332};
330 333
331/* This functions tries to identify a MT2060 tuner by reading the PART/REV register. This is hasty. */ 334/* This functions tries to identify a MT2060 tuner by reading the PART/REV register. This is hasty. */
332int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1) 335struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1)
333{ 336{
334 struct mt2060_priv *priv = NULL; 337 struct mt2060_priv *priv = NULL;
335 u8 id = 0; 338 u8 id = 0;
336 339
337 priv = kzalloc(sizeof(struct mt2060_priv), GFP_KERNEL); 340 priv = kzalloc(sizeof(struct mt2060_priv), GFP_KERNEL);
338 if (priv == NULL) 341 if (priv == NULL)
339 return -ENOMEM; 342 return NULL;
340 343
341 priv->cfg = cfg; 344 priv->cfg = cfg;
342 priv->i2c = i2c; 345 priv->i2c = i2c;
@@ -344,12 +347,12 @@ int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt206
344 347
345 if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) { 348 if (mt2060_readreg(priv,REG_PART_REV,&id) != 0) {
346 kfree(priv); 349 kfree(priv);
347 return -ENODEV; 350 return NULL;
348 } 351 }
349 352
350 if (id != PART_REV) { 353 if (id != PART_REV) {
351 kfree(priv); 354 kfree(priv);
352 return -ENODEV; 355 return NULL;
353 } 356 }
354 printk(KERN_INFO "MT2060: successfully identified (IF1 = %d)\n", if1); 357 printk(KERN_INFO "MT2060: successfully identified (IF1 = %d)\n", if1);
355 memcpy(&fe->ops.tuner_ops, &mt2060_tuner_ops, sizeof(struct dvb_tuner_ops)); 358 memcpy(&fe->ops.tuner_ops, &mt2060_tuner_ops, sizeof(struct dvb_tuner_ops));
@@ -358,7 +361,7 @@ int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt206
358 361
359 mt2060_calibrate(priv); 362 mt2060_calibrate(priv);
360 363
361 return 0; 364 return fe;
362} 365}
363EXPORT_SYMBOL(mt2060_attach); 366EXPORT_SYMBOL(mt2060_attach);
364 367
diff --git a/drivers/media/dvb/frontends/mt2060.h b/drivers/media/dvb/frontends/mt2060.h
index c58b03e82345..34a37c2b556f 100644
--- a/drivers/media/dvb/frontends/mt2060.h
+++ b/drivers/media/dvb/frontends/mt2060.h
@@ -27,9 +27,9 @@ struct i2c_adapter;
27 27
28struct mt2060_config { 28struct mt2060_config {
29 u8 i2c_address; 29 u8 i2c_address;
30 /* Shall we add settings for the discrete outputs ? */ 30 u8 clock_out; /* 0 = off, 1 = CLK/4, 2 = CLK/2, 3 = CLK/1 */
31}; 31};
32 32
33extern int mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1); 33extern struct dvb_frontend * mt2060_attach(struct dvb_frontend *fe, struct i2c_adapter *i2c, struct mt2060_config *cfg, u16 if1);
34 34
35#endif 35#endif
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index f6779a422f1b..afb734df6e05 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -36,7 +36,7 @@ config VIDEO_HELPER_CHIPS_AUTO
36menu "Encoders/decoders and other helper chips" 36menu "Encoders/decoders and other helper chips"
37 depends on VIDEO_DEV && !VIDEO_HELPER_CHIPS_AUTO 37 depends on VIDEO_DEV && !VIDEO_HELPER_CHIPS_AUTO
38 38
39comment "Audio Decoders" 39comment "Audio decoders"
40 40
41config VIDEO_TVAUDIO 41config VIDEO_TVAUDIO
42 tristate "Simple audio decoder chips" 42 tristate "Simple audio decoder chips"
@@ -51,7 +51,7 @@ config VIDEO_TVAUDIO
51 module will be called tvaudio. 51 module will be called tvaudio.
52 52
53config VIDEO_TDA7432 53config VIDEO_TDA7432
54 tristate "Philips TDA7432 audio processor chip" 54 tristate "Philips TDA7432 audio processor"
55 depends on VIDEO_V4L1 && I2C 55 depends on VIDEO_V4L1 && I2C
56 ---help--- 56 ---help---
57 Support for tda7432 audio decoder chip found on some bt8xx boards. 57 Support for tda7432 audio decoder chip found on some bt8xx boards.
@@ -60,7 +60,7 @@ config VIDEO_TDA7432
60 module will be called tda7432. 60 module will be called tda7432.
61 61
62config VIDEO_TDA9840 62config VIDEO_TDA9840
63 tristate "Philips TDA9840 audio processor chip" 63 tristate "Philips TDA9840 audio processor"
64 depends on VIDEO_DEV && I2C 64 depends on VIDEO_DEV && I2C
65 ---help--- 65 ---help---
66 Support for tda9840 audio decoder chip found on some Zoran boards. 66 Support for tda9840 audio decoder chip found on some Zoran boards.
@@ -69,7 +69,7 @@ config VIDEO_TDA9840
69 module will be called tda9840. 69 module will be called tda9840.
70 70
71config VIDEO_TDA9875 71config VIDEO_TDA9875
72 tristate "Philips TDA9875 audio processor chip" 72 tristate "Philips TDA9875 audio processor"
73 depends on VIDEO_V4L1 && I2C 73 depends on VIDEO_V4L1 && I2C
74 ---help--- 74 ---help---
75 Support for tda9875 audio decoder chip found on some bt8xx boards. 75 Support for tda9875 audio decoder chip found on some bt8xx boards.
@@ -78,7 +78,7 @@ config VIDEO_TDA9875
78 module will be called tda9875. 78 module will be called tda9875.
79 79
80config VIDEO_TEA6415C 80config VIDEO_TEA6415C
81 tristate "Philips TEA6415C audio processor chip" 81 tristate "Philips TEA6415C audio processor"
82 depends on VIDEO_DEV && I2C 82 depends on VIDEO_DEV && I2C
83 ---help--- 83 ---help---
84 Support for tea6415c audio decoder chip found on some bt8xx boards. 84 Support for tea6415c audio decoder chip found on some bt8xx boards.
@@ -87,7 +87,7 @@ config VIDEO_TEA6415C
87 module will be called tea6415c. 87 module will be called tea6415c.
88 88
89config VIDEO_TEA6420 89config VIDEO_TEA6420
90 tristate "Philips TEA6420 audio processor chip" 90 tristate "Philips TEA6420 audio processor"
91 depends on VIDEO_DEV && I2C 91 depends on VIDEO_DEV && I2C
92 ---help--- 92 ---help---
93 Support for tea6420 audio decoder chip found on some bt8xx boards. 93 Support for tea6420 audio decoder chip found on some bt8xx boards.
@@ -143,64 +143,10 @@ config VIDEO_WM8739
143 To compile this driver as a module, choose M here: the 143 To compile this driver as a module, choose M here: the
144 module will be called wm8739. 144 module will be called wm8739.
145 145
146comment "MPEG video encoders"
147
148config VIDEO_CX2341X
149 tristate "Conexant CX2341x MPEG encoders"
150 depends on VIDEO_V4L2 && EXPERIMENTAL
151 ---help---
152 Support for the Conexant CX23416 MPEG encoders
153 and CX23415 MPEG encoder/decoders.
154
155 This module currently supports the encoding functions only.
156
157 To compile this driver as a module, choose M here: the
158 module will be called cx2341x.
159
160source "drivers/media/video/cx25840/Kconfig"
161
162comment "Video encoders"
163
164config VIDEO_SAA7127
165 tristate "Philips SAA7127/9 digital video encoders"
166 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
167 ---help---
168 Support for the Philips SAA7127/9 digital video encoders.
169
170 To compile this driver as a module, choose M here: the
171 module will be called saa7127.
172
173config VIDEO_SAA7185
174 tristate "Philips SAA7185 video encoder"
175 depends on VIDEO_V4L1 && I2C
176 ---help---
177 Support for the Philips SAA7185 video encoder.
178
179 To compile this driver as a module, choose M here: the
180 module will be called saa7185.
181
182config VIDEO_ADV7170
183 tristate "Analog Devices ADV7170 video encoder driver"
184 depends on VIDEO_V4L1 && I2C
185 ---help---
186 Support for the Analog Devices ADV7170 video encoder driver
187
188 To compile this driver as a module, choose M here: the
189 module will be called adv7170.
190
191config VIDEO_ADV7175
192 tristate "Analog Devices ADV7175 video encoder driver"
193 depends on VIDEO_V4L1 && I2C
194 ---help---
195 Support for the Analog Devices ADV7175 video encoder driver
196
197 To compile this driver as a module, choose M here: the
198 module will be called adv7175.
199
200comment "Video decoders" 146comment "Video decoders"
201 147
202config VIDEO_BT819 148config VIDEO_BT819
203 tristate "BT819A VideoStream Decoder" 149 tristate "BT819A VideoStream decoder"
204 depends on VIDEO_V4L1 && I2C 150 depends on VIDEO_V4L1 && I2C
205 ---help--- 151 ---help---
206 Support for BT819A video decoder. 152 Support for BT819A video decoder.
@@ -209,7 +155,7 @@ config VIDEO_BT819
209 module will be called bt819. 155 module will be called bt819.
210 156
211config VIDEO_BT856 157config VIDEO_BT856
212 tristate "BT856 VideoStream Decoder" 158 tristate "BT856 VideoStream decoder"
213 depends on VIDEO_V4L1 && I2C 159 depends on VIDEO_V4L1 && I2C
214 ---help--- 160 ---help---
215 Support for BT856 video decoder. 161 Support for BT856 video decoder.
@@ -218,7 +164,7 @@ config VIDEO_BT856
218 module will be called bt856. 164 module will be called bt856.
219 165
220config VIDEO_BT866 166config VIDEO_BT866
221 tristate "BT866 VideoStream Decoder" 167 tristate "BT866 VideoStream decoder"
222 depends on VIDEO_V4L1 && I2C 168 depends on VIDEO_V4L1 && I2C
223 ---help--- 169 ---help---
224 Support for BT866 video decoder. 170 Support for BT866 video decoder.
@@ -295,7 +241,7 @@ config VIDEO_TVP5150
295 module will be called tvp5150. 241 module will be called tvp5150.
296 242
297config VIDEO_VPX3220 243config VIDEO_VPX3220
298 tristate "vpx3220a, vpx3216b & vpx3214c video decoder driver" 244 tristate "vpx3220a, vpx3216b & vpx3214c video decoders"
299 depends on VIDEO_V4L1 && I2C 245 depends on VIDEO_V4L1 && I2C
300 ---help--- 246 ---help---
301 Support for VPX322x video decoders. 247 Support for VPX322x video decoders.
@@ -303,6 +249,62 @@ config VIDEO_VPX3220
303 To compile this driver as a module, choose M here: the 249 To compile this driver as a module, choose M here: the
304 module will be called vpx3220. 250 module will be called vpx3220.
305 251
252comment "Video and audio decoders"
253
254source "drivers/media/video/cx25840/Kconfig"
255
256comment "MPEG video encoders"
257
258config VIDEO_CX2341X
259 tristate "Conexant CX2341x MPEG encoders"
260 depends on VIDEO_V4L2 && EXPERIMENTAL
261 ---help---
262 Support for the Conexant CX23416 MPEG encoders
263 and CX23415 MPEG encoder/decoders.
264
265 This module currently supports the encoding functions only.
266
267 To compile this driver as a module, choose M here: the
268 module will be called cx2341x.
269
270comment "Video encoders"
271
272config VIDEO_SAA7127
273 tristate "Philips SAA7127/9 digital video encoders"
274 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
275 ---help---
276 Support for the Philips SAA7127/9 digital video encoders.
277
278 To compile this driver as a module, choose M here: the
279 module will be called saa7127.
280
281config VIDEO_SAA7185
282 tristate "Philips SAA7185 video encoder"
283 depends on VIDEO_V4L1 && I2C
284 ---help---
285 Support for the Philips SAA7185 video encoder.
286
287 To compile this driver as a module, choose M here: the
288 module will be called saa7185.
289
290config VIDEO_ADV7170
291 tristate "Analog Devices ADV7170 video encoder"
292 depends on VIDEO_V4L1 && I2C
293 ---help---
294 Support for the Analog Devices ADV7170 video encoder driver
295
296 To compile this driver as a module, choose M here: the
297 module will be called adv7170.
298
299config VIDEO_ADV7175
300 tristate "Analog Devices ADV7175 video encoder"
301 depends on VIDEO_V4L1 && I2C
302 ---help---
303 Support for the Analog Devices ADV7175 video encoder driver
304
305 To compile this driver as a module, choose M here: the
306 module will be called adv7175.
307
306comment "Video improvement chips" 308comment "Video improvement chips"
307 309
308config VIDEO_UPD64031A 310config VIDEO_UPD64031A
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index d23a42b1504f..a84903e0d810 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -2000,7 +2000,7 @@ struct tvcard bttv_tvcards[] = {
2000 .no_msp34xx = 1, 2000 .no_msp34xx = 1,
2001 .no_tda9875 = 1, 2001 .no_tda9875 = 1,
2002 .no_tda7432 = 1, 2002 .no_tda7432 = 1,
2003 .muxsel = { 3, 0, 1, 2 }, 2003 .muxsel = { 3, 1 },
2004 .pll = PLL_28, 2004 .pll = PLL_28,
2005 .no_gpioirq = 1, 2005 .no_gpioirq = 1,
2006 .has_dvb = 1, 2006 .has_dvb = 1,
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index a7921f9d45d8..46738321adaf 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -896,7 +896,7 @@ static int mpeg_do_ioctl(struct inode *inode, struct file *file,
896 snprintf(name, sizeof(name), "%s/2", core->name); 896 snprintf(name, sizeof(name), "%s/2", core->name);
897 printk("%s/2: ============ START LOG STATUS ============\n", 897 printk("%s/2: ============ START LOG STATUS ============\n",
898 core->name); 898 core->name);
899 cx88_call_i2c_clients(core, VIDIOC_LOG_STATUS, 0); 899 cx88_call_i2c_clients(core, VIDIOC_LOG_STATUS, NULL);
900 cx2341x_log_status(&dev->params, name); 900 cx2341x_log_status(&dev->params, name);
901 printk("%s/2: ============= END LOG STATUS =============\n", 901 printk("%s/2: ============= END LOG STATUS =============\n",
902 core->name); 902 core->name);
@@ -1086,7 +1086,7 @@ static int __devinit blackbird_probe(struct pci_dev *pci_dev,
1086 return -EINVAL; 1086 return -EINVAL;
1087 1087
1088 err = -ENODEV; 1088 err = -ENODEV;
1089 if (!cx88_boards[core->board].blackbird) 1089 if (!(cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD))
1090 goto fail_core; 1090 goto fail_core;
1091 1091
1092 err = -ENOMEM; 1092 err = -ENOMEM;
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 6214eb823b29..af71d4225c76 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -294,7 +294,7 @@ struct cx88_board cx88_boards[] = {
294 .type = CX88_RADIO, 294 .type = CX88_RADIO,
295 .gpio0 = 0x0000bd62, 295 .gpio0 = 0x0000bd62,
296 }, 296 },
297 .blackbird = 1, 297 .mpeg = CX88_MPEG_BLACKBIRD,
298 }, 298 },
299 [CX88_BOARD_IODATA_GVVCP3PCI] = { 299 [CX88_BOARD_IODATA_GVVCP3PCI] = {
300 .name = "IODATA GV-VCP3/PCI", 300 .name = "IODATA GV-VCP3/PCI",
@@ -358,7 +358,7 @@ struct cx88_board cx88_boards[] = {
358 .type = CX88_RADIO, 358 .type = CX88_RADIO,
359 .gpio0 = 0x0000fde2, 359 .gpio0 = 0x0000fde2,
360 }, 360 },
361 .blackbird = 1, 361 .mpeg = CX88_MPEG_BLACKBIRD,
362 }, 362 },
363 [CX88_BOARD_MSI_TVANYWHERE] = { 363 [CX88_BOARD_MSI_TVANYWHERE] = {
364 .name = "MSI TV-@nywhere", 364 .name = "MSI TV-@nywhere",
@@ -401,7 +401,7 @@ struct cx88_board cx88_boards[] = {
401 .gpio0 = 0x0700, 401 .gpio0 = 0x0700,
402 .gpio2 = 0x0101, 402 .gpio2 = 0x0101,
403 }}, 403 }},
404 .dvb = 1, 404 .mpeg = CX88_MPEG_DVB,
405 }, 405 },
406 [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = { 406 [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = {
407 .name = "DViCO FusionHDTV DVB-T1", 407 .name = "DViCO FusionHDTV DVB-T1",
@@ -418,7 +418,7 @@ struct cx88_board cx88_boards[] = {
418 .vmux = 2, 418 .vmux = 2,
419 .gpio0 = 0x000027df, 419 .gpio0 = 0x000027df,
420 }}, 420 }},
421 .dvb = 1, 421 .mpeg = CX88_MPEG_DVB,
422 }, 422 },
423 [CX88_BOARD_KWORLD_LTV883] = { 423 [CX88_BOARD_KWORLD_LTV883] = {
424 .name = "KWorld LTV883RF", 424 .name = "KWorld LTV883RF",
@@ -488,7 +488,7 @@ struct cx88_board cx88_boards[] = {
488 .vmux = 2, 488 .vmux = 2,
489 .gpio0 = 0x0f00, 489 .gpio0 = 0x0f00,
490 }}, 490 }},
491 .dvb = 1, 491 .mpeg = CX88_MPEG_DVB,
492 }, 492 },
493 [CX88_BOARD_HAUPPAUGE_DVB_T1] = { 493 [CX88_BOARD_HAUPPAUGE_DVB_T1] = {
494 .name = "Hauppauge Nova-T DVB-T", 494 .name = "Hauppauge Nova-T DVB-T",
@@ -500,7 +500,7 @@ struct cx88_board cx88_boards[] = {
500 .type = CX88_VMUX_DVB, 500 .type = CX88_VMUX_DVB,
501 .vmux = 0, 501 .vmux = 0,
502 }}, 502 }},
503 .dvb = 1, 503 .mpeg = CX88_MPEG_DVB,
504 }, 504 },
505 [CX88_BOARD_CONEXANT_DVB_T1] = { 505 [CX88_BOARD_CONEXANT_DVB_T1] = {
506 .name = "Conexant DVB-T reference design", 506 .name = "Conexant DVB-T reference design",
@@ -512,7 +512,7 @@ struct cx88_board cx88_boards[] = {
512 .type = CX88_VMUX_DVB, 512 .type = CX88_VMUX_DVB,
513 .vmux = 0, 513 .vmux = 0,
514 }}, 514 }},
515 .dvb = 1, 515 .mpeg = CX88_MPEG_DVB,
516 }, 516 },
517 [CX88_BOARD_PROVIDEO_PV259] = { 517 [CX88_BOARD_PROVIDEO_PV259] = {
518 .name = "Provideo PV259", 518 .name = "Provideo PV259",
@@ -524,7 +524,7 @@ struct cx88_board cx88_boards[] = {
524 .type = CX88_VMUX_TELEVISION, 524 .type = CX88_VMUX_TELEVISION,
525 .vmux = 0, 525 .vmux = 0,
526 }}, 526 }},
527 .blackbird = 1, 527 .mpeg = CX88_MPEG_BLACKBIRD,
528 }, 528 },
529 [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = { 529 [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = {
530 .name = "DViCO FusionHDTV DVB-T Plus", 530 .name = "DViCO FusionHDTV DVB-T Plus",
@@ -541,7 +541,7 @@ struct cx88_board cx88_boards[] = {
541 .vmux = 2, 541 .vmux = 2,
542 .gpio0 = 0x000027df, 542 .gpio0 = 0x000027df,
543 }}, 543 }},
544 .dvb = 1, 544 .mpeg = CX88_MPEG_DVB,
545 }, 545 },
546 [CX88_BOARD_DNTV_LIVE_DVB_T] = { 546 [CX88_BOARD_DNTV_LIVE_DVB_T] = {
547 .name = "digitalnow DNTV Live! DVB-T", 547 .name = "digitalnow DNTV Live! DVB-T",
@@ -560,7 +560,7 @@ struct cx88_board cx88_boards[] = {
560 .gpio0 = 0x00000700, 560 .gpio0 = 0x00000700,
561 .gpio2 = 0x00000101, 561 .gpio2 = 0x00000101,
562 }}, 562 }},
563 .dvb = 1, 563 .mpeg = CX88_MPEG_DVB,
564 }, 564 },
565 [CX88_BOARD_PCHDTV_HD3000] = { 565 [CX88_BOARD_PCHDTV_HD3000] = {
566 .name = "pcHDTV HD3000 HDTV", 566 .name = "pcHDTV HD3000 HDTV",
@@ -599,7 +599,7 @@ struct cx88_board cx88_boards[] = {
599 .gpio2 = 0x00000000, 599 .gpio2 = 0x00000000,
600 .gpio3 = 0x00000000, 600 .gpio3 = 0x00000000,
601 }, 601 },
602 .dvb = 1, 602 .mpeg = CX88_MPEG_DVB,
603 }, 603 },
604 [CX88_BOARD_HAUPPAUGE_ROSLYN] = { 604 [CX88_BOARD_HAUPPAUGE_ROSLYN] = {
605 // entry added by Kaustubh D. Bhalerao <bhalerao.1@osu.edu> 605 // entry added by Kaustubh D. Bhalerao <bhalerao.1@osu.edu>
@@ -633,7 +633,7 @@ struct cx88_board cx88_boards[] = {
633 .gpio0 = 0xed96, 633 .gpio0 = 0xed96,
634 .gpio2 = 0x00ff, 634 .gpio2 = 0x00ff,
635 }, 635 },
636 .blackbird = 1, 636 .mpeg = CX88_MPEG_BLACKBIRD,
637 }, 637 },
638 [CX88_BOARD_DIGITALLOGIC_MEC] = { 638 [CX88_BOARD_DIGITALLOGIC_MEC] = {
639 .name = "Digital-Logic MICROSPACE Entertainment Center (MEC)", 639 .name = "Digital-Logic MICROSPACE Entertainment Center (MEC)",
@@ -659,7 +659,7 @@ struct cx88_board cx88_boards[] = {
659 .type = CX88_RADIO, 659 .type = CX88_RADIO,
660 .gpio0 = 0x00009d00, 660 .gpio0 = 0x00009d00,
661 }, 661 },
662 .blackbird = 1, 662 .mpeg = CX88_MPEG_BLACKBIRD,
663 }, 663 },
664 [CX88_BOARD_IODATA_GVBCTV7E] = { 664 [CX88_BOARD_IODATA_GVBCTV7E] = {
665 .name = "IODATA GV/BCTV7E", 665 .name = "IODATA GV/BCTV7E",
@@ -727,7 +727,7 @@ struct cx88_board cx88_boards[] = {
727 .vmux = 2, 727 .vmux = 2,
728 .gpio0 = 0x97e9, 728 .gpio0 = 0x97e9,
729 }}, 729 }},
730 .dvb = 1, 730 .mpeg = CX88_MPEG_DVB,
731 }, 731 },
732 [CX88_BOARD_ADSTECH_DVB_T_PCI] = { 732 [CX88_BOARD_ADSTECH_DVB_T_PCI] = {
733 .name = "ADS Tech Instant TV DVB-T PCI", 733 .name = "ADS Tech Instant TV DVB-T PCI",
@@ -746,7 +746,7 @@ struct cx88_board cx88_boards[] = {
746 .gpio0 = 0x0700, 746 .gpio0 = 0x0700,
747 .gpio2 = 0x0101, 747 .gpio2 = 0x0101,
748 }}, 748 }},
749 .dvb = 1, 749 .mpeg = CX88_MPEG_DVB,
750 }, 750 },
751 [CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1] = { 751 [CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1] = {
752 .name = "TerraTec Cinergy 1400 DVB-T", 752 .name = "TerraTec Cinergy 1400 DVB-T",
@@ -755,7 +755,7 @@ struct cx88_board cx88_boards[] = {
755 .type = CX88_VMUX_DVB, 755 .type = CX88_VMUX_DVB,
756 .vmux = 0, 756 .vmux = 0,
757 }}, 757 }},
758 .dvb = 1, 758 .mpeg = CX88_MPEG_DVB,
759 }, 759 },
760 [CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD] = { 760 [CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD] = {
761 .name = "DViCO FusionHDTV 5 Gold", 761 .name = "DViCO FusionHDTV 5 Gold",
@@ -777,7 +777,7 @@ struct cx88_board cx88_boards[] = {
777 .vmux = 2, 777 .vmux = 2,
778 .gpio0 = 0x87f9, 778 .gpio0 = 0x87f9,
779 }}, 779 }},
780 .dvb = 1, 780 .mpeg = CX88_MPEG_DVB,
781 }, 781 },
782 [CX88_BOARD_AVERMEDIA_ULTRATV_MC_550] = { 782 [CX88_BOARD_AVERMEDIA_ULTRATV_MC_550] = {
783 .name = "AverMedia UltraTV Media Center PCI 550", 783 .name = "AverMedia UltraTV Media Center PCI 550",
@@ -786,7 +786,7 @@ struct cx88_board cx88_boards[] = {
786 .tuner_addr = ADDR_UNSET, 786 .tuner_addr = ADDR_UNSET,
787 .radio_addr = ADDR_UNSET, 787 .radio_addr = ADDR_UNSET,
788 .tda9887_conf = TDA9887_PRESENT, 788 .tda9887_conf = TDA9887_PRESENT,
789 .blackbird = 1, 789 .mpeg = CX88_MPEG_BLACKBIRD,
790 .input = {{ 790 .input = {{
791 .type = CX88_VMUX_COMPOSITE1, 791 .type = CX88_VMUX_COMPOSITE1,
792 .vmux = 0, 792 .vmux = 0,
@@ -854,7 +854,7 @@ struct cx88_board cx88_boards[] = {
854 .gpio2 = 0x00000001, 854 .gpio2 = 0x00000001,
855 .gpio3 = 0x00000000, 855 .gpio3 = 0x00000000,
856 }}, 856 }},
857 .dvb = 1, 857 .mpeg = CX88_MPEG_DVB,
858 }, 858 },
859 [CX88_BOARD_WINFAST_DTV1000] = { 859 [CX88_BOARD_WINFAST_DTV1000] = {
860 .name = "WinFast DTV1000-T", 860 .name = "WinFast DTV1000-T",
@@ -866,7 +866,7 @@ struct cx88_board cx88_boards[] = {
866 .type = CX88_VMUX_DVB, 866 .type = CX88_VMUX_DVB,
867 .vmux = 0, 867 .vmux = 0,
868 }}, 868 }},
869 .dvb = 1, 869 .mpeg = CX88_MPEG_DVB,
870 }, 870 },
871 [CX88_BOARD_AVERTV_303] = { 871 [CX88_BOARD_AVERTV_303] = {
872 .name = "AVerTV 303 (M126)", 872 .name = "AVerTV 303 (M126)",
@@ -914,7 +914,7 @@ struct cx88_board cx88_boards[] = {
914 .type = CX88_VMUX_SVIDEO, 914 .type = CX88_VMUX_SVIDEO,
915 .vmux = 2, 915 .vmux = 2,
916 }}, 916 }},
917 .dvb = 1, 917 .mpeg = CX88_MPEG_DVB,
918 }, 918 },
919 [CX88_BOARD_HAUPPAUGE_NOVASE2_S1] = { 919 [CX88_BOARD_HAUPPAUGE_NOVASE2_S1] = {
920 .name = "Hauppauge Nova-SE2 DVB-S", 920 .name = "Hauppauge Nova-SE2 DVB-S",
@@ -926,7 +926,7 @@ struct cx88_board cx88_boards[] = {
926 .type = CX88_VMUX_DVB, 926 .type = CX88_VMUX_DVB,
927 .vmux = 0, 927 .vmux = 0,
928 }}, 928 }},
929 .dvb = 1, 929 .mpeg = CX88_MPEG_DVB,
930 }, 930 },
931 [CX88_BOARD_KWORLD_DVBS_100] = { 931 [CX88_BOARD_KWORLD_DVBS_100] = {
932 .name = "KWorld DVB-S 100", 932 .name = "KWorld DVB-S 100",
@@ -944,7 +944,7 @@ struct cx88_board cx88_boards[] = {
944 .type = CX88_VMUX_SVIDEO, 944 .type = CX88_VMUX_SVIDEO,
945 .vmux = 2, 945 .vmux = 2,
946 }}, 946 }},
947 .dvb = 1, 947 .mpeg = CX88_MPEG_DVB,
948 }, 948 },
949 [CX88_BOARD_HAUPPAUGE_HVR1100] = { 949 [CX88_BOARD_HAUPPAUGE_HVR1100] = {
950 .name = "Hauppauge WinTV-HVR1100 DVB-T/Hybrid", 950 .name = "Hauppauge WinTV-HVR1100 DVB-T/Hybrid",
@@ -964,7 +964,7 @@ struct cx88_board cx88_boards[] = {
964 .vmux = 2, 964 .vmux = 2,
965 }}, 965 }},
966 /* fixme: Add radio support */ 966 /* fixme: Add radio support */
967 .dvb = 1, 967 .mpeg = CX88_MPEG_DVB,
968 }, 968 },
969 [CX88_BOARD_HAUPPAUGE_HVR1100LP] = { 969 [CX88_BOARD_HAUPPAUGE_HVR1100LP] = {
970 .name = "Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile)", 970 .name = "Hauppauge WinTV-HVR1100 DVB-T/Hybrid (Low Profile)",
@@ -981,7 +981,7 @@ struct cx88_board cx88_boards[] = {
981 .vmux = 1, 981 .vmux = 1,
982 }}, 982 }},
983 /* fixme: Add radio support */ 983 /* fixme: Add radio support */
984 .dvb = 1, 984 .mpeg = CX88_MPEG_DVB,
985 }, 985 },
986 [CX88_BOARD_DNTV_LIVE_DVB_T_PRO] = { 986 [CX88_BOARD_DNTV_LIVE_DVB_T_PRO] = {
987 .name = "digitalnow DNTV Live! DVB-T Pro", 987 .name = "digitalnow DNTV Live! DVB-T Pro",
@@ -1008,7 +1008,7 @@ struct cx88_board cx88_boards[] = {
1008 .type = CX88_RADIO, 1008 .type = CX88_RADIO,
1009 .gpio0 = 0xf80808, 1009 .gpio0 = 0xf80808,
1010 }, 1010 },
1011 .dvb = 1, 1011 .mpeg = CX88_MPEG_DVB,
1012 }, 1012 },
1013 [CX88_BOARD_KWORLD_DVB_T_CX22702] = { 1013 [CX88_BOARD_KWORLD_DVB_T_CX22702] = {
1014 /* Kworld V-stream Xpert DVB-T with Thomson tuner */ 1014 /* Kworld V-stream Xpert DVB-T with Thomson tuner */
@@ -1030,7 +1030,7 @@ struct cx88_board cx88_boards[] = {
1030 .gpio0 = 0x0700, 1030 .gpio0 = 0x0700,
1031 .gpio2 = 0x0101, 1031 .gpio2 = 0x0101,
1032 }}, 1032 }},
1033 .dvb = 1, 1033 .mpeg = CX88_MPEG_DVB,
1034 }, 1034 },
1035 [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL] = { 1035 [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL] = {
1036 .name = "DViCO FusionHDTV DVB-T Dual Digital", 1036 .name = "DViCO FusionHDTV DVB-T Dual Digital",
@@ -1047,7 +1047,7 @@ struct cx88_board cx88_boards[] = {
1047 .vmux = 2, 1047 .vmux = 2,
1048 .gpio0 = 0x000067df, 1048 .gpio0 = 0x000067df,
1049 }}, 1049 }},
1050 .dvb = 1, 1050 .mpeg = CX88_MPEG_DVB,
1051 }, 1051 },
1052 [CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT] = { 1052 [CX88_BOARD_KWORLD_HARDWARE_MPEG_TV_XPERT] = {
1053 /* FIXME: Audio not working for s-video / composite inputs. */ 1053 /* FIXME: Audio not working for s-video / composite inputs. */
@@ -1075,7 +1075,7 @@ struct cx88_board cx88_boards[] = {
1075 .gpio0 = 0x3de6, 1075 .gpio0 = 0x3de6,
1076 .gpio2 = 0x00ff, 1076 .gpio2 = 0x00ff,
1077 }, 1077 },
1078 .blackbird = 1, 1078 .mpeg = CX88_MPEG_BLACKBIRD,
1079 }, 1079 },
1080 [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID] = { 1080 [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID] = {
1081 .name = "DViCO FusionHDTV DVB-T Hybrid", 1081 .name = "DViCO FusionHDTV DVB-T Hybrid",
@@ -1096,7 +1096,7 @@ struct cx88_board cx88_boards[] = {
1096 .vmux = 2, 1096 .vmux = 2,
1097 .gpio0 = 0x0000a75b, 1097 .gpio0 = 0x0000a75b,
1098 }}, 1098 }},
1099 .dvb = 1, 1099 .mpeg = CX88_MPEG_DVB,
1100 }, 1100 },
1101 [CX88_BOARD_PCHDTV_HD5500] = { 1101 [CX88_BOARD_PCHDTV_HD5500] = {
1102 .name = "pcHDTV HD5500 HDTV", 1102 .name = "pcHDTV HD5500 HDTV",
@@ -1118,7 +1118,7 @@ struct cx88_board cx88_boards[] = {
1118 .vmux = 2, 1118 .vmux = 2,
1119 .gpio0 = 0x87f9, 1119 .gpio0 = 0x87f9,
1120 }}, 1120 }},
1121 .dvb = 1, 1121 .mpeg = CX88_MPEG_DVB,
1122 }, 1122 },
1123 [CX88_BOARD_KWORLD_MCE200_DELUXE] = { 1123 [CX88_BOARD_KWORLD_MCE200_DELUXE] = {
1124 /* FIXME: tested TV input only, disabled composite, 1124 /* FIXME: tested TV input only, disabled composite,
@@ -1134,7 +1134,7 @@ struct cx88_board cx88_boards[] = {
1134 .vmux = 0, 1134 .vmux = 0,
1135 .gpio0 = 0x0000BDE6 1135 .gpio0 = 0x0000BDE6
1136 }}, 1136 }},
1137 .blackbird = 1, 1137 .mpeg = CX88_MPEG_BLACKBIRD,
1138 }, 1138 },
1139 [CX88_BOARD_PIXELVIEW_PLAYTV_P7000] = { 1139 [CX88_BOARD_PIXELVIEW_PLAYTV_P7000] = {
1140 /* FIXME: SVideo, Composite and FM inputs are untested */ 1140 /* FIXME: SVideo, Composite and FM inputs are untested */
@@ -1150,7 +1150,7 @@ struct cx88_board cx88_boards[] = {
1150 .vmux = 0, 1150 .vmux = 0,
1151 .gpio0 = 0x5da6, 1151 .gpio0 = 0x5da6,
1152 }}, 1152 }},
1153 .blackbird = 1, 1153 .mpeg = CX88_MPEG_BLACKBIRD,
1154 }, 1154 },
1155 [CX88_BOARD_NPGTECH_REALTV_TOP10FM] = { 1155 [CX88_BOARD_NPGTECH_REALTV_TOP10FM] = {
1156 .name = "NPG Tech Real TV FM Top 10", 1156 .name = "NPG Tech Real TV FM Top 10",
@@ -1192,7 +1192,7 @@ struct cx88_board cx88_boards[] = {
1192 .gpio2 = 0x00017304, 1192 .gpio2 = 0x00017304,
1193 .gpio3 = 0x02000000, 1193 .gpio3 = 0x02000000,
1194 }}, 1194 }},
1195 .dvb = 1, 1195 .mpeg = CX88_MPEG_DVB,
1196 }, 1196 },
1197 [CX88_BOARD_GENIATECH_DVBS] = { 1197 [CX88_BOARD_GENIATECH_DVBS] = {
1198 .name = "Geniatech DVB-S", 1198 .name = "Geniatech DVB-S",
@@ -1207,7 +1207,7 @@ struct cx88_board cx88_boards[] = {
1207 .type = CX88_VMUX_COMPOSITE1, 1207 .type = CX88_VMUX_COMPOSITE1,
1208 .vmux = 1, 1208 .vmux = 1,
1209 }}, 1209 }},
1210 .dvb = 1, 1210 .mpeg = CX88_MPEG_DVB,
1211 }, 1211 },
1212 [CX88_BOARD_HAUPPAUGE_HVR3000] = { 1212 [CX88_BOARD_HAUPPAUGE_HVR3000] = {
1213 /* FIXME: Add dvb & radio support */ 1213 /* FIXME: Add dvb & radio support */
@@ -1287,6 +1287,7 @@ struct cx88_board cx88_boards[] = {
1287 .tuner_addr = ADDR_UNSET, 1287 .tuner_addr = ADDR_UNSET,
1288 .radio_addr = ADDR_UNSET, 1288 .radio_addr = ADDR_UNSET,
1289 .tda9887_conf = TDA9887_PRESENT, 1289 .tda9887_conf = TDA9887_PRESENT,
1290 .audio_chip = AUDIO_CHIP_WM8775,
1290 .input = {{ 1291 .input = {{
1291 .type = CX88_VMUX_TELEVISION, 1292 .type = CX88_VMUX_TELEVISION,
1292 .vmux = 0, 1293 .vmux = 0,
@@ -1301,7 +1302,7 @@ struct cx88_board cx88_boards[] = {
1301 .gpio0 = 0xe780, 1302 .gpio0 = 0xe780,
1302 }}, 1303 }},
1303 /* fixme: Add radio support */ 1304 /* fixme: Add radio support */
1304 .dvb = 1, 1305 .mpeg = CX88_MPEG_DVB,
1305 }, 1306 },
1306}; 1307};
1307const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); 1308const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
@@ -1581,6 +1582,14 @@ struct cx88_subid cx88_subids[] = {
1581 .subvendor = 0x107d, 1582 .subvendor = 0x107d,
1582 .subdevice = 0x6632, 1583 .subdevice = 0x6632,
1583 .card = CX88_BOARD_LEADTEK_PVR2000, 1584 .card = CX88_BOARD_LEADTEK_PVR2000,
1585 },{
1586 .subvendor = 0x12ab,
1587 .subdevice = 0x2300, /* Club3D Zap TV2100 */
1588 .card = CX88_BOARD_KWORLD_DVB_T_CX22702,
1589 },{
1590 .subvendor = 0x0070,
1591 .subdevice = 0x9000,
1592 .card = CX88_BOARD_HAUPPAUGE_DVB_T1,
1584 }, 1593 },
1585}; 1594};
1586const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); 1595const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index f379ede3049a..4b655f2ef278 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -658,13 +658,6 @@ static unsigned int inline norm_fsc8(struct cx88_tvnorm *norm)
658 return (norm->id & V4L2_STD_625_50) ? pal : ntsc; 658 return (norm->id & V4L2_STD_625_50) ? pal : ntsc;
659} 659}
660 660
661static unsigned int inline norm_notchfilter(struct cx88_tvnorm *norm)
662{
663 return (norm->id & V4L2_STD_625_50)
664 ? HLNotchFilter135PAL
665 : HLNotchFilter135NTSC;
666}
667
668static unsigned int inline norm_htotal(struct cx88_tvnorm *norm) 661static unsigned int inline norm_htotal(struct cx88_tvnorm *norm)
669{ 662{
670 /* Should always be Line Draw Time / (4*FSC) */ 663 /* Should always be Line Draw Time / (4*FSC) */
@@ -937,7 +930,7 @@ int cx88_set_tvnorm(struct cx88_core *core, struct cx88_tvnorm *norm)
937 // htotal 930 // htotal
938 tmp64 = norm_htotal(norm) * (u64)vdec_clock; 931 tmp64 = norm_htotal(norm) * (u64)vdec_clock;
939 do_div(tmp64, fsc8); 932 do_div(tmp64, fsc8);
940 htotal = (u32)tmp64 | (norm_notchfilter(norm) << 11); 933 htotal = (u32)tmp64 | (HLNotchFilter4xFsc << 11);
941 dprintk(1,"set_tvnorm: MO_HTOTAL 0x%08x [old=0x%08x,htotal=%d]\n", 934 dprintk(1,"set_tvnorm: MO_HTOTAL 0x%08x [old=0x%08x,htotal=%d]\n",
942 htotal, cx_read(MO_HTOTAL), (u32)tmp64); 935 htotal, cx_read(MO_HTOTAL), (u32)tmp64);
943 cx_write(MO_HTOTAL, htotal); 936 cx_write(MO_HTOTAL, htotal);
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index c87041dee21e..bd0c8797f26d 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -802,7 +802,7 @@ static int __devinit dvb_probe(struct pci_dev *pci_dev,
802 return -EINVAL; 802 return -EINVAL;
803 803
804 err = -ENODEV; 804 err = -ENODEV;
805 if (!cx88_boards[core->board].dvb) 805 if (!(cx88_boards[core->board].mpeg & CX88_MPEG_DVB))
806 goto fail_core; 806 goto fail_core;
807 807
808 err = -ENOMEM; 808 err = -ENOMEM;
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index 27b5dbb2ca1a..88af23a93870 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -145,7 +145,7 @@ void cx88_call_i2c_clients(struct cx88_core *core, unsigned int cmd, void *arg)
145 if (0 != core->i2c_rc) 145 if (0 != core->i2c_rc)
146 return; 146 return;
147 147
148 if (core->dvbdev) { 148 if ( (core->dvbdev) && (core->dvbdev->dvb.frontend) ) {
149 if (core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl) 149 if (core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl)
150 core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl(core->dvbdev->dvb.frontend, 1); 150 core->dvbdev->dvb.frontend->ops.i2c_gate_ctrl(core->dvbdev->dvb.frontend, 1);
151 151
@@ -220,7 +220,7 @@ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
220 220
221 if (core->tuner_type != TUNER_ABSENT) 221 if (core->tuner_type != TUNER_ABSENT)
222 core->i2c_adap.class |= I2C_CLASS_TV_ANALOG; 222 core->i2c_adap.class |= I2C_CLASS_TV_ANALOG;
223 if (cx88_boards[core->board].dvb) 223 if (cx88_boards[core->board].mpeg & CX88_MPEG_DVB)
224 core->i2c_adap.class |= I2C_CLASS_TV_DIGITAL; 224 core->i2c_adap.class |= I2C_CLASS_TV_DIGITAL;
225 225
226 core->i2c_adap.dev.parent = &pci->dev; 226 core->i2c_adap.dev.parent = &pci->dev;
diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c
index 138a4f692501..d6d980774c21 100644
--- a/drivers/media/video/cx88/cx88-mpeg.c
+++ b/drivers/media/video/cx88/cx88-mpeg.c
@@ -65,8 +65,17 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
65 65
66 /* FIXME: this needs a review. 66 /* FIXME: this needs a review.
67 * also: move to cx88-blackbird + cx88-dvb source files? */ 67 * also: move to cx88-blackbird + cx88-dvb source files? */
68 if (cx88_boards[core->board].mpeg == (CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD) ) {
69 /* Report a warning until the mini driver patch is applied,
70 * else the following conditions will set the dma registers incorrectly.
71 * This will be removed in the next major patch and changes to the conditions
72 * will be made.
73 */
74 printk(KERN_INFO "%s() board->(CX88_MPEG_DVB | CX88_MPEG_BLACKBIRD) is invalid\n", __FUNCTION__);
75 return -EINVAL;
76 }
68 77
69 if (cx88_boards[core->board].dvb) { 78 if (cx88_boards[core->board].mpeg & CX88_MPEG_DVB) {
70 /* negedge driven & software reset */ 79 /* negedge driven & software reset */
71 cx_write(TS_GEN_CNTRL, 0x0040 | dev->ts_gen_cntrl); 80 cx_write(TS_GEN_CNTRL, 0x0040 | dev->ts_gen_cntrl);
72 udelay(100); 81 udelay(100);
@@ -92,7 +101,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev,
92 udelay(100); 101 udelay(100);
93 } 102 }
94 103
95 if (cx88_boards[core->board].blackbird) { 104 if (cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD) {
96 cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */ 105 cx_write(MO_PINMUX_IO, 0x88); /* enable MPEG parallel IO */
97 106
98 cx_write(TS_GEN_CNTRL, 0x46); /* punctured clock TS & posedge driven & software reset */ 107 cx_write(TS_GEN_CNTRL, 0x46); /* punctured clock TS & posedge driven & software reset */
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 741e7c5e69ec..58ba9f773524 100644
--- a/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/drivers/media/video/cx88/cx88-tvaudio.c
@@ -142,7 +142,7 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
142 cx_write(AUD_RATE_THRES_DMD, 0x000000C0); 142 cx_write(AUD_RATE_THRES_DMD, 0x000000C0);
143 cx88_start_audio_dma(core); 143 cx88_start_audio_dma(core);
144 144
145 if (cx88_boards[core->board].blackbird) { 145 if (cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD) {
146 /* sets sound input from external adc */ 146 /* sets sound input from external adc */
147 switch (core->board) { 147 switch (core->board) {
148 case CX88_BOARD_HAUPPAUGE_ROSLYN: 148 case CX88_BOARD_HAUPPAUGE_ROSLYN:
@@ -164,7 +164,7 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
164 cx_write(AUD_I2SCNTL, 0); 164 cx_write(AUD_I2SCNTL, 0);
165 /* cx_write(AUD_APB_IN_RATE_ADJ, 0); */ 165 /* cx_write(AUD_APB_IN_RATE_ADJ, 0); */
166 } 166 }
167 if ((always_analog) || (!cx88_boards[core->board].blackbird)) { 167 if ((always_analog) || (!(cx88_boards[core->board].mpeg & CX88_MPEG_BLACKBIRD))) {
168 ctl |= EN_DAC_ENABLE; 168 ctl |= EN_DAC_ENABLE;
169 cx_write(AUD_CTL, ctl); 169 cx_write(AUD_CTL, ctl);
170 } 170 }
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index fbc79e9842aa..cb0c0eea20f9 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -1928,6 +1928,9 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev,
1928 if (TUNER_ABSENT != core->tuner_type) 1928 if (TUNER_ABSENT != core->tuner_type)
1929 request_module("tuner"); 1929 request_module("tuner");
1930 1930
1931 if (cx88_boards[ core->board ].audio_chip == AUDIO_CHIP_WM8775)
1932 request_module("wm8775");
1933
1931 /* register v4l devices */ 1934 /* register v4l devices */
1932 dev->video_dev = cx88_vdev_init(core,dev->pci, 1935 dev->video_dev = cx88_vdev_init(core,dev->pci,
1933 &cx8800_video_template,"video"); 1936 &cx8800_video_template,"video");
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index 89f12e273b7f..3bc91aad4fe5 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -30,6 +30,7 @@
30#include <media/tveeprom.h> 30#include <media/tveeprom.h>
31#include <media/video-buf.h> 31#include <media/video-buf.h>
32#include <media/cx2341x.h> 32#include <media/cx2341x.h>
33#include <media/audiochip.h>
33#include <media/video-buf-dvb.h> 34#include <media/video-buf-dvb.h>
34 35
35#include "btcx-risc.h" 36#include "btcx-risc.h"
@@ -39,12 +40,6 @@
39#include <linux/mutex.h> 40#include <linux/mutex.h>
40#define CX88_VERSION_CODE KERNEL_VERSION(0,0,6) 41#define CX88_VERSION_CODE KERNEL_VERSION(0,0,6)
41 42
42#ifndef TRUE
43# define TRUE (1==1)
44#endif
45#ifndef FALSE
46# define FALSE (1==0)
47#endif
48#define UNSET (-1U) 43#define UNSET (-1U)
49 44
50#define CX88_MAXBOARDS 8 45#define CX88_MAXBOARDS 8
@@ -73,6 +68,12 @@ enum cx88_deemph_type {
73 FM_DEEMPH_75 68 FM_DEEMPH_75
74}; 69};
75 70
71enum cx88_board_type {
72 CX88_BOARD_NONE = 0,
73 CX88_MPEG_DVB,
74 CX88_MPEG_BLACKBIRD
75};
76
76/* ----------------------------------------------------------- */ 77/* ----------------------------------------------------------- */
77/* tv norms */ 78/* tv norms */
78 79
@@ -230,8 +231,8 @@ struct cx88_board {
230 int tda9887_conf; 231 int tda9887_conf;
231 struct cx88_input input[MAX_CX88_INPUT]; 232 struct cx88_input input[MAX_CX88_INPUT];
232 struct cx88_input radio; 233 struct cx88_input radio;
233 unsigned int blackbird:1; 234 enum cx88_board_type mpeg;
234 unsigned int dvb:1; 235 enum audiochip audio_chip;
235}; 236};
236 237
237struct cx88_subid { 238struct cx88_subid {
diff --git a/drivers/media/video/ir-kbd-i2c.c b/drivers/media/video/ir-kbd-i2c.c
index fba30a40e9c6..1457b1602221 100644
--- a/drivers/media/video/ir-kbd-i2c.c
+++ b/drivers/media/video/ir-kbd-i2c.c
@@ -64,23 +64,32 @@ MODULE_PARM_DESC(hauppauge, "Specify Hauppauge remote: 0=black, 1=grey (defaults
64static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw) 64static int get_key_haup(struct IR_i2c *ir, u32 *ir_key, u32 *ir_raw)
65{ 65{
66 unsigned char buf[3]; 66 unsigned char buf[3];
67 int start, toggle, dev, code; 67 int start, range, toggle, dev, code;
68 68
69 /* poll IR chip */ 69 /* poll IR chip */
70 if (3 != i2c_master_recv(&ir->c,buf,3)) 70 if (3 != i2c_master_recv(&ir->c,buf,3))
71 return -EIO; 71 return -EIO;
72 72
73 /* split rc5 data block ... */ 73 /* split rc5 data block ... */
74 start = (buf[0] >> 6) & 3; 74 start = (buf[0] >> 7) & 1;
75 range = (buf[0] >> 6) & 1;
75 toggle = (buf[0] >> 5) & 1; 76 toggle = (buf[0] >> 5) & 1;
76 dev = buf[0] & 0x1f; 77 dev = buf[0] & 0x1f;
77 code = (buf[1] >> 2) & 0x3f; 78 code = (buf[1] >> 2) & 0x3f;
78 79
79 if (3 != start) 80 /* rc5 has two start bits
81 * the first bit must be one
82 * the second bit defines the command range (1 = 0-63, 0 = 64 - 127)
83 */
84 if (!start)
80 /* no key pressed */ 85 /* no key pressed */
81 return 0; 86 return 0;
82 dprintk(1,"ir hauppauge (rc5): s%d t%d dev=%d code=%d\n", 87
83 start, toggle, dev, code); 88 if (!range)
89 code += 64;
90
91 dprintk(1,"ir hauppauge (rc5): s%d r%d t%d dev=%d code=%d\n",
92 start, range, toggle, dev, code);
84 93
85 /* return key */ 94 /* return key */
86 *ir_key = code; 95 *ir_key = code;
diff --git a/drivers/media/video/msp3400-driver.c b/drivers/media/video/msp3400-driver.c
index 56246b8578f3..cf43df3fe708 100644
--- a/drivers/media/video/msp3400-driver.c
+++ b/drivers/media/video/msp3400-driver.c
@@ -904,6 +904,8 @@ static int msp_attach(struct i2c_adapter *adapter, int address, int kind)
904 state->has_virtual_dolby_surround = msp_revision == 'G' && msp_prod_lo == 1; 904 state->has_virtual_dolby_surround = msp_revision == 'G' && msp_prod_lo == 1;
905 /* Has Virtual Dolby Surround & Dolby Pro Logic: only in msp34x2 */ 905 /* Has Virtual Dolby Surround & Dolby Pro Logic: only in msp34x2 */
906 state->has_dolby_pro_logic = msp_revision == 'G' && msp_prod_lo == 2; 906 state->has_dolby_pro_logic = msp_revision == 'G' && msp_prod_lo == 2;
907 /* The msp343xG supports BTSC only and cannot do Automatic Standard Detection. */
908 state->force_btsc = msp_family == 3 && msp_revision == 'G' && msp_prod_hi == 3;
907 909
908 state->opmode = opmode; 910 state->opmode = opmode;
909 if (state->opmode == OPMODE_AUTO) { 911 if (state->opmode == OPMODE_AUTO) {
diff --git a/drivers/media/video/msp3400-driver.h b/drivers/media/video/msp3400-driver.h
index 545e4ac094f2..7531efa1615e 100644
--- a/drivers/media/video/msp3400-driver.h
+++ b/drivers/media/video/msp3400-driver.h
@@ -64,6 +64,7 @@ struct msp_state {
64 u8 has_sound_processing; 64 u8 has_sound_processing;
65 u8 has_virtual_dolby_surround; 65 u8 has_virtual_dolby_surround;
66 u8 has_dolby_pro_logic; 66 u8 has_dolby_pro_logic;
67 u8 force_btsc;
67 68
68 int radio; 69 int radio;
69 int opmode; 70 int opmode;
diff --git a/drivers/media/video/msp3400-kthreads.c b/drivers/media/video/msp3400-kthreads.c
index ed02ff811388..4c7f85b566a0 100644
--- a/drivers/media/video/msp3400-kthreads.c
+++ b/drivers/media/video/msp3400-kthreads.c
@@ -960,9 +960,10 @@ int msp34xxg_thread(void *data)
960 960
961 /* setup the chip*/ 961 /* setup the chip*/
962 msp34xxg_reset(client); 962 msp34xxg_reset(client);
963 state->std = state->radio ? 0x40 : msp_standard; 963 state->std = state->radio ? 0x40 :
964 /* start autodetect */ 964 (state->force_btsc && msp_standard == 1) ? 32 : msp_standard;
965 msp_write_dem(client, 0x20, state->std); 965 msp_write_dem(client, 0x20, state->std);
966 /* start autodetect */
966 if (state->std != 1) 967 if (state->std != 1)
967 goto unmute; 968 goto unmute;
968 969
diff --git a/drivers/media/video/pvrusb2/Kconfig b/drivers/media/video/pvrusb2/Kconfig
index a52171ef6134..5645c9318890 100644
--- a/drivers/media/video/pvrusb2/Kconfig
+++ b/drivers/media/video/pvrusb2/Kconfig
@@ -18,8 +18,8 @@ config VIDEO_PVRUSB2_29XXX
18 select VIDEO_SAA711X 18 select VIDEO_SAA711X
19 select VIDEO_MSP3400 19 select VIDEO_MSP3400
20 ---help--- 20 ---help---
21 This option enables support for WinTV-PVR USB2 devices whose 21 This option enables support for WinTV-PVR USB2 devices whose
22 model number is of the form "29xxx" (leading prefix of "29" 22 model number is of the form "29xxx" (leading prefix of "29"
23 followed by 3 digits). 23 followed by 3 digits).
24 To see if you may need this option, examine the white 24 To see if you may need this option, examine the white
25 sticker on the underside of your device. 25 sticker on the underside of your device.
@@ -37,14 +37,9 @@ config VIDEO_PVRUSB2_24XXX
37 form "24xxx" (leading prefix of "24" followed by 3 digits). 37 form "24xxx" (leading prefix of "24" followed by 3 digits).
38 To see if you may need this option, examine the white 38 To see if you may need this option, examine the white
39 sticker on the underside of your device. Enabling this 39 sticker on the underside of your device. Enabling this
40 option will not harm support for older devices, however it 40 option will not harm support for older devices.
41 is a separate option because of the experimental nature of
42 this new feature.
43 41
44 If you are in doubt, say N. 42 If you are in doubt, say Y.
45
46 Note: This feature is _very_ experimental. You have been
47 warned.
48 43
49config VIDEO_PVRUSB2_SYSFS 44config VIDEO_PVRUSB2_SYSFS
50 bool "pvrusb2 sysfs support (EXPERIMENTAL)" 45 bool "pvrusb2 sysfs support (EXPERIMENTAL)"
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index 88604365777c..3d8cd0daf6a9 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -24,6 +24,7 @@
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/firmware.h> 25#include <linux/firmware.h>
26#include <linux/videodev2.h> 26#include <linux/videodev2.h>
27#include <media/v4l2-common.h>
27#include <asm/semaphore.h> 28#include <asm/semaphore.h>
28#include "pvrusb2.h" 29#include "pvrusb2.h"
29#include "pvrusb2-std.h" 30#include "pvrusb2-std.h"
@@ -3131,6 +3132,42 @@ static int pvr2_hdw_get_eeprom_addr(struct pvr2_hdw *hdw)
3131} 3132}
3132 3133
3133 3134
3135int pvr2_hdw_register_access(struct pvr2_hdw *hdw,
3136 u32 chip_id,unsigned long reg_id,
3137 int setFl,u32 *val_ptr)
3138{
3139#ifdef CONFIG_VIDEO_ADV_DEBUG
3140 struct list_head *item;
3141 struct pvr2_i2c_client *cp;
3142 struct v4l2_register req;
3143 int stat = 0;
3144 int okFl = 0;
3145
3146 req.i2c_id = chip_id;
3147 req.reg = reg_id;
3148 if (setFl) req.val = *val_ptr;
3149 mutex_lock(&hdw->i2c_list_lock); do {
3150 list_for_each(item,&hdw->i2c_clients) {
3151 cp = list_entry(item,struct pvr2_i2c_client,list);
3152 if (cp->client->driver->id != chip_id) continue;
3153 stat = pvr2_i2c_client_cmd(
3154 cp,(setFl ? VIDIOC_INT_S_REGISTER :
3155 VIDIOC_INT_G_REGISTER),&req);
3156 if (!setFl) *val_ptr = req.val;
3157 okFl = !0;
3158 break;
3159 }
3160 } while (0); mutex_unlock(&hdw->i2c_list_lock);
3161 if (okFl) {
3162 return stat;
3163 }
3164 return -EINVAL;
3165#else
3166 return -ENOSYS;
3167#endif
3168}
3169
3170
3134/* 3171/*
3135 Stuff for Emacs to see, in order to encourage consistent editing style: 3172 Stuff for Emacs to see, in order to encourage consistent editing style:
3136 *** Local Variables: *** 3173 *** Local Variables: ***
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.h b/drivers/media/video/pvrusb2/pvrusb2-hdw.h
index fd931b5da490..29979bb2a768 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.h
@@ -211,6 +211,14 @@ int pvr2_hdw_v4l_get_minor_number(struct pvr2_hdw *);
211/* Store the v4l minor device number */ 211/* Store the v4l minor device number */
212void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,int); 212void pvr2_hdw_v4l_store_minor_number(struct pvr2_hdw *,int);
213 213
214/* Direct read/write access to chip's registers:
215 chip_id - unique id of chip (e.g. I2C_DRIVERD_xxxx)
216 reg_id - register number to access
217 setFl - true to set the register, false to read it
218 val_ptr - storage location for source / result. */
219int pvr2_hdw_register_access(struct pvr2_hdw *,
220 u32 chip_id,unsigned long reg_id,
221 int setFl,u32 *val_ptr);
214 222
215/* The following entry points are all lower level things you normally don't 223/* The following entry points are all lower level things you normally don't
216 want to worry about. */ 224 want to worry about. */
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c
index ed3e8105292a..05121666b9ba 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c
@@ -19,6 +19,7 @@
19 * 19 *
20 */ 20 */
21 21
22#include <linux/kernel.h>
22#include "pvrusb2-i2c-core.h" 23#include "pvrusb2-i2c-core.h"
23#include "pvrusb2-hdw-internal.h" 24#include "pvrusb2-hdw-internal.h"
24#include "pvrusb2-debug.h" 25#include "pvrusb2-debug.h"
@@ -89,7 +90,8 @@ void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
89 90
90const struct pvr2_i2c_op *pvr2_i2c_get_op(unsigned int idx) 91const struct pvr2_i2c_op *pvr2_i2c_get_op(unsigned int idx)
91{ 92{
92 if (idx >= sizeof(ops)/sizeof(ops[0])) return 0; 93 if (idx >= ARRAY_SIZE(ops))
94 return NULL;
93 return ops[idx]; 95 return ops[idx];
94} 96}
95 97
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 3608c2f81df9..97e974d9b9c3 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -29,27 +29,17 @@
29#include "pvrusb2-v4l2.h" 29#include "pvrusb2-v4l2.h"
30#include "pvrusb2-ioread.h" 30#include "pvrusb2-ioread.h"
31#include <linux/videodev2.h> 31#include <linux/videodev2.h>
32#include <media/v4l2-dev.h>
32#include <media/v4l2-common.h> 33#include <media/v4l2-common.h>
33 34
34struct pvr2_v4l2_dev; 35struct pvr2_v4l2_dev;
35struct pvr2_v4l2_fh; 36struct pvr2_v4l2_fh;
36struct pvr2_v4l2; 37struct pvr2_v4l2;
37 38
38/* V4L no longer provide the ability to set / get a private context pointer
39 (i.e. video_get_drvdata / video_set_drvdata), which means we have to
40 concoct our own context locating mechanism. Supposedly this is intended
41 to simplify driver implementation. It's not clear to me how that can
42 possibly be true. Our solution here is to maintain a lookup table of
43 our context instances, indexed by the minor device number of the V4L
44 device. See pvr2_v4l2_open() for some implications of this approach. */
45static struct pvr2_v4l2_dev *devices[256];
46static DEFINE_MUTEX(device_lock);
47
48struct pvr2_v4l2_dev { 39struct pvr2_v4l2_dev {
40 struct video_device devbase; /* MUST be first! */
49 struct pvr2_v4l2 *v4lp; 41 struct pvr2_v4l2 *v4lp;
50 struct video_device *vdev;
51 struct pvr2_context_stream *stream; 42 struct pvr2_context_stream *stream;
52 int ctxt_idx;
53 enum pvr2_config config; 43 enum pvr2_config config;
54}; 44};
55 45
@@ -74,7 +64,7 @@ struct pvr2_v4l2 {
74 struct v4l2_prio_state prio; 64 struct v4l2_prio_state prio;
75 65
76 /* streams */ 66 /* streams */
77 struct pvr2_v4l2_dev video_dev; 67 struct pvr2_v4l2_dev *vdev;
78}; 68};
79 69
80static int video_nr[PVR_NUM] = {[0 ... PVR_NUM-1] = -1}; 70static int video_nr[PVR_NUM] = {[0 ... PVR_NUM-1] = -1};
@@ -671,6 +661,20 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
671 ret = 0; 661 ret = 0;
672 break; 662 break;
673 } 663 }
664#ifdef CONFIG_VIDEO_ADV_DEBUG
665 case VIDIOC_INT_G_REGISTER:
666 case VIDIOC_INT_S_REGISTER:
667 {
668 u32 val;
669 struct v4l2_register *req = (struct v4l2_register *)arg;
670 if (cmd == VIDIOC_INT_S_REGISTER) val = req->val;
671 ret = pvr2_hdw_register_access(
672 hdw,req->i2c_id,req->reg,
673 cmd == VIDIOC_INT_S_REGISTER,&val);
674 if (cmd == VIDIOC_INT_G_REGISTER) req->val = val;
675 break;
676 }
677#endif
674 678
675 default : 679 default :
676 ret = v4l_compat_translate_ioctl(inode,file,cmd, 680 ret = v4l_compat_translate_ioctl(inode,file,cmd,
@@ -704,21 +708,22 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
704static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip) 708static void pvr2_v4l2_dev_destroy(struct pvr2_v4l2_dev *dip)
705{ 709{
706 printk(KERN_INFO "pvrusb2: unregistering device video%d [%s]\n", 710 printk(KERN_INFO "pvrusb2: unregistering device video%d [%s]\n",
707 dip->vdev->minor,pvr2_config_get_name(dip->config)); 711 dip->devbase.minor,pvr2_config_get_name(dip->config));
708 if (dip->ctxt_idx >= 0) { 712
709 mutex_lock(&device_lock); 713 /* Paranoia */
710 devices[dip->ctxt_idx] = NULL; 714 dip->v4lp = 0;
711 dip->ctxt_idx = -1; 715 dip->stream = 0;
712 mutex_unlock(&device_lock); 716
713 } 717 /* Actual deallocation happens later when all internal references
714 video_unregister_device(dip->vdev); 718 are gone. */
719 video_unregister_device(&dip->devbase);
715} 720}
716 721
717 722
718static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp) 723static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp)
719{ 724{
720 pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw,-1); 725 pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw,-1);
721 pvr2_v4l2_dev_destroy(&vp->video_dev); 726 pvr2_v4l2_dev_destroy(vp->vdev);
722 727
723 pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr2_v4l2 id=%p",vp); 728 pvr2_trace(PVR2_TRACE_STRUCT,"Destroying pvr2_v4l2 id=%p",vp);
724 pvr2_channel_done(&vp->channel); 729 pvr2_channel_done(&vp->channel);
@@ -726,6 +731,14 @@ static void pvr2_v4l2_destroy_no_lock(struct pvr2_v4l2 *vp)
726} 731}
727 732
728 733
734static void pvr2_video_device_release(struct video_device *vdev)
735{
736 struct pvr2_v4l2_dev *dev;
737 dev = container_of(vdev,struct pvr2_v4l2_dev,devbase);
738 kfree(dev);
739}
740
741
729static void pvr2_v4l2_internal_check(struct pvr2_channel *chp) 742static void pvr2_v4l2_internal_check(struct pvr2_channel *chp)
730{ 743{
731 struct pvr2_v4l2 *vp; 744 struct pvr2_v4l2 *vp;
@@ -797,40 +810,12 @@ static int pvr2_v4l2_release(struct inode *inode, struct file *file)
797 810
798static int pvr2_v4l2_open(struct inode *inode, struct file *file) 811static int pvr2_v4l2_open(struct inode *inode, struct file *file)
799{ 812{
800 struct pvr2_v4l2_dev *dip = NULL; /* Our own context pointer */ 813 struct pvr2_v4l2_dev *dip; /* Our own context pointer */
801 struct pvr2_v4l2_fh *fhp; 814 struct pvr2_v4l2_fh *fhp;
802 struct pvr2_v4l2 *vp; 815 struct pvr2_v4l2 *vp;
803 struct pvr2_hdw *hdw; 816 struct pvr2_hdw *hdw;
804 817
805 mutex_lock(&device_lock); 818 dip = container_of(video_devdata(file),struct pvr2_v4l2_dev,devbase);
806 /* MCI 7-Jun-2006 Even though we're just doing what amounts to an
807 atomic read of the device mapping array here, we still need the
808 mutex. The problem is that there is a tiny race possible when
809 we register the device. We can't update the device mapping
810 array until after the device has been registered, owing to the
811 fact that we can't know the minor device number until after the
812 registration succeeds. And if another thread tries to open the
813 device in the window of time after registration but before the
814 map is updated, then it will get back an erroneous null pointer
815 and the open will result in a spurious failure. The only way to
816 prevent that is to (a) be inside the mutex here before we access
817 the array, and (b) cover the entire registration process later
818 on with this same mutex. Thus if we get inside the mutex here,
819 then we can be assured that the registration process actually
820 completed correctly. This is an unhappy complication from the
821 use of global data in a driver that lives in a preemptible
822 environment. It sure would be nice if the video device itself
823 had a means for storing and retrieving a local context pointer.
824 Oh wait. It did. But now it's gone. Silly me. */
825 {
826 unsigned int midx = iminor(file->f_dentry->d_inode);
827 if (midx < sizeof(devices)/sizeof(devices[0])) {
828 dip = devices[midx];
829 }
830 }
831 mutex_unlock(&device_lock);
832
833 if (!dip) return -ENODEV; /* Should be impossible but I'm paranoid */
834 819
835 vp = dip->v4lp; 820 vp = dip->v4lp;
836 hdw = vp->channel.hdw; 821 hdw = vp->channel.hdw;
@@ -1060,38 +1045,24 @@ static void pvr2_v4l2_dev_init(struct pvr2_v4l2_dev *dip,
1060 return; 1045 return;
1061 } 1046 }
1062 1047
1063 dip->vdev = video_device_alloc(); 1048 memcpy(&dip->devbase,&vdev_template,sizeof(vdev_template));
1064 if (!dip->vdev) { 1049 dip->devbase.release = pvr2_video_device_release;
1065 err("Alloc of pvrusb2 v4l video device failed");
1066 return;
1067 }
1068
1069 memcpy(dip->vdev,&vdev_template,sizeof(vdev_template));
1070 dip->vdev->release = video_device_release;
1071 mutex_lock(&device_lock);
1072 1050
1073 mindevnum = -1; 1051 mindevnum = -1;
1074 unit_number = pvr2_hdw_get_unit_number(vp->channel.mc_head->hdw); 1052 unit_number = pvr2_hdw_get_unit_number(vp->channel.mc_head->hdw);
1075 if ((unit_number >= 0) && (unit_number < PVR_NUM)) { 1053 if ((unit_number >= 0) && (unit_number < PVR_NUM)) {
1076 mindevnum = video_nr[unit_number]; 1054 mindevnum = video_nr[unit_number];
1077 } 1055 }
1078 if ((video_register_device(dip->vdev, v4l_type, mindevnum) < 0) && 1056 if ((video_register_device(&dip->devbase, v4l_type, mindevnum) < 0) &&
1079 (video_register_device(dip->vdev, v4l_type, -1) < 0)) { 1057 (video_register_device(&dip->devbase, v4l_type, -1) < 0)) {
1080 err("Failed to register pvrusb2 v4l video device"); 1058 err("Failed to register pvrusb2 v4l video device");
1081 } else { 1059 } else {
1082 printk(KERN_INFO "pvrusb2: registered device video%d [%s]\n", 1060 printk(KERN_INFO "pvrusb2: registered device video%d [%s]\n",
1083 dip->vdev->minor,pvr2_config_get_name(dip->config)); 1061 dip->devbase.minor,pvr2_config_get_name(dip->config));
1084 }
1085
1086 if ((dip->vdev->minor < sizeof(devices)/sizeof(devices[0])) &&
1087 (devices[dip->vdev->minor] == NULL)) {
1088 dip->ctxt_idx = dip->vdev->minor;
1089 devices[dip->ctxt_idx] = dip;
1090 } 1062 }
1091 mutex_unlock(&device_lock);
1092 1063
1093 pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw, 1064 pvr2_hdw_v4l_store_minor_number(vp->channel.mc_head->hdw,
1094 dip->vdev->minor); 1065 dip->devbase.minor);
1095} 1066}
1096 1067
1097 1068
@@ -1102,15 +1073,19 @@ struct pvr2_v4l2 *pvr2_v4l2_create(struct pvr2_context *mnp)
1102 vp = kmalloc(sizeof(*vp),GFP_KERNEL); 1073 vp = kmalloc(sizeof(*vp),GFP_KERNEL);
1103 if (!vp) return vp; 1074 if (!vp) return vp;
1104 memset(vp,0,sizeof(*vp)); 1075 memset(vp,0,sizeof(*vp));
1105 vp->video_dev.ctxt_idx = -1; 1076 vp->vdev = kmalloc(sizeof(*vp->vdev),GFP_KERNEL);
1077 if (!vp->vdev) {
1078 kfree(vp);
1079 return 0;
1080 }
1081 memset(vp->vdev,0,sizeof(*vp->vdev));
1106 pvr2_channel_init(&vp->channel,mnp); 1082 pvr2_channel_init(&vp->channel,mnp);
1107 pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr2_v4l2 id=%p",vp); 1083 pvr2_trace(PVR2_TRACE_STRUCT,"Creating pvr2_v4l2 id=%p",vp);
1108 1084
1109 vp->channel.check_func = pvr2_v4l2_internal_check; 1085 vp->channel.check_func = pvr2_v4l2_internal_check;
1110 1086
1111 /* register streams */ 1087 /* register streams */
1112 pvr2_v4l2_dev_init(&vp->video_dev,vp,pvr2_config_mpeg); 1088 pvr2_v4l2_dev_init(vp->vdev,vp,pvr2_config_mpeg);
1113
1114 1089
1115 return vp; 1090 return vp;
1116} 1091}
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index aa1db509f3d4..fe3c83ca3de3 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -2965,6 +2965,35 @@ struct saa7134_board saa7134_boards[] = {
2965 .amux = LINE1, 2965 .amux = LINE1,
2966 }, 2966 },
2967 }, 2967 },
2968 [SAA7134_BOARD_AVERMEDIA_A16AR] = {
2969 /* Petr Baudis <pasky@ucw.cz> */
2970 .name = "AVerMedia TV Hybrid A16AR",
2971 .audio_clock = 0x187de7,
2972 .tuner_type = TUNER_PHILIPS_TDA8290, /* untested */
2973 .radio_type = TUNER_TEA5767, /* untested */
2974 .tuner_addr = ADDR_UNSET,
2975 .radio_addr = ADDR_UNSET,
2976 .tda9887_conf = TDA9887_PRESENT,
2977 .mpeg = SAA7134_MPEG_DVB,
2978 .inputs = {{
2979 .name = name_tv,
2980 .vmux = 1,
2981 .amux = TV,
2982 .tv = 1,
2983 },{
2984 .name = name_comp1,
2985 .vmux = 3,
2986 .amux = LINE2,
2987 },{
2988 .name = name_svideo,
2989 .vmux = 8,
2990 .amux = LINE1,
2991 }},
2992 .radio = {
2993 .name = name_radio,
2994 .amux = LINE1,
2995 },
2996 },
2968}; 2997};
2969 2998
2970const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); 2999const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -3562,6 +3591,12 @@ struct pci_device_id saa7134_pci_tbl[] = {
3562 .subdevice = 0x2003, 3591 .subdevice = 0x2003,
3563 .driver_data = SAA7134_BOARD_PROTEUS_2309, 3592 .driver_data = SAA7134_BOARD_PROTEUS_2309,
3564 },{ 3593 },{
3594 .vendor = PCI_VENDOR_ID_PHILIPS,
3595 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
3596 .subvendor = 0x1461,
3597 .subdevice = 0x2c00,
3598 .driver_data = SAA7134_BOARD_AVERMEDIA_A16AR,
3599 },{
3565 /* --- boards without eeprom + subsystem ID --- */ 3600 /* --- boards without eeprom + subsystem ID --- */
3566 .vendor = PCI_VENDOR_ID_PHILIPS, 3601 .vendor = PCI_VENDOR_ID_PHILIPS,
3567 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 3602 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -3703,6 +3738,7 @@ int saa7134_board_init1(struct saa7134_dev *dev)
3703 saa_writeb(SAA7134_GPIO_GPMODE3, 0x08); 3738 saa_writeb(SAA7134_GPIO_GPMODE3, 0x08);
3704 saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x00); 3739 saa_writeb(SAA7134_GPIO_GPSTATUS3, 0x00);
3705 break; 3740 break;
3741 case SAA7134_BOARD_AVERMEDIA_A16AR:
3706 case SAA7134_BOARD_AVERMEDIA_CARDBUS: 3742 case SAA7134_BOARD_AVERMEDIA_CARDBUS:
3707 /* power-up tuner chip */ 3743 /* power-up tuner chip */
3708 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff); 3744 saa_andorl(SAA7134_GPIO_GPMODE0 >> 2, 0xffffffff, 0xffffffff);
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index b6881541e704..fb741fa465a5 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -1055,6 +1055,7 @@ static int dvb_init(struct saa7134_dev *dev)
1055 } 1055 }
1056 break; 1056 break;
1057 case SAA7134_BOARD_AVERMEDIA_777: 1057 case SAA7134_BOARD_AVERMEDIA_777:
1058 case SAA7134_BOARD_AVERMEDIA_A16AR:
1058 printk("%s: avertv 777 dvb setup\n",dev->name); 1059 printk("%s: avertv 777 dvb setup\n",dev->name);
1059 dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777, 1060 dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777,
1060 &dev->i2c_adap); 1061 &dev->i2c_adap);
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index f7ea857d5d73..ff5991136f4e 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -185,6 +185,7 @@ int saa7134_input_init1(struct saa7134_dev *dev)
185 case SAA7134_BOARD_AVERMEDIA_STUDIO_305: 185 case SAA7134_BOARD_AVERMEDIA_STUDIO_305:
186 case SAA7134_BOARD_AVERMEDIA_STUDIO_307: 186 case SAA7134_BOARD_AVERMEDIA_STUDIO_307:
187 case SAA7134_BOARD_AVERMEDIA_GO_007_FM: 187 case SAA7134_BOARD_AVERMEDIA_GO_007_FM:
188 case SAA7134_BOARD_AVERMEDIA_A16AR:
188 ir_codes = ir_codes_avermedia; 189 ir_codes = ir_codes_avermedia;
189 mask_keycode = 0x0007C8; 190 mask_keycode = 0x0007C8;
190 mask_keydown = 0x000010; 191 mask_keydown = 0x000010;
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 7db7b9705953..701a90942108 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -226,6 +226,7 @@ struct saa7134_format {
226#define SAA7134_BOARD_MEDION_MD8800_QUADRO 96 226#define SAA7134_BOARD_MEDION_MD8800_QUADRO 96
227#define SAA7134_BOARD_FLYDVBS_LR300 97 227#define SAA7134_BOARD_FLYDVBS_LR300 97
228#define SAA7134_BOARD_PROTEUS_2309 98 228#define SAA7134_BOARD_PROTEUS_2309 98
229#define SAA7134_BOARD_AVERMEDIA_A16AR 99
229 230
230#define SAA7134_MAXBOARDS 8 231#define SAA7134_MAXBOARDS 8
231#define SAA7134_INPUT_MAX 8 232#define SAA7134_INPUT_MAX 8
diff --git a/drivers/media/video/video-buf.c b/drivers/media/video/video-buf.c
index acc5ea936687..f429f49901b9 100644
--- a/drivers/media/video/video-buf.c
+++ b/drivers/media/video/video-buf.c
@@ -365,7 +365,12 @@ videobuf_iolock(struct videobuf_queue* q, struct videobuf_buffer *vb,
365 if (NULL == fbuf) 365 if (NULL == fbuf)
366 return -EINVAL; 366 return -EINVAL;
367 /* FIXME: need sanity checks for vb->boff */ 367 /* FIXME: need sanity checks for vb->boff */
368 bus = (dma_addr_t)fbuf->base + vb->boff; 368 /*
369 * Using a double cast to avoid compiler warnings when
370 * building for PAE. Compiler doesn't like direct casting
371 * of a 32 bit ptr to 64 bit integer.
372 */
373 bus = (dma_addr_t)(unsigned long)fbuf->base + vb->boff;
369 pages = PAGE_ALIGN(vb->size) >> PAGE_SHIFT; 374 pages = PAGE_ALIGN(vb->size) >> PAGE_SHIFT;
370 err = videobuf_dma_init_overlay(&vb->dma,PCI_DMA_FROMDEVICE, 375 err = videobuf_dma_init_overlay(&vb->dma,PCI_DMA_FROMDEVICE,
371 bus, pages); 376 bus, pages);
diff --git a/include/asm-mips/bootinfo.h b/include/asm-mips/bootinfo.h
index 78c35ec46362..1e5ccdad3b02 100644
--- a/include/asm-mips/bootinfo.h
+++ b/include/asm-mips/bootinfo.h
@@ -125,12 +125,6 @@
125#define MACH_MOMENCO_OCELOT_3 4 125#define MACH_MOMENCO_OCELOT_3 4
126 126
127/* 127/*
128 * Valid machtype for group ITE
129 */
130#define MACH_GROUP_ITE 13 /* ITE Semi Eval Boards */
131#define MACH_QED_4N_S01B 0 /* ITE8172 based eval board */
132
133/*
134 * Valid machtype for group PHILIPS 128 * Valid machtype for group PHILIPS
135 */ 129 */
136#define MACH_GROUP_PHILIPS 14 130#define MACH_GROUP_PHILIPS 14
@@ -139,12 +133,6 @@
139#define MACH_PHILIPS_JBS 2 /* JBS */ 133#define MACH_PHILIPS_JBS 2 /* JBS */
140 134
141/* 135/*
142 * Valid machtype for group Globespan
143 */
144#define MACH_GROUP_GLOBESPAN 15 /* Globespan */
145#define MACH_IVR 0 /* IVR eval board */
146
147/*
148 * Valid machtype for group SIBYTE 136 * Valid machtype for group SIBYTE
149 */ 137 */
150#define MACH_GROUP_SIBYTE 16 /* Sibyte / Broadcom */ 138#define MACH_GROUP_SIBYTE 16 /* Sibyte / Broadcom */
diff --git a/include/asm-mips/it8172/it8172.h b/include/asm-mips/it8172/it8172.h
deleted file mode 100644
index 8f23af0a1ee8..000000000000
--- a/include/asm-mips/it8172/it8172.h
+++ /dev/null
@@ -1,348 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 system controller defines.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#ifndef __IT8172__H__
32#define __IT8172__H__
33
34#include <asm/addrspace.h>
35
36#define IT8172_BASE 0x18000000
37#define IT8172_PCI_IO_BASE 0x14000000
38#define IT8172_PCI_MEM_BASE 0x10000000
39
40// System registers offsets from IT8172_BASE
41#define IT_CMFPCR 0x0
42#define IT_DSRR 0x2
43#define IT_PCDCR 0x4
44#define IT_SPLLCR 0x6
45#define IT_CIDR 0x10
46#define IT_CRNR 0x12
47#define IT_CPUTR 0x14
48#define IT_CTCR 0x16
49#define IT_SDPR 0xF0
50
51// Power management register offset from IT8172_PCI_IO_BASE
52// Power Management Device Standby Register
53#define IT_PM_DSR 0x15800
54
55#define IT_PM_DSR_TMR0SB 0x0001
56#define IT_PM_DSR_TMR1SB 0x0002
57#define IT_PM_DSR_CIR0SB 0x0004
58#define IT_PM_DSR_CIR1SB 0x0008
59#define IT_PM_DSR_SCR0SB 0x0010
60#define IT_PM_DSR_SCR1SB 0x0020
61#define IT_PM_DSR_PPSB 0x0040
62#define IT_PM_DSR_I2CSB 0x0080
63#define IT_PM_DSR_UARTSB 0x0100
64#define IT_PM_DSR_IDESB 0x0200
65#define IT_PM_DSR_ACSB 0x0400
66#define IT_PM_DSR_M68KSB 0x0800
67
68// Power Management PCI Device Software Reset Register
69#define IT_PM_PCISR 0x15802
70
71#define IT_PM_PCISR_IDESR 0x0001
72#define IT_PM_PCISR_CDMASR 0x0002
73#define IT_PM_PCISR_USBSR 0x0004
74#define IT_PM_PCISR_DMASR 0x0008
75#define IT_PM_PCISR_ACSR 0x0010
76#define IT_PM_PCISR_MEMSR 0x0020
77#define IT_PM_PCISR_68KSR 0x0040
78
79
80// PCI Configuration address and data register offsets
81// from IT8172_BASE
82#define IT_CONFADDR 0x4000
83#define IT_BUSNUM_SHF 16
84#define IT_DEVNUM_SHF 11
85#define IT_FUNCNUM_SHF 8
86#define IT_REGNUM_SHF 2
87
88#define IT_CONFDATA 0x4004
89
90// PCI configuration header common register offsets
91#define IT_VID 0x00
92#define IT_DID 0x02
93#define IT_PCICMD 0x04
94#define IT_PCISTS 0x06
95#define IT_RID 0x08
96#define IT_CLASSC 0x09
97#define IT_HEADT 0x0E
98#define IT_SERIRQC 0x49
99
100// PCI to Internal/LPC Bus Bridge configuration header register offset
101#define IT_P2I_BCR 0x4C
102#define IT_P2I_D0IOSC 0x50
103#define IT_P2I_D1IOSC 0x54
104#define IT_P2I_D2IOSC 0x58
105#define IT_P2I_D3IOSC 0x5C
106#define IT_P2I_D4IOSC 0x60
107#define IT_P2I_D5IOSC 0x64
108#define IT_P2I_D6IOSC 0x68
109#define IT_P2I_D7IOSC 0x6C
110#define IT_P2I_D8IOSC 0x70
111#define IT_P2I_D9IOSC 0x74
112#define IT_P2I_D10IOSC 0x78
113#define IT_P2I_D11IOSC 0x7C
114
115// Memory controller register offsets from IT8172_BASE
116#define IT_MC_SDRMR 0x1000
117#define IT_MC_SDRTR 0x1004
118#define IT_MC_MCR 0x1008
119#define IT_MC_SDTYPE 0x100C
120#define IT_MC_WPBA 0x1010
121#define IT_MC_WPTA 0x1014
122#define IT_MC_HATR 0x1018
123#define IT_MC_PCICR 0x101C
124
125// Flash/ROM control register offsets from IT8172_BASE
126#define IT_FC_BRCR 0x2000
127#define IT_FC_FCR 0x2004
128#define IT_FC_DCR 0x2008
129
130// M68K interface bridge configuration header register offset
131#define IT_M68K_MBCSR 0x54
132#define IT_M68K_TMR 0x58
133#define IT_M68K_BCR 0x5C
134#define IT_M68K_BSR 0x5D
135#define IT_M68K_DTR 0x5F
136
137// Register offset from IT8172_PCI_IO_BASE
138// These registers are accessible through 8172 PCI IO window.
139
140// INTC
141#define IT_INTC_BASE 0x10000
142#define IT_INTC_LBDNIRR 0x10000
143#define IT_INTC_LBDNIMR 0x10002
144#define IT_INTC_LBDNITR 0x10004
145#define IT_INTC_LBDNIAR 0x10006
146#define IT_INTC_LPCNIRR 0x10010
147#define IT_INTC_LPCNIMR 0x10012
148#define IT_INTC_LPCNITR 0x10014
149#define IT_INTC_LPCNIAR 0x10016
150#define IT_INTC_PDNIRR 0x10020
151#define IT_INTC_PDNIMR 0x10022
152#define IT_INTC_PDNITR 0x10024
153#define IT_INTC_PDNIAR 0x10026
154#define IT_INTC_UMNIRR 0x10030
155#define IT_INTC_UMNITR 0x10034
156#define IT_INTC_UMNIAR 0x10036
157#define IT_INTC_TYPER 0x107FE
158
159// IT8172 PCI device number
160#define IT_C2P_DEVICE 0
161#define IT_AUDIO_DEVICE 1
162#define IT_DMAC_DEVICE 1
163#define IT_CDMAC_DEVICE 1
164#define IT_USB_DEVICE 1
165#define IT_P2I_DEVICE 1
166#define IT_IDE_DEVICE 1
167#define IT_M68K_DEVICE 1
168
169// IT8172 PCI function number
170#define IT_C2P_FUNCION 0
171#define IT_AUDIO_FUNCTION 0
172#define IT_DMAC_FUNCTION 1
173#define IT_CDMAC_FUNCTION 2
174#define IT_USB_FUNCTION 3
175#define IT_P2I_FUNCTION 4
176#define IT_IDE_FUNCTION 5
177#define IT_M68K_FUNCTION 6
178
179// IT8172 GPIO
180#define IT_GPADR 0x13800
181#define IT_GPBDR 0x13808
182#define IT_GPCDR 0x13810
183#define IT_GPACR 0x13802
184#define IT_GPBCR 0x1380A
185#define IT_GPCCR 0x13812
186#define IT_GPAICR 0x13804
187#define IT_GPBICR 0x1380C
188#define IT_GPCICR 0x13814
189#define IT_GPAISR 0x13806
190#define IT_GPBISR 0x1380E
191#define IT_GPCISR 0x13816
192#define IT_GCR 0x13818
193
194// IT8172 RTC
195#define IT_RTC_BASE 0x14800
196#define IT_RTC_CENTURY 0x14808
197
198#define IT_RTC_RIR0 0x00
199#define IT_RTC_RTR0 0x01
200#define IT_RTC_RIR1 0x02
201#define IT_RTC_RTR1 0x03
202#define IT_RTC_RIR2 0x04
203#define IT_RTC_RTR2 0x05
204#define IT_RTC_RCTR 0x08
205#define IT_RTC_RA 0x0A
206#define IT_RTC_RB 0x0B
207#define IT_RTC_RC 0x0C
208#define IT_RTC_RD 0x0D
209
210#define RTC_SEC_INDEX 0x00
211#define RTC_MIN_INDEX 0x02
212#define RTC_HOUR_INDEX 0x04
213#define RTC_DAY_INDEX 0x06
214#define RTC_DATE_INDEX 0x07
215#define RTC_MONTH_INDEX 0x08
216#define RTC_YEAR_INDEX 0x09
217
218// IT8172 internal device registers
219#define IT_TIMER_BASE 0x10800
220#define IT_CIR0_BASE 0x11000
221#define IT_UART_BASE 0x11800
222#define IT_SCR0_BASE 0x12000
223#define IT_SCR1_BASE 0x12800
224#define IT_PP_BASE 0x13000
225#define IT_I2C_BASE 0x14000
226#define IT_CIR1_BASE 0x15000
227
228// IT8172 Smart Card Reader offsets from IT_SCR*_BASE
229#define IT_SCR_SFR 0x08
230#define IT_SCR_SCDR 0x09
231
232// IT8172 IT_SCR_SFR bit definition & mask
233#define IT_SCR_SFR_GATE_UART 0x40
234#define IT_SCR_SFR_GATE_UART_BIT 6
235#define IT_SCR_SFR_GATE_UART_OFF 0
236#define IT_SCR_SFR_GATE_UART_ON 1
237#define IT_SCR_SFR_FET_CHARGE 0x30
238#define IT_SCR_SFR_FET_CHARGE_BIT 4
239#define IT_SCR_SFR_FET_CHARGE_3_3_US 3
240#define IT_SCR_SFR_FET_CHARGE_13_US 2
241#define IT_SCR_SFR_FET_CHARGE_53_US 1
242#define IT_SCR_SFR_FET_CHARGE_213_US 0
243#define IT_SCR_SFR_CARD_FREQ 0x0C
244#define IT_SCR_SFR_CARD_FREQ_BIT 2
245#define IT_SCR_SFR_CARD_FREQ_STOP 3
246#define IT_SCR_SFR_CARD_FREQ_3_5_MHZ 0
247#define IT_SCR_SFR_CARD_FREQ_7_1_MHZ 2
248#define IT_SCR_SFR_CARD_FREQ_96_DIV_MHZ 1
249#define IT_SCR_SFR_FET_ACTIVE 0x02
250#define IT_SCR_SFR_FET_ACTIVE_BIT 1
251#define IT_SCR_SFR_FET_ACTIVE_INVERT 0
252#define IT_SCR_SFR_FET_ACTIVE_NONINVERT 1
253#define IT_SCR_SFR_ENABLE 0x01
254#define IT_SCR_SFR_ENABLE_BIT 0
255#define IT_SCR_SFR_ENABLE_OFF 0
256#define IT_SCR_SFR_ENABLE_ON 1
257
258// IT8172 IT_SCR_SCDR bit definition & mask
259#define IT_SCR_SCDR_RESET_MODE 0x80
260#define IT_SCR_SCDR_RESET_MODE_BIT 7
261#define IT_SCR_SCDR_RESET_MODE_ASYNC 0
262#define IT_SCR_SCDR_RESET_MODE_SYNC 1
263#define IT_SCR_SCDR_DIVISOR 0x7F
264#define IT_SCR_SCDR_DIVISOR_BIT 0
265#define IT_SCR_SCDR_DIVISOR_STOP_VAL_1 0x00
266#define IT_SCR_SCDR_DIVISOR_STOP_VAL_2 0x01
267#define IT_SCR_SCDR_DIVISOR_STOP_VAL_3 0x7F
268
269// IT8172 DMA
270#define IT_DMAC_BASE 0x16000
271#define IT_DMAC_BCAR0 0x00
272#define IT_DMAC_BCAR1 0x04
273#define IT_DMAC_BCAR2 0x08
274#define IT_DMAC_BCAR3 0x0C
275#define IT_DMAC_BCCR0 0x02
276#define IT_DMAC_BCCR1 0x06
277#define IT_DMAC_BCCR2 0x0a
278#define IT_DMAC_BCCR3 0x0e
279#define IT_DMAC_CR 0x10
280#define IT_DMAC_SR 0x12
281#define IT_DMAC_ESR 0x13
282#define IT_DMAC_RQR 0x14
283#define IT_DMAC_MR 0x16
284#define IT_DMAC_EMR 0x17
285#define IT_DMAC_MKR 0x18
286#define IT_DMAC_PAR0 0x20
287#define IT_DMAC_PAR1 0x22
288#define IT_DMAC_PAR2 0x24
289#define IT_DMAC_PAR3 0x26
290
291// IT8172 IDE
292#define IT_IDE_BASE 0x17800
293#define IT_IDE_STATUS 0x1F7
294
295// IT8172 Audio Controller
296#define IT_AC_BASE 0x17000
297#define IT_AC_PCMOV 0x00
298#define IT_AC_FMOV 0x02
299#define IT_AC_I2SV 0x04
300#define IT_AC_DRSS 0x06
301#define IT_AC_PCC 0x08
302#define IT_AC_PCDL 0x0A
303#define IT_AC_PCB1STA 0x0C
304#define IT_AC_PCB2STA 0x10
305#define IT_AC_CAPCC 0x14
306#define IT_AC_CAPCDL 0x16
307#define IT_AC_CAPB1STA 0x18
308#define IT_AC_CAPB2STA 0x1C
309#define IT_AC_CODECC 0x22
310#define IT_AC_I2SMC 0x24
311#define IT_AC_VS 0x26
312#define IT_AC_SRCS 0x28
313#define IT_AC_CIRCP 0x2A
314#define IT_AC_CIRDP 0x2C
315#define IT_AC_TM 0x4A
316#define IT_AC_PFDP 0x4C
317#define IT_AC_GC 0x54
318#define IT_AC_IMC 0x56
319#define IT_AC_ISC 0x5B
320#define IT_AC_OPL3SR 0x68
321#define IT_AC_OPL3DWDR 0x69
322#define IT_AC_OPL3AB1W 0x6A
323#define IT_AC_OPL3DW 0x6B
324#define IT_AC_BPDC 0x70
325
326
327// IT8172 Timer
328#define IT_TIMER_BASE 0x10800
329#define TIMER_TCVR0 0x00
330#define TIMER_TRVR0 0x02
331#define TIMER_TCR0 0x04
332#define TIMER_TIRR 0x06
333#define TIMER_TCVR1 0x08
334#define TIMER_TRVR1 0x0A
335#define TIMER_TCR1 0x0C
336#define TIMER_TIDR 0x0E
337
338
339#define IT_WRITE(ofs, data) *(volatile u32 *)KSEG1ADDR((IT8172_BASE+ofs)) = data
340#define IT_READ(ofs, data) data = *(volatile u32 *)KSEG1ADDR((IT8172_BASE+ofs))
341
342#define IT_IO_WRITE(ofs, data) *(volatile u32 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs)) = data
343#define IT_IO_READ(ofs, data) data = *(volatile u32 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs))
344
345#define IT_IO_WRITE16(ofs, data) *(volatile u16 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs)) = data
346#define IT_IO_READ16(ofs, data) data = *(volatile u16 *)KSEG1ADDR((IT8172_PCI_IO_BASE+ofs))
347
348#endif
diff --git a/include/asm-mips/it8172/it8172_cir.h b/include/asm-mips/it8172/it8172_cir.h
deleted file mode 100644
index 6a1dbd29f6d1..000000000000
--- a/include/asm-mips/it8172/it8172_cir.h
+++ /dev/null
@@ -1,140 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 Consumer IR port defines.
5 *
6 * Copyright 2001 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#define NUM_CIR_PORTS 2
32
33/* Master Control Register */
34#define CIR_RESET 0x1
35#define CIR_FIFO_CLEAR 0x2
36#define CIR_SET_FIFO_TL(x) (((x)&0x3)<<2)
37#define CIR_ILE 0x10
38#define CIR_ILSEL 0x20
39
40/* Interrupt Enable Register */
41#define CIR_TLDLIE 0x1
42#define CIR_RDAIE 0x2
43#define CIR_RFOIE 0x4
44#define CIR_IEC 0x80
45
46/* Interrupt Identification Register */
47#define CIR_TLDLI 0x1
48#define CIR_RDAI 0x2
49#define CIR_RFOI 0x4
50#define CIR_NIP 0x80
51
52/* Carrier Frequency Register */
53#define CIR_SET_CF(x) ((x)&0x1f)
54 #define CFQ_38_480 0xB /* 38 KHz low, 480 KHz high */
55#define CIR_HCFS 0x20
56 #define CIR_SET_HS(x) (((x)&0x1)<<5)
57
58
59/* Receiver Control Register */
60#define CIR_SET_RXDCR(x) ((x)&0x7)
61#define CIR_RXACT 0x8
62#define CIR_RXEND 0x10
63#define CIR_RDWOS 0x20
64 #define CIR_SET_RDWOS(x) (((x)&0x1)<<5)
65#define CIR_RXEN 0x80
66
67/* Transmitter Control Register */
68#define CIR_SET_TXMPW(x) ((x)&0x7)
69#define CIR_SET_TXMPM(x) (((x)&0x3)<<3)
70#define CIR_TXENDF 0x20
71#define CIR_TXRLE 0x40
72
73/* Receiver FIFO Status Register */
74#define CIR_RXFBC_MASK 0x3f
75#define CIR_RXFTO 0x80
76
77/* Wakeup Code Length Register */
78#define CIR_SET_WCL ((x)&0x3f)
79#define CIR_WCL_MASK(x) ((x)&0x3f)
80
81/* Wakeup Power Control/Status Register */
82#define CIR_BTMON 0x2
83#define CIR_CIRON 0x4
84#define CIR_RCRST 0x10
85#define CIR_WCRST 0x20
86
87struct cir_port {
88 int port;
89 unsigned short baud_rate;
90 unsigned char fifo_tl;
91 unsigned char cfq;
92 unsigned char hcfs;
93 unsigned char rdwos;
94 unsigned char rxdcr;
95};
96
97struct it8172_cir_regs {
98 unsigned char dr; /* data */
99 char pad;
100 unsigned char mstcr; /* master control */
101 char pad1;
102 unsigned char ier; /* interrupt enable */
103 char pad2;
104 unsigned char iir; /* interrupt identification */
105 char pad3;
106 unsigned char cfr; /* carrier frequency */
107 char pad4;
108 unsigned char rcr; /* receiver control */
109 char pad5;
110 unsigned char tcr; /* transmitter control */
111 char pad6;
112 char pad7;
113 char pad8;
114 unsigned char bdlr; /* baud rate divisor low byte */
115 char pad9;
116 unsigned char bdhr; /* baud rate divisor high byte */
117 char pad10;
118 unsigned char tfsr; /* tx fifo byte count */
119 char pad11;
120 unsigned char rfsr; /* rx fifo status */
121 char pad12;
122 unsigned char wcl; /* wakeup code length */
123 char pad13;
124 unsigned char wcr; /* wakeup code read/write */
125 char pad14;
126 unsigned char wps; /* wakeup power control/status */
127};
128
129int cir_port_init(struct cir_port *cir);
130extern void clear_fifo(struct cir_port *cir);
131extern void enable_receiver(struct cir_port *cir);
132extern void disable_receiver(struct cir_port *cir);
133extern void enable_rx_demodulation(struct cir_port *cir);
134extern void disable_rx_demodulation(struct cir_port *cir);
135extern void set_rx_active(struct cir_port *cir);
136extern void int_enable(struct cir_port *cir);
137extern void rx_int_enable(struct cir_port *cir);
138extern char get_int_status(struct cir_port *cir);
139extern int cir_get_rx_count(struct cir_port *cir);
140extern char cir_read_data(struct cir_port *cir);
diff --git a/include/asm-mips/it8172/it8172_dbg.h b/include/asm-mips/it8172/it8172_dbg.h
deleted file mode 100644
index f404ec7c03ac..000000000000
--- a/include/asm-mips/it8172/it8172_dbg.h
+++ /dev/null
@@ -1,38 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * Function prototypes for low level uart routines to
5 * directly access a 16550 uart.
6 *
7 * Copyright 2000 MontaVista Software Inc.
8 * Author: MontaVista Software, Inc.
9 * ppopov@mvista.com or source@mvista.com
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms of the GNU General Public License as published by the
13 * Free Software Foundation; either version 2 of the License, or (at your
14 * option) any later version.
15 *
16 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
19 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
21 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
22 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
23 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
24 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
25 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 *
27 * You should have received a copy of the GNU General Public License along
28 * with this program; if not, write to the Free Software Foundation, Inc.,
29 * 675 Mass Ave, Cambridge, MA 02139, USA.
30 */
31
32#include <linux/types.h>
33
34extern void putch(const unsigned char c);
35extern void puts(unsigned char *cp);
36extern void fputs(unsigned char *cp);
37extern void put64(uint64_t ul);
38extern void put32(unsigned u);
diff --git a/include/asm-mips/it8172/it8172_int.h b/include/asm-mips/it8172/it8172_int.h
deleted file mode 100644
index 837e83ac25f5..000000000000
--- a/include/asm-mips/it8172/it8172_int.h
+++ /dev/null
@@ -1,144 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * ITE 8172 Interrupt Numbering
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#ifndef _MIPS_ITEINT_H
32#define _MIPS_ITEINT_H
33
34/*
35 * Here's the "strategy":
36 * We number the LPC serial irqs from 0 to 15,
37 * the local bus irqs from 16 to 31,
38 * the pci dev register interrupts from 32 to 47,
39 * and the non-maskable ints from 48 to 53.
40 */
41
42#define IT8172_LPC_IRQ_BASE 0 /* first LPC int number */
43#define IT8172_SERIRQ_0 (IT8172_LPC_IRQ_BASE + 0)
44#define IT8172_SERIRQ_1 (IT8172_LPC_IRQ_BASE + 1)
45#define IT8172_SERIRQ_2 (IT8172_LPC_IRQ_BASE + 2)
46#define IT8172_SERIRQ_3 (IT8172_LPC_IRQ_BASE + 3)
47#define IT8172_SERIRQ_4 (IT8172_LPC_IRQ_BASE + 4)
48#define IT8172_SERIRQ_5 (IT8172_LPC_IRQ_BASE + 5)
49#define IT8172_SERIRQ_6 (IT8172_LPC_IRQ_BASE + 6)
50#define IT8172_SERIRQ_7 (IT8172_LPC_IRQ_BASE + 7)
51#define IT8172_SERIRQ_8 (IT8172_LPC_IRQ_BASE + 8)
52#define IT8172_SERIRQ_9 (IT8172_LPC_IRQ_BASE + 9)
53#define IT8172_SERIRQ_10 (IT8172_LPC_IRQ_BASE + 10)
54#define IT8172_SERIRQ_11 (IT8172_LPC_IRQ_BASE + 11)
55#define IT8172_SERIRQ_12 (IT8172_LPC_IRQ_BASE + 12)
56#define IT8172_SERIRQ_13 (IT8172_LPC_IRQ_BASE + 13)
57#define IT8172_SERIRQ_14 (IT8172_LPC_IRQ_BASE + 14)
58#define IT8172_SERIRQ_15 (IT8172_LPC_IRQ_BASE + 15)
59
60#define IT8172_LB_IRQ_BASE 16 /* first local bus int number */
61#define IT8172_PPR_IRQ (IT8172_LB_IRQ_BASE + 0) /* parallel port */
62#define IT8172_TIMER0_IRQ (IT8172_LB_IRQ_BASE + 1)
63#define IT8172_TIMER1_IRQ (IT8172_LB_IRQ_BASE + 2)
64#define IT8172_I2C_IRQ (IT8172_LB_IRQ_BASE + 3)
65#define IT8172_GPIO_IRQ (IT8172_LB_IRQ_BASE + 4)
66#define IT8172_CIR0_IRQ (IT8172_LB_IRQ_BASE + 5)
67#define IT8172_CIR1_IRQ (IT8172_LB_IRQ_BASE + 6)
68#define IT8172_UART_IRQ (IT8172_LB_IRQ_BASE + 7)
69#define IT8172_SCR0_IRQ (IT8172_LB_IRQ_BASE + 8)
70#define IT8172_SCR1_IRQ (IT8172_LB_IRQ_BASE + 9)
71#define IT8172_RTC_IRQ (IT8172_LB_IRQ_BASE + 10)
72#define IT8172_IOCHK_IRQ (IT8172_LB_IRQ_BASE + 11)
73/* 12 - 15 reserved */
74
75/*
76 * Note here that the pci dev registers includes bits for more than
77 * just the pci devices.
78 */
79#define IT8172_PCI_DEV_IRQ_BASE 32 /* first pci dev irq */
80#define IT8172_AC97_IRQ (IT8172_PCI_DEV_IRQ_BASE + 0)
81#define IT8172_MC68K_IRQ (IT8172_PCI_DEV_IRQ_BASE + 1)
82#define IT8172_IDE_IRQ (IT8172_PCI_DEV_IRQ_BASE + 2)
83#define IT8172_USB_IRQ (IT8172_PCI_DEV_IRQ_BASE + 3)
84#define IT8172_BRIDGE_MASTER_IRQ (IT8172_PCI_DEV_IRQ_BASE + 4)
85#define IT8172_BRIDGE_TARGET_IRQ (IT8172_PCI_DEV_IRQ_BASE + 5)
86#define IT8172_PCI_INTA_IRQ (IT8172_PCI_DEV_IRQ_BASE + 6)
87#define IT8172_PCI_INTB_IRQ (IT8172_PCI_DEV_IRQ_BASE + 7)
88#define IT8172_PCI_INTC_IRQ (IT8172_PCI_DEV_IRQ_BASE + 8)
89#define IT8172_PCI_INTD_IRQ (IT8172_PCI_DEV_IRQ_BASE + 9)
90#define IT8172_S_INTA_IRQ (IT8172_PCI_DEV_IRQ_BASE + 10)
91#define IT8172_S_INTB_IRQ (IT8172_PCI_DEV_IRQ_BASE + 11)
92#define IT8172_S_INTC_IRQ (IT8172_PCI_DEV_IRQ_BASE + 12)
93#define IT8172_S_INTD_IRQ (IT8172_PCI_DEV_IRQ_BASE + 13)
94#define IT8172_CDMA_IRQ (IT8172_PCI_DEV_IRQ_BASE + 14)
95#define IT8172_DMA_IRQ (IT8172_PCI_DEV_IRQ_BASE + 15)
96
97#define IT8172_NMI_IRQ_BASE 48
98#define IT8172_SER_NMI_IRQ (IT8172_NMI_IRQ_BASE + 0)
99#define IT8172_PCI_NMI_IRQ (IT8172_NMI_IRQ_BASE + 1)
100#define IT8172_RTC_NMI_IRQ (IT8172_NMI_IRQ_BASE + 2)
101#define IT8172_CPUIF_NMI_IRQ (IT8172_NMI_IRQ_BASE + 3)
102#define IT8172_PMER_NMI_IRQ (IT8172_NMI_IRQ_BASE + 4)
103#define IT8172_POWER_NMI_IRQ (IT8172_NMI_IRQ_BASE + 5)
104
105#define IT8172_LAST_IRQ (IT8172_POWER_NMI_IRQ)
106/* Finally, let's move over here the mips cpu timer interrupt.
107 */
108#define MIPS_CPU_TIMER_IRQ (NR_IRQS-1)
109
110/*
111 * IT8172 Interrupt Controller Registers
112 */
113struct it8172_intc_regs {
114 volatile unsigned short lb_req; /* offset 0 */
115 volatile unsigned short lb_mask;
116 volatile unsigned short lb_trigger;
117 volatile unsigned short lb_level;
118 unsigned char pad0[8];
119
120 volatile unsigned short lpc_req; /* offset 0x10 */
121 volatile unsigned short lpc_mask;
122 volatile unsigned short lpc_trigger;
123 volatile unsigned short lpc_level;
124 unsigned char pad1[8];
125
126 volatile unsigned short pci_req; /* offset 0x20 */
127 volatile unsigned short pci_mask;
128 volatile unsigned short pci_trigger;
129 volatile unsigned short pci_level;
130 unsigned char pad2[8];
131
132 volatile unsigned short nmi_req; /* offset 0x30 */
133 volatile unsigned short nmi_mask;
134 volatile unsigned short nmi_trigger;
135 volatile unsigned short nmi_level;
136 unsigned char pad3[6];
137
138 volatile unsigned short nmi_redir; /* offset 0x3E */
139 unsigned char pad4[0xBE];
140
141 volatile unsigned short intstatus; /* offset 0xFE */
142};
143
144#endif /* _MIPS_ITEINT_H */
diff --git a/include/asm-mips/it8172/it8172_pci.h b/include/asm-mips/it8172/it8172_pci.h
deleted file mode 100644
index 42c61f56eeba..000000000000
--- a/include/asm-mips/it8172/it8172_pci.h
+++ /dev/null
@@ -1,108 +0,0 @@
1/*
2 *
3 * BRIEF MODULE DESCRIPTION
4 * IT8172 system controller specific pci defines.
5 *
6 * Copyright 2000 MontaVista Software Inc.
7 * Author: MontaVista Software, Inc.
8 * ppopov@mvista.com or source@mvista.com
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms of the GNU General Public License as published by the
12 * Free Software Foundation; either version 2 of the License, or (at your
13 * option) any later version.
14 *
15 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
16 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
17 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
18 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
19 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
20 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
21 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
22 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
24 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 *
26 * You should have received a copy of the GNU General Public License along
27 * with this program; if not, write to the Free Software Foundation, Inc.,
28 * 675 Mass Ave, Cambridge, MA 02139, USA.
29 */
30
31#ifndef _8172PCI_H_
32#define _8172PCI_H_
33
34// PCI configuration space Type0
35#define PCI_IDREG 0x00
36#define PCI_CMDSTSREG 0x04
37#define PCI_CLASSREG 0x08
38#define PCI_BHLCREG 0x0C
39#define PCI_BASE1REG 0x10
40#define PCI_BASE2REG 0x14
41#define PCI_BASE3REG 0x18
42#define PCI_BASE4REG 0x1C
43#define PCI_BASE5REG 0x20
44#define PCI_BASE6REG 0x24
45#define PCI_ROMBASEREG 0x30
46#define PCI_INTRREG 0x3C
47
48// PCI configuration space Type1
49#define PCI_BUSNOREG 0x18
50
51#define IT_PCI_VENDORID(x) ((x) & 0xFFFF)
52#define IT_PCI_DEVICEID(x) (((x)>>16) & 0xFFFF)
53
54// Command register
55#define PCI_CMD_IOEN 0x00000001
56#define PCI_CMD_MEMEN 0x00000002
57#define PCI_CMD_BUSMASTER 0x00000004
58#define PCI_CMD_SPCYCLE 0x00000008
59#define PCI_CMD_WRINV 0x00000010
60#define PCI_CMD_VGASNOOP 0x00000020
61#define PCI_CMD_PERR 0x00000040
62#define PCI_CMD_WAITCTRL 0x00000080
63#define PCI_CMD_SERR 0x00000100
64#define PCI_CMD_FAST_BACKTOBACK 0x00000200
65
66// Status register
67#define PCI_STS_66MHZ 0x00200000
68#define PCI_STS_SUPPORT_UDF 0x00400000
69#define PCI_STS_FAST_BACKTOBACK 0x00800000
70#define PCI_STS_DATA_PERR 0x01000000
71#define PCI_STS_DEVSEL0 0x02000000
72#define PCI_STS_DEVSEL1 0x04000000
73#define PCI_STS_SIG_TGTABORT 0x08000000
74#define PCI_STS_RCV_TGTABORT 0x10000000
75#define PCI_STS_RCV_MSTABORT 0x20000000
76#define PCI_STS_SYSERR 0x40000000
77#define PCI_STS_DETCT_PERR 0x80000000
78
79#define IT_PCI_CLASS(x) (((x)>>24) & 0xFF)
80#define IT_PCI_SUBCLASS(x) (((x)>>16) & 0xFF)
81#define IT_PCI_INTERFACE(x) (((x)>>8) & 0xFF)
82#define IT_PCI_REVISION(x) ((x) & 0xFF)
83
84// PCI class code
85#define PCI_CLASS_BRIDGE 0x06
86
87// bridge subclass
88#define PCI_SUBCLASS_BRIDGE_HOST 0x00
89#define PCI_SUBCLASS_BRIDGE_PCI 0x04
90
91// BHLCREG
92#define IT_PCI_BIST(x) (((x)>>24) & 0xFF)
93#define IT_PCI_HEADERTYPE(x) (((x)>>16) & 0xFF)
94#define IT_PCI_LATENCYTIMER(x) (((x)>>8) & 0xFF)
95#define IT_PCI_CACHELINESIZE(x) ((x) & 0xFF)
96
97#define PCI_MULTIFUNC 0x80
98
99// INTRREG
100#define IT_PCI_MAXLAT(x) (((x)>>24) & 0xFF)
101#define IT_PCI_MINGNT(x) (((x)>>16) & 0xFF)
102#define IT_PCI_INTRPIN(x) (((x)>>8) & 0xFF)
103#define IT_PCI_INTRLINE(x) ((x) & 0xFF)
104
105#define PCI_VENDOR_NEC 0x1033
106#define PCI_VENDOR_DEC 0x1101
107
108#endif // _8172PCI_H_
diff --git a/include/asm-mips/it8712.h b/include/asm-mips/it8712.h
deleted file mode 100644
index ca2dee02a011..000000000000
--- a/include/asm-mips/it8712.h
+++ /dev/null
@@ -1,28 +0,0 @@
1
2#ifndef __IT8712_H__
3#define __IT8712_H__
4
5#define LPC_BASE_ADDR 0x14000000
6
7// MB PnP configuration register
8#define LPC_KEY_ADDR 0x1400002E
9#define LPC_DATA_ADDR 0x1400002F
10
11// Device LDN
12#define LDN_SERIAL1 0x01
13#define LDN_SERIAL2 0x02
14#define LDN_PARALLEL 0x03
15#define LDN_KEYBOARD 0x05
16#define LDN_MOUSE 0x06
17
18#define IT8712_UART1_PORT 0x3F8
19#define IT8712_UART2_PORT 0x2F8
20
21#ifndef ASM_ONLY
22
23void LPCSetConfig(char LdnNumber, char Index, char data);
24char LPCGetConfig(char LdnNumber, char Index);
25
26#endif
27
28#endif
diff --git a/include/asm-mips/ptrace.h b/include/asm-mips/ptrace.h
index 4fb0fc43ffd7..5f3a9075cd28 100644
--- a/include/asm-mips/ptrace.h
+++ b/include/asm-mips/ptrace.h
@@ -44,9 +44,8 @@ struct pt_regs {
44 unsigned long cp0_epc; 44 unsigned long cp0_epc;
45#ifdef CONFIG_MIPS_MT_SMTC 45#ifdef CONFIG_MIPS_MT_SMTC
46 unsigned long cp0_tcstatus; 46 unsigned long cp0_tcstatus;
47 unsigned long smtc_pad;
48#endif /* CONFIG_MIPS_MT_SMTC */ 47#endif /* CONFIG_MIPS_MT_SMTC */
49}; 48} __attribute__ ((aligned (8)));
50 49
51/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */ 50/* Arbitrarily choose the same ptrace numbers as used by the Sparc code. */
52#define PTRACE_GETREGS 12 51#define PTRACE_GETREGS 12
diff --git a/include/asm-mips/serial.h b/include/asm-mips/serial.h
index c882e04e1497..d7a65135d837 100644
--- a/include/asm-mips/serial.h
+++ b/include/asm-mips/serial.h
@@ -69,38 +69,6 @@
69#define EV64120_SERIAL_PORT_DEFNS 69#define EV64120_SERIAL_PORT_DEFNS
70#endif 70#endif
71 71
72#ifdef CONFIG_MIPS_ITE8172
73#include <asm/it8172/it8172.h>
74#include <asm/it8172/it8172_int.h>
75#include <asm/it8712.h>
76#define ITE_SERIAL_PORT_DEFNS \
77 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \
78 .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
79 { .baud_base = (24000000/(16*13)), .port = (IT8172_PCI_IO_BASE + IT8712_UART1_PORT), \
80 .irq = IT8172_SERIRQ_4, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
81 /* Smart Card Reader 0 */ \
82 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR0_BASE), \
83 .irq = IT8172_SCR0_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
84 /* Smart Card Reader 1 */ \
85 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \
86 .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 },
87#else
88#define ITE_SERIAL_PORT_DEFNS
89#endif
90
91#ifdef CONFIG_MIPS_IVR
92#include <asm/it8172/it8172.h>
93#include <asm/it8172/it8172_int.h>
94#define IVR_SERIAL_PORT_DEFNS \
95 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_UART_BASE), \
96 .irq = IT8172_UART_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 }, \
97 /* Smart Card Reader 1 */ \
98 { .baud_base = BASE_BAUD, .port = (IT8172_PCI_IO_BASE + IT_SCR1_BASE), \
99 .irq = IT8172_SCR1_IRQ, .flags = STD_COM_FLAGS, .port = PORT_16550 },
100#else
101#define IVR_SERIAL_PORT_DEFNS
102#endif
103
104#ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT 72#ifdef CONFIG_HAVE_STD_PC_SERIAL_PORT
105#define STD_SERIAL_PORT_DEFNS \ 73#define STD_SERIAL_PORT_DEFNS \
106 /* UART CLK PORT IRQ FLAGS */ \ 74 /* UART CLK PORT IRQ FLAGS */ \
@@ -240,8 +208,6 @@
240 DDB5477_SERIAL_PORT_DEFNS \ 208 DDB5477_SERIAL_PORT_DEFNS \
241 EV64120_SERIAL_PORT_DEFNS \ 209 EV64120_SERIAL_PORT_DEFNS \
242 IP32_SERIAL_PORT_DEFNS \ 210 IP32_SERIAL_PORT_DEFNS \
243 ITE_SERIAL_PORT_DEFNS \
244 IVR_SERIAL_PORT_DEFNS \
245 JAZZ_SERIAL_PORT_DEFNS \ 211 JAZZ_SERIAL_PORT_DEFNS \
246 STD_SERIAL_PORT_DEFNS \ 212 STD_SERIAL_PORT_DEFNS \
247 MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \ 213 MOMENCO_OCELOT_G_SERIAL_PORT_DEFNS \
diff --git a/include/linux/ite_gpio.h b/include/linux/ite_gpio.h
deleted file mode 100644
index b123a14292d3..000000000000
--- a/include/linux/ite_gpio.h
+++ /dev/null
@@ -1,66 +0,0 @@
1/*
2 * FILE NAME ite_gpio.h
3 *
4 * BRIEF MODULE DESCRIPTION
5 * Generic gpio.
6 *
7 * Author: MontaVista Software, Inc. <source@mvista.com>
8 * Hai-Pao Fan <haipao@mvista.com>
9 *
10 * Copyright 2001 MontaVista Software Inc.
11 *
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public License as published by the
14 * Free Software Foundation; either version 2 of the License, or (at your
15 * option) any later version.
16 *
17 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
18 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
19 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
20 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
21 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
22 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
23 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
24 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
27 *
28 * You should have received a copy of the GNU General Public License along
29 * with this program; if not, write to the Free Software Foundation, Inc.,
30 * 675 Mass Ave, Cambridge, MA 02139, USA.
31 */
32
33#ifndef __ITE_GPIO_H
34#define __ITE_GPIO_H
35
36#include <linux/ioctl.h>
37
38struct ite_gpio_ioctl_data {
39 __u32 device;
40 __u32 mask;
41 __u32 data;
42};
43
44#define ITE_GPIO_IOCTL_BASE 'Z'
45
46#define ITE_GPIO_IN _IOWR(ITE_GPIO_IOCTL_BASE, 0, struct ite_gpio_ioctl_data)
47#define ITE_GPIO_OUT _IOW (ITE_GPIO_IOCTL_BASE, 1, struct ite_gpio_ioctl_data)
48#define ITE_GPIO_INT_CTRL _IOW (ITE_GPIO_IOCTL_BASE, 2, struct ite_gpio_ioctl_data)
49#define ITE_GPIO_IN_STATUS _IOW (ITE_GPIO_IOCTL_BASE, 3, struct ite_gpio_ioctl_data)
50#define ITE_GPIO_OUT_STATUS _IOW (ITE_GPIO_IOCTL_BASE, 4, struct ite_gpio_ioctl_data)
51#define ITE_GPIO_GEN_CTRL _IOW (ITE_GPIO_IOCTL_BASE, 5, struct ite_gpio_ioctl_data)
52#define ITE_GPIO_INT_WAIT _IOW (ITE_GPIO_IOCTL_BASE, 6, struct ite_gpio_ioctl_data)
53
54#define ITE_GPIO_PORTA 0x01
55#define ITE_GPIO_PORTB 0x02
56#define ITE_GPIO_PORTC 0x04
57
58extern int ite_gpio_in(__u32 device, __u32 mask, volatile __u32 *data);
59extern int ite_gpio_out(__u32 device, __u32 mask, __u32 data);
60extern int ite_gpio_int_ctrl(__u32 device, __u32 mask, __u32 data);
61extern int ite_gpio_in_status(__u32 device, __u32 mask, volatile __u32 *data);
62extern int ite_gpio_out_status(__u32 device, __u32 mask, __u32 data);
63extern int ite_gpio_gen_ctrl(__u32 device, __u32 mask, __u32 data);
64extern int ite_gpio_int_wait(__u32 device, __u32 mask, __u32 data);
65
66#endif
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index c9ffbc3843d5..f069df245469 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -1615,8 +1615,6 @@
1615#define PCI_VENDOR_ID_ROCKWELL 0x127A 1615#define PCI_VENDOR_ID_ROCKWELL 0x127A
1616 1616
1617#define PCI_VENDOR_ID_ITE 0x1283 1617#define PCI_VENDOR_ID_ITE 0x1283
1618#define PCI_DEVICE_ID_ITE_IT8172G 0x8172
1619#define PCI_DEVICE_ID_ITE_IT8172G_AUDIO 0x0801
1620#define PCI_DEVICE_ID_ITE_8211 0x8211 1618#define PCI_DEVICE_ID_ITE_8211 0x8211
1621#define PCI_DEVICE_ID_ITE_8212 0x8212 1619#define PCI_DEVICE_ID_ITE_8212 0x8212
1622#define PCI_DEVICE_ID_ITE_8872 0x8872 1620#define PCI_DEVICE_ID_ITE_8872 0x8872
@@ -1883,6 +1881,8 @@
1883#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400 1881#define PCI_DEVICE_ID_PANACOM_QUADMODEM 0x0400
1884#define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402 1882#define PCI_DEVICE_ID_PANACOM_DUALMODEM 0x0402
1885 1883
1884#define PCI_VENDOR_ID_SIPACKETS 0x14d9
1885#define PCI_DEVICE_ID_SP1011 0x0010
1886 1886
1887#define PCI_VENDOR_ID_AFAVLAB 0x14db 1887#define PCI_VENDOR_ID_AFAVLAB 0x14db
1888#define PCI_DEVICE_ID_AFAVLAB_P028 0x2180 1888#define PCI_DEVICE_ID_AFAVLAB_P028 0x2180
@@ -1997,6 +1997,7 @@
1997#define PCI_DEVICE_ID_FARSITE_TE1C 0x1612 1997#define PCI_DEVICE_ID_FARSITE_TE1C 0x1612
1998 1998
1999#define PCI_VENDOR_ID_SIBYTE 0x166d 1999#define PCI_VENDOR_ID_SIBYTE 0x166d
2000#define PCI_DEVICE_ID_BCM1250_PCI 0x0001
2000#define PCI_DEVICE_ID_BCM1250_HT 0x0002 2001#define PCI_DEVICE_ID_BCM1250_HT 0x0002
2001 2002
2002#define PCI_VENDOR_ID_NETCELL 0x169c 2003#define PCI_VENDOR_ID_NETCELL 0x169c
diff --git a/include/linux/videodev2.h b/include/linux/videodev2.h
index 44c59da26ed2..c5fdf6259548 100644
--- a/include/linux/videodev2.h
+++ b/include/linux/videodev2.h
@@ -276,6 +276,82 @@ struct v4l2_fmtdesc
276 276
277#define V4L2_FMT_FLAG_COMPRESSED 0x0001 277#define V4L2_FMT_FLAG_COMPRESSED 0x0001
278 278
279#if 1
280 /* Experimental Frame Size and frame rate enumeration */
281/*
282 * F R A M E S I Z E E N U M E R A T I O N
283 */
284enum v4l2_frmsizetypes
285{
286 V4L2_FRMSIZE_TYPE_DISCRETE = 1,
287 V4L2_FRMSIZE_TYPE_CONTINUOUS = 2,
288 V4L2_FRMSIZE_TYPE_STEPWISE = 3,
289};
290
291struct v4l2_frmsize_discrete
292{
293 __u32 width; /* Frame width [pixel] */
294 __u32 height; /* Frame height [pixel] */
295};
296
297struct v4l2_frmsize_stepwise
298{
299 __u32 min_width; /* Minimum frame width [pixel] */
300 __u32 max_width; /* Maximum frame width [pixel] */
301 __u32 step_width; /* Frame width step size [pixel] */
302 __u32 min_height; /* Minimum frame height [pixel] */
303 __u32 max_height; /* Maximum frame height [pixel] */
304 __u32 step_height; /* Frame height step size [pixel] */
305};
306
307struct v4l2_frmsizeenum
308{
309 __u32 index; /* Frame size number */
310 __u32 pixel_format; /* Pixel format */
311 __u32 type; /* Frame size type the device supports. */
312
313 union { /* Frame size */
314 struct v4l2_frmsize_discrete discrete;
315 struct v4l2_frmsize_stepwise stepwise;
316 };
317
318 __u32 reserved[2]; /* Reserved space for future use */
319};
320
321/*
322 * F R A M E R A T E E N U M E R A T I O N
323 */
324enum v4l2_frmivaltypes
325{
326 V4L2_FRMIVAL_TYPE_DISCRETE = 1,
327 V4L2_FRMIVAL_TYPE_CONTINUOUS = 2,
328 V4L2_FRMIVAL_TYPE_STEPWISE = 3,
329};
330
331struct v4l2_frmival_stepwise
332{
333 struct v4l2_fract min; /* Minimum frame interval [s] */
334 struct v4l2_fract max; /* Maximum frame interval [s] */
335 struct v4l2_fract step; /* Frame interval step size [s] */
336};
337
338struct v4l2_frmivalenum
339{
340 __u32 index; /* Frame format index */
341 __u32 pixel_format; /* Pixel format */
342 __u32 width; /* Frame width */
343 __u32 height; /* Frame height */
344 __u32 type; /* Frame interval type the device supports. */
345
346 union { /* Frame interval */
347 struct v4l2_fract discrete;
348 struct v4l2_frmival_stepwise stepwise;
349 };
350
351 __u32 reserved[2]; /* Reserved space for future use */
352};
353#endif
354
279/* 355/*
280 * T I M E C O D E 356 * T I M E C O D E
281 */ 357 */
@@ -1249,6 +1325,10 @@ struct v4l2_streamparm
1249#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls) 1325#define VIDIOC_G_EXT_CTRLS _IOWR ('V', 71, struct v4l2_ext_controls)
1250#define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls) 1326#define VIDIOC_S_EXT_CTRLS _IOWR ('V', 72, struct v4l2_ext_controls)
1251#define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls) 1327#define VIDIOC_TRY_EXT_CTRLS _IOWR ('V', 73, struct v4l2_ext_controls)
1328#if 1
1329#define VIDIOC_ENUM_FRAMESIZES _IOWR ('V', 74, struct v4l2_frmsizeenum)
1330#define VIDIOC_ENUM_FRAMEINTERVALS _IOWR ('V', 75, struct v4l2_frmivalenum)
1331#endif
1252 1332
1253#ifdef __OLD_VIDIOC_ 1333#ifdef __OLD_VIDIOC_
1254/* for compatibility, will go away some day */ 1334/* for compatibility, will go away some day */
diff --git a/include/media/audiochip.h b/include/media/audiochip.h
index 1fd4a2207574..db8823d45a7d 100644
--- a/include/media/audiochip.h
+++ b/include/media/audiochip.h
@@ -18,7 +18,9 @@ enum audiochip {
18 AUDIO_CHIP_TDA9874, 18 AUDIO_CHIP_TDA9874,
19 AUDIO_CHIP_PIC16C54, 19 AUDIO_CHIP_PIC16C54,
20 /* Provided by msp3400.c */ 20 /* Provided by msp3400.c */
21 AUDIO_CHIP_MSP34XX 21 AUDIO_CHIP_MSP34XX,
22 /* Provided by wm8775.c */
23 AUDIO_CHIP_WM8775
22}; 24};
23 25
24#endif /* AUDIOCHIP_H */ 26#endif /* AUDIOCHIP_H */
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig
index f08396c3f61a..cc2b9ab7f4e5 100644
--- a/sound/oss/Kconfig
+++ b/sound/oss/Kconfig
@@ -115,10 +115,6 @@ config SOUND_HAL2
115 Say Y or M if you have an SGI Indy or Indigo2 system and want to be able to 115 Say Y or M if you have an SGI Indy or Indigo2 system and want to be able to
116 use its on-board A2 audio system. 116 use its on-board A2 audio system.
117 117
118config SOUND_IT8172
119 tristate "IT8172G Sound"
120 depends on SOUND_PRIME && (MIPS_ITE8172 || MIPS_IVR)
121
122config SOUND_VRC5477 118config SOUND_VRC5477
123 tristate "NEC Vrc5477 AC97 sound" 119 tristate "NEC Vrc5477 AC97 sound"
124 depends on SOUND_PRIME && DDB5477 120 depends on SOUND_PRIME && DDB5477
diff --git a/sound/oss/Makefile b/sound/oss/Makefile
index 9bf3ee544d86..86811792002f 100644
--- a/sound/oss/Makefile
+++ b/sound/oss/Makefile
@@ -77,7 +77,6 @@ obj-$(CONFIG_SOUND_BCM_CS4297A) += swarm_cs4297a.o
77obj-$(CONFIG_SOUND_RME96XX) += rme96xx.o 77obj-$(CONFIG_SOUND_RME96XX) += rme96xx.o
78obj-$(CONFIG_SOUND_BT878) += btaudio.o 78obj-$(CONFIG_SOUND_BT878) += btaudio.o
79obj-$(CONFIG_SOUND_ALI5455) += ali5455.o ac97_codec.o 79obj-$(CONFIG_SOUND_ALI5455) += ali5455.o ac97_codec.o
80obj-$(CONFIG_SOUND_IT8172) += ite8172.o ac97_codec.o
81obj-$(CONFIG_SOUND_FORTE) += forte.o ac97_codec.o 80obj-$(CONFIG_SOUND_FORTE) += forte.o ac97_codec.o
82 81
83obj-$(CONFIG_SOUND_AD1980) += ac97_plugin_ad1980.o ac97_codec.o 82obj-$(CONFIG_SOUND_AD1980) += ac97_plugin_ad1980.o ac97_codec.o
diff --git a/sound/oss/ite8172.c b/sound/oss/ite8172.c
deleted file mode 100644
index 68aab3605d74..000000000000
--- a/sound/oss/ite8172.c
+++ /dev/null
@@ -1,2261 +0,0 @@
1/*
2 * ite8172.c -- ITE IT8172G Sound Driver.
3 *
4 * Copyright 2001 MontaVista Software Inc.
5 * Author: MontaVista Software, Inc.
6 * stevel@mvista.com or source@mvista.com
7 *
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public License as published by the
10 * Free Software Foundation; either version 2 of the License, or (at your
11 * option) any later version.
12 *
13 * THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED
14 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
15 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN
16 * NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
17 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
18 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
19 * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
22 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
23 *
24 * You should have received a copy of the GNU General Public License along
25 * with this program; if not, write to the Free Software Foundation, Inc.,
26 * 675 Mass Ave, Cambridge, MA 02139, USA.
27 *
28 *
29 * Module command line parameters:
30 *
31 * Supported devices:
32 * /dev/dsp standard OSS /dev/dsp device
33 * /dev/mixer standard OSS /dev/mixer device
34 *
35 * Notes:
36 *
37 * 1. Much of the OSS buffer allocation, ioctl's, and mmap'ing are
38 * taken, slightly modified or not at all, from the ES1371 driver,
39 * so refer to the credits in es1371.c for those. The rest of the
40 * code (probe, open, read, write, the ISR, etc.) is new.
41 * 2. The following support is untested:
42 * * Memory mapping the audio buffers, and the ioctl controls that go
43 * with it.
44 * * S/PDIF output.
45 * * I2S support.
46 * 3. The following is not supported:
47 * * legacy audio mode.
48 * 4. Support for volume button interrupts is implemented but doesn't
49 * work yet.
50 *
51 * Revision history
52 * 02.08.2001 Initial release
53 * 06.22.2001 Added I2S support
54 * 07.30.2003 Removed initialisation to zero for static variables
55 * (spdif[NR_DEVICE], i2s_fmt[NR_DEVICE], and devindex)
56 */
57#include <linux/module.h>
58#include <linux/string.h>
59#include <linux/ioport.h>
60#include <linux/sched.h>
61#include <linux/delay.h>
62#include <linux/sound.h>
63#include <linux/slab.h>
64#include <linux/soundcard.h>
65#include <linux/pci.h>
66#include <linux/init.h>
67#include <linux/poll.h>
68#include <linux/bitops.h>
69#include <linux/proc_fs.h>
70#include <linux/spinlock.h>
71#include <linux/smp_lock.h>
72#include <linux/ac97_codec.h>
73#include <linux/interrupt.h>
74#include <linux/mutex.h>
75
76#include <asm/io.h>
77#include <asm/dma.h>
78#include <asm/uaccess.h>
79#include <asm/it8172/it8172.h>
80
81/* --------------------------------------------------------------------- */
82
83#undef OSS_DOCUMENTED_MIXER_SEMANTICS
84#define IT8172_DEBUG
85#undef IT8172_VERBOSE_DEBUG
86#define DBG(x) {}
87
88#define IT8172_MODULE_NAME "IT8172 audio"
89#define PFX IT8172_MODULE_NAME
90
91#ifdef IT8172_DEBUG
92#define dbg(format, arg...) printk(KERN_DEBUG PFX ": " format "\n" , ## arg)
93#else
94#define dbg(format, arg...) do {} while (0)
95#endif
96#define err(format, arg...) printk(KERN_ERR PFX ": " format "\n" , ## arg)
97#define info(format, arg...) printk(KERN_INFO PFX ": " format "\n" , ## arg)
98#define warn(format, arg...) printk(KERN_WARNING PFX ": " format "\n" , ## arg)
99
100
101#define IT8172_MODULE_NAME "IT8172 audio"
102#define PFX IT8172_MODULE_NAME
103
104#ifdef IT8172_DEBUG
105#define dbg(format, arg...) printk(KERN_DEBUG PFX ": " format "\n" , ## arg)
106#else
107#define dbg(format, arg...) do {} while (0)
108#endif
109#define err(format, arg...) printk(KERN_ERR PFX ": " format "\n" , ## arg)
110#define info(format, arg...) printk(KERN_INFO PFX ": " format "\n" , ## arg)
111#define warn(format, arg...) printk(KERN_WARNING PFX ": " format "\n" , ## arg)
112
113
114static const unsigned sample_shift[] = { 0, 1, 1, 2 };
115
116
117/*
118 * Audio Controller register bit definitions follow. See
119 * include/asm/it8172/it8172.h for register offsets.
120 */
121
122/* PCM Out Volume Reg */
123#define PCMOV_PCMOM (1<<15) /* PCM Out Mute default 1: mute */
124#define PCMOV_PCMRCG_BIT 8 /* PCM Right channel Gain */
125#define PCMOV_PCMRCG_MASK (0x1f<<PCMOV_PCMRCG_BIT)
126#define PCMOV_PCMLCG_BIT 0 /* PCM Left channel gain */
127#define PCMOV_PCMLCG_MASK 0x1f
128
129/* FM Out Volume Reg */
130#define FMOV_FMOM (1<<15) /* FM Out Mute default 1: mute */
131#define FMOV_FMRCG_BIT 8 /* FM Right channel Gain */
132#define FMOV_FMRCG_MASK (0x1f<<FMOV_FMRCG_BIT)
133#define FMOV_FMLCG_BIT 0 /* FM Left channel gain */
134#define FMOV_FMLCG_MASK 0x1f
135
136/* I2S Out Volume Reg */
137#define I2SV_I2SOM (1<<15) /* I2S Out Mute default 1: mute */
138#define I2SV_I2SRCG_BIT 8 /* I2S Right channel Gain */
139#define I2SV_I2SRCG_MASK (0x1f<<I2SV_I2SRCG_BIT)
140#define I2SV_I2SLCG_BIT 0 /* I2S Left channel gain */
141#define I2SV_I2SLCG_MASK 0x1f
142
143/* Digital Recording Source Select Reg */
144#define DRSS_BIT 0
145#define DRSS_MASK 0x07
146#define DRSS_AC97_PRIM 0
147#define DRSS_FM 1
148#define DRSS_I2S 2
149#define DRSS_PCM 3
150#define DRSS_AC97_SEC 4
151
152/* Playback/Capture Channel Control Registers */
153#define CC_SM (1<<15) /* Stereo, Mone 0: mono 1: stereo */
154#define CC_DF (1<<14) /* Data Format 0: 8 bit 1: 16 bit */
155#define CC_FMT_BIT 14
156#define CC_FMT_MASK (0x03<<CC_FMT_BIT)
157#define CC_CF_BIT 12 /* Channel format (Playback only) */
158#define CC_CF_MASK (0x03<<CC_CF_BIT)
159#define CC_CF_2 0
160#define CC_CF_4 (1<<CC_CF_BIT)
161#define CC_CF_6 (2<<CC_CF_BIT)
162#define CC_SR_BIT 8 /* sample Rate */
163#define CC_SR_MASK (0x0f<<CC_SR_BIT)
164#define CC_SR_5500 0
165#define CC_SR_8000 (1<<CC_SR_BIT)
166#define CC_SR_9600 (2<<CC_SR_BIT)
167#define CC_SR_11025 (3<<CC_SR_BIT)
168#define CC_SR_16000 (4<<CC_SR_BIT)
169#define CC_SR_19200 (5<<CC_SR_BIT)
170#define CC_SR_22050 (6<<CC_SR_BIT)
171#define CC_SR_32000 (7<<CC_SR_BIT)
172#define CC_SR_38400 (8<<CC_SR_BIT)
173#define CC_SR_44100 (9<<CC_SR_BIT)
174#define CC_SR_48000 (10<<CC_SR_BIT)
175#define CC_CSP (1<<7) /* Channel stop
176 * 0: End of Current buffer
177 * 1: Immediately stop when rec stop */
178#define CC_CP (1<<6) /* Channel pause 0: normal, 1: pause */
179#define CC_CA (1<<5) /* Channel Action 0: Stop , 1: start */
180#define CC_CB2L (1<<2) /* Cur. buf. 2 xfr is last 0: No, 1: Yes */
181#define CC_CB1L (1<<1) /* Cur. buf. 1 xfr is last 0: No, 1: Yes */
182#define CC_DE 1 /* DFC/DFIFO Data Empty 1: empty, 0: not empty
183 * (Playback only)
184 */
185
186/* Codec Control Reg */
187#define CODECC_GME (1<<9) /* AC97 GPIO Mode enable */
188#define CODECC_ATM (1<<8) /* AC97 ATE test mode 0: test 1: normal */
189#define CODECC_WR (1<<6) /* AC97 Warn reset 1: warm reset , 0: Normal */
190#define CODECC_CR (1<<5) /* AC97 Cold reset 1: Cold reset , 0: Normal */
191
192
193/* I2S Control Reg */
194#define I2SMC_SR_BIT 6 /* I2S Sampling rate
195 * 00: 48KHz, 01: 44.1 KHz, 10: 32 32 KHz */
196#define I2SMC_SR_MASK (0x03<<I2SMC_SR_BIT)
197#define I2SMC_SR_48000 0
198#define I2SMC_SR_44100 (1<<I2SMC_SR_BIT)
199#define I2SMC_SR_32000 (2<<I2SMC_SR_BIT)
200#define I2SMC_SRSS (1<<5) /* Sample Rate Source Select 1:S/W, 0: H/W */
201#define I2SMC_I2SF_BIT 0 /* I2S Format */
202#define I2SMC_I2SF_MASK 0x03
203#define I2SMC_I2SF_DAC 0
204#define I2SMC_I2SF_ADC 2
205#define I2SMC_I2SF_I2S 3
206
207
208/* Volume up, Down, Mute */
209#define VS_VMP (1<<2) /* Volume mute 1: pushed, 0: not */
210#define VS_VDP (1<<1) /* Volume Down 1: pushed, 0: not */
211#define VS_VUP 1 /* Volime Up 1: pushed, 0: not */
212
213/* SRC, Mixer test control/DFC status reg */
214#define SRCS_DPUSC (1<<5) /* DFC Playback underrun Status/clear */
215#define SRCS_DCOSC (1<<4) /* DFC Capture Overrun Status/clear */
216#define SRCS_SIS (1<<3) /* SRC input select 1: Mixer, 0: Codec I/F */
217#define SRCS_CDIS_BIT 0 /* Codec Data Input Select */
218#define SRCS_CDIS_MASK 0x07
219#define SRCS_CDIS_MIXER 0
220#define SRCS_CDIS_PCM 1
221#define SRCS_CDIS_I2S 2
222#define SRCS_CDIS_FM 3
223#define SRCS_CDIS_DFC 4
224
225
226/* Codec Index Reg command Port */
227#define CIRCP_CID_BIT 10
228#define CIRCP_CID_MASK (0x03<<CIRCP_CID_BIT)
229#define CIRCP_CPS (1<<9) /* Command Port Status 0: ready, 1: busy */
230#define CIRCP_DPVF (1<<8) /* Data Port Valid Flag 0: invalis, 1: valid */
231#define CIRCP_RWC (1<<7) /* Read/write command */
232#define CIRCP_CIA_BIT 0
233#define CIRCP_CIA_MASK 0x007F /* Codec Index Address */
234
235/* Test Mode Control/Test group Select Control */
236
237/* General Control Reg */
238#define GC_VDC_BIT 6 /* Volume Division Control */
239#define GC_VDC_MASK (0x03<<GC_VDC_BIT)
240#define GC_VDC_NONE 0
241#define GC_VDC_DIV2 (1<<GC_VDC_BIT)
242#define GC_VDC_DIV4 (2<<GC_VDC_BIT)
243#define GC_SOE (1<<2) /* S/PDIF Output enable */
244#define GC_SWR 1 /* Software warn reset */
245
246/* Interrupt mask Control Reg */
247#define IMC_VCIM (1<<6) /* Volume CNTL interrupt mask */
248#define IMC_CCIM (1<<1) /* Capture Chan. iterrupt mask */
249#define IMC_PCIM 1 /* Playback Chan. interrupt mask */
250
251/* Interrupt status/clear reg */
252#define ISC_VCI (1<<6) /* Volume CNTL interrupt 1: clears */
253#define ISC_CCI (1<<1) /* Capture Chan. interrupt 1: clears */
254#define ISC_PCI 1 /* Playback Chan. interrupt 1: clears */
255
256/* misc stuff */
257#define POLL_COUNT 0x5000
258
259
260/* --------------------------------------------------------------------- */
261
262/*
263 * Define DIGITAL1 as the I2S channel, since it is not listed in
264 * soundcard.h.
265 */
266#define SOUND_MIXER_I2S SOUND_MIXER_DIGITAL1
267#define SOUND_MASK_I2S SOUND_MASK_DIGITAL1
268#define SOUND_MIXER_READ_I2S MIXER_READ(SOUND_MIXER_I2S)
269#define SOUND_MIXER_WRITE_I2S MIXER_WRITE(SOUND_MIXER_I2S)
270
271/* --------------------------------------------------------------------- */
272
273struct it8172_state {
274 /* list of it8172 devices */
275 struct list_head devs;
276
277 /* the corresponding pci_dev structure */
278 struct pci_dev *dev;
279
280 /* soundcore stuff */
281 int dev_audio;
282
283 /* hardware resources */
284 unsigned long io;
285 unsigned int irq;
286
287 /* PCI ID's */
288 u16 vendor;
289 u16 device;
290 u8 rev; /* the chip revision */
291
292 /* options */
293 int spdif_volume; /* S/PDIF output is enabled if != -1 */
294 int i2s_volume; /* current I2S out volume, in OSS format */
295 int i2s_recording;/* 1 = recording from I2S, 0 = not */
296
297#ifdef IT8172_DEBUG
298 /* debug /proc entry */
299 struct proc_dir_entry *ps;
300 struct proc_dir_entry *ac97_ps;
301#endif /* IT8172_DEBUG */
302
303 struct ac97_codec codec;
304
305 unsigned short pcc, capcc;
306 unsigned dacrate, adcrate;
307
308 spinlock_t lock;
309 struct mutex open_mutex;
310 mode_t open_mode;
311 wait_queue_head_t open_wait;
312
313 struct dmabuf {
314 void *rawbuf;
315 dma_addr_t dmaaddr;
316 unsigned buforder;
317 unsigned numfrag;
318 unsigned fragshift;
319 void* nextIn;
320 void* nextOut;
321 int count;
322 int curBufPtr;
323 unsigned total_bytes;
324 unsigned error; /* over/underrun */
325 wait_queue_head_t wait;
326 /* redundant, but makes calculations easier */
327 unsigned fragsize;
328 unsigned dmasize;
329 unsigned fragsamples;
330 /* OSS stuff */
331 unsigned mapped:1;
332 unsigned ready:1;
333 unsigned stopped:1;
334 unsigned ossfragshift;
335 int ossmaxfrags;
336 unsigned subdivision;
337 } dma_dac, dma_adc;
338};
339
340/* --------------------------------------------------------------------- */
341
342static LIST_HEAD(devs);
343
344/* --------------------------------------------------------------------- */
345
346static inline unsigned ld2(unsigned int x)
347{
348 unsigned r = 0;
349
350 if (x >= 0x10000) {
351 x >>= 16;
352 r += 16;
353 }
354 if (x >= 0x100) {
355 x >>= 8;
356 r += 8;
357 }
358 if (x >= 0x10) {
359 x >>= 4;
360 r += 4;
361 }
362 if (x >= 4) {
363 x >>= 2;
364 r += 2;
365 }
366 if (x >= 2)
367 r++;
368 return r;
369}
370
371/* --------------------------------------------------------------------- */
372
373static void it8172_delay(int msec)
374{
375 unsigned long tmo;
376 signed long tmo2;
377
378 if (in_interrupt())
379 return;
380
381 tmo = jiffies + (msec*HZ)/1000;
382 for (;;) {
383 tmo2 = tmo - jiffies;
384 if (tmo2 <= 0)
385 break;
386 schedule_timeout(tmo2);
387 }
388}
389
390
391static unsigned short
392get_compat_rate(unsigned* rate)
393{
394 unsigned rate_out = *rate;
395 unsigned short sr;
396
397 if (rate_out >= 46050) {
398 sr = CC_SR_48000; rate_out = 48000;
399 } else if (rate_out >= 41250) {
400 sr = CC_SR_44100; rate_out = 44100;
401 } else if (rate_out >= 35200) {
402 sr = CC_SR_38400; rate_out = 38400;
403 } else if (rate_out >= 27025) {
404 sr = CC_SR_32000; rate_out = 32000;
405 } else if (rate_out >= 20625) {
406 sr = CC_SR_22050; rate_out = 22050;
407 } else if (rate_out >= 17600) {
408 sr = CC_SR_19200; rate_out = 19200;
409 } else if (rate_out >= 13513) {
410 sr = CC_SR_16000; rate_out = 16000;
411 } else if (rate_out >= 10313) {
412 sr = CC_SR_11025; rate_out = 11025;
413 } else if (rate_out >= 8800) {
414 sr = CC_SR_9600; rate_out = 9600;
415 } else if (rate_out >= 6750) {
416 sr = CC_SR_8000; rate_out = 8000;
417 } else {
418 sr = CC_SR_5500; rate_out = 5500;
419 }
420
421 *rate = rate_out;
422 return sr;
423}
424
425static void set_adc_rate(struct it8172_state *s, unsigned rate)
426{
427 unsigned long flags;
428 unsigned short sr;
429
430 sr = get_compat_rate(&rate);
431
432 spin_lock_irqsave(&s->lock, flags);
433 s->capcc &= ~CC_SR_MASK;
434 s->capcc |= sr;
435 outw(s->capcc, s->io+IT_AC_CAPCC);
436 spin_unlock_irqrestore(&s->lock, flags);
437
438 s->adcrate = rate;
439}
440
441
442static void set_dac_rate(struct it8172_state *s, unsigned rate)
443{
444 unsigned long flags;
445 unsigned short sr;
446
447 sr = get_compat_rate(&rate);
448
449 spin_lock_irqsave(&s->lock, flags);
450 s->pcc &= ~CC_SR_MASK;
451 s->pcc |= sr;
452 outw(s->pcc, s->io+IT_AC_PCC);
453 spin_unlock_irqrestore(&s->lock, flags);
454
455 s->dacrate = rate;
456}
457
458
459/* --------------------------------------------------------------------- */
460
461static u16 rdcodec(struct ac97_codec *codec, u8 addr)
462{
463 struct it8172_state *s = (struct it8172_state *)codec->private_data;
464 unsigned long flags;
465 unsigned short circp, data;
466 int i;
467
468 spin_lock_irqsave(&s->lock, flags);
469
470 for (i = 0; i < POLL_COUNT; i++)
471 if (!(inw(s->io+IT_AC_CIRCP) & CIRCP_CPS))
472 break;
473 if (i == POLL_COUNT)
474 err("rdcodec: codec ready poll expired!");
475
476 circp = addr & CIRCP_CIA_MASK;
477 circp |= (codec->id << CIRCP_CID_BIT);
478 circp |= CIRCP_RWC; // read command
479 outw(circp, s->io+IT_AC_CIRCP);
480
481 /* now wait for the data */
482 for (i = 0; i < POLL_COUNT; i++)
483 if (inw(s->io+IT_AC_CIRCP) & CIRCP_DPVF)
484 break;
485 if (i == POLL_COUNT)
486 err("rdcodec: read poll expired!");
487
488 data = inw(s->io+IT_AC_CIRDP);
489 spin_unlock_irqrestore(&s->lock, flags);
490
491 return data;
492}
493
494
495static void wrcodec(struct ac97_codec *codec, u8 addr, u16 data)
496{
497 struct it8172_state *s = (struct it8172_state *)codec->private_data;
498 unsigned long flags;
499 unsigned short circp;
500 int i;
501
502 spin_lock_irqsave(&s->lock, flags);
503
504 for (i = 0; i < POLL_COUNT; i++)
505 if (!(inw(s->io+IT_AC_CIRCP) & CIRCP_CPS))
506 break;
507 if (i == POLL_COUNT)
508 err("wrcodec: codec ready poll expired!");
509
510 circp = addr & CIRCP_CIA_MASK;
511 circp |= (codec->id << CIRCP_CID_BIT);
512 circp &= ~CIRCP_RWC; // write command
513
514 outw(data, s->io+IT_AC_CIRDP); // send data first
515 outw(circp, s->io+IT_AC_CIRCP);
516
517 spin_unlock_irqrestore(&s->lock, flags);
518}
519
520
521static void waitcodec(struct ac97_codec *codec)
522{
523 unsigned short temp;
524
525 /* codec_wait is used to wait for a ready state after
526 an AC97_RESET. */
527 it8172_delay(10);
528
529 temp = rdcodec(codec, 0x26);
530
531 // If power down, power up
532 if (temp & 0x3f00) {
533 // Power on
534 wrcodec(codec, 0x26, 0);
535 it8172_delay(100);
536 // Reread
537 temp = rdcodec(codec, 0x26);
538 }
539
540 // Check if Codec REF,ANL,DAC,ADC ready***/
541 if ((temp & 0x3f0f) != 0x000f) {
542 err("codec reg 26 status (0x%x) not ready!!", temp);
543 return;
544 }
545}
546
547
548/* --------------------------------------------------------------------- */
549
550static inline void stop_adc(struct it8172_state *s)
551{
552 struct dmabuf* db = &s->dma_adc;
553 unsigned long flags;
554 unsigned char imc;
555
556 if (db->stopped)
557 return;
558
559 spin_lock_irqsave(&s->lock, flags);
560
561 s->capcc &= ~(CC_CA | CC_CP | CC_CB2L | CC_CB1L);
562 s->capcc |= CC_CSP;
563 outw(s->capcc, s->io+IT_AC_CAPCC);
564
565 // disable capture interrupt
566 imc = inb(s->io+IT_AC_IMC);
567 outb(imc | IMC_CCIM, s->io+IT_AC_IMC);
568
569 db->stopped = 1;
570
571 spin_unlock_irqrestore(&s->lock, flags);
572}
573
574static inline void stop_dac(struct it8172_state *s)
575{
576 struct dmabuf* db = &s->dma_dac;
577 unsigned long flags;
578 unsigned char imc;
579
580 if (db->stopped)
581 return;
582
583 spin_lock_irqsave(&s->lock, flags);
584
585 s->pcc &= ~(CC_CA | CC_CP | CC_CB2L | CC_CB1L);
586 s->pcc |= CC_CSP;
587 outw(s->pcc, s->io+IT_AC_PCC);
588
589 // disable playback interrupt
590 imc = inb(s->io+IT_AC_IMC);
591 outb(imc | IMC_PCIM, s->io+IT_AC_IMC);
592
593 db->stopped = 1;
594
595 spin_unlock_irqrestore(&s->lock, flags);
596}
597
598static void start_dac(struct it8172_state *s)
599{
600 struct dmabuf* db = &s->dma_dac;
601 unsigned long flags;
602 unsigned char imc;
603 unsigned long buf1, buf2;
604
605 if (!db->stopped)
606 return;
607
608 spin_lock_irqsave(&s->lock, flags);
609
610 // reset Buffer 1 and 2 pointers to nextOut and nextOut+fragsize
611 buf1 = virt_to_bus(db->nextOut);
612 buf2 = buf1 + db->fragsize;
613 if (buf2 >= db->dmaaddr + db->dmasize)
614 buf2 -= db->dmasize;
615
616 outl(buf1, s->io+IT_AC_PCB1STA);
617 outl(buf2, s->io+IT_AC_PCB2STA);
618 db->curBufPtr = IT_AC_PCB1STA;
619
620 // enable playback interrupt
621 imc = inb(s->io+IT_AC_IMC);
622 outb(imc & ~IMC_PCIM, s->io+IT_AC_IMC);
623
624 s->pcc &= ~(CC_CSP | CC_CP | CC_CB2L | CC_CB1L);
625 s->pcc |= CC_CA;
626 outw(s->pcc, s->io+IT_AC_PCC);
627
628 db->stopped = 0;
629
630 spin_unlock_irqrestore(&s->lock, flags);
631}
632
633static void start_adc(struct it8172_state *s)
634{
635 struct dmabuf* db = &s->dma_adc;
636 unsigned long flags;
637 unsigned char imc;
638 unsigned long buf1, buf2;
639
640 if (!db->stopped)
641 return;
642
643 spin_lock_irqsave(&s->lock, flags);
644
645 // reset Buffer 1 and 2 pointers to nextIn and nextIn+fragsize
646 buf1 = virt_to_bus(db->nextIn);
647 buf2 = buf1 + db->fragsize;
648 if (buf2 >= db->dmaaddr + db->dmasize)
649 buf2 -= db->dmasize;
650
651 outl(buf1, s->io+IT_AC_CAPB1STA);
652 outl(buf2, s->io+IT_AC_CAPB2STA);
653 db->curBufPtr = IT_AC_CAPB1STA;
654
655 // enable capture interrupt
656 imc = inb(s->io+IT_AC_IMC);
657 outb(imc & ~IMC_CCIM, s->io+IT_AC_IMC);
658
659 s->capcc &= ~(CC_CSP | CC_CP | CC_CB2L | CC_CB1L);
660 s->capcc |= CC_CA;
661 outw(s->capcc, s->io+IT_AC_CAPCC);
662
663 db->stopped = 0;
664
665 spin_unlock_irqrestore(&s->lock, flags);
666}
667
668/* --------------------------------------------------------------------- */
669
670#define DMABUF_DEFAULTORDER (17-PAGE_SHIFT)
671#define DMABUF_MINORDER 1
672
673static inline void dealloc_dmabuf(struct it8172_state *s, struct dmabuf *db)
674{
675 struct page *page, *pend;
676
677 if (db->rawbuf) {
678 /* undo marking the pages as reserved */
679 pend = virt_to_page(db->rawbuf +
680 (PAGE_SIZE << db->buforder) - 1);
681 for (page = virt_to_page(db->rawbuf); page <= pend; page++)
682 ClearPageReserved(page);
683 pci_free_consistent(s->dev, PAGE_SIZE << db->buforder,
684 db->rawbuf, db->dmaaddr);
685 }
686 db->rawbuf = db->nextIn = db->nextOut = NULL;
687 db->mapped = db->ready = 0;
688}
689
690static int prog_dmabuf(struct it8172_state *s, struct dmabuf *db,
691 unsigned rate, unsigned fmt, unsigned reg)
692{
693 int order;
694 unsigned bytepersec;
695 unsigned bufs;
696 struct page *page, *pend;
697
698 if (!db->rawbuf) {
699 db->ready = db->mapped = 0;
700 for (order = DMABUF_DEFAULTORDER;
701 order >= DMABUF_MINORDER; order--)
702 if ((db->rawbuf =
703 pci_alloc_consistent(s->dev,
704 PAGE_SIZE << order,
705 &db->dmaaddr)))
706 break;
707 if (!db->rawbuf)
708 return -ENOMEM;
709 db->buforder = order;
710 /* now mark the pages as reserved;
711 otherwise remap_pfn_range doesn't do what we want */
712 pend = virt_to_page(db->rawbuf +
713 (PAGE_SIZE << db->buforder) - 1);
714 for (page = virt_to_page(db->rawbuf); page <= pend; page++)
715 SetPageReserved(page);
716 }
717
718 db->count = 0;
719 db->nextIn = db->nextOut = db->rawbuf;
720
721 bytepersec = rate << sample_shift[fmt];
722 bufs = PAGE_SIZE << db->buforder;
723 if (db->ossfragshift) {
724 if ((1000 << db->ossfragshift) < bytepersec)
725 db->fragshift = ld2(bytepersec/1000);
726 else
727 db->fragshift = db->ossfragshift;
728 } else {
729 db->fragshift = ld2(bytepersec/100/(db->subdivision ?
730 db->subdivision : 1));
731 if (db->fragshift < 3)
732 db->fragshift = 3;
733 }
734 db->numfrag = bufs >> db->fragshift;
735 while (db->numfrag < 4 && db->fragshift > 3) {
736 db->fragshift--;
737 db->numfrag = bufs >> db->fragshift;
738 }
739 db->fragsize = 1 << db->fragshift;
740 if (db->ossmaxfrags >= 4 && db->ossmaxfrags < db->numfrag)
741 db->numfrag = db->ossmaxfrags;
742 db->fragsamples = db->fragsize >> sample_shift[fmt];
743 db->dmasize = db->numfrag << db->fragshift;
744 memset(db->rawbuf, (fmt & (CC_DF>>CC_FMT_BIT)) ? 0 : 0x80, bufs);
745
746#ifdef IT8172_VERBOSE_DEBUG
747 dbg("rate=%d, fragsize=%d, numfrag=%d, dmasize=%d",
748 rate, db->fragsize, db->numfrag, db->dmasize);
749#endif
750
751 // set data length register
752 outw(db->fragsize, s->io+reg+2);
753 db->ready = 1;
754
755 return 0;
756}
757
758static inline int prog_dmabuf_adc(struct it8172_state *s)
759{
760 stop_adc(s);
761 return prog_dmabuf(s, &s->dma_adc, s->adcrate,
762 (s->capcc & CC_FMT_MASK) >> CC_FMT_BIT,
763 IT_AC_CAPCC);
764}
765
766static inline int prog_dmabuf_dac(struct it8172_state *s)
767{
768 stop_dac(s);
769 return prog_dmabuf(s, &s->dma_dac, s->dacrate,
770 (s->pcc & CC_FMT_MASK) >> CC_FMT_BIT,
771 IT_AC_PCC);
772}
773
774
775/* hold spinlock for the following! */
776
777static irqreturn_t it8172_interrupt(int irq, void *dev_id, struct pt_regs *regs)
778{
779 struct it8172_state *s = (struct it8172_state *)dev_id;
780 struct dmabuf* dac = &s->dma_dac;
781 struct dmabuf* adc = &s->dma_adc;
782 unsigned char isc, vs;
783 unsigned short vol, mute;
784 unsigned long newptr;
785
786 spin_lock(&s->lock);
787
788 isc = inb(s->io+IT_AC_ISC);
789
790 /* fastpath out, to ease interrupt sharing */
791 if (!(isc & (ISC_VCI | ISC_CCI | ISC_PCI))) {
792 spin_unlock(&s->lock);
793 return IRQ_NONE;
794 }
795
796 /* clear audio interrupts first */
797 outb(isc | ISC_VCI | ISC_CCI | ISC_PCI, s->io+IT_AC_ISC);
798
799 /* handle volume button events (ignore if S/PDIF enabled) */
800 if ((isc & ISC_VCI) && s->spdif_volume == -1) {
801 vs = inb(s->io+IT_AC_VS);
802 outb(0, s->io+IT_AC_VS);
803 vol = inw(s->io+IT_AC_PCMOV);
804 mute = vol & PCMOV_PCMOM;
805 vol &= PCMOV_PCMLCG_MASK;
806 if ((vs & VS_VUP) && vol > 0)
807 vol--;
808 if ((vs & VS_VDP) && vol < 0x1f)
809 vol++;
810 vol |= (vol << PCMOV_PCMRCG_BIT);
811 if (vs & VS_VMP)
812 vol |= (mute ^ PCMOV_PCMOM);
813 outw(vol, s->io+IT_AC_PCMOV);
814 }
815
816 /* update capture pointers */
817 if (isc & ISC_CCI) {
818 if (adc->count > adc->dmasize - adc->fragsize) {
819 // Overrun. Stop ADC and log the error
820 stop_adc(s);
821 adc->error++;
822 dbg("adc overrun");
823 } else {
824 newptr = virt_to_bus(adc->nextIn) + 2*adc->fragsize;
825 if (newptr >= adc->dmaaddr + adc->dmasize)
826 newptr -= adc->dmasize;
827
828 outl(newptr, s->io+adc->curBufPtr);
829 adc->curBufPtr = (adc->curBufPtr == IT_AC_CAPB1STA) ?
830 IT_AC_CAPB2STA : IT_AC_CAPB1STA;
831
832 adc->nextIn += adc->fragsize;
833 if (adc->nextIn >= adc->rawbuf + adc->dmasize)
834 adc->nextIn -= adc->dmasize;
835
836 adc->count += adc->fragsize;
837 adc->total_bytes += adc->fragsize;
838
839 /* wake up anybody listening */
840 if (waitqueue_active(&adc->wait))
841 wake_up_interruptible(&adc->wait);
842 }
843 }
844
845 /* update playback pointers */
846 if (isc & ISC_PCI) {
847 newptr = virt_to_bus(dac->nextOut) + 2*dac->fragsize;
848 if (newptr >= dac->dmaaddr + dac->dmasize)
849 newptr -= dac->dmasize;
850
851 outl(newptr, s->io+dac->curBufPtr);
852 dac->curBufPtr = (dac->curBufPtr == IT_AC_PCB1STA) ?
853 IT_AC_PCB2STA : IT_AC_PCB1STA;
854
855 dac->nextOut += dac->fragsize;
856 if (dac->nextOut >= dac->rawbuf + dac->dmasize)
857 dac->nextOut -= dac->dmasize;
858
859 dac->count -= dac->fragsize;
860 dac->total_bytes += dac->fragsize;
861
862 /* wake up anybody listening */
863 if (waitqueue_active(&dac->wait))
864 wake_up_interruptible(&dac->wait);
865
866 if (dac->count <= 0)
867 stop_dac(s);
868 }
869
870 spin_unlock(&s->lock);
871 return IRQ_HANDLED;
872}
873
874/* --------------------------------------------------------------------- */
875
876static int it8172_open_mixdev(struct inode *inode, struct file *file)
877{
878 int minor = iminor(inode);
879 struct list_head *list;
880 struct it8172_state *s;
881
882 for (list = devs.next; ; list = list->next) {
883 if (list == &devs)
884 return -ENODEV;
885 s = list_entry(list, struct it8172_state, devs);
886 if (s->codec.dev_mixer == minor)
887 break;
888 }
889 file->private_data = s;
890 return nonseekable_open(inode, file);
891}
892
893static int it8172_release_mixdev(struct inode *inode, struct file *file)
894{
895 return 0;
896}
897
898
899static u16
900cvt_ossvol(unsigned int gain)
901{
902 u16 ret;
903
904 if (gain == 0)
905 return 0;
906
907 if (gain > 100)
908 gain = 100;
909
910 ret = (100 - gain + 32) / 4;
911 ret = ret > 31 ? 31 : ret;
912 return ret;
913}
914
915
916static int mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd,
917 unsigned long arg)
918{
919 struct it8172_state *s = (struct it8172_state *)codec->private_data;
920 unsigned int left, right;
921 unsigned long flags;
922 int val;
923 u16 vol;
924
925 /*
926 * When we are in S/PDIF mode, we want to disable any analog output so
927 * we filter the master/PCM channel volume ioctls.
928 *
929 * Also filter I2S channel, which AC'97 knows nothing about.
930 */
931
932 switch (cmd) {
933 case SOUND_MIXER_WRITE_VOLUME:
934 // if not in S/PDIF mode, pass to AC'97
935 if (s->spdif_volume == -1)
936 break;
937 return 0;
938 case SOUND_MIXER_WRITE_PCM:
939 // if not in S/PDIF mode, pass to AC'97
940 if (s->spdif_volume == -1)
941 break;
942 if (get_user(val, (int *)arg))
943 return -EFAULT;
944 right = ((val >> 8) & 0xff);
945 left = (val & 0xff);
946 if (right > 100)
947 right = 100;
948 if (left > 100)
949 left = 100;
950 s->spdif_volume = (right << 8) | left;
951 vol = cvt_ossvol(left);
952 vol |= (cvt_ossvol(right) << PCMOV_PCMRCG_BIT);
953 if (vol == 0)
954 vol = PCMOV_PCMOM; // mute
955 spin_lock_irqsave(&s->lock, flags);
956 outw(vol, s->io+IT_AC_PCMOV);
957 spin_unlock_irqrestore(&s->lock, flags);
958 return put_user(s->spdif_volume, (int *)arg);
959 case SOUND_MIXER_READ_PCM:
960 // if not in S/PDIF mode, pass to AC'97
961 if (s->spdif_volume == -1)
962 break;
963 return put_user(s->spdif_volume, (int *)arg);
964 case SOUND_MIXER_WRITE_I2S:
965 if (get_user(val, (int *)arg))
966 return -EFAULT;
967 right = ((val >> 8) & 0xff);
968 left = (val & 0xff);
969 if (right > 100)
970 right = 100;
971 if (left > 100)
972 left = 100;
973 s->i2s_volume = (right << 8) | left;
974 vol = cvt_ossvol(left);
975 vol |= (cvt_ossvol(right) << I2SV_I2SRCG_BIT);
976 if (vol == 0)
977 vol = I2SV_I2SOM; // mute
978 outw(vol, s->io+IT_AC_I2SV);
979 return put_user(s->i2s_volume, (int *)arg);
980 case SOUND_MIXER_READ_I2S:
981 return put_user(s->i2s_volume, (int *)arg);
982 case SOUND_MIXER_WRITE_RECSRC:
983 if (get_user(val, (int *)arg))
984 return -EFAULT;
985 if (val & SOUND_MASK_I2S) {
986 s->i2s_recording = 1;
987 outb(DRSS_I2S, s->io+IT_AC_DRSS);
988 return 0;
989 } else {
990 s->i2s_recording = 0;
991 outb(DRSS_AC97_PRIM, s->io+IT_AC_DRSS);
992 // now let AC'97 select record source
993 break;
994 }
995 case SOUND_MIXER_READ_RECSRC:
996 if (s->i2s_recording)
997 return put_user(SOUND_MASK_I2S, (int *)arg);
998 else
999 // let AC'97 report recording source
1000 break;
1001 }
1002
1003 return codec->mixer_ioctl(codec, cmd, arg);
1004}
1005
1006static int it8172_ioctl_mixdev(struct inode *inode, struct file *file,
1007 unsigned int cmd, unsigned long arg)
1008{
1009 struct it8172_state *s = (struct it8172_state *)file->private_data;
1010 struct ac97_codec *codec = &s->codec;
1011
1012 return mixdev_ioctl(codec, cmd, arg);
1013}
1014
1015static /*const*/ struct file_operations it8172_mixer_fops = {
1016 .owner = THIS_MODULE,
1017 .llseek = no_llseek,
1018 .ioctl = it8172_ioctl_mixdev,
1019 .open = it8172_open_mixdev,
1020 .release = it8172_release_mixdev,
1021};
1022
1023/* --------------------------------------------------------------------- */
1024
1025static int drain_dac(struct it8172_state *s, int nonblock)
1026{
1027 unsigned long flags;
1028 int count, tmo;
1029
1030 if (s->dma_dac.mapped || !s->dma_dac.ready || s->dma_dac.stopped)
1031 return 0;
1032
1033 for (;;) {
1034 spin_lock_irqsave(&s->lock, flags);
1035 count = s->dma_dac.count;
1036 spin_unlock_irqrestore(&s->lock, flags);
1037 if (count <= 0)
1038 break;
1039 if (signal_pending(current))
1040 break;
1041 //if (nonblock)
1042 //return -EBUSY;
1043 tmo = 1000 * count / s->dacrate;
1044 tmo >>= sample_shift[(s->pcc & CC_FMT_MASK) >> CC_FMT_BIT];
1045 it8172_delay(tmo);
1046 }
1047 if (signal_pending(current))
1048 return -ERESTARTSYS;
1049 return 0;
1050}
1051
1052/* --------------------------------------------------------------------- */
1053
1054
1055/*
1056 * Copy audio data to/from user buffer from/to dma buffer, taking care
1057 * that we wrap when reading/writing the dma buffer. Returns actual byte
1058 * count written to or read from the dma buffer.
1059 */
1060static int copy_dmabuf_user(struct dmabuf *db, char* userbuf,
1061 int count, int to_user)
1062{
1063 char* bufptr = to_user ? db->nextOut : db->nextIn;
1064 char* bufend = db->rawbuf + db->dmasize;
1065
1066 if (bufptr + count > bufend) {
1067 int partial = (int)(bufend - bufptr);
1068 if (to_user) {
1069 if (copy_to_user(userbuf, bufptr, partial))
1070 return -EFAULT;
1071 if (copy_to_user(userbuf + partial, db->rawbuf,
1072 count - partial))
1073 return -EFAULT;
1074 } else {
1075 if (copy_from_user(bufptr, userbuf, partial))
1076 return -EFAULT;
1077 if (copy_from_user(db->rawbuf,
1078 userbuf + partial,
1079 count - partial))
1080 return -EFAULT;
1081 }
1082 } else {
1083 if (to_user) {
1084 if (copy_to_user(userbuf, bufptr, count))
1085 return -EFAULT;
1086 } else {
1087 if (copy_from_user(bufptr, userbuf, count))
1088 return -EFAULT;
1089 }
1090 }
1091
1092 return count;
1093}
1094
1095
1096static ssize_t it8172_read(struct file *file, char *buffer,
1097 size_t count, loff_t *ppos)
1098{
1099 struct it8172_state *s = (struct it8172_state *)file->private_data;
1100 struct dmabuf *db = &s->dma_adc;
1101 ssize_t ret;
1102 unsigned long flags;
1103 int cnt, remainder, avail;
1104
1105 if (db->mapped)
1106 return -ENXIO;
1107 if (!access_ok(VERIFY_WRITE, buffer, count))
1108 return -EFAULT;
1109 ret = 0;
1110
1111 while (count > 0) {
1112 // wait for samples in capture buffer
1113 do {
1114 spin_lock_irqsave(&s->lock, flags);
1115 if (db->stopped)
1116 start_adc(s);
1117 avail = db->count;
1118 spin_unlock_irqrestore(&s->lock, flags);
1119 if (avail <= 0) {
1120 if (file->f_flags & O_NONBLOCK) {
1121 if (!ret)
1122 ret = -EAGAIN;
1123 return ret;
1124 }
1125 interruptible_sleep_on(&db->wait);
1126 if (signal_pending(current)) {
1127 if (!ret)
1128 ret = -ERESTARTSYS;
1129 return ret;
1130 }
1131 }
1132 } while (avail <= 0);
1133
1134 // copy from nextOut to user
1135 if ((cnt = copy_dmabuf_user(db, buffer, count > avail ?
1136 avail : count, 1)) < 0) {
1137 if (!ret)
1138 ret = -EFAULT;
1139 return ret;
1140 }
1141
1142 spin_lock_irqsave(&s->lock, flags);
1143 db->count -= cnt;
1144 spin_unlock_irqrestore(&s->lock, flags);
1145
1146 db->nextOut += cnt;
1147 if (db->nextOut >= db->rawbuf + db->dmasize)
1148 db->nextOut -= db->dmasize;
1149
1150 count -= cnt;
1151 buffer += cnt;
1152 ret += cnt;
1153 } // while (count > 0)
1154
1155 /*
1156 * See if the dma buffer count after this read call is
1157 * aligned on a fragsize boundary. If not, read from
1158 * buffer until we reach a boundary, and let's hope this
1159 * is just the last remainder of an audio record. If not
1160 * it means the user is not reading in fragsize chunks, in
1161 * which case it's his/her fault that there are audio gaps
1162 * in their record.
1163 */
1164 spin_lock_irqsave(&s->lock, flags);
1165 remainder = db->count % db->fragsize;
1166 if (remainder) {
1167 db->nextOut += remainder;
1168 if (db->nextOut >= db->rawbuf + db->dmasize)
1169 db->nextOut -= db->dmasize;
1170 db->count -= remainder;
1171 }
1172 spin_unlock_irqrestore(&s->lock, flags);
1173
1174 return ret;
1175}
1176
1177static ssize_t it8172_write(struct file *file, const char *buffer,
1178 size_t count, loff_t *ppos)
1179{
1180 struct it8172_state *s = (struct it8172_state *)file->private_data;
1181 struct dmabuf *db = &s->dma_dac;
1182 ssize_t ret;
1183 unsigned long flags;
1184 int cnt, remainder, avail;
1185
1186 if (db->mapped)
1187 return -ENXIO;
1188 if (!access_ok(VERIFY_READ, buffer, count))
1189 return -EFAULT;
1190 ret = 0;
1191
1192 while (count > 0) {
1193 // wait for space in playback buffer
1194 do {
1195 spin_lock_irqsave(&s->lock, flags);
1196 avail = db->dmasize - db->count;
1197 spin_unlock_irqrestore(&s->lock, flags);
1198 if (avail <= 0) {
1199 if (file->f_flags & O_NONBLOCK) {
1200 if (!ret)
1201 ret = -EAGAIN;
1202 return ret;
1203 }
1204 interruptible_sleep_on(&db->wait);
1205 if (signal_pending(current)) {
1206 if (!ret)
1207 ret = -ERESTARTSYS;
1208 return ret;
1209 }
1210 }
1211 } while (avail <= 0);
1212
1213 // copy to nextIn
1214 if ((cnt = copy_dmabuf_user(db, (char*)buffer,
1215 count > avail ?
1216 avail : count, 0)) < 0) {
1217 if (!ret)
1218 ret = -EFAULT;
1219 return ret;
1220 }
1221
1222 spin_lock_irqsave(&s->lock, flags);
1223 db->count += cnt;
1224 if (db->stopped)
1225 start_dac(s);
1226 spin_unlock_irqrestore(&s->lock, flags);
1227
1228 db->nextIn += cnt;
1229 if (db->nextIn >= db->rawbuf + db->dmasize)
1230 db->nextIn -= db->dmasize;
1231
1232 count -= cnt;
1233 buffer += cnt;
1234 ret += cnt;
1235 } // while (count > 0)
1236
1237 /*
1238 * See if the dma buffer count after this write call is
1239 * aligned on a fragsize boundary. If not, fill buffer
1240 * with silence to the next boundary, and let's hope this
1241 * is just the last remainder of an audio playback. If not
1242 * it means the user is not sending us fragsize chunks, in
1243 * which case it's his/her fault that there are audio gaps
1244 * in their playback.
1245 */
1246 spin_lock_irqsave(&s->lock, flags);
1247 remainder = db->count % db->fragsize;
1248 if (remainder) {
1249 int fill_cnt = db->fragsize - remainder;
1250 memset(db->nextIn, 0, fill_cnt);
1251 db->nextIn += fill_cnt;
1252 if (db->nextIn >= db->rawbuf + db->dmasize)
1253 db->nextIn -= db->dmasize;
1254 db->count += fill_cnt;
1255 }
1256 spin_unlock_irqrestore(&s->lock, flags);
1257
1258 return ret;
1259}
1260
1261/* No kernel lock - we have our own spinlock */
1262static unsigned int it8172_poll(struct file *file,
1263 struct poll_table_struct *wait)
1264{
1265 struct it8172_state *s = (struct it8172_state *)file->private_data;
1266 unsigned long flags;
1267 unsigned int mask = 0;
1268
1269 if (file->f_mode & FMODE_WRITE) {
1270 if (!s->dma_dac.ready)
1271 return 0;
1272 poll_wait(file, &s->dma_dac.wait, wait);
1273 }
1274 if (file->f_mode & FMODE_READ) {
1275 if (!s->dma_adc.ready)
1276 return 0;
1277 poll_wait(file, &s->dma_adc.wait, wait);
1278 }
1279
1280 spin_lock_irqsave(&s->lock, flags);
1281 if (file->f_mode & FMODE_READ) {
1282 if (s->dma_adc.count >= (signed)s->dma_adc.fragsize)
1283 mask |= POLLIN | POLLRDNORM;
1284 }
1285 if (file->f_mode & FMODE_WRITE) {
1286 if (s->dma_dac.mapped) {
1287 if (s->dma_dac.count >= (signed)s->dma_dac.fragsize)
1288 mask |= POLLOUT | POLLWRNORM;
1289 } else {
1290 if ((signed)s->dma_dac.dmasize >=
1291 s->dma_dac.count + (signed)s->dma_dac.fragsize)
1292 mask |= POLLOUT | POLLWRNORM;
1293 }
1294 }
1295 spin_unlock_irqrestore(&s->lock, flags);
1296 return mask;
1297}
1298
1299static int it8172_mmap(struct file *file, struct vm_area_struct *vma)
1300{
1301 struct it8172_state *s = (struct it8172_state *)file->private_data;
1302 struct dmabuf *db;
1303 unsigned long size;
1304
1305 lock_kernel();
1306 if (vma->vm_flags & VM_WRITE)
1307 db = &s->dma_dac;
1308 else if (vma->vm_flags & VM_READ)
1309 db = &s->dma_adc;
1310 else {
1311 unlock_kernel();
1312 return -EINVAL;
1313 }
1314 if (vma->vm_pgoff != 0) {
1315 unlock_kernel();
1316 return -EINVAL;
1317 }
1318 size = vma->vm_end - vma->vm_start;
1319 if (size > (PAGE_SIZE << db->buforder)) {
1320 unlock_kernel();
1321 return -EINVAL;
1322 }
1323 if (remap_pfn_range(vma, vma->vm_start,
1324 virt_to_phys(db->rawbuf) >> PAGE_SHIFT,
1325 size, vma->vm_page_prot)) {
1326 unlock_kernel();
1327 return -EAGAIN;
1328 }
1329 db->mapped = 1;
1330 unlock_kernel();
1331 return 0;
1332}
1333
1334
1335#ifdef IT8172_VERBOSE_DEBUG
1336static struct ioctl_str_t {
1337 unsigned int cmd;
1338 const char* str;
1339} ioctl_str[] = {
1340 {SNDCTL_DSP_RESET, "SNDCTL_DSP_RESET"},
1341 {SNDCTL_DSP_SYNC, "SNDCTL_DSP_SYNC"},
1342 {SNDCTL_DSP_SPEED, "SNDCTL_DSP_SPEED"},
1343 {SNDCTL_DSP_STEREO, "SNDCTL_DSP_STEREO"},
1344 {SNDCTL_DSP_GETBLKSIZE, "SNDCTL_DSP_GETBLKSIZE"},
1345 {SNDCTL_DSP_SAMPLESIZE, "SNDCTL_DSP_SAMPLESIZE"},
1346 {SNDCTL_DSP_CHANNELS, "SNDCTL_DSP_CHANNELS"},
1347 {SOUND_PCM_WRITE_CHANNELS, "SOUND_PCM_WRITE_CHANNELS"},
1348 {SOUND_PCM_WRITE_FILTER, "SOUND_PCM_WRITE_FILTER"},
1349 {SNDCTL_DSP_POST, "SNDCTL_DSP_POST"},
1350 {SNDCTL_DSP_SUBDIVIDE, "SNDCTL_DSP_SUBDIVIDE"},
1351 {SNDCTL_DSP_SETFRAGMENT, "SNDCTL_DSP_SETFRAGMENT"},
1352 {SNDCTL_DSP_GETFMTS, "SNDCTL_DSP_GETFMTS"},
1353 {SNDCTL_DSP_SETFMT, "SNDCTL_DSP_SETFMT"},
1354 {SNDCTL_DSP_GETOSPACE, "SNDCTL_DSP_GETOSPACE"},
1355 {SNDCTL_DSP_GETISPACE, "SNDCTL_DSP_GETISPACE"},
1356 {SNDCTL_DSP_NONBLOCK, "SNDCTL_DSP_NONBLOCK"},
1357 {SNDCTL_DSP_GETCAPS, "SNDCTL_DSP_GETCAPS"},
1358 {SNDCTL_DSP_GETTRIGGER, "SNDCTL_DSP_GETTRIGGER"},
1359 {SNDCTL_DSP_SETTRIGGER, "SNDCTL_DSP_SETTRIGGER"},
1360 {SNDCTL_DSP_GETIPTR, "SNDCTL_DSP_GETIPTR"},
1361 {SNDCTL_DSP_GETOPTR, "SNDCTL_DSP_GETOPTR"},
1362 {SNDCTL_DSP_MAPINBUF, "SNDCTL_DSP_MAPINBUF"},
1363 {SNDCTL_DSP_MAPOUTBUF, "SNDCTL_DSP_MAPOUTBUF"},
1364 {SNDCTL_DSP_SETSYNCRO, "SNDCTL_DSP_SETSYNCRO"},
1365 {SNDCTL_DSP_SETDUPLEX, "SNDCTL_DSP_SETDUPLEX"},
1366 {SNDCTL_DSP_GETODELAY, "SNDCTL_DSP_GETODELAY"},
1367 {SNDCTL_DSP_GETCHANNELMASK, "SNDCTL_DSP_GETCHANNELMASK"},
1368 {SNDCTL_DSP_BIND_CHANNEL, "SNDCTL_DSP_BIND_CHANNEL"},
1369 {OSS_GETVERSION, "OSS_GETVERSION"},
1370 {SOUND_PCM_READ_RATE, "SOUND_PCM_READ_RATE"},
1371 {SOUND_PCM_READ_CHANNELS, "SOUND_PCM_READ_CHANNELS"},
1372 {SOUND_PCM_READ_BITS, "SOUND_PCM_READ_BITS"},
1373 {SOUND_PCM_READ_FILTER, "SOUND_PCM_READ_FILTER"}
1374};
1375#endif
1376
1377static int it8172_ioctl(struct inode *inode, struct file *file,
1378 unsigned int cmd, unsigned long arg)
1379{
1380 struct it8172_state *s = (struct it8172_state *)file->private_data;
1381 unsigned long flags;
1382 audio_buf_info abinfo;
1383 count_info cinfo;
1384 int count;
1385 int val, mapped, ret, diff;
1386
1387 mapped = ((file->f_mode & FMODE_WRITE) && s->dma_dac.mapped) ||
1388 ((file->f_mode & FMODE_READ) && s->dma_adc.mapped);
1389
1390#ifdef IT8172_VERBOSE_DEBUG
1391 for (count=0; count<sizeof(ioctl_str)/sizeof(ioctl_str[0]); count++) {
1392 if (ioctl_str[count].cmd == cmd)
1393 break;
1394 }
1395 if (count < sizeof(ioctl_str)/sizeof(ioctl_str[0]))
1396 dbg("ioctl %s, arg=0x%08x",
1397 ioctl_str[count].str, (unsigned int)arg);
1398 else
1399 dbg("ioctl unknown, 0x%x", cmd);
1400#endif
1401
1402 switch (cmd) {
1403 case OSS_GETVERSION:
1404 return put_user(SOUND_VERSION, (int *)arg);
1405
1406 case SNDCTL_DSP_SYNC:
1407 if (file->f_mode & FMODE_WRITE)
1408 return drain_dac(s, file->f_flags & O_NONBLOCK);
1409 return 0;
1410
1411 case SNDCTL_DSP_SETDUPLEX:
1412 return 0;
1413
1414 case SNDCTL_DSP_GETCAPS:
1415 return put_user(DSP_CAP_DUPLEX | DSP_CAP_REALTIME |
1416 DSP_CAP_TRIGGER | DSP_CAP_MMAP, (int *)arg);
1417
1418 case SNDCTL_DSP_RESET:
1419 if (file->f_mode & FMODE_WRITE) {
1420 stop_dac(s);
1421 synchronize_irq(s->irq);
1422 s->dma_dac.count = s->dma_dac.total_bytes = 0;
1423 s->dma_dac.nextIn = s->dma_dac.nextOut =
1424 s->dma_dac.rawbuf;
1425 }
1426 if (file->f_mode & FMODE_READ) {
1427 stop_adc(s);
1428 synchronize_irq(s->irq);
1429 s->dma_adc.count = s->dma_adc.total_bytes = 0;
1430 s->dma_adc.nextIn = s->dma_adc.nextOut =
1431 s->dma_adc.rawbuf;
1432 }
1433 return 0;
1434
1435 case SNDCTL_DSP_SPEED:
1436 if (get_user(val, (int *)arg))
1437 return -EFAULT;
1438 if (val >= 0) {
1439 if (file->f_mode & FMODE_READ) {
1440 stop_adc(s);
1441 set_adc_rate(s, val);
1442 if ((ret = prog_dmabuf_adc(s)))
1443 return ret;
1444 }
1445 if (file->f_mode & FMODE_WRITE) {
1446 stop_dac(s);
1447 set_dac_rate(s, val);
1448 if ((ret = prog_dmabuf_dac(s)))
1449 return ret;
1450 }
1451 }
1452 return put_user((file->f_mode & FMODE_READ) ?
1453 s->adcrate : s->dacrate, (int *)arg);
1454
1455 case SNDCTL_DSP_STEREO:
1456 if (get_user(val, (int *)arg))
1457 return -EFAULT;
1458 if (file->f_mode & FMODE_READ) {
1459 stop_adc(s);
1460 if (val)
1461 s->capcc |= CC_SM;
1462 else
1463 s->capcc &= ~CC_SM;
1464 outw(s->capcc, s->io+IT_AC_CAPCC);
1465 if ((ret = prog_dmabuf_adc(s)))
1466 return ret;
1467 }
1468 if (file->f_mode & FMODE_WRITE) {
1469 stop_dac(s);
1470 if (val)
1471 s->pcc |= CC_SM;
1472 else
1473 s->pcc &= ~CC_SM;
1474 outw(s->pcc, s->io+IT_AC_PCC);
1475 if ((ret = prog_dmabuf_dac(s)))
1476 return ret;
1477 }
1478 return 0;
1479
1480 case SNDCTL_DSP_CHANNELS:
1481 if (get_user(val, (int *)arg))
1482 return -EFAULT;
1483 if (val != 0) {
1484 if (file->f_mode & FMODE_READ) {
1485 stop_adc(s);
1486 if (val >= 2) {
1487 val = 2;
1488 s->capcc |= CC_SM;
1489 }
1490 else
1491 s->capcc &= ~CC_SM;
1492 outw(s->capcc, s->io+IT_AC_CAPCC);
1493 if ((ret = prog_dmabuf_adc(s)))
1494 return ret;
1495 }
1496 if (file->f_mode & FMODE_WRITE) {
1497 stop_dac(s);
1498 switch (val) {
1499 case 1:
1500 s->pcc &= ~CC_SM;
1501 break;
1502 case 2:
1503 s->pcc |= CC_SM;
1504 break;
1505 default:
1506 // FIX! support multichannel???
1507 val = 2;
1508 s->pcc |= CC_SM;
1509 break;
1510 }
1511 outw(s->pcc, s->io+IT_AC_PCC);
1512 if ((ret = prog_dmabuf_dac(s)))
1513 return ret;
1514 }
1515 }
1516 return put_user(val, (int *)arg);
1517
1518 case SNDCTL_DSP_GETFMTS: /* Returns a mask */
1519 return put_user(AFMT_S16_LE|AFMT_U8, (int *)arg);
1520
1521 case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
1522 if (get_user(val, (int *)arg))
1523 return -EFAULT;
1524 if (val != AFMT_QUERY) {
1525 if (file->f_mode & FMODE_READ) {
1526 stop_adc(s);
1527 if (val == AFMT_S16_LE)
1528 s->capcc |= CC_DF;
1529 else {
1530 val = AFMT_U8;
1531 s->capcc &= ~CC_DF;
1532 }
1533 outw(s->capcc, s->io+IT_AC_CAPCC);
1534 if ((ret = prog_dmabuf_adc(s)))
1535 return ret;
1536 }
1537 if (file->f_mode & FMODE_WRITE) {
1538 stop_dac(s);
1539 if (val == AFMT_S16_LE)
1540 s->pcc |= CC_DF;
1541 else {
1542 val = AFMT_U8;
1543 s->pcc &= ~CC_DF;
1544 }
1545 outw(s->pcc, s->io+IT_AC_PCC);
1546 if ((ret = prog_dmabuf_dac(s)))
1547 return ret;
1548 }
1549 } else {
1550 if (file->f_mode & FMODE_READ)
1551 val = (s->capcc & CC_DF) ?
1552 AFMT_S16_LE : AFMT_U8;
1553 else
1554 val = (s->pcc & CC_DF) ?
1555 AFMT_S16_LE : AFMT_U8;
1556 }
1557 return put_user(val, (int *)arg);
1558
1559 case SNDCTL_DSP_POST:
1560 return 0;
1561
1562 case SNDCTL_DSP_GETTRIGGER:
1563 val = 0;
1564 spin_lock_irqsave(&s->lock, flags);
1565 if (file->f_mode & FMODE_READ && !s->dma_adc.stopped)
1566 val |= PCM_ENABLE_INPUT;
1567 if (file->f_mode & FMODE_WRITE && !s->dma_dac.stopped)
1568 val |= PCM_ENABLE_OUTPUT;
1569 spin_unlock_irqrestore(&s->lock, flags);
1570 return put_user(val, (int *)arg);
1571
1572 case SNDCTL_DSP_SETTRIGGER:
1573 if (get_user(val, (int *)arg))
1574 return -EFAULT;
1575 if (file->f_mode & FMODE_READ) {
1576 if (val & PCM_ENABLE_INPUT)
1577 start_adc(s);
1578 else
1579 stop_adc(s);
1580 }
1581 if (file->f_mode & FMODE_WRITE) {
1582 if (val & PCM_ENABLE_OUTPUT)
1583 start_dac(s);
1584 else
1585 stop_dac(s);
1586 }
1587 return 0;
1588
1589 case SNDCTL_DSP_GETOSPACE:
1590 if (!(file->f_mode & FMODE_WRITE))
1591 return -EINVAL;
1592 abinfo.fragsize = s->dma_dac.fragsize;
1593 spin_lock_irqsave(&s->lock, flags);
1594 count = s->dma_dac.count;
1595 if (!s->dma_dac.stopped)
1596 count -= (s->dma_dac.fragsize -
1597 inw(s->io+IT_AC_PCDL));
1598 spin_unlock_irqrestore(&s->lock, flags);
1599 if (count < 0)
1600 count = 0;
1601 abinfo.bytes = s->dma_dac.dmasize - count;
1602 abinfo.fragstotal = s->dma_dac.numfrag;
1603 abinfo.fragments = abinfo.bytes >> s->dma_dac.fragshift;
1604 return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ?
1605 -EFAULT : 0;
1606
1607 case SNDCTL_DSP_GETISPACE:
1608 if (!(file->f_mode & FMODE_READ))
1609 return -EINVAL;
1610 abinfo.fragsize = s->dma_adc.fragsize;
1611 spin_lock_irqsave(&s->lock, flags);
1612 count = s->dma_adc.count;
1613 if (!s->dma_adc.stopped)
1614 count += (s->dma_adc.fragsize -
1615 inw(s->io+IT_AC_CAPCDL));
1616 spin_unlock_irqrestore(&s->lock, flags);
1617 if (count < 0)
1618 count = 0;
1619 abinfo.bytes = count;
1620 abinfo.fragstotal = s->dma_adc.numfrag;
1621 abinfo.fragments = abinfo.bytes >> s->dma_adc.fragshift;
1622 return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ?
1623 -EFAULT : 0;
1624
1625 case SNDCTL_DSP_NONBLOCK:
1626 file->f_flags |= O_NONBLOCK;
1627 return 0;
1628
1629 case SNDCTL_DSP_GETODELAY:
1630 if (!(file->f_mode & FMODE_WRITE))
1631 return -EINVAL;
1632 spin_lock_irqsave(&s->lock, flags);
1633 count = s->dma_dac.count;
1634 if (!s->dma_dac.stopped)
1635 count -= (s->dma_dac.fragsize -
1636 inw(s->io+IT_AC_PCDL));
1637 spin_unlock_irqrestore(&s->lock, flags);
1638 if (count < 0)
1639 count = 0;
1640 return put_user(count, (int *)arg);
1641
1642 case SNDCTL_DSP_GETIPTR:
1643 if (!(file->f_mode & FMODE_READ))
1644 return -EINVAL;
1645 spin_lock_irqsave(&s->lock, flags);
1646 cinfo.bytes = s->dma_adc.total_bytes;
1647 count = s->dma_adc.count;
1648 if (!s->dma_adc.stopped) {
1649 diff = s->dma_adc.fragsize - inw(s->io+IT_AC_CAPCDL);
1650 count += diff;
1651 cinfo.bytes += diff;
1652 cinfo.ptr = inl(s->io+s->dma_adc.curBufPtr) -
1653 s->dma_adc.dmaaddr;
1654 } else
1655 cinfo.ptr = virt_to_bus(s->dma_adc.nextIn) -
1656 s->dma_adc.dmaaddr;
1657 if (s->dma_adc.mapped)
1658 s->dma_adc.count &= s->dma_adc.fragsize-1;
1659 spin_unlock_irqrestore(&s->lock, flags);
1660 if (count < 0)
1661 count = 0;
1662 cinfo.blocks = count >> s->dma_adc.fragshift;
1663 if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
1664 return -EFAULT;
1665 return 0;
1666
1667 case SNDCTL_DSP_GETOPTR:
1668 if (!(file->f_mode & FMODE_READ))
1669 return -EINVAL;
1670 spin_lock_irqsave(&s->lock, flags);
1671 cinfo.bytes = s->dma_dac.total_bytes;
1672 count = s->dma_dac.count;
1673 if (!s->dma_dac.stopped) {
1674 diff = s->dma_dac.fragsize - inw(s->io+IT_AC_CAPCDL);
1675 count -= diff;
1676 cinfo.bytes += diff;
1677 cinfo.ptr = inl(s->io+s->dma_dac.curBufPtr) -
1678 s->dma_dac.dmaaddr;
1679 } else
1680 cinfo.ptr = virt_to_bus(s->dma_dac.nextOut) -
1681 s->dma_dac.dmaaddr;
1682 if (s->dma_dac.mapped)
1683 s->dma_dac.count &= s->dma_dac.fragsize-1;
1684 spin_unlock_irqrestore(&s->lock, flags);
1685 if (count < 0)
1686 count = 0;
1687 cinfo.blocks = count >> s->dma_dac.fragshift;
1688 if (copy_to_user((void *)arg, &cinfo, sizeof(cinfo)))
1689 return -EFAULT;
1690 return 0;
1691
1692 case SNDCTL_DSP_GETBLKSIZE:
1693 if (file->f_mode & FMODE_WRITE)
1694 return put_user(s->dma_dac.fragsize, (int *)arg);
1695 else
1696 return put_user(s->dma_adc.fragsize, (int *)arg);
1697
1698 case SNDCTL_DSP_SETFRAGMENT:
1699 if (get_user(val, (int *)arg))
1700 return -EFAULT;
1701 if (file->f_mode & FMODE_READ) {
1702 stop_adc(s);
1703 s->dma_adc.ossfragshift = val & 0xffff;
1704 s->dma_adc.ossmaxfrags = (val >> 16) & 0xffff;
1705 if (s->dma_adc.ossfragshift < 4)
1706 s->dma_adc.ossfragshift = 4;
1707 if (s->dma_adc.ossfragshift > 15)
1708 s->dma_adc.ossfragshift = 15;
1709 if (s->dma_adc.ossmaxfrags < 4)
1710 s->dma_adc.ossmaxfrags = 4;
1711 if ((ret = prog_dmabuf_adc(s)))
1712 return ret;
1713 }
1714 if (file->f_mode & FMODE_WRITE) {
1715 stop_dac(s);
1716 s->dma_dac.ossfragshift = val & 0xffff;
1717 s->dma_dac.ossmaxfrags = (val >> 16) & 0xffff;
1718 if (s->dma_dac.ossfragshift < 4)
1719 s->dma_dac.ossfragshift = 4;
1720 if (s->dma_dac.ossfragshift > 15)
1721 s->dma_dac.ossfragshift = 15;
1722 if (s->dma_dac.ossmaxfrags < 4)
1723 s->dma_dac.ossmaxfrags = 4;
1724 if ((ret = prog_dmabuf_dac(s)))
1725 return ret;
1726 }
1727 return 0;
1728
1729 case SNDCTL_DSP_SUBDIVIDE:
1730 if ((file->f_mode & FMODE_READ && s->dma_adc.subdivision) ||
1731 (file->f_mode & FMODE_WRITE && s->dma_dac.subdivision))
1732 return -EINVAL;
1733 if (get_user(val, (int *)arg))
1734 return -EFAULT;
1735 if (val != 1 && val != 2 && val != 4)
1736 return -EINVAL;
1737 if (file->f_mode & FMODE_READ) {
1738 stop_adc(s);
1739 s->dma_adc.subdivision = val;
1740 if ((ret = prog_dmabuf_adc(s)))
1741 return ret;
1742 }
1743 if (file->f_mode & FMODE_WRITE) {
1744 stop_dac(s);
1745 s->dma_dac.subdivision = val;
1746 if ((ret = prog_dmabuf_dac(s)))
1747 return ret;
1748 }
1749 return 0;
1750
1751 case SOUND_PCM_READ_RATE:
1752 return put_user((file->f_mode & FMODE_READ) ?
1753 s->adcrate : s->dacrate, (int *)arg);
1754
1755 case SOUND_PCM_READ_CHANNELS:
1756 if (file->f_mode & FMODE_READ)
1757 return put_user((s->capcc & CC_SM) ? 2 : 1,
1758 (int *)arg);
1759 else
1760 return put_user((s->pcc & CC_SM) ? 2 : 1,
1761 (int *)arg);
1762
1763 case SOUND_PCM_READ_BITS:
1764 if (file->f_mode & FMODE_READ)
1765 return put_user((s->capcc & CC_DF) ? 16 : 8,
1766 (int *)arg);
1767 else
1768 return put_user((s->pcc & CC_DF) ? 16 : 8,
1769 (int *)arg);
1770
1771 case SOUND_PCM_WRITE_FILTER:
1772 case SNDCTL_DSP_SETSYNCRO:
1773 case SOUND_PCM_READ_FILTER:
1774 return -EINVAL;
1775 }
1776
1777 return mixdev_ioctl(&s->codec, cmd, arg);
1778}
1779
1780
1781static int it8172_open(struct inode *inode, struct file *file)
1782{
1783 int minor = iminor(inode);
1784 DECLARE_WAITQUEUE(wait, current);
1785 unsigned long flags;
1786 struct list_head *list;
1787 struct it8172_state *s;
1788 int ret;
1789
1790#ifdef IT8172_VERBOSE_DEBUG
1791 if (file->f_flags & O_NONBLOCK)
1792 dbg("%s: non-blocking", __FUNCTION__);
1793 else
1794 dbg("%s: blocking", __FUNCTION__);
1795#endif
1796
1797 for (list = devs.next; ; list = list->next) {
1798 if (list == &devs)
1799 return -ENODEV;
1800 s = list_entry(list, struct it8172_state, devs);
1801 if (!((s->dev_audio ^ minor) & ~0xf))
1802 break;
1803 }
1804 file->private_data = s;
1805 /* wait for device to become free */
1806 mutex_lock(&s->open_mutex);
1807 while (s->open_mode & file->f_mode) {
1808 if (file->f_flags & O_NONBLOCK) {
1809 mutex_unlock(&s->open_mutex);
1810 return -EBUSY;
1811 }
1812 add_wait_queue(&s->open_wait, &wait);
1813 __set_current_state(TASK_INTERRUPTIBLE);
1814 mutex_unlock(&s->open_mutex);
1815 schedule();
1816 remove_wait_queue(&s->open_wait, &wait);
1817 set_current_state(TASK_RUNNING);
1818 if (signal_pending(current))
1819 return -ERESTARTSYS;
1820 mutex_lock(&s->open_mutex);
1821 }
1822
1823 spin_lock_irqsave(&s->lock, flags);
1824
1825 if (file->f_mode & FMODE_READ) {
1826 s->dma_adc.ossfragshift = s->dma_adc.ossmaxfrags =
1827 s->dma_adc.subdivision = s->dma_adc.total_bytes = 0;
1828 s->capcc &= ~(CC_SM | CC_DF);
1829 set_adc_rate(s, 8000);
1830 if ((minor & 0xf) == SND_DEV_DSP16)
1831 s->capcc |= CC_DF;
1832 outw(s->capcc, s->io+IT_AC_CAPCC);
1833 if ((ret = prog_dmabuf_adc(s))) {
1834 spin_unlock_irqrestore(&s->lock, flags);
1835 return ret;
1836 }
1837 }
1838 if (file->f_mode & FMODE_WRITE) {
1839 s->dma_dac.ossfragshift = s->dma_dac.ossmaxfrags =
1840 s->dma_dac.subdivision = s->dma_dac.total_bytes = 0;
1841 s->pcc &= ~(CC_SM | CC_DF);
1842 set_dac_rate(s, 8000);
1843 if ((minor & 0xf) == SND_DEV_DSP16)
1844 s->pcc |= CC_DF;
1845 outw(s->pcc, s->io+IT_AC_PCC);
1846 if ((ret = prog_dmabuf_dac(s))) {
1847 spin_unlock_irqrestore(&s->lock, flags);
1848 return ret;
1849 }
1850 }
1851
1852 spin_unlock_irqrestore(&s->lock, flags);
1853
1854 s->open_mode |= (file->f_mode & (FMODE_READ | FMODE_WRITE));
1855 mutex_unlock(&s->open_mutex);
1856 return nonseekable_open(inode, file);
1857}
1858
1859static int it8172_release(struct inode *inode, struct file *file)
1860{
1861 struct it8172_state *s = (struct it8172_state *)file->private_data;
1862
1863#ifdef IT8172_VERBOSE_DEBUG
1864 dbg("%s", __FUNCTION__);
1865#endif
1866 lock_kernel();
1867 if (file->f_mode & FMODE_WRITE)
1868 drain_dac(s, file->f_flags & O_NONBLOCK);
1869 mutex_lock(&s->open_mutex);
1870 if (file->f_mode & FMODE_WRITE) {
1871 stop_dac(s);
1872 dealloc_dmabuf(s, &s->dma_dac);
1873 }
1874 if (file->f_mode & FMODE_READ) {
1875 stop_adc(s);
1876 dealloc_dmabuf(s, &s->dma_adc);
1877 }
1878 s->open_mode &= ((~file->f_mode) & (FMODE_READ|FMODE_WRITE));
1879 mutex_unlock(&s->open_mutex);
1880 wake_up(&s->open_wait);
1881 unlock_kernel();
1882 return 0;
1883}
1884
1885static /*const*/ struct file_operations it8172_audio_fops = {
1886 .owner = THIS_MODULE,
1887 .llseek = no_llseek,
1888 .read = it8172_read,
1889 .write = it8172_write,
1890 .poll = it8172_poll,
1891 .ioctl = it8172_ioctl,
1892 .mmap = it8172_mmap,
1893 .open = it8172_open,
1894 .release = it8172_release,
1895};
1896
1897
1898/* --------------------------------------------------------------------- */
1899
1900
1901/* --------------------------------------------------------------------- */
1902
1903/*
1904 * for debugging purposes, we'll create a proc device that dumps the
1905 * CODEC chipstate
1906 */
1907
1908#ifdef IT8172_DEBUG
1909static int proc_it8172_dump (char *buf, char **start, off_t fpos,
1910 int length, int *eof, void *data)
1911{
1912 struct it8172_state *s;
1913 int cnt, len = 0;
1914
1915 if (list_empty(&devs))
1916 return 0;
1917 s = list_entry(devs.next, struct it8172_state, devs);
1918
1919 /* print out header */
1920 len += sprintf(buf + len, "\n\t\tIT8172 Audio Debug\n\n");
1921
1922 // print out digital controller state
1923 len += sprintf (buf + len, "IT8172 Audio Controller registers\n");
1924 len += sprintf (buf + len, "---------------------------------\n");
1925 cnt=0;
1926 while (cnt < 0x72) {
1927 if (cnt == IT_AC_PCB1STA || cnt == IT_AC_PCB2STA ||
1928 cnt == IT_AC_CAPB1STA || cnt == IT_AC_CAPB2STA ||
1929 cnt == IT_AC_PFDP) {
1930 len+= sprintf (buf + len, "reg %02x = %08x\n",
1931 cnt, inl(s->io+cnt));
1932 cnt += 4;
1933 } else {
1934 len+= sprintf (buf + len, "reg %02x = %04x\n",
1935 cnt, inw(s->io+cnt));
1936 cnt += 2;
1937 }
1938 }
1939
1940 /* print out CODEC state */
1941 len += sprintf (buf + len, "\nAC97 CODEC registers\n");
1942 len += sprintf (buf + len, "----------------------\n");
1943 for (cnt=0; cnt <= 0x7e; cnt = cnt +2)
1944 len+= sprintf (buf + len, "reg %02x = %04x\n",
1945 cnt, rdcodec(&s->codec, cnt));
1946
1947 if (fpos >=len){
1948 *start = buf;
1949 *eof =1;
1950 return 0;
1951 }
1952 *start = buf + fpos;
1953 if ((len -= fpos) > length)
1954 return length;
1955 *eof =1;
1956 return len;
1957
1958}
1959#endif /* IT8172_DEBUG */
1960
1961/* --------------------------------------------------------------------- */
1962
1963/* maximum number of devices; only used for command line params */
1964#define NR_DEVICE 5
1965
1966static int spdif[NR_DEVICE];
1967static int i2s_fmt[NR_DEVICE];
1968
1969static unsigned int devindex;
1970
1971module_param_array(spdif, int, NULL, 0);
1972MODULE_PARM_DESC(spdif, "if 1 the S/PDIF digital output is enabled");
1973module_param_array(i2s_fmt, int, NULL, 0);
1974MODULE_PARM_DESC(i2s_fmt, "the format of I2S");
1975
1976MODULE_AUTHOR("Monta Vista Software, stevel@mvista.com");
1977MODULE_DESCRIPTION("IT8172 Audio Driver");
1978
1979/* --------------------------------------------------------------------- */
1980
1981static int __devinit it8172_probe(struct pci_dev *pcidev,
1982 const struct pci_device_id *pciid)
1983{
1984 struct it8172_state *s;
1985 int i, val;
1986 unsigned short pcisr, vol;
1987 unsigned char legacy, imc;
1988 char proc_str[80];
1989
1990 if (pcidev->irq == 0)
1991 return -1;
1992
1993 if (!(s = kmalloc(sizeof(struct it8172_state), GFP_KERNEL))) {
1994 err("alloc of device struct failed");
1995 return -1;
1996 }
1997
1998 memset(s, 0, sizeof(struct it8172_state));
1999 init_waitqueue_head(&s->dma_adc.wait);
2000 init_waitqueue_head(&s->dma_dac.wait);
2001 init_waitqueue_head(&s->open_wait);
2002 mutex_init(&s->open_mutex);
2003 spin_lock_init(&s->lock);
2004 s->dev = pcidev;
2005 s->io = pci_resource_start(pcidev, 0);
2006 s->irq = pcidev->irq;
2007 s->vendor = pcidev->vendor;
2008 s->device = pcidev->device;
2009 pci_read_config_byte(pcidev, PCI_REVISION_ID, &s->rev);
2010 s->codec.private_data = s;
2011 s->codec.id = 0;
2012 s->codec.codec_read = rdcodec;
2013 s->codec.codec_write = wrcodec;
2014 s->codec.codec_wait = waitcodec;
2015
2016 if (!request_region(s->io, pci_resource_len(pcidev,0),
2017 IT8172_MODULE_NAME)) {
2018 err("io ports %#lx->%#lx in use",
2019 s->io, s->io + pci_resource_len(pcidev,0)-1);
2020 goto err_region;
2021 }
2022 if (request_irq(s->irq, it8172_interrupt, IRQF_DISABLED,
2023 IT8172_MODULE_NAME, s)) {
2024 err("irq %u in use", s->irq);
2025 goto err_irq;
2026 }
2027
2028 info("IO at %#lx, IRQ %d", s->io, s->irq);
2029
2030 /* register devices */
2031 if ((s->dev_audio = register_sound_dsp(&it8172_audio_fops, -1)) < 0)
2032 goto err_dev1;
2033 if ((s->codec.dev_mixer =
2034 register_sound_mixer(&it8172_mixer_fops, -1)) < 0)
2035 goto err_dev2;
2036
2037#ifdef IT8172_DEBUG
2038 /* initialize the debug proc device */
2039 s->ps = create_proc_read_entry(IT8172_MODULE_NAME, 0, NULL,
2040 proc_it8172_dump, NULL);
2041#endif /* IT8172_DEBUG */
2042
2043 /*
2044 * Reset the Audio device using the IT8172 PCI Reset register. This
2045 * creates an audible double click on a speaker connected to Line-out.
2046 */
2047 IT_IO_READ16(IT_PM_PCISR, pcisr);
2048 pcisr |= IT_PM_PCISR_ACSR;
2049 IT_IO_WRITE16(IT_PM_PCISR, pcisr);
2050 /* wait up to 100msec for reset to complete */
2051 for (i=0; pcisr & IT_PM_PCISR_ACSR; i++) {
2052 it8172_delay(10);
2053 if (i == 10)
2054 break;
2055 IT_IO_READ16(IT_PM_PCISR, pcisr);
2056 }
2057 if (i == 10) {
2058 err("chip reset timeout!");
2059 goto err_dev3;
2060 }
2061
2062 /* enable pci io and bus mastering */
2063 if (pci_enable_device(pcidev))
2064 goto err_dev3;
2065 pci_set_master(pcidev);
2066
2067 /* get out of legacy mode */
2068 pci_read_config_byte (pcidev, 0x40, &legacy);
2069 pci_write_config_byte (pcidev, 0x40, legacy & ~1);
2070
2071 s->spdif_volume = -1;
2072 /* check to see if s/pdif mode is being requested */
2073 if (spdif[devindex]) {
2074 info("enabling S/PDIF output");
2075 s->spdif_volume = 0;
2076 outb(GC_SOE, s->io+IT_AC_GC);
2077 } else {
2078 info("disabling S/PDIF output");
2079 outb(0, s->io+IT_AC_GC);
2080 }
2081
2082 /* check to see if I2S format requested */
2083 if (i2s_fmt[devindex]) {
2084 info("setting I2S format to 0x%02x", i2s_fmt[devindex]);
2085 outb(i2s_fmt[devindex], s->io+IT_AC_I2SMC);
2086 } else {
2087 outb(I2SMC_I2SF_I2S, s->io+IT_AC_I2SMC);
2088 }
2089
2090 /* cold reset the AC97 */
2091 outw(CODECC_CR, s->io+IT_AC_CODECC);
2092 udelay(1000);
2093 outw(0, s->io+IT_AC_CODECC);
2094 /* need to delay around 500msec(bleech) to give
2095 some CODECs enough time to wakeup */
2096 it8172_delay(500);
2097
2098 /* AC97 warm reset to start the bitclk */
2099 outw(CODECC_WR, s->io+IT_AC_CODECC);
2100 udelay(1000);
2101 outw(0, s->io+IT_AC_CODECC);
2102
2103 /* codec init */
2104 if (!ac97_probe_codec(&s->codec))
2105 goto err_dev3;
2106
2107 /* add I2S as allowable recording source */
2108 s->codec.record_sources |= SOUND_MASK_I2S;
2109
2110 /* Enable Volume button interrupts */
2111 imc = inb(s->io+IT_AC_IMC);
2112 outb(imc & ~IMC_VCIM, s->io+IT_AC_IMC);
2113
2114 /* Un-mute PCM and FM out on the controller */
2115 vol = inw(s->io+IT_AC_PCMOV);
2116 outw(vol & ~PCMOV_PCMOM, s->io+IT_AC_PCMOV);
2117 vol = inw(s->io+IT_AC_FMOV);
2118 outw(vol & ~FMOV_FMOM, s->io+IT_AC_FMOV);
2119
2120 /* set channel defaults to 8-bit, mono, 8 Khz */
2121 s->pcc = 0;
2122 s->capcc = 0;
2123 set_dac_rate(s, 8000);
2124 set_adc_rate(s, 8000);
2125
2126 /* set mic to be the recording source */
2127 val = SOUND_MASK_MIC;
2128 mixdev_ioctl(&s->codec, SOUND_MIXER_WRITE_RECSRC,
2129 (unsigned long)&val);
2130
2131 /* mute AC'97 master and PCM when in S/PDIF mode */
2132 if (s->spdif_volume != -1) {
2133 val = 0x0000;
2134 s->codec.mixer_ioctl(&s->codec, SOUND_MIXER_WRITE_VOLUME,
2135 (unsigned long)&val);
2136 s->codec.mixer_ioctl(&s->codec, SOUND_MIXER_WRITE_PCM,
2137 (unsigned long)&val);
2138 }
2139
2140#ifdef IT8172_DEBUG
2141 sprintf(proc_str, "driver/%s/%d/ac97", IT8172_MODULE_NAME,
2142 s->codec.id);
2143 s->ac97_ps = create_proc_read_entry (proc_str, 0, NULL,
2144 ac97_read_proc, &s->codec);
2145#endif
2146
2147 /* store it in the driver field */
2148 pci_set_drvdata(pcidev, s);
2149 pcidev->dma_mask = 0xffffffff;
2150 /* put it into driver list */
2151 list_add_tail(&s->devs, &devs);
2152 /* increment devindex */
2153 if (devindex < NR_DEVICE-1)
2154 devindex++;
2155 return 0;
2156
2157 err_dev3:
2158 unregister_sound_mixer(s->codec.dev_mixer);
2159 err_dev2:
2160 unregister_sound_dsp(s->dev_audio);
2161 err_dev1:
2162 err("cannot register misc device");
2163 free_irq(s->irq, s);
2164 err_irq:
2165 release_region(s->io, pci_resource_len(pcidev,0));
2166 err_region:
2167 kfree(s);
2168 return -1;
2169}
2170
2171static void __devexit it8172_remove(struct pci_dev *dev)
2172{
2173 struct it8172_state *s = pci_get_drvdata(dev);
2174
2175 if (!s)
2176 return;
2177 list_del(&s->devs);
2178#ifdef IT8172_DEBUG
2179 if (s->ps)
2180 remove_proc_entry(IT8172_MODULE_NAME, NULL);
2181#endif /* IT8172_DEBUG */
2182 synchronize_irq(s->irq);
2183 free_irq(s->irq, s);
2184 release_region(s->io, pci_resource_len(dev,0));
2185 unregister_sound_dsp(s->dev_audio);
2186 unregister_sound_mixer(s->codec.dev_mixer);
2187 kfree(s);
2188 pci_set_drvdata(dev, NULL);
2189}
2190
2191
2192
2193static struct pci_device_id id_table[] = {
2194 { PCI_VENDOR_ID_ITE, PCI_DEVICE_ID_ITE_IT8172G_AUDIO, PCI_ANY_ID,
2195 PCI_ANY_ID, 0, 0 },
2196 { 0, }
2197};
2198
2199MODULE_DEVICE_TABLE(pci, id_table);
2200
2201static struct pci_driver it8172_driver = {
2202 .name = IT8172_MODULE_NAME,
2203 .id_table = id_table,
2204 .probe = it8172_probe,
2205 .remove = __devexit_p(it8172_remove)
2206};
2207
2208static int __init init_it8172(void)
2209{
2210 info("version v0.5 time " __TIME__ " " __DATE__);
2211 return pci_register_driver(&it8172_driver);
2212}
2213
2214static void __exit cleanup_it8172(void)
2215{
2216 info("unloading");
2217 pci_unregister_driver(&it8172_driver);
2218}
2219
2220module_init(init_it8172);
2221module_exit(cleanup_it8172);
2222
2223/* --------------------------------------------------------------------- */
2224
2225#ifndef MODULE
2226
2227/* format is: it8172=[spdif],[i2s:<I2S format>] */
2228
2229static int __init it8172_setup(char *options)
2230{
2231 char* this_opt;
2232 static unsigned __initdata nr_dev = 0;
2233
2234 if (nr_dev >= NR_DEVICE)
2235 return 0;
2236
2237 if (!options || !*options)
2238 return 0;
2239
2240 while (this_opt = strsep(&options, ",")) {
2241 if (!*this_opt)
2242 continue;
2243 if (!strncmp(this_opt, "spdif", 5)) {
2244 spdif[nr_dev] = 1;
2245 } else if (!strncmp(this_opt, "i2s:", 4)) {
2246 if (!strncmp(this_opt+4, "dac", 3))
2247 i2s_fmt[nr_dev] = I2SMC_I2SF_DAC;
2248 else if (!strncmp(this_opt+4, "adc", 3))
2249 i2s_fmt[nr_dev] = I2SMC_I2SF_ADC;
2250 else if (!strncmp(this_opt+4, "i2s", 3))
2251 i2s_fmt[nr_dev] = I2SMC_I2SF_I2S;
2252 }
2253 }
2254
2255 nr_dev++;
2256 return 1;
2257}
2258
2259__setup("it8172=", it8172_setup);
2260
2261#endif /* MODULE */