aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@g5.osdl.org>2006-09-30 12:39:15 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2006-09-30 12:39:15 -0400
commit5ffd1a6aaacc25be8cd0770a51ec6d46add3a276 (patch)
tree5b076c44f8b7ff88dba9a554d7748c6f083c9071 /drivers/media/video
parent0cd43f83d381c4246a08cd775834833d6fd64805 (diff)
parent8dd86eebc5315910ebfd9f30f1674254308be4b3 (diff)
Merge master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb
* master.kernel.org:/pub/scm/linux/kernel/git/mchehab/v4l-dvb: (180 commits) V4L/DVB (4641): Trivial: use lowercase letters in hex subsystem ids V4L/DVB (4639): Cx88: add autodetection for alternate revision of Leadtek PVR V4L/DVB (4638): Basic DVB-T and analog TV support for the HVR1300. V4L/DVB (4637): Add a default method for VIDIOC_G_PARM V4L/DVB (4635): Extend bttv and saa7134 to check for both AGP and PCI PCI failure case V4L/DVB (4634): Zr36120: implement pcipci checks V4L/DVB (4632): Zoran: Implement pcipci failure check V4L/DVB (4631): Av7110: remove V4L2_CAP_VBI_CAPTURE flag V4L/DVB (4630): Av7110: FW_LOADER depemdency fixed V4L/DVB (4629): Saa7134: add card support for Proteus Pro 2309 V4L/DVB (4628): Fix VIDIOC_ENUMSTD ioctl in videodev.c V4L/DVB (4627): Vivi crashes with mplayer V4L/DVB (4626): On saa7111/7113, LUMA_CTRL need a different value V4L/DVB (4624): Tvaudio: Replaced kernel_thread() with kthread_run() V4L/DVB (4622): Copy-paste bug in videodev.c V4L/DVB (4620): Fix AGC configuration for MOD3000P-based boards V4L/DVB (4619): Fixes some I2C dependencies on V4L devices V4L/DVB (4617): Problem with dibusb-mb.c USB IDs V4L/DVB (4616): [PATCH] Nebula DigiTV USB RC support V4L/DVB (4614): Export symbol saa7134_tvaudio_setmute from saa7134 for saa7134-alsa ...
Diffstat (limited to 'drivers/media/video')
-rw-r--r--drivers/media/video/Kconfig476
-rw-r--r--drivers/media/video/Makefile45
-rw-r--r--drivers/media/video/bt866.c2
-rw-r--r--drivers/media/video/bt8xx/Kconfig5
-rw-r--r--drivers/media/video/bt8xx/bttv-cards.c2
-rw-r--r--drivers/media/video/bt8xx/bttv-driver.c12
-rw-r--r--drivers/media/video/bt8xx/bttv-i2c.c16
-rw-r--r--drivers/media/video/compat_ioctl32.c59
-rw-r--r--drivers/media/video/cx2341x.c25
-rw-r--r--drivers/media/video/cx25840/Kconfig2
-rw-r--r--drivers/media/video/cx25840/cx25840-vbi.c4
-rw-r--r--drivers/media/video/cx88/Kconfig109
-rw-r--r--drivers/media/video/cx88/Makefile7
-rw-r--r--drivers/media/video/cx88/cx88-blackbird.c2
-rw-r--r--drivers/media/video/cx88/cx88-cards.c161
-rw-r--r--drivers/media/video/cx88/cx88-core.c13
-rw-r--r--drivers/media/video/cx88/cx88-dvb.c330
-rw-r--r--drivers/media/video/cx88/cx88-i2c.c13
-rw-r--r--drivers/media/video/cx88/cx88-input.c19
-rw-r--r--drivers/media/video/cx88/cx88-tvaudio.c5
-rw-r--r--drivers/media/video/cx88/cx88-video.c7
-rw-r--r--drivers/media/video/cx88/cx88.h5
-rw-r--r--drivers/media/video/em28xx/Kconfig3
-rw-r--r--drivers/media/video/em28xx/em28xx-video.c2
-rw-r--r--drivers/media/video/ks0127.c3
-rw-r--r--drivers/media/video/pvrusb2/Kconfig18
-rw-r--r--drivers/media/video/pvrusb2/Makefile6
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-ctrl.c21
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-encoder.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h31
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-hdw.c84
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c4
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c2
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-i2c-core.c6
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-main.c1
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-sysfs.c3
-rw-r--r--drivers/media/video/pvrusb2/pvrusb2-v4l2.c36
-rw-r--r--drivers/media/video/saa5246a.c1
-rw-r--r--drivers/media/video/saa5249.c1
-rw-r--r--drivers/media/video/saa7115.c1250
-rw-r--r--drivers/media/video/saa711x_regs.h549
-rw-r--r--drivers/media/video/saa7134/Kconfig50
-rw-r--r--drivers/media/video/saa7134/Makefile3
-rw-r--r--drivers/media/video/saa7134/saa7134-alsa.c8
-rw-r--r--drivers/media/video/saa7134/saa7134-cards.c127
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c2
-rw-r--r--drivers/media/video/saa7134/saa7134-dvb.c197
-rw-r--r--drivers/media/video/saa7134/saa7134-input.c6
-rw-r--r--drivers/media/video/saa7134/saa7134-tvaudio.c1
-rw-r--r--drivers/media/video/saa7134/saa7134.h3
-rw-r--r--drivers/media/video/tda9887.c2
-rw-r--r--drivers/media/video/tuner-simple.c6
-rw-r--r--drivers/media/video/tuner-types.c1
-rw-r--r--drivers/media/video/tvaudio.c42
-rw-r--r--drivers/media/video/tveeprom.c2
-rw-r--r--drivers/media/video/tvp5150.c7
-rw-r--r--drivers/media/video/usbvideo/konicawc.c9
-rw-r--r--drivers/media/video/usbvideo/vicam.c4
-rw-r--r--drivers/media/video/v4l1-compat.c12
-rw-r--r--drivers/media/video/v4l2-common.c1
-rw-r--r--drivers/media/video/video-buf-dvb.c2
-rw-r--r--drivers/media/video/videodev.c32
-rw-r--r--drivers/media/video/vino.c1
-rw-r--r--drivers/media/video/vivi.c5
-rw-r--r--drivers/media/video/vpx3220.c2
-rw-r--r--drivers/media/video/zoran_card.c6
-rw-r--r--drivers/media/video/zoran_driver.c7
-rw-r--r--drivers/media/video/zr36120.c6
69 files changed, 2615 insertions, 1275 deletions
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig
index 94d078b77bab..d1183c939221 100644
--- a/drivers/media/video/Kconfig
+++ b/drivers/media/video/Kconfig
@@ -16,6 +16,320 @@ config VIDEO_ADV_DEBUG
16 V4L devices. 16 V4L devices.
17 In doubt, say N. 17 In doubt, say N.
18 18
19config VIDEO_HELPER_CHIPS_AUTO
20 bool "Autoselect pertinent encoders/decoders and other helper chips"
21 default y
22 ---help---
23 Most video cards may require additional modules to encode or
24 decode audio/video standards. This option will autoselect
25 all pertinent modules to each selected video module.
26
27 Unselect this only if you know exaclty what you are doing, since
28 it may break support on some boards.
29
30 In doubt, say Y.
31
32#
33# Encoder / Decoder module configuration
34#
35
36menu "Encoders/decoders and other helper chips"
37 depends on VIDEO_DEV && !VIDEO_HELPER_CHIPS_AUTO
38
39comment "Audio Decoders"
40
41config VIDEO_TVAUDIO
42 tristate "Simple audio decoder chips"
43 depends on VIDEO_V4L1 && I2C
44 ---help---
45 Support for several audio decoder chips found on some bt8xx boards:
46 Philips: tda9840, tda9873h, tda9874h/a, tda9850, tda985x, tea6300,
47 tea6320, tea6420, tda8425, ta8874z.
48 Microchip: pic16c54 based design on ProVideo PV951 board.
49
50 To compile this driver as a module, choose M here: the
51 module will be called tvaudio.
52
53config VIDEO_TDA7432
54 tristate "Philips TDA7432 audio processor chip"
55 depends on VIDEO_V4L1 && I2C
56 ---help---
57 Support for tda7432 audio decoder chip found on some bt8xx boards.
58
59 To compile this driver as a module, choose M here: the
60 module will be called tda7432.
61
62config VIDEO_TDA9840
63 tristate "Philips TDA9840 audio processor chip"
64 depends on VIDEO_DEV && I2C
65 ---help---
66 Support for tda9840 audio decoder chip found on some Zoran boards.
67
68 To compile this driver as a module, choose M here: the
69 module will be called tda9840.
70
71config VIDEO_TDA9875
72 tristate "Philips TDA9875 audio processor chip"
73 depends on VIDEO_V4L1 && I2C
74 ---help---
75 Support for tda9875 audio decoder chip found on some bt8xx boards.
76
77 To compile this driver as a module, choose M here: the
78 module will be called tda9875.
79
80config VIDEO_TEA6415C
81 tristate "Philips TEA6415C audio processor chip"
82 depends on VIDEO_DEV && I2C
83 ---help---
84 Support for tea6415c audio decoder chip found on some bt8xx boards.
85
86 To compile this driver as a module, choose M here: the
87 module will be called tea6415c.
88
89config VIDEO_TEA6420
90 tristate "Philips TEA6420 audio processor chip"
91 depends on VIDEO_DEV && I2C
92 ---help---
93 Support for tea6420 audio decoder chip found on some bt8xx boards.
94
95 To compile this driver as a module, choose M here: the
96 module will be called tea6420.
97
98config VIDEO_MSP3400
99 tristate "Micronas MSP34xx audio decoders"
100 depends on VIDEO_V4L2 && I2C
101 ---help---
102 Support for the Micronas MSP34xx series of audio decoders.
103
104 To compile this driver as a module, choose M here: the
105 module will be called msp3400.
106
107config VIDEO_CS53L32A
108 tristate "Cirrus Logic CS53L32A audio ADC"
109 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
110 ---help---
111 Support for the Cirrus Logic CS53L32A low voltage
112 stereo A/D converter.
113
114 To compile this driver as a module, choose M here: the
115 module will be called cs53l32a.
116
117config VIDEO_TLV320AIC23B
118 tristate "Texas Instruments TLV320AIC23B audio codec"
119 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
120 ---help---
121 Support for the Texas Instruments TLV320AIC23B audio codec.
122
123 To compile this driver as a module, choose M here: the
124 module will be called tlv320aic23b.
125
126config VIDEO_WM8775
127 tristate "Wolfson Microelectronics WM8775 audio ADC with input mixer"
128 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
129 ---help---
130 Support for the Wolfson Microelectronics WM8775 high
131 performance stereo A/D Converter with a 4 channel input mixer.
132
133 To compile this driver as a module, choose M here: the
134 module will be called wm8775.
135
136config VIDEO_WM8739
137 tristate "Wolfson Microelectronics WM8739 stereo audio ADC"
138 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
139 ---help---
140 Support for the Wolfson Microelectronics WM8739
141 stereo A/D Converter.
142
143 To compile this driver as a module, choose M here: the
144 module will be called wm8739.
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"
201
202config VIDEO_BT819
203 tristate "BT819A VideoStream Decoder"
204 depends on VIDEO_V4L1 && I2C
205 ---help---
206 Support for BT819A video decoder.
207
208 To compile this driver as a module, choose M here: the
209 module will be called bt819.
210
211config VIDEO_BT856
212 tristate "BT856 VideoStream Decoder"
213 depends on VIDEO_V4L1 && I2C
214 ---help---
215 Support for BT856 video decoder.
216
217 To compile this driver as a module, choose M here: the
218 module will be called bt856.
219
220config VIDEO_BT866
221 tristate "BT866 VideoStream Decoder"
222 depends on VIDEO_V4L1 && I2C
223 ---help---
224 Support for BT866 video decoder.
225
226 To compile this driver as a module, choose M here: the
227 module will be called bt866.
228
229config VIDEO_KS0127
230 tristate "KS0127 video decoder"
231 depends on VIDEO_V4L1 && I2C
232 ---help---
233 Support for KS0127 video decoder.
234
235 This chip is used on AverMedia AVS6EYES Zoran-based MJPEG
236 cards.
237
238 To compile this driver as a module, choose M here: the
239 module will be called ks0127.
240
241config VIDEO_SAA7110
242 tristate "Philips SAA7110 video decoder"
243 depends on VIDEO_V4L1
244 ---help---
245 Support for the Philips SAA7110 video decoders.
246
247 To compile this driver as a module, choose M here: the
248 module will be called saa7110.
249
250config VIDEO_SAA7111
251 tristate "Philips SAA7111 video decoder"
252 depends on VIDEO_V4L1 && I2C
253 ---help---
254 Support for the Philips SAA711 video decoder.
255
256 To compile this driver as a module, choose M here: the
257 module will be called saa7111.
258
259config VIDEO_SAA7114
260 tristate "Philips SAA7114 video decoder"
261 depends on VIDEO_V4L1 && I2C
262 ---help---
263 Support for the Philips SAA7114 video decoder. This driver
264 is used only on Zoran driver and should be moved soon to
265 SAA711x module.
266
267 To compile this driver as a module, choose M here: the
268 module will be called saa7114.
269
270config VIDEO_SAA711X
271 tristate "Philips SAA7113/4/5 video decoders"
272 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
273 ---help---
274 Support for the Philips SAA7113/4/5 video decoders.
275
276 To compile this driver as a module, choose M here: the
277 module will be called saa7115.
278
279config VIDEO_SAA7191
280 tristate "Philips SAA7191 video decoder"
281 depends on VIDEO_V4L1 && I2C
282 ---help---
283 Support for the Philips SAA7191 video decoder.
284
285 To compile this driver as a module, choose M here: the
286 module will be called saa7191.
287
288config VIDEO_TVP5150
289 tristate "Texas Instruments TVP5150 video decoder"
290 depends on VIDEO_V4L2 && I2C
291 ---help---
292 Support for the Texas Instruments TVP5150 video decoder.
293
294 To compile this driver as a module, choose M here: the
295 module will be called tvp5150.
296
297config VIDEO_VPX3220
298 tristate "vpx3220a, vpx3216b & vpx3214c video decoder driver"
299 depends on VIDEO_V4L1 && I2C
300 ---help---
301 Support for VPX322x video decoders.
302
303 To compile this driver as a module, choose M here: the
304 module will be called vpx3220.
305
306comment "Video improvement chips"
307
308config VIDEO_UPD64031A
309 tristate "NEC Electronics uPD64031A Ghost Reduction"
310 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
311 ---help---
312 Support for the NEC Electronics uPD64031A Ghost Reduction
313 video chip. It is most often found in NTSC TV cards made for
314 Japan and is used to reduce the 'ghosting' effect that can
315 be present in analog TV broadcasts.
316
317 To compile this driver as a module, choose M here: the
318 module will be called upd64031a.
319
320config VIDEO_UPD64083
321 tristate "NEC Electronics uPD64083 3-Dimensional Y/C separation"
322 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
323 ---help---
324 Support for the NEC Electronics uPD64083 3-Dimensional Y/C
325 separation video chip. It is used to improve the quality of
326 the colors of a composite signal.
327
328 To compile this driver as a module, choose M here: the
329 module will be called upd64083.
330
331endmenu # encoder / decoder chips
332
19config VIDEO_VIVI 333config VIDEO_VIVI
20 tristate "Virtual Video Driver" 334 tristate "Virtual Video Driver"
21 depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 335 depends on VIDEO_V4L2 && !SPARC32 && !SPARC64
@@ -135,7 +449,7 @@ source "drivers/media/video/cpia2/Kconfig"
135 449
136config VIDEO_SAA5246A 450config VIDEO_SAA5246A
137 tristate "SAA5246A, SAA5281 Teletext processor" 451 tristate "SAA5246A, SAA5281 Teletext processor"
138 depends on I2C && VIDEO_V4L1 452 depends on I2C && VIDEO_V4L2
139 help 453 help
140 Support for I2C bus based teletext using the SAA5246A or SAA5281 454 Support for I2C bus based teletext using the SAA5246A or SAA5281
141 chip. Useful only if you live in Europe. 455 chip. Useful only if you live in Europe.
@@ -145,7 +459,7 @@ config VIDEO_SAA5246A
145 459
146config VIDEO_SAA5249 460config VIDEO_SAA5249
147 tristate "SAA5249 Teletext processor" 461 tristate "SAA5249 Teletext processor"
148 depends on VIDEO_DEV && I2C && VIDEO_V4L1 462 depends on VIDEO_DEV && I2C && VIDEO_V4L2
149 help 463 help
150 Support for I2C bus based teletext using the SAA5249 chip. At the 464 Support for I2C bus based teletext using the SAA5249 chip. At the
151 moment this is only useful on some European WinTV cards. 465 moment this is only useful on some European WinTV cards.
@@ -162,8 +476,9 @@ config TUNER_3036
162 476
163config VIDEO_VINO 477config VIDEO_VINO
164 tristate "SGI Vino Video For Linux (EXPERIMENTAL)" 478 tristate "SGI Vino Video For Linux (EXPERIMENTAL)"
165 depends on I2C && SGI_IP22 && EXPERIMENTAL && VIDEO_V4L1 479 depends on I2C && SGI_IP22 && EXPERIMENTAL && VIDEO_V4L2
166 select I2C_ALGO_SGI 480 select I2C_ALGO_SGI
481 select VIDEO_SAA7191 if VIDEO_HELPER_CHIPS_AUTO
167 help 482 help
168 Say Y here to build in support for the Vino video input system found 483 Say Y here to build in support for the Vino video input system found
169 on SGI Indy machines. 484 on SGI Indy machines.
@@ -176,6 +491,9 @@ config VIDEO_STRADIS
176 driver for PCI. There is a product page at 491 driver for PCI. There is a product page at
177 <http://www.stradis.com/>. 492 <http://www.stradis.com/>.
178 493
494config VIDEO_ZORAN_ZR36060
495 tristate
496
179config VIDEO_ZORAN 497config VIDEO_ZORAN
180 tristate "Zoran ZR36057/36067 Video For Linux" 498 tristate "Zoran ZR36057/36067 Video For Linux"
181 depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && !PPC64 499 depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && !PPC64
@@ -192,12 +510,18 @@ config VIDEO_ZORAN
192config VIDEO_ZORAN_BUZ 510config VIDEO_ZORAN_BUZ
193 tristate "Iomega Buz support" 511 tristate "Iomega Buz support"
194 depends on VIDEO_ZORAN 512 depends on VIDEO_ZORAN
513 select VIDEO_SAA7111 if VIDEO_HELPER_CHIPS_AUTO
514 select VIDEO_SAA7185 if VIDEO_HELPER_CHIPS_AUTO
515 select VIDEO_ZORAN_ZR36060
195 help 516 help
196 Support for the Iomega Buz MJPEG capture/playback card. 517 Support for the Iomega Buz MJPEG capture/playback card.
197 518
198config VIDEO_ZORAN_DC10 519config VIDEO_ZORAN_DC10
199 tristate "Pinnacle/Miro DC10(+) support" 520 tristate "Pinnacle/Miro DC10(+) support"
200 depends on VIDEO_ZORAN 521 depends on VIDEO_ZORAN
522 select VIDEO_SAA7110
523 select VIDEO_ADV7175 if VIDEO_HELPER_CHIPS_AUTO
524 select VIDEO_ZORAN_ZR36060
201 help 525 help
202 Support for the Pinnacle/Miro DC10(+) MJPEG capture/playback 526 Support for the Pinnacle/Miro DC10(+) MJPEG capture/playback
203 card. 527 card.
@@ -205,6 +529,8 @@ config VIDEO_ZORAN_DC10
205config VIDEO_ZORAN_DC30 529config VIDEO_ZORAN_DC30
206 tristate "Pinnacle/Miro DC30(+) support" 530 tristate "Pinnacle/Miro DC30(+) support"
207 depends on VIDEO_ZORAN 531 depends on VIDEO_ZORAN
532 select VIDEO_ADV7175 if VIDEO_HELPER_CHIPS_AUTO
533 select VIDEO_VPX3220 if VIDEO_HELPER_CHIPS_AUTO
208 help 534 help
209 Support for the Pinnacle/Miro DC30(+) MJPEG capture/playback 535 Support for the Pinnacle/Miro DC30(+) MJPEG capture/playback
210 card. This also supports really old DC10 cards based on the 536 card. This also supports really old DC10 cards based on the
@@ -213,6 +539,9 @@ config VIDEO_ZORAN_DC30
213config VIDEO_ZORAN_LML33 539config VIDEO_ZORAN_LML33
214 tristate "Linux Media Labs LML33 support" 540 tristate "Linux Media Labs LML33 support"
215 depends on VIDEO_ZORAN 541 depends on VIDEO_ZORAN
542 select VIDEO_BT819 if VIDEO_HELPER_CHIPS_AUTO
543 select VIDEO_BT856 if VIDEO_HELPER_CHIPS_AUTO
544 select VIDEO_ZORAN_ZR36060
216 help 545 help
217 Support for the Linux Media Labs LML33 MJPEG capture/playback 546 Support for the Linux Media Labs LML33 MJPEG capture/playback
218 card. 547 card.
@@ -220,6 +549,9 @@ config VIDEO_ZORAN_LML33
220config VIDEO_ZORAN_LML33R10 549config VIDEO_ZORAN_LML33R10
221 tristate "Linux Media Labs LML33R10 support" 550 tristate "Linux Media Labs LML33R10 support"
222 depends on VIDEO_ZORAN 551 depends on VIDEO_ZORAN
552 select VIDEO_SAA7114 if VIDEO_HELPER_CHIPS_AUTO
553 select VIDEO_ADV7170 if VIDEO_HELPER_CHIPS_AUTO
554 select VIDEO_ZORAN_ZR36060
223 help 555 help
224 support for the Linux Media Labs LML33R10 MJPEG capture/playback 556 support for the Linux Media Labs LML33R10 MJPEG capture/playback
225 card. 557 card.
@@ -227,6 +559,9 @@ config VIDEO_ZORAN_LML33R10
227config VIDEO_ZORAN_AVS6EYES 559config VIDEO_ZORAN_AVS6EYES
228 tristate "AverMedia 6 Eyes support (EXPERIMENTAL)" 560 tristate "AverMedia 6 Eyes support (EXPERIMENTAL)"
229 depends on VIDEO_ZORAN && EXPERIMENTAL && VIDEO_V4L1 561 depends on VIDEO_ZORAN && EXPERIMENTAL && VIDEO_V4L1
562 select VIDEO_BT856 if VIDEO_HELPER_CHIPS_AUTO
563 select VIDEO_KS0127 if VIDEO_HELPER_CHIPS_AUTO
564 select VIDEO_ZORAN_ZR36060
230 help 565 help
231 Support for the AverMedia 6 Eyes video surveillance card. 566 Support for the AverMedia 6 Eyes video surveillance card.
232 567
@@ -263,6 +598,10 @@ config VIDEO_MXB
263 depends on PCI && VIDEO_V4L1 && I2C 598 depends on PCI && VIDEO_V4L1 && I2C
264 select VIDEO_SAA7146_VV 599 select VIDEO_SAA7146_VV
265 select VIDEO_TUNER 600 select VIDEO_TUNER
601 select VIDEO_SAA7111 if VIDEO_HELPER_CHIPS_AUTO
602 select VIDEO_TDA9840 if VIDEO_HELPER_CHIPS_AUTO
603 select VIDEO_TEA6415C if VIDEO_HELPER_CHIPS_AUTO
604 select VIDEO_TEA6420 if VIDEO_HELPER_CHIPS_AUTO
266 ---help--- 605 ---help---
267 This is a video4linux driver for the 'Multimedia eXtension Board' 606 This is a video4linux driver for the 'Multimedia eXtension Board'
268 TV card by Siemens-Nixdorf. 607 TV card by Siemens-Nixdorf.
@@ -274,7 +613,7 @@ config VIDEO_DPC
274 tristate "Philips-Semiconductors 'dpc7146 demonstration board'" 613 tristate "Philips-Semiconductors 'dpc7146 demonstration board'"
275 depends on PCI && VIDEO_V4L1 && I2C 614 depends on PCI && VIDEO_V4L1 && I2C
276 select VIDEO_SAA7146_VV 615 select VIDEO_SAA7146_VV
277 select VIDEO_V4L2 616 select VIDEO_SAA7111 if VIDEO_HELPER_CHIPS_AUTO
278 ---help--- 617 ---help---
279 This is a video4linux driver for the 'dpc7146 demonstration 618 This is a video4linux driver for the 'dpc7146 demonstration
280 board' by Philips-Semiconductors. It's the reference design 619 board' by Philips-Semiconductors. It's the reference design
@@ -287,9 +626,8 @@ config VIDEO_DPC
287 626
288config VIDEO_HEXIUM_ORION 627config VIDEO_HEXIUM_ORION
289 tristate "Hexium HV-PCI6 and Orion frame grabber" 628 tristate "Hexium HV-PCI6 and Orion frame grabber"
290 depends on PCI && VIDEO_V4L1 && I2C 629 depends on PCI && VIDEO_V4L2 && I2C
291 select VIDEO_SAA7146_VV 630 select VIDEO_SAA7146_VV
292 select VIDEO_V4L2
293 ---help--- 631 ---help---
294 This is a video4linux driver for the Hexium HV-PCI6 and 632 This is a video4linux driver for the Hexium HV-PCI6 and
295 Orion frame grabber cards by Hexium. 633 Orion frame grabber cards by Hexium.
@@ -299,9 +637,8 @@ config VIDEO_HEXIUM_ORION
299 637
300config VIDEO_HEXIUM_GEMINI 638config VIDEO_HEXIUM_GEMINI
301 tristate "Hexium Gemini frame grabber" 639 tristate "Hexium Gemini frame grabber"
302 depends on PCI && VIDEO_V4L1 && I2C 640 depends on PCI && VIDEO_V4L2 && I2C
303 select VIDEO_SAA7146_VV 641 select VIDEO_SAA7146_VV
304 select VIDEO_V4L2
305 ---help--- 642 ---help---
306 This is a video4linux driver for the Hexium Gemini frame 643 This is a video4linux driver for the Hexium Gemini frame
307 grabber card by Hexium. Please note that the Gemini Dual 644 grabber card by Hexium. Please note that the Gemini Dual
@@ -320,123 +657,16 @@ config VIDEO_M32R_AR
320 camera module. 657 camera module.
321 658
322config VIDEO_M32R_AR_M64278 659config VIDEO_M32R_AR_M64278
323 tristate "Use Colour AR module M64278(VGA)" 660 tristate "AR device with color module M64278(VGA)"
324 depends on VIDEO_M32R_AR && PLAT_M32700UT 661 depends on PLAT_M32700UT
325 ---help--- 662 select VIDEO_M32R_AR
326 Say Y here to use the Renesas M64278E-800 camera module,
327 which supports VGA(640x480 pixcels) size of images.
328
329#
330# Encoder / Decoder module configuration
331#
332
333menu "Encoders and Decoders"
334 depends on VIDEO_DEV
335
336config VIDEO_MSP3400
337 tristate "Micronas MSP34xx audio decoders"
338 depends on VIDEO_DEV && I2C
339 ---help---
340 Support for the Micronas MSP34xx series of audio decoders.
341
342 To compile this driver as a module, choose M here: the
343 module will be called msp3400.
344
345config VIDEO_CS53L32A
346 tristate "Cirrus Logic CS53L32A audio ADC"
347 depends on VIDEO_DEV && I2C && EXPERIMENTAL
348 ---help---
349 Support for the Cirrus Logic CS53L32A low voltage
350 stereo A/D converter.
351
352 To compile this driver as a module, choose M here: the
353 module will be called cs53l32a.
354
355config VIDEO_TLV320AIC23B
356 tristate "Texas Instruments TLV320AIC23B audio codec"
357 depends on VIDEO_DEV && I2C && EXPERIMENTAL
358 ---help--- 663 ---help---
359 Support for the Texas Instruments TLV320AIC23B audio codec. 664 This is a video4linux driver for the Renesas AR (Artificial
360 665 Retina) with M64278E-800 camera module.
361 To compile this driver as a module, choose M here: the 666 This module supports VGA(640x480 pixels) resolutions.
362 module will be called tlv320aic23b.
363
364config VIDEO_WM8775
365 tristate "Wolfson Microelectronics WM8775 audio ADC with input mixer"
366 depends on VIDEO_DEV && I2C && EXPERIMENTAL
367 ---help---
368 Support for the Wolfson Microelectronics WM8775 high
369 performance stereo A/D Converter with a 4 channel input mixer.
370 667
371 To compile this driver as a module, choose M here: the 668 To compile this driver as a module, choose M here: the
372 module will be called wm8775. 669 module will be called arv.
373
374config VIDEO_WM8739
375 tristate "Wolfson Microelectronics WM8739 stereo audio ADC"
376 depends on VIDEO_DEV && I2C && EXPERIMENTAL
377 ---help---
378 Support for the Wolfson Microelectronics WM8739
379 stereo A/D Converter.
380
381 To compile this driver as a module, choose M here: the
382 module will be called wm8739.
383
384config VIDEO_CX2341X
385 tristate "Conexant CX2341x MPEG encoders"
386 depends on VIDEO_V4L2 && EXPERIMENTAL
387 ---help---
388 Support for the Conexant CX23416 MPEG encoders
389 and CX23415 MPEG encoder/decoders.
390
391 This module currently supports the encoding functions only.
392
393 To compile this driver as a module, choose M here: the
394 module will be called cx2341x.
395
396source "drivers/media/video/cx25840/Kconfig"
397
398config VIDEO_SAA711X
399 tristate "Philips SAA7113/4/5 video decoders"
400 depends on VIDEO_DEV && I2C && EXPERIMENTAL
401 ---help---
402 Support for the Philips SAA7113/4/5 video decoders.
403
404 To compile this driver as a module, choose M here: the
405 module will be called saa7115.
406
407config VIDEO_SAA7127
408 tristate "Philips SAA7127/9 digital video encoders"
409 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
410 ---help---
411 Support for the Philips SAA7127/9 digital video encoders.
412
413 To compile this driver as a module, choose M here: the
414 module will be called saa7127.
415
416config VIDEO_UPD64031A
417 tristate "NEC Electronics uPD64031A Ghost Reduction"
418 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
419 ---help---
420 Support for the NEC Electronics uPD64031A Ghost Reduction
421 video chip. It is most often found in NTSC TV cards made for
422 Japan and is used to reduce the 'ghosting' effect that can
423 be present in analog TV broadcasts.
424
425 To compile this driver as a module, choose M here: the
426 module will be called upd64031a.
427
428config VIDEO_UPD64083
429 tristate "NEC Electronics uPD64083 3-Dimensional Y/C separation"
430 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
431 ---help---
432 Support for the NEC Electronics uPD64083 3-Dimensional Y/C
433 separation video chip. It is used to improve the quality of
434 the colors of a composite signal.
435
436 To compile this driver as a module, choose M here: the
437 module will be called upd64083.
438
439endmenu # encoder / decoder chips
440 670
441# 671#
442# USB Multimedia device configuration 672# USB Multimedia device configuration
@@ -445,8 +675,6 @@ endmenu # encoder / decoder chips
445menu "V4L USB devices" 675menu "V4L USB devices"
446 depends on USB && VIDEO_DEV 676 depends on USB && VIDEO_DEV
447 677
448source "drivers/media/video/pvrusb2/Kconfig"
449
450source "drivers/media/video/em28xx/Kconfig" 678source "drivers/media/video/em28xx/Kconfig"
451 679
452source "drivers/media/video/usbvideo/Kconfig" 680source "drivers/media/video/usbvideo/Kconfig"
diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile
index e82e511f2a72..af57abce8a6e 100644
--- a/drivers/media/video/Makefile
+++ b/drivers/media/video/Makefile
@@ -17,7 +17,10 @@ ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y)
17endif 17endif
18 18
19obj-$(CONFIG_VIDEO_BT848) += bt8xx/ 19obj-$(CONFIG_VIDEO_BT848) += bt8xx/
20obj-$(CONFIG_VIDEO_BT848) += tvaudio.o tda7432.o tda9875.o ir-kbd-i2c.o 20obj-$(CONFIG_VIDEO_BT848) += ir-kbd-i2c.o
21obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o
22obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o
23obj-$(CONFIG_VIDEO_TDA9875) += tda9875.o
21obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o 24obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o
22 25
23obj-$(CONFIG_VIDEO_ZR36120) += zoran.o 26obj-$(CONFIG_VIDEO_ZR36120) += zoran.o
@@ -27,17 +30,32 @@ obj-$(CONFIG_VIDEO_SAA5249) += saa5249.o
27obj-$(CONFIG_VIDEO_CQCAM) += c-qcam.o 30obj-$(CONFIG_VIDEO_CQCAM) += c-qcam.o
28obj-$(CONFIG_VIDEO_BWQCAM) += bw-qcam.o 31obj-$(CONFIG_VIDEO_BWQCAM) += bw-qcam.o
29obj-$(CONFIG_VIDEO_W9966) += w9966.o 32obj-$(CONFIG_VIDEO_W9966) += w9966.o
30obj-$(CONFIG_VIDEO_ZORAN_BUZ) += saa7111.o saa7185.o zr36060.o 33
31obj-$(CONFIG_VIDEO_ZORAN_DC10) += saa7110.o adv7175.o zr36060.o 34obj-$(CONFIG_VIDEO_TDA9840) += tda9840.o
32obj-$(CONFIG_VIDEO_ZORAN_DC30) += adv7175.o vpx3220.o zr36050.o \ 35obj-$(CONFIG_VIDEO_TEA6415C) += tea6415c.o
33 zr36016.o 36obj-$(CONFIG_VIDEO_TEA6420) += tea6420.o
34obj-$(CONFIG_VIDEO_ZORAN_LML33) += bt819.o bt856.o zr36060.o 37obj-$(CONFIG_VIDEO_SAA7110) += saa7110.o
35obj-$(CONFIG_VIDEO_ZORAN_LML33R10) += saa7114.o adv7170.o zr36060.o 38obj-$(CONFIG_VIDEO_SAA7111) += saa7111.o
36obj-$(CONFIG_VIDEO_ZORAN_AVS6EYES) += bt866.o ks0127.o zr36060.o 39obj-$(CONFIG_VIDEO_SAA7114) += saa7114.o
40obj-$(CONFIG_VIDEO_SAA711X) += saa7115.o
41obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o
42obj-$(CONFIG_VIDEO_SAA7185) += saa7185.o
43obj-$(CONFIG_VIDEO_SAA7191) += saa7191.o
44obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o
45obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o
46obj-$(CONFIG_VIDEO_VPX3220) += vpx3220.o
47obj-$(CONFIG_VIDEO_BT819) += bt819.o
48obj-$(CONFIG_VIDEO_BT856) += bt856.o
49obj-$(CONFIG_VIDEO_BT866) += bt866.o
50obj-$(CONFIG_VIDEO_KS0127) += ks0127.o
51
37obj-$(CONFIG_VIDEO_ZORAN) += zr36067.o videocodec.o 52obj-$(CONFIG_VIDEO_ZORAN) += zr36067.o videocodec.o
53obj-$(CONFIG_VIDEO_ZORAN_DC30) += zr36050.o zr36016.o
54obj-$(CONFIG_VIDEO_ZORAN_ZR36060) += zr36060.o
55
38obj-$(CONFIG_VIDEO_PMS) += pms.o 56obj-$(CONFIG_VIDEO_PMS) += pms.o
39obj-$(CONFIG_VIDEO_PLANB) += planb.o 57obj-$(CONFIG_VIDEO_PLANB) += planb.o
40obj-$(CONFIG_VIDEO_VINO) += vino.o saa7191.o indycam.o 58obj-$(CONFIG_VIDEO_VINO) += vino.o indycam.o
41obj-$(CONFIG_VIDEO_STRADIS) += stradis.o 59obj-$(CONFIG_VIDEO_STRADIS) += stradis.o
42obj-$(CONFIG_VIDEO_CPIA) += cpia.o 60obj-$(CONFIG_VIDEO_CPIA) += cpia.o
43obj-$(CONFIG_VIDEO_CPIA_PP) += cpia_pp.o 61obj-$(CONFIG_VIDEO_CPIA_PP) += cpia_pp.o
@@ -46,7 +64,7 @@ obj-$(CONFIG_VIDEO_MEYE) += meye.o
46obj-$(CONFIG_VIDEO_SAA7134) += ir-kbd-i2c.o saa7134/ 64obj-$(CONFIG_VIDEO_SAA7134) += ir-kbd-i2c.o saa7134/
47obj-$(CONFIG_VIDEO_CX88) += cx88/ 65obj-$(CONFIG_VIDEO_CX88) += cx88/
48obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ 66obj-$(CONFIG_VIDEO_EM28XX) += em28xx/
49obj-$(CONFIG_VIDEO_EM28XX) += tvp5150.o 67obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.o
50obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2/ 68obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2/
51obj-$(CONFIG_VIDEO_MSP3400) += msp3400.o 69obj-$(CONFIG_VIDEO_MSP3400) += msp3400.o
52obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o 70obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o
@@ -55,10 +73,10 @@ obj-$(CONFIG_VIDEO_WM8775) += wm8775.o
55obj-$(CONFIG_VIDEO_WM8739) += wm8739.o 73obj-$(CONFIG_VIDEO_WM8739) += wm8739.o
56obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip/ 74obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip/
57obj-$(CONFIG_VIDEO_CPIA2) += cpia2/ 75obj-$(CONFIG_VIDEO_CPIA2) += cpia2/
58obj-$(CONFIG_VIDEO_MXB) += saa7111.o tda9840.o tea6415c.o tea6420.o mxb.o 76obj-$(CONFIG_VIDEO_MXB) += mxb.o
59obj-$(CONFIG_VIDEO_HEXIUM_ORION) += hexium_orion.o 77obj-$(CONFIG_VIDEO_HEXIUM_ORION) += hexium_orion.o
60obj-$(CONFIG_VIDEO_HEXIUM_GEMINI) += hexium_gemini.o 78obj-$(CONFIG_VIDEO_HEXIUM_GEMINI) += hexium_gemini.o
61obj-$(CONFIG_VIDEO_DPC) += saa7111.o dpc7146.o 79obj-$(CONFIG_VIDEO_DPC) += dpc7146.o
62obj-$(CONFIG_TUNER_3036) += tuner-3036.o 80obj-$(CONFIG_TUNER_3036) += tuner-3036.o
63 81
64obj-$(CONFIG_VIDEO_TUNER) += tuner.o 82obj-$(CONFIG_VIDEO_TUNER) += tuner.o
@@ -70,8 +88,6 @@ obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o
70obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o 88obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o
71 89
72obj-$(CONFIG_VIDEO_CX25840) += cx25840/ 90obj-$(CONFIG_VIDEO_CX25840) += cx25840/
73obj-$(CONFIG_VIDEO_SAA711X) += saa7115.o
74obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o
75obj-$(CONFIG_VIDEO_UPD64031A) += upd64031a.o 91obj-$(CONFIG_VIDEO_UPD64031A) += upd64031a.o
76obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o 92obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o
77obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o 93obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o
@@ -96,4 +112,3 @@ obj-$(CONFIG_VIDEO_VIVI) += vivi.o
96 112
97EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core 113EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
98extra-cflags-$(CONFIG_VIDEO_V4L1_COMPAT) += -DCONFIG_VIDEO_V4L1_COMPAT 114extra-cflags-$(CONFIG_VIDEO_V4L1_COMPAT) += -DCONFIG_VIDEO_V4L1_COMPAT
99
diff --git a/drivers/media/video/bt866.c b/drivers/media/video/bt866.c
index 05e42bbcfc3d..772fd52d551a 100644
--- a/drivers/media/video/bt866.c
+++ b/drivers/media/video/bt866.c
@@ -65,7 +65,7 @@ MODULE_LICENSE("GPL");
65struct bt866 { 65struct bt866 {
66 struct i2c_client *i2c; 66 struct i2c_client *i2c;
67 int addr; 67 int addr;
68 unsigned char reg[128]; 68 unsigned char reg[256];
69 69
70 int norm; 70 int norm;
71 int enable; 71 int enable;
diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig
index cdcf55650714..58eae887a629 100644
--- a/drivers/media/video/bt8xx/Kconfig
+++ b/drivers/media/video/bt8xx/Kconfig
@@ -8,7 +8,10 @@ config VIDEO_BT848
8 select VIDEO_IR 8 select VIDEO_IR
9 select VIDEO_TUNER 9 select VIDEO_TUNER
10 select VIDEO_TVEEPROM 10 select VIDEO_TVEEPROM
11 select VIDEO_MSP3400 11 select VIDEO_MSP3400 if VIDEO_HELPER_CHIPS_AUTO
12 select VIDEO_TVAUDIO if VIDEO_HELPER_CHIPS_AUTO
13 select VIDEO_TDA7432 if VIDEO_HELPER_CHIPS_AUTO
14 select VIDEO_TDA9875 if VIDEO_HELPER_CHIPS_AUTO
12 ---help--- 15 ---help---
13 Support for BT848 based frame grabber/overlay boards. This includes 16 Support for BT848 based frame grabber/overlay boards. This includes
14 the Miro, Hauppauge and STB boards. Please read the material in 17 the Miro, Hauppauge and STB boards. Please read the material in
diff --git a/drivers/media/video/bt8xx/bttv-cards.c b/drivers/media/video/bt8xx/bttv-cards.c
index de14818d5cc4..d23a42b1504f 100644
--- a/drivers/media/video/bt8xx/bttv-cards.c
+++ b/drivers/media/video/bt8xx/bttv-cards.c
@@ -4991,7 +4991,7 @@ void __devinit bttv_check_chipset(void)
4991 int pcipci_fail = 0; 4991 int pcipci_fail = 0;
4992 struct pci_dev *dev = NULL; 4992 struct pci_dev *dev = NULL;
4993 4993
4994 if (pci_pci_problems & PCIPCI_FAIL) 4994 if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL)) /* should check if target is AGP */
4995 pcipci_fail = 1; 4995 pcipci_fail = 1;
4996 if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF)) 4996 if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF))
4997 triton1 = 1; 4997 triton1 = 1;
diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c
index 20dff7c316eb..50dde82844ec 100644
--- a/drivers/media/video/bt8xx/bttv-driver.c
+++ b/drivers/media/video/bt8xx/bttv-driver.c
@@ -2431,6 +2431,14 @@ static int bttv_do_ioctl(struct inode *inode, struct file *file,
2431 fbuf->bytesperline = btv->fbuf.fmt.bytesperline; 2431 fbuf->bytesperline = btv->fbuf.fmt.bytesperline;
2432 if (fh->ovfmt) 2432 if (fh->ovfmt)
2433 fbuf->depth = fh->ovfmt->depth; 2433 fbuf->depth = fh->ovfmt->depth;
2434 else {
2435 if (fbuf->width)
2436 fbuf->depth = ((fbuf->bytesperline<<3)
2437 + (fbuf->width-1) )
2438 /fbuf->width;
2439 else
2440 fbuf->depth = 0;
2441 }
2434 return 0; 2442 return 0;
2435 } 2443 }
2436 case VIDIOCSFBUF: 2444 case VIDIOCSFBUF:
@@ -4186,6 +4194,7 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev)
4186 return; 4194 return;
4187} 4195}
4188 4196
4197#ifdef CONFIG_PM
4189static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state) 4198static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state)
4190{ 4199{
4191 struct bttv *btv = pci_get_drvdata(pci_dev); 4200 struct bttv *btv = pci_get_drvdata(pci_dev);
@@ -4266,6 +4275,7 @@ static int bttv_resume(struct pci_dev *pci_dev)
4266 spin_unlock_irqrestore(&btv->s_lock,flags); 4275 spin_unlock_irqrestore(&btv->s_lock,flags);
4267 return 0; 4276 return 0;
4268} 4277}
4278#endif
4269 4279
4270static struct pci_device_id bttv_pci_tbl[] = { 4280static struct pci_device_id bttv_pci_tbl[] = {
4271 {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT848, 4281 {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT848,
@@ -4286,8 +4296,10 @@ static struct pci_driver bttv_pci_driver = {
4286 .id_table = bttv_pci_tbl, 4296 .id_table = bttv_pci_tbl,
4287 .probe = bttv_probe, 4297 .probe = bttv_probe,
4288 .remove = __devexit_p(bttv_remove), 4298 .remove = __devexit_p(bttv_remove),
4299#ifdef CONFIG_PM
4289 .suspend = bttv_suspend, 4300 .suspend = bttv_suspend,
4290 .resume = bttv_resume, 4301 .resume = bttv_resume,
4302#endif
4291}; 4303};
4292 4304
4293static int bttv_init_module(void) 4305static int bttv_init_module(void)
diff --git a/drivers/media/video/bt8xx/bttv-i2c.c b/drivers/media/video/bt8xx/bttv-i2c.c
index 0dfbcc85ebb9..70de6c96e201 100644
--- a/drivers/media/video/bt8xx/bttv-i2c.c
+++ b/drivers/media/video/bt8xx/bttv-i2c.c
@@ -8,6 +8,9 @@
8 & Marcus Metzler (mocm@thp.uni-koeln.de) 8 & Marcus Metzler (mocm@thp.uni-koeln.de)
9 (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org> 9 (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
10 10
11 (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org>
12 - Multituner support and i2c address binding
13
11 This program is free software; you can redistribute it and/or modify 14 This program is free software; you can redistribute it and/or modify
12 it under the terms of the GNU General Public License as published by 15 it under the terms of the GNU General Public License as published by
13 the Free Software Foundation; either version 2 of the License, or 16 the Free Software Foundation; either version 2 of the License, or
@@ -45,10 +48,18 @@ static int i2c_debug;
45static int i2c_hw; 48static int i2c_hw;
46static int i2c_scan; 49static int i2c_scan;
47module_param(i2c_debug, int, 0644); 50module_param(i2c_debug, int, 0644);
51MODULE_PARM_DESC(i2c_hw,"configure i2c debug level");
48module_param(i2c_hw, int, 0444); 52module_param(i2c_hw, int, 0444);
53MODULE_PARM_DESC(i2c_hw,"force use of hardware i2c support, "
54 "instead of software bitbang");
49module_param(i2c_scan, int, 0444); 55module_param(i2c_scan, int, 0444);
50MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); 56MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
51 57
58static unsigned int i2c_udelay = 5;
59module_param(i2c_udelay, int, 0444);
60MODULE_PARM_DESC(i2c_udelay,"soft i2c delay at insmod time, in usecs "
61 "(should be 5 or higher). Lower value means higher bus speed.");
62
52/* ----------------------------------------------------------------------- */ 63/* ----------------------------------------------------------------------- */
53/* I2C functions - bitbanging adapter (software i2c) */ 64/* I2C functions - bitbanging adapter (software i2c) */
54 65
@@ -425,6 +436,11 @@ int __devinit init_bttv_i2c(struct bttv *btv)
425 sizeof(bttv_i2c_adap_hw_template)); 436 sizeof(bttv_i2c_adap_hw_template));
426 } else { 437 } else {
427 /* bt848 */ 438 /* bt848 */
439 /* Prevents usage of invalid delay values */
440 if (i2c_udelay<5)
441 i2c_udelay=5;
442 bttv_i2c_algo_bit_template.udelay=i2c_udelay;
443
428 memcpy(&btv->c.i2c_adap, &bttv_i2c_adap_sw_template, 444 memcpy(&btv->c.i2c_adap, &bttv_i2c_adap_sw_template,
429 sizeof(bttv_i2c_adap_sw_template)); 445 sizeof(bttv_i2c_adap_sw_template));
430 memcpy(&btv->i2c_algo, &bttv_i2c_algo_bit_template, 446 memcpy(&btv->i2c_algo, &bttv_i2c_algo_bit_template,
diff --git a/drivers/media/video/compat_ioctl32.c b/drivers/media/video/compat_ioctl32.c
index b69ee1194815..d82a488f12a6 100644
--- a/drivers/media/video/compat_ioctl32.c
+++ b/drivers/media/video/compat_ioctl32.c
@@ -58,6 +58,7 @@ static int put_video_tuner32(struct video_tuner *kp, struct video_tuner32 __user
58 return 0; 58 return 0;
59} 59}
60 60
61
61struct video_buffer32 { 62struct video_buffer32 {
62 compat_caddr_t base; 63 compat_caddr_t base;
63 compat_int_t height, width, depth, bytesperline; 64 compat_int_t height, width, depth, bytesperline;
@@ -618,6 +619,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
618 struct video_buffer vb; 619 struct video_buffer vb;
619 struct video_window vw; 620 struct video_window vw;
620 struct video_code vc; 621 struct video_code vc;
622 struct video_audio va;
621#endif 623#endif
622 struct v4l2_format v2f; 624 struct v4l2_format v2f;
623 struct v4l2_buffer v2b; 625 struct v4l2_buffer v2b;
@@ -635,31 +637,31 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
635 /* First, convert the command. */ 637 /* First, convert the command. */
636 switch(cmd) { 638 switch(cmd) {
637#ifdef CONFIG_VIDEO_V4L1_COMPAT 639#ifdef CONFIG_VIDEO_V4L1_COMPAT
638 case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break; 640 case VIDIOCGTUNER32: realcmd = cmd = VIDIOCGTUNER; break;
639 case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break; 641 case VIDIOCSTUNER32: realcmd = cmd = VIDIOCSTUNER; break;
640 case VIDIOCGWIN32: cmd = VIDIOCGWIN; break; 642 case VIDIOCGWIN32: realcmd = cmd = VIDIOCGWIN; break;
641 case VIDIOCGFBUF32: cmd = VIDIOCGFBUF; break; 643 case VIDIOCGFBUF32: realcmd = cmd = VIDIOCGFBUF; break;
642 case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break; 644 case VIDIOCSFBUF32: realcmd = cmd = VIDIOCSFBUF; break;
643 case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break; 645 case VIDIOCGFREQ32: realcmd = cmd = VIDIOCGFREQ; break;
644 case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break; 646 case VIDIOCSFREQ32: realcmd = cmd = VIDIOCSFREQ; break;
645 case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break; 647 case VIDIOCSMICROCODE32: realcmd = cmd = VIDIOCSMICROCODE; break;
646#endif 648#endif
647 case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break; 649 case VIDIOC_G_FMT32: realcmd = cmd = VIDIOC_G_FMT; break;
648 case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break; 650 case VIDIOC_S_FMT32: realcmd = cmd = VIDIOC_S_FMT; break;
649 case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break; 651 case VIDIOC_QUERYBUF32: realcmd = cmd = VIDIOC_QUERYBUF; break;
650 case VIDIOC_QBUF32: cmd = VIDIOC_QBUF; break; 652 case VIDIOC_QBUF32: realcmd = cmd = VIDIOC_QBUF; break;
651 case VIDIOC_DQBUF32: cmd = VIDIOC_DQBUF; break; 653 case VIDIOC_DQBUF32: realcmd = cmd = VIDIOC_DQBUF; break;
652 case VIDIOC_STREAMON32: cmd = VIDIOC_STREAMON; break; 654 case VIDIOC_STREAMON32: realcmd = cmd = VIDIOC_STREAMON; break;
653 case VIDIOC_STREAMOFF32: cmd = VIDIOC_STREAMOFF; break; 655 case VIDIOC_STREAMOFF32: realcmd = cmd = VIDIOC_STREAMOFF; break;
654 case VIDIOC_G_FBUF32: cmd = VIDIOC_G_FBUF; break; 656 case VIDIOC_G_FBUF32: realcmd = cmd = VIDIOC_G_FBUF; break;
655 case VIDIOC_S_FBUF32: cmd = VIDIOC_S_FBUF; break; 657 case VIDIOC_S_FBUF32: realcmd = cmd = VIDIOC_S_FBUF; break;
656 case VIDIOC_OVERLAY32: cmd = VIDIOC_OVERLAY; break; 658 case VIDIOC_OVERLAY32: realcmd = cmd = VIDIOC_OVERLAY; break;
657 case VIDIOC_ENUMSTD32: realcmd = VIDIOC_ENUMSTD; break; 659 case VIDIOC_ENUMSTD32: realcmd = VIDIOC_ENUMSTD; break;
658 case VIDIOC_ENUMINPUT32: realcmd = VIDIOC_ENUMINPUT; break; 660 case VIDIOC_ENUMINPUT32: realcmd = VIDIOC_ENUMINPUT; break;
659 case VIDIOC_S_CTRL32: cmd = VIDIOC_S_CTRL; break; 661 case VIDIOC_S_CTRL32: realcmd = cmd = VIDIOC_S_CTRL; break;
660 case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; 662 case VIDIOC_G_INPUT32: realcmd = cmd = VIDIOC_G_INPUT; break;
661 case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; 663 case VIDIOC_S_INPUT32: realcmd = cmd = VIDIOC_S_INPUT; break;
662 case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break; 664 case VIDIOC_TRY_FMT32: realcmd = cmd = VIDIOC_TRY_FMT; break;
663 }; 665 };
664 666
665 switch(cmd) { 667 switch(cmd) {
@@ -676,6 +678,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
676 compatible_arg = 0; 678 compatible_arg = 0;
677 break; 679 break;
678 680
681
679 case VIDIOCSFREQ: 682 case VIDIOCSFREQ:
680#endif 683#endif
681 case VIDIOC_S_INPUT: 684 case VIDIOC_S_INPUT:
@@ -683,7 +686,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
683 case VIDIOC_STREAMON: 686 case VIDIOC_STREAMON:
684 case VIDIOC_STREAMOFF: 687 case VIDIOC_STREAMOFF:
685 err = get_user(karg.vx, (u32 __user *)up); 688 err = get_user(karg.vx, (u32 __user *)up);
686 compatible_arg = 0; 689 compatible_arg = 1;
687 break; 690 break;
688 691
689 case VIDIOC_S_FBUF: 692 case VIDIOC_S_FBUF:
@@ -739,6 +742,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
739 case VIDIOC_G_FBUF: 742 case VIDIOC_G_FBUF:
740 case VIDIOC_G_INPUT: 743 case VIDIOC_G_INPUT:
741 compatible_arg = 0; 744 compatible_arg = 0;
745 break;
742#ifdef CONFIG_VIDEO_V4L1_COMPAT 746#ifdef CONFIG_VIDEO_V4L1_COMPAT
743 case VIDIOCSMICROCODE: 747 case VIDIOCSMICROCODE:
744 err = microcode32(&karg.vc, up); 748 err = microcode32(&karg.vc, up);
@@ -755,7 +759,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
755 mm_segment_t old_fs = get_fs(); 759 mm_segment_t old_fs = get_fs();
756 760
757 set_fs(KERNEL_DS); 761 set_fs(KERNEL_DS);
758 err = native_ioctl(file, realcmd, (unsigned long)&karg); 762 err = native_ioctl(file, realcmd, (unsigned long) &karg);
759 set_fs(old_fs); 763 set_fs(old_fs);
760 } 764 }
761 if(err == 0) { 765 if(err == 0) {
@@ -772,6 +776,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg
772 case VIDIOCGFBUF: 776 case VIDIOCGFBUF:
773 err = put_video_buffer32(&karg.vb, up); 777 err = put_video_buffer32(&karg.vb, up);
774 break; 778 break;
779
775#endif 780#endif
776 case VIDIOC_G_FBUF: 781 case VIDIOC_G_FBUF:
777 err = put_v4l2_framebuffer32(&karg.v2fb, up); 782 err = put_v4l2_framebuffer32(&karg.v2fb, up);
@@ -841,10 +846,14 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
841 case VIDIOCSFBUF32: 846 case VIDIOCSFBUF32:
842 case VIDIOCGFREQ32: 847 case VIDIOCGFREQ32:
843 case VIDIOCSFREQ32: 848 case VIDIOCSFREQ32:
849 case VIDIOCGAUDIO:
850 case VIDIOCSAUDIO:
844#endif 851#endif
845 case VIDIOC_QUERYCAP: 852 case VIDIOC_QUERYCAP:
846 case VIDIOC_ENUM_FMT: 853 case VIDIOC_ENUM_FMT:
847 case VIDIOC_G_FMT32: 854 case VIDIOC_G_FMT32:
855 case VIDIOC_CROPCAP:
856 case VIDIOC_S_CROP:
848 case VIDIOC_S_FMT32: 857 case VIDIOC_S_FMT32:
849 case VIDIOC_REQBUFS: 858 case VIDIOC_REQBUFS:
850 case VIDIOC_QUERYBUF32: 859 case VIDIOC_QUERYBUF32:
@@ -882,8 +891,6 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg)
882 case VIDIOCSPICT: 891 case VIDIOCSPICT:
883 case VIDIOCCAPTURE: 892 case VIDIOCCAPTURE:
884 case VIDIOCKEY: 893 case VIDIOCKEY:
885 case VIDIOCGAUDIO:
886 case VIDIOCSAUDIO:
887 case VIDIOCSYNC: 894 case VIDIOCSYNC:
888 case VIDIOCMCAPTURE: 895 case VIDIOCMCAPTURE:
889 case VIDIOCGMBUF: 896 case VIDIOCGMBUF:
diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c
index 65f00fc08fa9..657e0b969145 100644
--- a/drivers/media/video/cx2341x.c
+++ b/drivers/media/video/cx2341x.c
@@ -691,7 +691,7 @@ void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p)
691 .video_luma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR, 691 .video_luma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR,
692 .video_chroma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, 692 .video_chroma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR,
693 .video_temporal_filter_mode = V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, 693 .video_temporal_filter_mode = V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL,
694 .video_temporal_filter = 0, 694 .video_temporal_filter = 8,
695 .video_median_filter_type = V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, 695 .video_median_filter_type = V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF,
696 .video_luma_median_filter_top = 255, 696 .video_luma_median_filter_top = 255,
697 .video_luma_median_filter_bottom = 0, 697 .video_luma_median_filter_bottom = 0,
@@ -731,6 +731,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
731 }; 731 };
732 732
733 int err = 0; 733 int err = 0;
734 u16 temporal = new->video_temporal_filter;
734 735
735 cx2341x_api(priv, func, CX2341X_ENC_SET_OUTPUT_PORT, 2, new->port, 0); 736 cx2341x_api(priv, func, CX2341X_ENC_SET_OUTPUT_PORT, 2, new->port, 0);
736 737
@@ -741,6 +742,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
741 742
742 if (old == NULL || old->width != new->width || old->height != new->height || 743 if (old == NULL || old->width != new->width || old->height != new->height ||
743 old->video_encoding != new->video_encoding) { 744 old->video_encoding != new->video_encoding) {
745 int is_scaling;
744 u16 w = new->width; 746 u16 w = new->width;
745 u16 h = new->height; 747 u16 h = new->height;
746 748
@@ -750,6 +752,20 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
750 } 752 }
751 err = cx2341x_api(priv, func, CX2341X_ENC_SET_FRAME_SIZE, 2, h, w); 753 err = cx2341x_api(priv, func, CX2341X_ENC_SET_FRAME_SIZE, 2, h, w);
752 if (err) return err; 754 if (err) return err;
755
756 /* Adjust temporal filter if necessary. The problem with the temporal
757 filter is that it works well with full resolution capturing, but
758 not when the capture window is scaled (the filter introduces
759 a ghosting effect). So if the capture window changed, and there is
760 no updated filter value, then the filter is set depending on whether
761 the new window is full resolution or not.
762
763 For full resolution a setting of 8 really improves the video
764 quality, especially if the original video quality is suboptimal. */
765 is_scaling = new->width != 720 || new->height != (new->is_50hz ? 576 : 480);
766 if (old && old->video_temporal_filter == temporal) {
767 temporal = is_scaling ? 0 : 8;
768 }
753 } 769 }
754 770
755 if (old == NULL || old->stream_type != new->stream_type) { 771 if (old == NULL || old->stream_type != new->stream_type) {
@@ -815,9 +831,9 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
815 } 831 }
816 if (old == NULL || 832 if (old == NULL ||
817 old->video_spatial_filter != new->video_spatial_filter || 833 old->video_spatial_filter != new->video_spatial_filter ||
818 old->video_temporal_filter != new->video_temporal_filter) { 834 old->video_temporal_filter != temporal) {
819 err = cx2341x_api(priv, func, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2, 835 err = cx2341x_api(priv, func, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2,
820 new->video_spatial_filter, new->video_temporal_filter); 836 new->video_spatial_filter, temporal);
821 if (err) return err; 837 if (err) return err;
822 } 838 }
823 if (old == NULL || old->video_temporal_decimation != new->video_temporal_decimation) { 839 if (old == NULL || old->video_temporal_decimation != new->video_temporal_decimation) {
@@ -855,6 +871,9 @@ void cx2341x_log_status(struct cx2341x_mpeg_params *p, const char *prefix)
855 printk(KERN_INFO "%s: Stream: %s\n", 871 printk(KERN_INFO "%s: Stream: %s\n",
856 prefix, 872 prefix,
857 cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_TYPE)); 873 cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_TYPE));
874 printk(KERN_INFO "%s: VBI Format: %s\n",
875 prefix,
876 cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_VBI_FMT));
858 877
859 /* Video */ 878 /* Video */
860 printk(KERN_INFO "%s: Video: %dx%d, %d fps\n", 879 printk(KERN_INFO "%s: Video: %dx%d, %d fps\n",
diff --git a/drivers/media/video/cx25840/Kconfig b/drivers/media/video/cx25840/Kconfig
index 854264e42ec0..7cf29a03ed63 100644
--- a/drivers/media/video/cx25840/Kconfig
+++ b/drivers/media/video/cx25840/Kconfig
@@ -1,6 +1,6 @@
1config VIDEO_CX25840 1config VIDEO_CX25840
2 tristate "Conexant CX2584x audio/video decoders" 2 tristate "Conexant CX2584x audio/video decoders"
3 depends on VIDEO_DEV && I2C && EXPERIMENTAL 3 depends on VIDEO_V4L2 && I2C && EXPERIMENTAL
4 select FW_LOADER 4 select FW_LOADER
5 ---help--- 5 ---help---
6 Support for the Conexant CX2584x audio/video decoders. 6 Support for the Conexant CX2584x audio/video decoders.
diff --git a/drivers/media/video/cx25840/cx25840-vbi.c b/drivers/media/video/cx25840/cx25840-vbi.c
index 6cc8bf215e85..48014a254e15 100644
--- a/drivers/media/video/cx25840/cx25840-vbi.c
+++ b/drivers/media/video/cx25840/cx25840-vbi.c
@@ -111,6 +111,10 @@ void cx25840_vbi_setup(struct i2c_client *client)
111 uv_lpf=0; 111 uv_lpf=0;
112 comb=0; 112 comb=0;
113 sc=0x0a425f; 113 sc=0x0a425f;
114 } else if (std == V4L2_STD_PAL_Nc) {
115 uv_lpf=1;
116 comb=0x20;
117 sc=556453;
114 } else { 118 } else {
115 uv_lpf=1; 119 uv_lpf=1;
116 comb=0x20; 120 comb=0x20;
diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig
index 7a94e6a11927..51d68f32aa06 100644
--- a/drivers/media/video/cx88/Kconfig
+++ b/drivers/media/video/cx88/Kconfig
@@ -1,7 +1,3 @@
1config VIDEO_CX88_VP3054
2 tristate
3 depends on VIDEO_CX88_DVB && DVB_MT352
4
5config VIDEO_CX88 1config VIDEO_CX88
6 tristate "Conexant 2388x (bt878 successor) support" 2 tristate "Conexant 2388x (bt878 successor) support"
7 depends on VIDEO_DEV && PCI && I2C 3 depends on VIDEO_DEV && PCI && I2C
@@ -52,6 +48,14 @@ config VIDEO_CX88_DVB
52 depends on VIDEO_CX88 && DVB_CORE 48 depends on VIDEO_CX88 && DVB_CORE
53 select VIDEO_BUF_DVB 49 select VIDEO_BUF_DVB
54 select DVB_PLL 50 select DVB_PLL
51 select DVB_MT352 if !DVB_FE_CUSTOMISE
52 select DVB_ZL10353 if !DVB_FE_CUSTOMISE
53 select DVB_OR51132 if !DVB_FE_CUSTOMISE
54 select DVB_CX22702 if !DVB_FE_CUSTOMISE
55 select DVB_LGDT330X if !DVB_FE_CUSTOMISE
56 select DVB_NXT200X if !DVB_FE_CUSTOMISE
57 select DVB_CX24123 if !DVB_FE_CUSTOMISE
58 select DVB_ISL6421 if !DVB_FE_CUSTOMISE
55 ---help--- 59 ---help---
56 This adds support for DVB/ATSC cards based on the 60 This adds support for DVB/ATSC cards based on the
57 Conexant 2388x chip. 61 Conexant 2388x chip.
@@ -59,101 +63,12 @@ config VIDEO_CX88_DVB
59 To compile this driver as a module, choose M here: the 63 To compile this driver as a module, choose M here: the
60 module will be called cx88-dvb. 64 module will be called cx88-dvb.
61 65
62 You must also select one or more DVB/ATSC demodulators. 66config VIDEO_CX88_VP3054
63 If you are unsure which you need, choose all of them. 67 tristate "VP-3054 Secondary I2C Bus Support"
64 68 default m
65config VIDEO_CX88_DVB_ALL_FRONTENDS 69 depends on VIDEO_CX88_DVB && DVB_MT352
66 bool "Build all supported frontends for cx2388x based TV cards"
67 default y
68 depends on VIDEO_CX88_DVB
69 select DVB_MT352
70 select VIDEO_CX88_VP3054
71 select DVB_ZL10353
72 select DVB_OR51132
73 select DVB_CX22702
74 select DVB_LGDT330X
75 select DVB_NXT200X
76 select DVB_CX24123
77 select DVB_ISL6421
78 ---help---
79 This builds cx88-dvb with all currently supported frontend
80 demodulators. If you wish to tweak your configuration, and
81 only include support for the hardware that you need, choose N here.
82
83 If you are unsure, choose Y.
84
85config VIDEO_CX88_DVB_MT352
86 bool "Zarlink MT352 DVB-T Support"
87 default y
88 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS
89 select DVB_MT352
90 ---help---
91 This adds DVB-T support for cards based on the
92 Connexant 2388x chip and the MT352 demodulator.
93
94config VIDEO_CX88_DVB_VP3054
95 bool "VP-3054 Secondary I2C Bus Support"
96 default y
97 depends on VIDEO_CX88_DVB_MT352
98 select VIDEO_CX88_VP3054
99 ---help--- 70 ---help---
100 This adds DVB-T support for cards based on the 71 This adds DVB-T support for cards based on the
101 Connexant 2388x chip and the MT352 demodulator, 72 Connexant 2388x chip and the MT352 demodulator,
102 which also require support for the VP-3054 73 which also require support for the VP-3054
103 Secondary I2C bus, such at DNTV Live! DVB-T Pro. 74 Secondary I2C bus, such at DNTV Live! DVB-T Pro.
104
105config VIDEO_CX88_DVB_ZL10353
106 bool "Zarlink ZL10353 DVB-T Support"
107 default y
108 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS
109 select DVB_ZL10353
110 ---help---
111 This adds DVB-T support for cards based on the
112 Connexant 2388x chip and the ZL10353 demodulator,
113 successor to the Zarlink MT352.
114
115config VIDEO_CX88_DVB_OR51132
116 bool "OR51132 ATSC Support"
117 default y
118 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS
119 select DVB_OR51132
120 ---help---
121 This adds ATSC 8VSB and QAM64/256 support for cards based on the
122 Connexant 2388x chip and the OR51132 demodulator.
123
124config VIDEO_CX88_DVB_CX22702
125 bool "Conexant CX22702 DVB-T Support"
126 default y
127 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS
128 select DVB_CX22702
129 ---help---
130 This adds DVB-T support for cards based on the
131 Connexant 2388x chip and the CX22702 demodulator.
132
133config VIDEO_CX88_DVB_LGDT330X
134 bool "LG Electronics DT3302/DT3303 ATSC Support"
135 default y
136 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS
137 select DVB_LGDT330X
138 ---help---
139 This adds ATSC 8VSB and QAM64/256 support for cards based on the
140 Connexant 2388x chip and the LGDT3302/LGDT3303 demodulator.
141
142config VIDEO_CX88_DVB_NXT200X
143 bool "NXT2002/NXT2004 ATSC Support"
144 default y
145 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS
146 select DVB_NXT200X
147 ---help---
148 This adds ATSC 8VSB and QAM64/256 support for cards based on the
149 Connexant 2388x chip and the NXT2002/NXT2004 demodulator.
150
151config VIDEO_CX88_DVB_CX24123
152 bool "Conexant CX24123 DVB-S Support"
153 default y
154 depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS
155 select DVB_CX24123
156 select DVB_ISL6421
157 ---help---
158 This adds DVB-S support for cards based on the
159 Connexant 2388x chip and the CX24123 demodulator.
diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile
index 352b919f30c4..639c3b659d0e 100644
--- a/drivers/media/video/cx88/Makefile
+++ b/drivers/media/video/cx88/Makefile
@@ -14,13 +14,6 @@ EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
14EXTRA_CFLAGS += -Idrivers/media/dvb/frontends 14EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
15 15
16extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1 16extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1
17extra-cflags-$(CONFIG_DVB_CX22702) += -DHAVE_CX22702=1
18extra-cflags-$(CONFIG_DVB_OR51132) += -DHAVE_OR51132=1
19extra-cflags-$(CONFIG_DVB_LGDT330X) += -DHAVE_LGDT330X=1
20extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1
21extra-cflags-$(CONFIG_DVB_ZL10353) += -DHAVE_ZL10353=1
22extra-cflags-$(CONFIG_DVB_NXT200X) += -DHAVE_NXT200X=1
23extra-cflags-$(CONFIG_DVB_CX24123) += -DHAVE_CX24123=1
24extra-cflags-$(CONFIG_VIDEO_CX88_VP3054)+= -DHAVE_VP3054_I2C=1 17extra-cflags-$(CONFIG_VIDEO_CX88_VP3054)+= -DHAVE_VP3054_I2C=1
25 18
26EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m) 19EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m)
diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c
index b60177f173c3..a7921f9d45d8 100644
--- a/drivers/media/video/cx88/cx88-blackbird.c
+++ b/drivers/media/video/cx88/cx88-blackbird.c
@@ -1160,8 +1160,10 @@ static struct pci_driver blackbird_pci_driver = {
1160 .id_table = cx8802_pci_tbl, 1160 .id_table = cx8802_pci_tbl,
1161 .probe = blackbird_probe, 1161 .probe = blackbird_probe,
1162 .remove = __devexit_p(blackbird_remove), 1162 .remove = __devexit_p(blackbird_remove),
1163#ifdef CONFIG_PM
1163 .suspend = cx8802_suspend_common, 1164 .suspend = cx8802_suspend_common,
1164 .resume = cx8802_resume_common, 1165 .resume = cx8802_resume_common,
1166#endif
1165}; 1167};
1166 1168
1167static int blackbird_init(void) 1169static int blackbird_init(void)
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c
index 14bd4863d157..6214eb823b29 100644
--- a/drivers/media/video/cx88/cx88-cards.c
+++ b/drivers/media/video/cx88/cx88-cards.c
@@ -1041,11 +1041,11 @@ struct cx88_board cx88_boards[] = {
1041 .input = {{ 1041 .input = {{
1042 .type = CX88_VMUX_COMPOSITE1, 1042 .type = CX88_VMUX_COMPOSITE1,
1043 .vmux = 1, 1043 .vmux = 1,
1044 .gpio0 = 0x000027df, 1044 .gpio0 = 0x000067df,
1045 },{ 1045 },{
1046 .type = CX88_VMUX_SVIDEO, 1046 .type = CX88_VMUX_SVIDEO,
1047 .vmux = 2, 1047 .vmux = 2,
1048 .gpio0 = 0x000027df, 1048 .gpio0 = 0x000067df,
1049 }}, 1049 }},
1050 .dvb = 1, 1050 .dvb = 1,
1051 }, 1051 },
@@ -1209,6 +1209,100 @@ struct cx88_board cx88_boards[] = {
1209 }}, 1209 }},
1210 .dvb = 1, 1210 .dvb = 1,
1211 }, 1211 },
1212 [CX88_BOARD_HAUPPAUGE_HVR3000] = {
1213 /* FIXME: Add dvb & radio support */
1214 .name = "Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T",
1215 .tuner_type = TUNER_PHILIPS_FMD1216ME_MK3,
1216 .radio_type = UNSET,
1217 .tuner_addr = ADDR_UNSET,
1218 .radio_addr = ADDR_UNSET,
1219 .tda9887_conf = TDA9887_PRESENT,
1220 .input = {{
1221 .type = CX88_VMUX_TELEVISION,
1222 .vmux = 0,
1223 .gpio0 = 0x84bf,
1224 },{
1225 .type = CX88_VMUX_COMPOSITE1,
1226 .vmux = 1,
1227 .gpio0 = 0x84bf,
1228 },{
1229 .type = CX88_VMUX_SVIDEO,
1230 .vmux = 2,
1231 .gpio0 = 0x84bf,
1232 }},
1233 },
1234 [CX88_BOARD_NORWOOD_MICRO] = {
1235 .name = "Norwood Micro TV Tuner",
1236 .tuner_type = TUNER_TNF_5335MF,
1237 .radio_type = UNSET,
1238 .tuner_addr = ADDR_UNSET,
1239 .radio_addr = ADDR_UNSET,
1240 .input = {{
1241 .type = CX88_VMUX_TELEVISION,
1242 .vmux = 0,
1243 .gpio0 = 0x0709,
1244 },{
1245 .type = CX88_VMUX_COMPOSITE1,
1246 .vmux = 1,
1247 .gpio0 = 0x070b,
1248 },{
1249 .type = CX88_VMUX_SVIDEO,
1250 .vmux = 2,
1251 .gpio0 = 0x070b,
1252 }},
1253 },
1254 [CX88_BOARD_TE_DTV_250_OEM_SWANN] = {
1255 .name = "Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM",
1256 .tuner_type = TUNER_LG_PAL_NEW_TAPC,
1257 .radio_type = UNSET,
1258 .tuner_addr = ADDR_UNSET,
1259 .radio_addr = ADDR_UNSET,
1260 .input = {{
1261 .type = CX88_VMUX_TELEVISION,
1262 .vmux = 0,
1263 .gpio0 = 0x003fffff,
1264 .gpio1 = 0x00e00000,
1265 .gpio2 = 0x003fffff,
1266 .gpio3 = 0x02000000,
1267 },{
1268 .type = CX88_VMUX_COMPOSITE1,
1269 .vmux = 1,
1270 .gpio0 = 0x003fffff,
1271 .gpio1 = 0x00e00000,
1272 .gpio2 = 0x003fffff,
1273 .gpio3 = 0x02000000,
1274 },{
1275 .type = CX88_VMUX_SVIDEO,
1276 .vmux = 2,
1277 .gpio0 = 0x003fffff,
1278 .gpio1 = 0x00e00000,
1279 .gpio2 = 0x003fffff,
1280 .gpio3 = 0x02000000,
1281 }},
1282 },
1283 [CX88_BOARD_HAUPPAUGE_HVR1300] = {
1284 .name = "Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder",
1285 .tuner_type = TUNER_PHILIPS_FMD1216ME_MK3,
1286 .radio_type = UNSET,
1287 .tuner_addr = ADDR_UNSET,
1288 .radio_addr = ADDR_UNSET,
1289 .tda9887_conf = TDA9887_PRESENT,
1290 .input = {{
1291 .type = CX88_VMUX_TELEVISION,
1292 .vmux = 0,
1293 .gpio0 = 0xe780,
1294 },{
1295 .type = CX88_VMUX_COMPOSITE1,
1296 .vmux = 1,
1297 .gpio0 = 0xe780,
1298 },{
1299 .type = CX88_VMUX_SVIDEO,
1300 .vmux = 2,
1301 .gpio0 = 0xe780,
1302 }},
1303 /* fixme: Add radio support */
1304 .dvb = 1,
1305 },
1212}; 1306};
1213const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); 1307const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
1214 1308
@@ -1254,7 +1348,7 @@ struct cx88_subid cx88_subids[] = {
1254 .card = CX88_BOARD_LEADTEK_PVR2000, 1348 .card = CX88_BOARD_LEADTEK_PVR2000,
1255 },{ 1349 },{
1256 .subvendor = 0x107d, 1350 .subvendor = 0x107d,
1257 .subdevice = 0x663C, 1351 .subdevice = 0x663c,
1258 .card = CX88_BOARD_LEADTEK_PVR2000, 1352 .card = CX88_BOARD_LEADTEK_PVR2000,
1259 },{ 1353 },{
1260 .subvendor = 0x1461, 1354 .subvendor = 0x1461,
@@ -1458,6 +1552,35 @@ struct cx88_subid cx88_subids[] = {
1458 .subvendor = 0x14f1, 1552 .subvendor = 0x14f1,
1459 .subdevice = 0x0084, 1553 .subdevice = 0x0084,
1460 .card = CX88_BOARD_GENIATECH_DVBS, 1554 .card = CX88_BOARD_GENIATECH_DVBS,
1555 },{
1556 .subvendor = 0x0070,
1557 .subdevice = 0x1404,
1558 .card = CX88_BOARD_HAUPPAUGE_HVR3000,
1559 },{
1560 .subvendor = 0x1461,
1561 .subdevice = 0xc111, /* AverMedia M150-D */
1562 /* This board is known to work with the ASUS PVR416 config */
1563 .card = CX88_BOARD_ASUS_PVR_416,
1564 },{
1565 .subvendor = 0xc180,
1566 .subdevice = 0xc980,
1567 .card = CX88_BOARD_TE_DTV_250_OEM_SWANN,
1568 },{
1569 .subvendor = 0x0070,
1570 .subdevice = 0x9600,
1571 .card = CX88_BOARD_HAUPPAUGE_HVR1300,
1572 },{
1573 .subvendor = 0x0070,
1574 .subdevice = 0x9601,
1575 .card = CX88_BOARD_HAUPPAUGE_HVR1300,
1576 },{
1577 .subvendor = 0x0070,
1578 .subdevice = 0x9602,
1579 .card = CX88_BOARD_HAUPPAUGE_HVR1300,
1580 },{
1581 .subvendor = 0x107d,
1582 .subdevice = 0x6632,
1583 .card = CX88_BOARD_LEADTEK_PVR2000,
1461 }, 1584 },
1462}; 1585};
1463const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); 1586const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
@@ -1501,6 +1624,7 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
1501 /* Make sure we support the board model */ 1624 /* Make sure we support the board model */
1502 switch (tv.model) 1625 switch (tv.model)
1503 { 1626 {
1627 case 14569: /* WinTV-HVR3000 (OEM, no IR, no back panel video) */
1504 case 28552: /* WinTV-PVR 'Roslyn' (No IR) */ 1628 case 28552: /* WinTV-PVR 'Roslyn' (No IR) */
1505 case 34519: /* WinTV-PCI-FM */ 1629 case 34519: /* WinTV-PCI-FM */
1506 case 90002: /* Nova-T-PCI (9002) */ 1630 case 90002: /* Nova-T-PCI (9002) */
@@ -1512,6 +1636,11 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data)
1512 case 92000: /* Nova-SE2 (OEM, No Video or IR) */ 1636 case 92000: /* Nova-SE2 (OEM, No Video or IR) */
1513 case 94009: /* WinTV-HVR1100 (Video and IR Retail) */ 1637 case 94009: /* WinTV-HVR1100 (Video and IR Retail) */
1514 case 94501: /* WinTV-HVR1100 (Video and IR OEM) */ 1638 case 94501: /* WinTV-HVR1100 (Video and IR OEM) */
1639 case 96009: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX) */
1640 case 96019: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX/TX) */
1641 case 96559: /* WinTV-HVR1300 (PAL Video, MPEG Video no IR) */
1642 case 96569: /* WinTV-HVR1300 () */
1643 case 96659: /* WinTV-HVR1300 () */
1515 case 98559: /* WinTV-HVR1100LP (Video no IR, Retail - Low Profile) */ 1644 case 98559: /* WinTV-HVR1100LP (Video no IR, Retail - Low Profile) */
1516 /* known */ 1645 /* known */
1517 break; 1646 break;
@@ -1638,6 +1767,22 @@ void cx88_card_list(struct cx88_core *core, struct pci_dev *pci)
1638 core->name, i, cx88_boards[i].name); 1767 core->name, i, cx88_boards[i].name);
1639} 1768}
1640 1769
1770void cx88_card_setup_pre_i2c(struct cx88_core *core)
1771{
1772 switch (core->board) {
1773 case CX88_BOARD_HAUPPAUGE_HVR1300:
1774 /* Bring the 702 demod up before i2c scanning/attach or devices are hidden */
1775 /* We leave here with the 702 on the bus */
1776 cx_write(MO_GP0_IO, 0x0000e780);
1777 udelay(1000);
1778 cx_clear(MO_GP0_IO, 0x00000080);
1779 udelay(50);
1780 cx_set(MO_GP0_IO, 0x00000080); /* 702 out of reset */
1781 udelay(1000);
1782 break;
1783 }
1784}
1785
1641void cx88_card_setup(struct cx88_core *core) 1786void cx88_card_setup(struct cx88_core *core)
1642{ 1787{
1643 static u8 eeprom[256]; 1788 static u8 eeprom[256];
@@ -1666,6 +1811,8 @@ void cx88_card_setup(struct cx88_core *core)
1666 case CX88_BOARD_HAUPPAUGE_DVB_T1: 1811 case CX88_BOARD_HAUPPAUGE_DVB_T1:
1667 case CX88_BOARD_HAUPPAUGE_HVR1100: 1812 case CX88_BOARD_HAUPPAUGE_HVR1100:
1668 case CX88_BOARD_HAUPPAUGE_HVR1100LP: 1813 case CX88_BOARD_HAUPPAUGE_HVR1100LP:
1814 case CX88_BOARD_HAUPPAUGE_HVR3000:
1815 case CX88_BOARD_HAUPPAUGE_HVR1300:
1669 if (0 == core->i2c_rc) 1816 if (0 == core->i2c_rc)
1670 hauppauge_eeprom(core,eeprom); 1817 hauppauge_eeprom(core,eeprom);
1671 break; 1818 break;
@@ -1673,9 +1820,15 @@ void cx88_card_setup(struct cx88_core *core)
1673 cx_write(MO_GP0_IO, 0x000007f8); 1820 cx_write(MO_GP0_IO, 0x000007f8);
1674 cx_write(MO_GP1_IO, 0x00000001); 1821 cx_write(MO_GP1_IO, 0x00000001);
1675 break; 1822 break;
1823 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL:
1824 /* GPIO0:6 is hooked to FX2 reset pin */
1825 cx_set(MO_GP0_IO, 0x00004040);
1826 cx_clear(MO_GP0_IO, 0x00000040);
1827 msleep(1000);
1828 cx_set(MO_GP0_IO, 0x00004040);
1829 /* FALLTHROUGH */
1676 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: 1830 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
1677 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: 1831 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
1678 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL:
1679 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: 1832 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID:
1680 /* GPIO0:0 is hooked to mt352 reset pin */ 1833 /* GPIO0:0 is hooked to mt352 reset pin */
1681 cx_set(MO_GP0_IO, 0x00000101); 1834 cx_set(MO_GP0_IO, 0x00000101);
diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c
index 973d3f39b2d5..f379ede3049a 100644
--- a/drivers/media/video/cx88/cx88-core.c
+++ b/drivers/media/video/cx88/cx88-core.c
@@ -105,7 +105,7 @@ static u32* cx88_risc_field(u32 *rp, struct scatterlist *sglist,
105 *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); 105 *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset);
106 offset+=bpl; 106 offset+=bpl;
107 } else { 107 } else {
108 /* scanline needs to be splitted */ 108 /* scanline needs to be split */
109 todo = bpl; 109 todo = bpl;
110 *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL| 110 *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL|
111 (sg_dma_len(sg)-offset)); 111 (sg_dma_len(sg)-offset));
@@ -792,6 +792,11 @@ int cx88_start_audio_dma(struct cx88_core *core)
792{ 792{
793 /* constant 128 made buzz in analog Nicam-stereo for bigger fifo_size */ 793 /* constant 128 made buzz in analog Nicam-stereo for bigger fifo_size */
794 int bpl = cx88_sram_channels[SRAM_CH25].fifo_size/4; 794 int bpl = cx88_sram_channels[SRAM_CH25].fifo_size/4;
795
796 /* If downstream RISC is enabled, bail out; ALSA is managing DMA */
797 if (cx_read(MO_AUD_DMACNTRL) & 0x10)
798 return 0;
799
795 /* setup fifo + format */ 800 /* setup fifo + format */
796 cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], bpl, 0); 801 cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], bpl, 0);
797 cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH26], bpl, 0); 802 cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH26], bpl, 0);
@@ -801,11 +806,16 @@ int cx88_start_audio_dma(struct cx88_core *core)
801 806
802 /* start dma */ 807 /* start dma */
803 cx_write(MO_AUD_DMACNTRL, 0x0003); /* Up and Down fifo enable */ 808 cx_write(MO_AUD_DMACNTRL, 0x0003); /* Up and Down fifo enable */
809
804 return 0; 810 return 0;
805} 811}
806 812
807int cx88_stop_audio_dma(struct cx88_core *core) 813int cx88_stop_audio_dma(struct cx88_core *core)
808{ 814{
815 /* If downstream RISC is enabled, bail out; ALSA is managing DMA */
816 if (cx_read(MO_AUD_DMACNTRL) & 0x10)
817 return 0;
818
809 /* stop dma */ 819 /* stop dma */
810 cx_write(MO_AUD_DMACNTRL, 0x0000); 820 cx_write(MO_AUD_DMACNTRL, 0x0000);
811 821
@@ -1123,6 +1133,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci)
1123 1133
1124 /* init hardware */ 1134 /* init hardware */
1125 cx88_reset(core); 1135 cx88_reset(core);
1136 cx88_card_setup_pre_i2c(core);
1126 cx88_i2c_init(core,pci); 1137 cx88_i2c_init(core,pci);
1127 cx88_call_i2c_clients (core, TUNER_SET_STANDBY, NULL); 1138 cx88_call_i2c_clients (core, TUNER_SET_STANDBY, NULL);
1128 cx88_card_setup(core); 1139 cx88_card_setup(core);
diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c
index afde3789d702..c87041dee21e 100644
--- a/drivers/media/video/cx88/cx88-dvb.c
+++ b/drivers/media/video/cx88/cx88-dvb.c
@@ -33,32 +33,18 @@
33#include "dvb-pll.h" 33#include "dvb-pll.h"
34#include <media/v4l2-common.h> 34#include <media/v4l2-common.h>
35 35
36#ifdef HAVE_MT352 36#include "mt352.h"
37# include "mt352.h" 37#include "mt352_priv.h"
38# include "mt352_priv.h" 38#ifdef HAVE_VP3054_I2C
39# ifdef HAVE_VP3054_I2C 39# include "cx88-vp3054-i2c.h"
40# include "cx88-vp3054-i2c.h"
41# endif
42#endif
43#ifdef HAVE_ZL10353
44# include "zl10353.h"
45#endif
46#ifdef HAVE_CX22702
47# include "cx22702.h"
48#endif
49#ifdef HAVE_OR51132
50# include "or51132.h"
51#endif
52#ifdef HAVE_LGDT330X
53# include "lgdt330x.h"
54# include "lg_h06xf.h"
55#endif
56#ifdef HAVE_NXT200X
57# include "nxt200x.h"
58#endif
59#ifdef HAVE_CX24123
60# include "cx24123.h"
61#endif 40#endif
41#include "zl10353.h"
42#include "cx22702.h"
43#include "or51132.h"
44#include "lgdt330x.h"
45#include "lg_h06xf.h"
46#include "nxt200x.h"
47#include "cx24123.h"
62#include "isl6421.h" 48#include "isl6421.h"
63 49
64MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); 50MODULE_DESCRIPTION("driver for cx2388x based DVB cards");
@@ -114,8 +100,6 @@ static struct videobuf_queue_ops dvb_qops = {
114}; 100};
115 101
116/* ------------------------------------------------------------------ */ 102/* ------------------------------------------------------------------ */
117
118#ifdef HAVE_MT352
119static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) 103static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe)
120{ 104{
121 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; 105 static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 };
@@ -181,7 +165,7 @@ static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe)
181} 165}
182 166
183static struct mt352_config dvico_fusionhdtv = { 167static struct mt352_config dvico_fusionhdtv = {
184 .demod_address = 0x0F, 168 .demod_address = 0x0f,
185 .demod_init = dvico_fusionhdtv_demod_init, 169 .demod_init = dvico_fusionhdtv_demod_init,
186}; 170};
187 171
@@ -191,7 +175,7 @@ static struct mt352_config dntv_live_dvbt_config = {
191}; 175};
192 176
193static struct mt352_config dvico_fusionhdtv_dual = { 177static struct mt352_config dvico_fusionhdtv_dual = {
194 .demod_address = 0x0F, 178 .demod_address = 0x0f,
195 .demod_init = dvico_dual_demod_init, 179 .demod_init = dvico_dual_demod_init,
196}; 180};
197 181
@@ -266,8 +250,8 @@ static int dntv_live_dvbt_pro_tuner_set_params(struct dvb_frontend* fe,
266 if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { 250 if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) {
267 251
268 printk(KERN_WARNING "cx88-dvb: %s error " 252 printk(KERN_WARNING "cx88-dvb: %s error "
269 "(addr %02x <- %02x, err = %i)\n", 253 "(addr %02x <- %02x, err = %i)\n",
270 __FUNCTION__, dev->core->pll_addr, buf[0], err); 254 __FUNCTION__, dev->core->pll_addr, buf[0], err);
271 if (err < 0) 255 if (err < 0)
272 return err; 256 return err;
273 else 257 else
@@ -283,9 +267,7 @@ static struct mt352_config dntv_live_dvbt_pro_config = {
283 .demod_init = dntv_live_dvbt_pro_demod_init, 267 .demod_init = dntv_live_dvbt_pro_demod_init,
284}; 268};
285#endif 269#endif
286#endif
287 270
288#ifdef HAVE_ZL10353
289static int dvico_hybrid_tuner_set_params(struct dvb_frontend *fe, 271static int dvico_hybrid_tuner_set_params(struct dvb_frontend *fe,
290 struct dvb_frontend_parameters *params) 272 struct dvb_frontend_parameters *params)
291{ 273{
@@ -304,8 +286,8 @@ static int dvico_hybrid_tuner_set_params(struct dvb_frontend *fe,
304 fe->ops.i2c_gate_ctrl(fe, 1); 286 fe->ops.i2c_gate_ctrl(fe, 1);
305 if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { 287 if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) {
306 printk(KERN_WARNING "cx88-dvb: %s error " 288 printk(KERN_WARNING "cx88-dvb: %s error "
307 "(addr %02x <- %02x, err = %i)\n", 289 "(addr %02x <- %02x, err = %i)\n",
308 __FUNCTION__, pllbuf[0], pllbuf[1], err); 290 __FUNCTION__, pllbuf[0], pllbuf[1], err);
309 if (err < 0) 291 if (err < 0)
310 return err; 292 return err;
311 else 293 else
@@ -316,16 +298,14 @@ static int dvico_hybrid_tuner_set_params(struct dvb_frontend *fe,
316} 298}
317 299
318static struct zl10353_config dvico_fusionhdtv_hybrid = { 300static struct zl10353_config dvico_fusionhdtv_hybrid = {
319 .demod_address = 0x0F, 301 .demod_address = 0x0f,
320 .no_tuner = 1, 302 .no_tuner = 1,
321}; 303};
322 304
323static struct zl10353_config dvico_fusionhdtv_plus_v1_1 = { 305static struct zl10353_config dvico_fusionhdtv_plus_v1_1 = {
324 .demod_address = 0x0F, 306 .demod_address = 0x0f,
325}; 307};
326#endif
327 308
328#ifdef HAVE_CX22702
329static struct cx22702_config connexant_refboard_config = { 309static struct cx22702_config connexant_refboard_config = {
330 .demod_address = 0x43, 310 .demod_address = 0x43,
331 .output_mode = CX22702_SERIAL_OUTPUT, 311 .output_mode = CX22702_SERIAL_OUTPUT,
@@ -339,9 +319,11 @@ static struct cx22702_config hauppauge_hvr1100_config = {
339 .demod_address = 0x63, 319 .demod_address = 0x63,
340 .output_mode = CX22702_SERIAL_OUTPUT, 320 .output_mode = CX22702_SERIAL_OUTPUT,
341}; 321};
342#endif 322static struct cx22702_config hauppauge_hvr1300_config = {
323 .demod_address = 0x63,
324 .output_mode = CX22702_SERIAL_OUTPUT,
325};
343 326
344#ifdef HAVE_OR51132
345static int or51132_set_ts_param(struct dvb_frontend* fe, 327static int or51132_set_ts_param(struct dvb_frontend* fe,
346 int is_punctured) 328 int is_punctured)
347{ 329{
@@ -351,12 +333,10 @@ static int or51132_set_ts_param(struct dvb_frontend* fe,
351} 333}
352 334
353static struct or51132_config pchdtv_hd3000 = { 335static struct or51132_config pchdtv_hd3000 = {
354 .demod_address = 0x15, 336 .demod_address = 0x15,
355 .set_ts_params = or51132_set_ts_param, 337 .set_ts_params = or51132_set_ts_param,
356}; 338};
357#endif
358 339
359#ifdef HAVE_LGDT330X
360static int lgdt3302_tuner_set_params(struct dvb_frontend* fe, 340static int lgdt3302_tuner_set_params(struct dvb_frontend* fe,
361 struct dvb_frontend_parameters* params) 341 struct dvb_frontend_parameters* params)
362{ 342{
@@ -373,14 +353,14 @@ static int lgdt3302_tuner_set_params(struct dvb_frontend* fe,
373 353
374 dvb_pll_configure(core->pll_desc, buf, params->frequency, 0); 354 dvb_pll_configure(core->pll_desc, buf, params->frequency, 0);
375 dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n", 355 dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n",
376 __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]); 356 __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]);
377 357
378 if (fe->ops.i2c_gate_ctrl) 358 if (fe->ops.i2c_gate_ctrl)
379 fe->ops.i2c_gate_ctrl(fe, 1); 359 fe->ops.i2c_gate_ctrl(fe, 1);
380 if ((err = i2c_transfer(&core->i2c_adap, &msg, 1)) != 1) { 360 if ((err = i2c_transfer(&core->i2c_adap, &msg, 1)) != 1) {
381 printk(KERN_WARNING "cx88-dvb: %s error " 361 printk(KERN_WARNING "cx88-dvb: %s error "
382 "(addr %02x <- %02x, err = %i)\n", 362 "(addr %02x <- %02x, err = %i)\n",
383 __FUNCTION__, buf[0], buf[1], err); 363 __FUNCTION__, buf[0], buf[1], err);
384 if (err < 0) 364 if (err < 0)
385 return err; 365 return err;
386 else 366 else
@@ -425,28 +405,26 @@ static int lgdt330x_set_ts_param(struct dvb_frontend* fe, int is_punctured)
425} 405}
426 406
427static struct lgdt330x_config fusionhdtv_3_gold = { 407static struct lgdt330x_config fusionhdtv_3_gold = {
428 .demod_address = 0x0e, 408 .demod_address = 0x0e,
429 .demod_chip = LGDT3302, 409 .demod_chip = LGDT3302,
430 .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */ 410 .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */
431 .set_ts_params = lgdt330x_set_ts_param, 411 .set_ts_params = lgdt330x_set_ts_param,
432}; 412};
433 413
434static struct lgdt330x_config fusionhdtv_5_gold = { 414static struct lgdt330x_config fusionhdtv_5_gold = {
435 .demod_address = 0x0e, 415 .demod_address = 0x0e,
436 .demod_chip = LGDT3303, 416 .demod_chip = LGDT3303,
437 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ 417 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
438 .set_ts_params = lgdt330x_set_ts_param, 418 .set_ts_params = lgdt330x_set_ts_param,
439}; 419};
440 420
441static struct lgdt330x_config pchdtv_hd5500 = { 421static struct lgdt330x_config pchdtv_hd5500 = {
442 .demod_address = 0x59, 422 .demod_address = 0x59,
443 .demod_chip = LGDT3303, 423 .demod_chip = LGDT3303,
444 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ 424 .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */
445 .set_ts_params = lgdt330x_set_ts_param, 425 .set_ts_params = lgdt330x_set_ts_param,
446}; 426};
447#endif
448 427
449#ifdef HAVE_NXT200X
450static int nxt200x_set_ts_param(struct dvb_frontend* fe, 428static int nxt200x_set_ts_param(struct dvb_frontend* fe,
451 int is_punctured) 429 int is_punctured)
452{ 430{
@@ -465,28 +443,27 @@ static int nxt200x_set_pll_input(u8* buf, int input)
465} 443}
466 444
467static struct nxt200x_config ati_hdtvwonder = { 445static struct nxt200x_config ati_hdtvwonder = {
468 .demod_address = 0x0a, 446 .demod_address = 0x0a,
469 .set_pll_input = nxt200x_set_pll_input, 447 .set_pll_input = nxt200x_set_pll_input,
470 .set_ts_params = nxt200x_set_ts_param, 448 .set_ts_params = nxt200x_set_ts_param,
471}; 449};
472#endif
473 450
474#ifdef HAVE_CX24123
475static int cx24123_set_ts_param(struct dvb_frontend* fe, 451static int cx24123_set_ts_param(struct dvb_frontend* fe,
476 int is_punctured) 452 int is_punctured)
477{ 453{
478 struct cx8802_dev *dev= fe->dvb->priv; 454 struct cx8802_dev *dev= fe->dvb->priv;
479 dev->ts_gen_cntrl = 0x2; 455 dev->ts_gen_cntrl = 0x02;
480 return 0; 456 return 0;
481} 457}
482 458
483static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) 459static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe,
460 fe_sec_voltage_t voltage)
484{ 461{
485 struct cx8802_dev *dev= fe->dvb->priv; 462 struct cx8802_dev *dev= fe->dvb->priv;
486 struct cx88_core *core = dev->core; 463 struct cx88_core *core = dev->core;
487 464
488 if (voltage == SEC_VOLTAGE_OFF) { 465 if (voltage == SEC_VOLTAGE_OFF) {
489 cx_write(MO_GP0_IO, 0x000006fB); 466 cx_write(MO_GP0_IO, 0x000006fb);
490 } else { 467 } else {
491 cx_write(MO_GP0_IO, 0x000006f9); 468 cx_write(MO_GP0_IO, 0x000006f9);
492 } 469 }
@@ -496,7 +473,8 @@ static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t
496 return 0; 473 return 0;
497} 474}
498 475
499static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) 476static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe,
477 fe_sec_voltage_t voltage)
500{ 478{
501 struct cx8802_dev *dev= fe->dvb->priv; 479 struct cx8802_dev *dev= fe->dvb->priv;
502 struct cx88_core *core = dev->core; 480 struct cx88_core *core = dev->core;
@@ -512,20 +490,20 @@ static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t
512} 490}
513 491
514static struct cx24123_config geniatech_dvbs_config = { 492static struct cx24123_config geniatech_dvbs_config = {
515 .demod_address = 0x55, 493 .demod_address = 0x55,
516 .set_ts_params = cx24123_set_ts_param, 494 .set_ts_params = cx24123_set_ts_param,
517}; 495};
518 496
519static struct cx24123_config hauppauge_novas_config = { 497static struct cx24123_config hauppauge_novas_config = {
520 .demod_address = 0x55, 498 .demod_address = 0x55,
521 .set_ts_params = cx24123_set_ts_param, 499 .set_ts_params = cx24123_set_ts_param,
522}; 500};
523 501
524static struct cx24123_config kworld_dvbs_100_config = { 502static struct cx24123_config kworld_dvbs_100_config = {
525 .demod_address = 0x15, 503 .demod_address = 0x15,
526 .set_ts_params = cx24123_set_ts_param, 504 .set_ts_params = cx24123_set_ts_param,
505 .lnb_polarity = 1,
527}; 506};
528#endif
529 507
530static int dvb_register(struct cx8802_dev *dev) 508static int dvb_register(struct cx8802_dev *dev)
531{ 509{
@@ -535,114 +513,114 @@ static int dvb_register(struct cx8802_dev *dev)
535 513
536 /* init frontend */ 514 /* init frontend */
537 switch (dev->core->board) { 515 switch (dev->core->board) {
538#ifdef HAVE_CX22702
539 case CX88_BOARD_HAUPPAUGE_DVB_T1: 516 case CX88_BOARD_HAUPPAUGE_DVB_T1:
540 dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config, 517 dev->dvb.frontend = dvb_attach(cx22702_attach,
541 &dev->core->i2c_adap); 518 &hauppauge_novat_config,
519 &dev->core->i2c_adap);
542 if (dev->dvb.frontend != NULL) { 520 if (dev->dvb.frontend != NULL) {
543 dvb_pll_attach(dev->dvb.frontend, 0x61, 521 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
544 &dev->core->i2c_adap, 522 &dev->core->i2c_adap,
545 &dvb_pll_thomson_dtt759x); 523 &dvb_pll_thomson_dtt759x);
546 } 524 }
547 break; 525 break;
548 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: 526 case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1:
549 case CX88_BOARD_CONEXANT_DVB_T1: 527 case CX88_BOARD_CONEXANT_DVB_T1:
550 case CX88_BOARD_KWORLD_DVB_T_CX22702: 528 case CX88_BOARD_KWORLD_DVB_T_CX22702:
551 case CX88_BOARD_WINFAST_DTV1000: 529 case CX88_BOARD_WINFAST_DTV1000:
552 dev->dvb.frontend = cx22702_attach(&connexant_refboard_config, 530 dev->dvb.frontend = dvb_attach(cx22702_attach,
553 &dev->core->i2c_adap); 531 &connexant_refboard_config,
532 &dev->core->i2c_adap);
554 if (dev->dvb.frontend != NULL) { 533 if (dev->dvb.frontend != NULL) {
555 dvb_pll_attach(dev->dvb.frontend, 0x60, 534 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60,
556 &dev->core->i2c_adap, 535 &dev->core->i2c_adap,
557 &dvb_pll_thomson_dtt7579); 536 &dvb_pll_thomson_dtt7579);
558 } 537 }
559 break; 538 break;
560 case CX88_BOARD_WINFAST_DTV2000H: 539 case CX88_BOARD_WINFAST_DTV2000H:
561 case CX88_BOARD_HAUPPAUGE_HVR1100: 540 case CX88_BOARD_HAUPPAUGE_HVR1100:
562 case CX88_BOARD_HAUPPAUGE_HVR1100LP: 541 case CX88_BOARD_HAUPPAUGE_HVR1100LP:
563 dev->dvb.frontend = cx22702_attach(&hauppauge_hvr1100_config, 542 dev->dvb.frontend = dvb_attach(cx22702_attach,
564 &dev->core->i2c_adap); 543 &hauppauge_hvr1100_config,
544 &dev->core->i2c_adap);
565 if (dev->dvb.frontend != NULL) { 545 if (dev->dvb.frontend != NULL) {
566 dvb_pll_attach(dev->dvb.frontend, 0x61, 546 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
567 &dev->core->i2c_adap, 547 &dev->core->i2c_adap,
568 &dvb_pll_fmd1216me); 548 &dvb_pll_fmd1216me);
549 }
550 break;
551 case CX88_BOARD_HAUPPAUGE_HVR1300:
552 dev->dvb.frontend = dvb_attach(cx22702_attach,
553 &hauppauge_hvr1300_config,
554 &dev->core->i2c_adap);
555 if (dev->dvb.frontend != NULL) {
556 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
557 &dev->core->i2c_adap,
558 &dvb_pll_fmd1216me);
569 } 559 }
570 break; 560 break;
571#endif
572#if defined(HAVE_MT352) || defined(HAVE_ZL10353)
573 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: 561 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS:
574#ifdef HAVE_MT352 562 dev->dvb.frontend = dvb_attach(mt352_attach,
575 dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv, 563 &dvico_fusionhdtv,
576 &dev->core->i2c_adap); 564 &dev->core->i2c_adap);
577 if (dev->dvb.frontend != NULL) { 565 if (dev->dvb.frontend != NULL) {
578 dvb_pll_attach(dev->dvb.frontend, 0x60, 566 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60,
579 &dev->core->i2c_adap, 567 NULL, &dvb_pll_thomson_dtt7579);
580 &dvb_pll_thomson_dtt7579);
581 break; 568 break;
582 } 569 }
583#endif
584#ifdef HAVE_ZL10353
585 /* ZL10353 replaces MT352 on later cards */ 570 /* ZL10353 replaces MT352 on later cards */
586 dev->dvb.frontend = zl10353_attach(&dvico_fusionhdtv_plus_v1_1, 571 dev->dvb.frontend = dvb_attach(zl10353_attach,
587 &dev->core->i2c_adap); 572 &dvico_fusionhdtv_plus_v1_1,
573 &dev->core->i2c_adap);
588 if (dev->dvb.frontend != NULL) { 574 if (dev->dvb.frontend != NULL) {
589 dvb_pll_attach(dev->dvb.frontend, 0x60, 575 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60,
590 &dev->core->i2c_adap, 576 NULL, &dvb_pll_thomson_dtt7579);
591 &dvb_pll_thomson_dtt7579);
592 } 577 }
593#endif
594 break; 578 break;
595 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: 579 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL:
596#ifdef HAVE_MT352
597 /* The tin box says DEE1601, but it seems to be DTT7579 580 /* The tin box says DEE1601, but it seems to be DTT7579
598 * compatible, with a slightly different MT352 AGC gain. */ 581 * compatible, with a slightly different MT352 AGC gain. */
599 dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv_dual, 582 dev->dvb.frontend = dvb_attach(mt352_attach,
600 &dev->core->i2c_adap); 583 &dvico_fusionhdtv_dual,
584 &dev->core->i2c_adap);
601 if (dev->dvb.frontend != NULL) { 585 if (dev->dvb.frontend != NULL) {
602 dvb_pll_attach(dev->dvb.frontend, 0x61, 586 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
603 &dev->core->i2c_adap, 587 NULL, &dvb_pll_thomson_dtt7579);
604 &dvb_pll_thomson_dtt7579);
605 break; 588 break;
606 } 589 }
607#endif
608#ifdef HAVE_ZL10353
609 /* ZL10353 replaces MT352 on later cards */ 590 /* ZL10353 replaces MT352 on later cards */
610 dev->dvb.frontend = zl10353_attach(&dvico_fusionhdtv_plus_v1_1, 591 dev->dvb.frontend = dvb_attach(zl10353_attach,
611 &dev->core->i2c_adap); 592 &dvico_fusionhdtv_plus_v1_1,
593 &dev->core->i2c_adap);
612 if (dev->dvb.frontend != NULL) { 594 if (dev->dvb.frontend != NULL) {
613 dvb_pll_attach(dev->dvb.frontend, 0x61, 595 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
614 &dev->core->i2c_adap, 596 NULL, &dvb_pll_thomson_dtt7579);
615 &dvb_pll_thomson_dtt7579);
616 } 597 }
617#endif
618 break; 598 break;
619#endif /* HAVE_MT352 || HAVE_ZL10353 */
620#ifdef HAVE_MT352
621 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: 599 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1:
622 dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv, 600 dev->dvb.frontend = dvb_attach(mt352_attach,
623 &dev->core->i2c_adap); 601 &dvico_fusionhdtv,
602 &dev->core->i2c_adap);
624 if (dev->dvb.frontend != NULL) { 603 if (dev->dvb.frontend != NULL) {
625 dvb_pll_attach(dev->dvb.frontend, 0x61, 604 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
626 &dev->core->i2c_adap, 605 NULL, &dvb_pll_lg_z201);
627 &dvb_pll_lg_z201);
628 } 606 }
629 break; 607 break;
630 case CX88_BOARD_KWORLD_DVB_T: 608 case CX88_BOARD_KWORLD_DVB_T:
631 case CX88_BOARD_DNTV_LIVE_DVB_T: 609 case CX88_BOARD_DNTV_LIVE_DVB_T:
632 case CX88_BOARD_ADSTECH_DVB_T_PCI: 610 case CX88_BOARD_ADSTECH_DVB_T_PCI:
633 dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config, 611 dev->dvb.frontend = dvb_attach(mt352_attach,
634 &dev->core->i2c_adap); 612 &dntv_live_dvbt_config,
613 &dev->core->i2c_adap);
635 if (dev->dvb.frontend != NULL) { 614 if (dev->dvb.frontend != NULL) {
636 dvb_pll_attach(dev->dvb.frontend, 0x61, 615 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
637 &dev->core->i2c_adap, 616 NULL, &dvb_pll_unknown_1);
638 &dvb_pll_unknown_1);
639 } 617 }
640 break; 618 break;
641 case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: 619 case CX88_BOARD_DNTV_LIVE_DVB_T_PRO:
642#ifdef HAVE_VP3054_I2C 620#ifdef HAVE_VP3054_I2C
643 dev->core->pll_addr = 0x61; 621 dev->core->pll_addr = 0x61;
644 dev->core->pll_desc = &dvb_pll_fmd1216me; 622 dev->core->pll_desc = &dvb_pll_fmd1216me;
645 dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_pro_config, 623 dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config,
646 &((struct vp3054_i2c_state *)dev->card_priv)->adap); 624 &((struct vp3054_i2c_state *)dev->card_priv)->adap);
647 if (dev->dvb.frontend != NULL) { 625 if (dev->dvb.frontend != NULL) {
648 dev->dvb.frontend->ops.tuner_ops.set_params = dntv_live_dvbt_pro_tuner_set_params; 626 dev->dvb.frontend->ops.tuner_ops.set_params = dntv_live_dvbt_pro_tuner_set_params;
@@ -651,30 +629,26 @@ static int dvb_register(struct cx8802_dev *dev)
651 printk("%s: built without vp3054 support\n", dev->core->name); 629 printk("%s: built without vp3054 support\n", dev->core->name);
652#endif 630#endif
653 break; 631 break;
654#endif
655#ifdef HAVE_ZL10353
656 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: 632 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID:
657 dev->core->pll_addr = 0x61; 633 dev->core->pll_addr = 0x61;
658 dev->core->pll_desc = &dvb_pll_thomson_fe6600; 634 dev->core->pll_desc = &dvb_pll_thomson_fe6600;
659 dev->dvb.frontend = zl10353_attach(&dvico_fusionhdtv_hybrid, 635 dev->dvb.frontend = dvb_attach(zl10353_attach,
660 &dev->core->i2c_adap); 636 &dvico_fusionhdtv_hybrid,
637 &dev->core->i2c_adap);
661 if (dev->dvb.frontend != NULL) { 638 if (dev->dvb.frontend != NULL) {
662 dev->dvb.frontend->ops.tuner_ops.set_params = dvico_hybrid_tuner_set_params; 639 dev->dvb.frontend->ops.tuner_ops.set_params = dvico_hybrid_tuner_set_params;
663 } 640 }
664 break; 641 break;
665#endif
666#ifdef HAVE_OR51132
667 case CX88_BOARD_PCHDTV_HD3000: 642 case CX88_BOARD_PCHDTV_HD3000:
668 dev->dvb.frontend = or51132_attach(&pchdtv_hd3000, 643 dev->dvb.frontend = dvb_attach(or51132_attach,
669 &dev->core->i2c_adap); 644 &pchdtv_hd3000,
645 &dev->core->i2c_adap);
670 if (dev->dvb.frontend != NULL) { 646 if (dev->dvb.frontend != NULL) {
671 dvb_pll_attach(dev->dvb.frontend, 0x61, 647 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
672 &dev->core->i2c_adap, 648 &dev->core->i2c_adap,
673 &dvb_pll_thomson_dtt761x); 649 &dvb_pll_thomson_dtt761x);
674 } 650 }
675 break; 651 break;
676#endif
677#ifdef HAVE_LGDT330X
678 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: 652 case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q:
679 dev->ts_gen_cntrl = 0x08; 653 dev->ts_gen_cntrl = 0x08;
680 { 654 {
@@ -690,8 +664,9 @@ static int dvb_register(struct cx8802_dev *dev)
690 fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set; 664 fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set;
691 dev->core->pll_addr = 0x61; 665 dev->core->pll_addr = 0x61;
692 dev->core->pll_desc = &dvb_pll_microtune_4042; 666 dev->core->pll_desc = &dvb_pll_microtune_4042;
693 dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold, 667 dev->dvb.frontend = dvb_attach(lgdt330x_attach,
694 &dev->core->i2c_adap); 668 &fusionhdtv_3_gold,
669 &dev->core->i2c_adap);
695 if (dev->dvb.frontend != NULL) { 670 if (dev->dvb.frontend != NULL) {
696 dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3302_tuner_set_params; 671 dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3302_tuner_set_params;
697 } 672 }
@@ -709,8 +684,9 @@ static int dvb_register(struct cx8802_dev *dev)
709 mdelay(200); 684 mdelay(200);
710 dev->core->pll_addr = 0x61; 685 dev->core->pll_addr = 0x61;
711 dev->core->pll_desc = &dvb_pll_thomson_dtt761x; 686 dev->core->pll_desc = &dvb_pll_thomson_dtt761x;
712 dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold, 687 dev->dvb.frontend = dvb_attach(lgdt330x_attach,
713 &dev->core->i2c_adap); 688 &fusionhdtv_3_gold,
689 &dev->core->i2c_adap);
714 if (dev->dvb.frontend != NULL) { 690 if (dev->dvb.frontend != NULL) {
715 dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3302_tuner_set_params; 691 dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3302_tuner_set_params;
716 } 692 }
@@ -726,8 +702,9 @@ static int dvb_register(struct cx8802_dev *dev)
726 mdelay(100); 702 mdelay(100);
727 cx_set(MO_GP0_IO, 1); 703 cx_set(MO_GP0_IO, 1);
728 mdelay(200); 704 mdelay(200);
729 dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_5_gold, 705 dev->dvb.frontend = dvb_attach(lgdt330x_attach,
730 &dev->core->i2c_adap); 706 &fusionhdtv_5_gold,
707 &dev->core->i2c_adap);
731 if (dev->dvb.frontend != NULL) { 708 if (dev->dvb.frontend != NULL) {
732 dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3303_tuner_set_params; 709 dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3303_tuner_set_params;
733 } 710 }
@@ -743,52 +720,51 @@ static int dvb_register(struct cx8802_dev *dev)
743 mdelay(100); 720 mdelay(100);
744 cx_set(MO_GP0_IO, 1); 721 cx_set(MO_GP0_IO, 1);
745 mdelay(200); 722 mdelay(200);
746 dev->dvb.frontend = lgdt330x_attach(&pchdtv_hd5500, 723 dev->dvb.frontend = dvb_attach(lgdt330x_attach,
747 &dev->core->i2c_adap); 724 &pchdtv_hd5500,
725 &dev->core->i2c_adap);
748 if (dev->dvb.frontend != NULL) { 726 if (dev->dvb.frontend != NULL) {
749 dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3303_tuner_set_params; 727 dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3303_tuner_set_params;
750 } 728 }
751 } 729 }
752 break; 730 break;
753#endif
754#ifdef HAVE_NXT200X
755 case CX88_BOARD_ATI_HDTVWONDER: 731 case CX88_BOARD_ATI_HDTVWONDER:
756 dev->dvb.frontend = nxt200x_attach(&ati_hdtvwonder, 732 dev->dvb.frontend = dvb_attach(nxt200x_attach,
757 &dev->core->i2c_adap); 733 &ati_hdtvwonder,
734 &dev->core->i2c_adap);
758 if (dev->dvb.frontend != NULL) { 735 if (dev->dvb.frontend != NULL) {
759 dvb_pll_attach(dev->dvb.frontend, 0x61, 736 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
760 &dev->core->i2c_adap, 737 NULL, &dvb_pll_tuv1236d);
761 &dvb_pll_tuv1236d);
762 } 738 }
763 break; 739 break;
764#endif
765#ifdef HAVE_CX24123
766 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: 740 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
767 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: 741 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
768 dev->dvb.frontend = cx24123_attach(&hauppauge_novas_config, 742 dev->dvb.frontend = dvb_attach(cx24123_attach,
769 &dev->core->i2c_adap); 743 &hauppauge_novas_config,
744 &dev->core->i2c_adap);
770 if (dev->dvb.frontend) { 745 if (dev->dvb.frontend) {
771 isl6421_attach(dev->dvb.frontend, &dev->core->i2c_adap, 746 dvb_attach(isl6421_attach, dev->dvb.frontend,
772 0x08, 0x00, 0x00); 747 &dev->core->i2c_adap, 0x08, 0x00, 0x00);
773 } 748 }
774 break; 749 break;
775 case CX88_BOARD_KWORLD_DVBS_100: 750 case CX88_BOARD_KWORLD_DVBS_100:
776 dev->dvb.frontend = cx24123_attach(&kworld_dvbs_100_config, 751 dev->dvb.frontend = dvb_attach(cx24123_attach,
777 &dev->core->i2c_adap); 752 &kworld_dvbs_100_config,
753 &dev->core->i2c_adap);
778 if (dev->dvb.frontend) { 754 if (dev->dvb.frontend) {
779 dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; 755 dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage;
780 dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; 756 dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage;
781 } 757 }
782 break; 758 break;
783 case CX88_BOARD_GENIATECH_DVBS: 759 case CX88_BOARD_GENIATECH_DVBS:
784 dev->dvb.frontend = cx24123_attach(&geniatech_dvbs_config, 760 dev->dvb.frontend = dvb_attach(cx24123_attach,
785 &dev->core->i2c_adap); 761 &geniatech_dvbs_config,
762 &dev->core->i2c_adap);
786 if (dev->dvb.frontend) { 763 if (dev->dvb.frontend) {
787 dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; 764 dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage;
788 dev->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage; 765 dev->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage;
789 } 766 }
790 break; 767 break;
791#endif
792 default: 768 default:
793 printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", 769 printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n",
794 dev->core->name); 770 dev->core->name);
@@ -908,8 +884,10 @@ static struct pci_driver dvb_pci_driver = {
908 .id_table = cx8802_pci_tbl, 884 .id_table = cx8802_pci_tbl,
909 .probe = dvb_probe, 885 .probe = dvb_probe,
910 .remove = __devexit_p(dvb_remove), 886 .remove = __devexit_p(dvb_remove),
887#ifdef CONFIG_PM
911 .suspend = cx8802_suspend_common, 888 .suspend = cx8802_suspend_common,
912 .resume = cx8802_resume_common, 889 .resume = cx8802_resume_common,
890#endif
913}; 891};
914 892
915static int dvb_init(void) 893static int dvb_init(void)
diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c
index 7bea34714861..27b5dbb2ca1a 100644
--- a/drivers/media/video/cx88/cx88-i2c.c
+++ b/drivers/media/video/cx88/cx88-i2c.c
@@ -7,6 +7,9 @@
7 (c) 2002 Yurij Sysoev <yurij@naturesoft.net> 7 (c) 2002 Yurij Sysoev <yurij@naturesoft.net>
8 (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org> 8 (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org>
9 9
10 (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org>
11 - Multituner support and i2c address binding
12
10 This program is free software; you can redistribute it and/or modify 13 This program is free software; you can redistribute it and/or modify
11 it under the terms of the GNU General Public License as published by 14 it under the terms of the GNU General Public License as published by
12 the Free Software Foundation; either version 2 of the License, or 15 the Free Software Foundation; either version 2 of the License, or
@@ -40,6 +43,11 @@ static unsigned int i2c_scan = 0;
40module_param(i2c_scan, int, 0444); 43module_param(i2c_scan, int, 0444);
41MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); 44MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time");
42 45
46static unsigned int i2c_udelay = 5;
47module_param(i2c_udelay, int, 0644);
48MODULE_PARM_DESC(i2c_udelay,"i2c delay at insmod time, in usecs "
49 "(should be 5 or higher). Lower value means higher bus speed.");
50
43#define dprintk(level,fmt, arg...) if (i2c_debug >= level) \ 51#define dprintk(level,fmt, arg...) if (i2c_debug >= level) \
44 printk(KERN_DEBUG "%s: " fmt, core->name , ## arg) 52 printk(KERN_DEBUG "%s: " fmt, core->name , ## arg)
45 53
@@ -198,6 +206,11 @@ static void do_i2c_scan(char *name, struct i2c_client *c)
198/* init + register i2c algo-bit adapter */ 206/* init + register i2c algo-bit adapter */
199int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) 207int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci)
200{ 208{
209 /* Prevents usage of invalid delay values */
210 if (i2c_udelay<5)
211 i2c_udelay=5;
212 cx8800_i2c_algo_template.udelay=i2c_udelay;
213
201 memcpy(&core->i2c_adap, &cx8800_i2c_adap_template, 214 memcpy(&core->i2c_adap, &cx8800_i2c_adap_template,
202 sizeof(core->i2c_adap)); 215 sizeof(core->i2c_adap));
203 memcpy(&core->i2c_algo, &cx8800_i2c_algo_template, 216 memcpy(&core->i2c_algo, &cx8800_i2c_algo_template,
diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c
index c25564648993..83ebf7a3c054 100644
--- a/drivers/media/video/cx88/cx88-input.c
+++ b/drivers/media/video/cx88/cx88-input.c
@@ -107,7 +107,15 @@ static void cx88_ir_handle_key(struct cx88_IR *ir)
107 (gpio & ir->mask_keydown) ? " down" : "", 107 (gpio & ir->mask_keydown) ? " down" : "",
108 (gpio & ir->mask_keyup) ? " up" : ""); 108 (gpio & ir->mask_keyup) ? " up" : "");
109 109
110 if (ir->mask_keydown) { 110 if (ir->core->board == CX88_BOARD_NORWOOD_MICRO) {
111 u32 gpio_key = cx_read(MO_GP0_IO);
112
113 data = (data << 4) | ((gpio_key & 0xf0) >> 4);
114
115 ir_input_keydown(ir->input, &ir->ir, data, data);
116 ir_input_nokey(ir->input, &ir->ir);
117
118 } else if (ir->mask_keydown) {
111 /* bit set on keydown */ 119 /* bit set on keydown */
112 if (gpio & ir->mask_keydown) { 120 if (gpio & ir->mask_keydown) {
113 ir_input_keydown(ir->input, &ir->ir, data, data); 121 ir_input_keydown(ir->input, &ir->ir, data, data);
@@ -187,6 +195,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
187 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: 195 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
188 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: 196 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
189 case CX88_BOARD_HAUPPAUGE_HVR1100: 197 case CX88_BOARD_HAUPPAUGE_HVR1100:
198 case CX88_BOARD_HAUPPAUGE_HVR1300:
190 ir_codes = ir_codes_hauppauge_new; 199 ir_codes = ir_codes_hauppauge_new;
191 ir_type = IR_TYPE_RC5; 200 ir_type = IR_TYPE_RC5;
192 ir->sampling = 1; 201 ir->sampling = 1;
@@ -248,6 +257,13 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci)
248 ir_type = IR_TYPE_PD; 257 ir_type = IR_TYPE_PD;
249 ir->sampling = 0xff00; /* address */ 258 ir->sampling = 0xff00; /* address */
250 break; 259 break;
260 case CX88_BOARD_NORWOOD_MICRO:
261 ir_codes = ir_codes_norwood;
262 ir->gpio_addr = MO_GP1_IO;
263 ir->mask_keycode = 0x0e;
264 ir->mask_keyup = 0x80;
265 ir->polling = 50; /* ms */
266 break;
251 case CX88_BOARD_NPGTECH_REALTV_TOP10FM: 267 case CX88_BOARD_NPGTECH_REALTV_TOP10FM:
252 ir_codes = ir_codes_npgtech; 268 ir_codes = ir_codes_npgtech;
253 ir->gpio_addr = MO_GP0_IO; 269 ir->gpio_addr = MO_GP0_IO;
@@ -402,6 +418,7 @@ void cx88_ir_irq(struct cx88_core *core)
402 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: 418 case CX88_BOARD_HAUPPAUGE_NOVASE2_S1:
403 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: 419 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1:
404 case CX88_BOARD_HAUPPAUGE_HVR1100: 420 case CX88_BOARD_HAUPPAUGE_HVR1100:
421 case CX88_BOARD_HAUPPAUGE_HVR1300:
405 ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); 422 ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7);
406 ir_dprintk("biphase decoded: %x\n", ircode); 423 ir_dprintk("biphase decoded: %x\n", ircode);
407 if ((ircode & 0xfffff000) != 0x3000) 424 if ((ircode & 0xfffff000) != 0x3000)
diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c
index 5785c3481579..741e7c5e69ec 100644
--- a/drivers/media/video/cx88/cx88-tvaudio.c
+++ b/drivers/media/video/cx88/cx88-tvaudio.c
@@ -52,7 +52,6 @@
52#include <linux/init.h> 52#include <linux/init.h>
53#include <linux/smp_lock.h> 53#include <linux/smp_lock.h>
54#include <linux/delay.h> 54#include <linux/delay.h>
55#include <linux/config.h>
56#include <linux/kthread.h> 55#include <linux/kthread.h>
57 56
58#include "cx88.h" 57#include "cx88.h"
@@ -138,14 +137,10 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl)
138{ 137{
139 u32 volume; 138 u32 volume;
140 139
141#ifndef CONFIG_VIDEO_CX88_ALSA
142 /* restart dma; This avoids buzz in NICAM and is good in others */ 140 /* restart dma; This avoids buzz in NICAM and is good in others */
143 cx88_stop_audio_dma(core); 141 cx88_stop_audio_dma(core);
144#endif
145 cx_write(AUD_RATE_THRES_DMD, 0x000000C0); 142 cx_write(AUD_RATE_THRES_DMD, 0x000000C0);
146#ifndef CONFIG_VIDEO_CX88_ALSA
147 cx88_start_audio_dma(core); 143 cx88_start_audio_dma(core);
148#endif
149 144
150 if (cx88_boards[core->board].blackbird) { 145 if (cx88_boards[core->board].blackbird) {
151 /* sets sound input from external adc */ 146 /* sets sound input from external adc */
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c
index 94c92bacc342..fbc79e9842aa 100644
--- a/drivers/media/video/cx88/cx88-video.c
+++ b/drivers/media/video/cx88/cx88-video.c
@@ -497,6 +497,7 @@ static int start_video_dma(struct cx8800_dev *dev,
497 return 0; 497 return 0;
498} 498}
499 499
500#ifdef CONFIG_PM
500static int stop_video_dma(struct cx8800_dev *dev) 501static int stop_video_dma(struct cx8800_dev *dev)
501{ 502{
502 struct cx88_core *core = dev->core; 503 struct cx88_core *core = dev->core;
@@ -512,6 +513,7 @@ static int stop_video_dma(struct cx8800_dev *dev)
512 cx_clear(MO_VID_INTMSK, 0x0f0011); 513 cx_clear(MO_VID_INTMSK, 0x0f0011);
513 return 0; 514 return 0;
514} 515}
516#endif
515 517
516static int restart_video_queue(struct cx8800_dev *dev, 518static int restart_video_queue(struct cx8800_dev *dev,
517 struct cx88_dmaqueue *q) 519 struct cx88_dmaqueue *q)
@@ -2017,6 +2019,7 @@ static void __devexit cx8800_finidev(struct pci_dev *pci_dev)
2017 kfree(dev); 2019 kfree(dev);
2018} 2020}
2019 2021
2022#ifdef CONFIG_PM
2020static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) 2023static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state)
2021{ 2024{
2022 struct cx8800_dev *dev = pci_get_drvdata(pci_dev); 2025 struct cx8800_dev *dev = pci_get_drvdata(pci_dev);
@@ -2092,6 +2095,7 @@ static int cx8800_resume(struct pci_dev *pci_dev)
2092 2095
2093 return 0; 2096 return 0;
2094} 2097}
2098#endif
2095 2099
2096/* ----------------------------------------------------------- */ 2100/* ----------------------------------------------------------- */
2097 2101
@@ -2112,9 +2116,10 @@ static struct pci_driver cx8800_pci_driver = {
2112 .id_table = cx8800_pci_tbl, 2116 .id_table = cx8800_pci_tbl,
2113 .probe = cx8800_initdev, 2117 .probe = cx8800_initdev,
2114 .remove = __devexit_p(cx8800_finidev), 2118 .remove = __devexit_p(cx8800_finidev),
2115 2119#ifdef CONFIG_PM
2116 .suspend = cx8800_suspend, 2120 .suspend = cx8800_suspend,
2117 .resume = cx8800_resume, 2121 .resume = cx8800_resume,
2122#endif
2118}; 2123};
2119 2124
2120static int cx8800_init(void) 2125static int cx8800_init(void)
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h
index e7810955dd4f..89f12e273b7f 100644
--- a/drivers/media/video/cx88/cx88.h
+++ b/drivers/media/video/cx88/cx88.h
@@ -197,6 +197,10 @@ extern struct sram_channel cx88_sram_channels[];
197#define CX88_BOARD_NPGTECH_REALTV_TOP10FM 50 197#define CX88_BOARD_NPGTECH_REALTV_TOP10FM 50
198#define CX88_BOARD_WINFAST_DTV2000H 51 198#define CX88_BOARD_WINFAST_DTV2000H 51
199#define CX88_BOARD_GENIATECH_DVBS 52 199#define CX88_BOARD_GENIATECH_DVBS 52
200#define CX88_BOARD_HAUPPAUGE_HVR3000 53
201#define CX88_BOARD_NORWOOD_MICRO 54
202#define CX88_BOARD_TE_DTV_250_OEM_SWANN 55
203#define CX88_BOARD_HAUPPAUGE_HVR1300 56
200 204
201enum cx88_itype { 205enum cx88_itype {
202 CX88_VMUX_COMPOSITE1 = 1, 206 CX88_VMUX_COMPOSITE1 = 1,
@@ -545,6 +549,7 @@ extern const unsigned int cx88_idcount;
545 549
546extern void cx88_card_list(struct cx88_core *core, struct pci_dev *pci); 550extern void cx88_card_list(struct cx88_core *core, struct pci_dev *pci);
547extern void cx88_card_setup(struct cx88_core *core); 551extern void cx88_card_setup(struct cx88_core *core);
552extern void cx88_card_setup_pre_i2c(struct cx88_core *core);
548 553
549/* ----------------------------------------------------------- */ 554/* ----------------------------------------------------------- */
550/* cx88-tvaudio.c */ 555/* cx88-tvaudio.c */
diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig
index dfb15bfb83dc..9285a58e47aa 100644
--- a/drivers/media/video/em28xx/Kconfig
+++ b/drivers/media/video/em28xx/Kconfig
@@ -5,7 +5,8 @@ config VIDEO_EM28XX
5 select VIDEO_TUNER 5 select VIDEO_TUNER
6 select VIDEO_TVEEPROM 6 select VIDEO_TVEEPROM
7 select VIDEO_IR 7 select VIDEO_IR
8 select VIDEO_SAA711X 8 select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO
9 select VIDEO_TVP5150 if VIDEO_HELPER_CHIPS_AUTO
9 ---help--- 10 ---help---
10 This is a video4linux driver for Empia 28xx based TV cards. 11 This is a video4linux driver for Empia 28xx based TV cards.
11 12
diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c
index 2a461dde480c..20df657b70c8 100644
--- a/drivers/media/video/em28xx/em28xx-video.c
+++ b/drivers/media/video/em28xx/em28xx-video.c
@@ -174,7 +174,7 @@ static void em28xx_config_i2c(struct em28xx *dev)
174 174
175 route.input = INPUT(dev->ctl_input)->vmux; 175 route.input = INPUT(dev->ctl_input)->vmux;
176 route.output = 0; 176 route.output = 0;
177 em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, NULL); 177 em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, 0);
178 em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route); 178 em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route);
179 em28xx_i2c_call_clients(dev, VIDIOC_STREAMON, NULL); 179 em28xx_i2c_call_clients(dev, VIDIOC_STREAMON, NULL);
180 180
diff --git a/drivers/media/video/ks0127.c b/drivers/media/video/ks0127.c
index 3bf7ac4f5288..c1a377f797d9 100644
--- a/drivers/media/video/ks0127.c
+++ b/drivers/media/video/ks0127.c
@@ -832,8 +832,7 @@ static int ks0127_detach(struct i2c_client *client)
832static int __devinit ks0127_init_module(void) 832static int __devinit ks0127_init_module(void)
833{ 833{
834 init_reg_defaults(); 834 init_reg_defaults();
835 i2c_add_driver(&i2c_driver_ks0127); 835 return i2c_add_driver(&i2c_driver_ks0127);
836 return 0;
837} 836}
838 837
839static void __devexit ks0127_cleanup_module(void) 838static void __devexit ks0127_cleanup_module(void)
diff --git a/drivers/media/video/pvrusb2/Kconfig b/drivers/media/video/pvrusb2/Kconfig
index 7e727fe14b32..a52171ef6134 100644
--- a/drivers/media/video/pvrusb2/Kconfig
+++ b/drivers/media/video/pvrusb2/Kconfig
@@ -5,8 +5,6 @@ config VIDEO_PVRUSB2
5 select VIDEO_TUNER 5 select VIDEO_TUNER
6 select VIDEO_TVEEPROM 6 select VIDEO_TVEEPROM
7 select VIDEO_CX2341X 7 select VIDEO_CX2341X
8 select VIDEO_SAA711X
9 select VIDEO_MSP3400
10 ---help--- 8 ---help---
11 This is a video4linux driver for Conexant 23416 based 9 This is a video4linux driver for Conexant 23416 based
12 usb2 personal video recorder devices. 10 usb2 personal video recorder devices.
@@ -14,6 +12,20 @@ config VIDEO_PVRUSB2
14 To compile this driver as a module, choose M here: the 12 To compile this driver as a module, choose M here: the
15 module will be called pvrusb2 13 module will be called pvrusb2
16 14
15config VIDEO_PVRUSB2_29XXX
16 bool "Hauppauge WinTV-PVR USB2 support for 29xxx model series"
17 depends on VIDEO_PVRUSB2 && EXPERIMENTAL
18 select VIDEO_SAA711X
19 select VIDEO_MSP3400
20 ---help---
21 This option enables support for WinTV-PVR USB2 devices whose
22 model number is of the form "29xxx" (leading prefix of "29"
23 followed by 3 digits).
24 To see if you may need this option, examine the white
25 sticker on the underside of your device.
26
27 If you are in doubt, say Y.
28
17config VIDEO_PVRUSB2_24XXX 29config VIDEO_PVRUSB2_24XXX
18 bool "Hauppauge WinTV-PVR USB2 support for 24xxx model series" 30 bool "Hauppauge WinTV-PVR USB2 support for 24xxx model series"
19 depends on VIDEO_PVRUSB2 && EXPERIMENTAL 31 depends on VIDEO_PVRUSB2 && EXPERIMENTAL
@@ -60,3 +72,5 @@ config VIDEO_PVRUSB2_DEBUGIFC
60 You do not need to select this option unless you plan 72 You do not need to select this option unless you plan
61 on debugging the driver or performing a manual firmware 73 on debugging the driver or performing a manual firmware
62 extraction. 74 extraction.
75
76 If you are in doubt, say N.
diff --git a/drivers/media/video/pvrusb2/Makefile b/drivers/media/video/pvrusb2/Makefile
index 02e414210dac..69b3e43cd0eb 100644
--- a/drivers/media/video/pvrusb2/Makefile
+++ b/drivers/media/video/pvrusb2/Makefile
@@ -1,10 +1,6 @@
1obj-pvrusb2-sysfs-$(CONFIG_VIDEO_PVRUSB2_SYSFS) := pvrusb2-sysfs.o 1obj-pvrusb2-sysfs-$(CONFIG_VIDEO_PVRUSB2_SYSFS) := pvrusb2-sysfs.o
2obj-pvrusb2-debugifc-$(CONFIG_VIDEO_PVRUSB2_DEBUGIFC) := pvrusb2-debugifc.o 2obj-pvrusb2-debugifc-$(CONFIG_VIDEO_PVRUSB2_DEBUGIFC) := pvrusb2-debugifc.o
3 3
4obj-pvrusb2-24xxx-$(CONFIG_VIDEO_PVRUSB2_24XXX) := \
5 pvrusb2-cx2584x-v4l.o \
6 pvrusb2-wm8775.o
7
8pvrusb2-objs := pvrusb2-i2c-core.o pvrusb2-i2c-cmd-v4l2.o \ 4pvrusb2-objs := pvrusb2-i2c-core.o pvrusb2-i2c-cmd-v4l2.o \
9 pvrusb2-audio.o pvrusb2-i2c-chips-v4l2.o \ 5 pvrusb2-audio.o pvrusb2-i2c-chips-v4l2.o \
10 pvrusb2-encoder.o pvrusb2-video-v4l.o \ 6 pvrusb2-encoder.o pvrusb2-video-v4l.o \
@@ -12,7 +8,7 @@ pvrusb2-objs := pvrusb2-i2c-core.o pvrusb2-i2c-cmd-v4l2.o \
12 pvrusb2-main.o pvrusb2-hdw.o pvrusb2-v4l2.o \ 8 pvrusb2-main.o pvrusb2-hdw.o pvrusb2-v4l2.o \
13 pvrusb2-ctrl.o pvrusb2-std.o \ 9 pvrusb2-ctrl.o pvrusb2-std.o \
14 pvrusb2-context.o pvrusb2-io.o pvrusb2-ioread.o \ 10 pvrusb2-context.o pvrusb2-io.o pvrusb2-ioread.o \
15 $(obj-pvrusb2-24xxx-y) \ 11 pvrusb2-cx2584x-v4l.o pvrusb2-wm8775.o \
16 $(obj-pvrusb2-sysfs-y) $(obj-pvrusb2-debugifc-y) 12 $(obj-pvrusb2-sysfs-y) $(obj-pvrusb2-debugifc-y)
17 13
18obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2.o 14obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2.o
diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
index fb6198f1df98..c77de859cc8e 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c
@@ -43,12 +43,17 @@ int pvr2_ctrl_set_mask_value(struct pvr2_ctrl *cptr,int mask,int val)
43 if (cptr->info->type == pvr2_ctl_bitmask) { 43 if (cptr->info->type == pvr2_ctl_bitmask) {
44 mask &= cptr->info->def.type_bitmask.valid_bits; 44 mask &= cptr->info->def.type_bitmask.valid_bits;
45 } else if (cptr->info->type == pvr2_ctl_int) { 45 } else if (cptr->info->type == pvr2_ctl_int) {
46 if (val < cptr->info->def.type_int.min_value) { 46 int lim;
47 break; 47 lim = cptr->info->def.type_int.min_value;
48 if (cptr->info->get_min_value) {
49 cptr->info->get_min_value(cptr,&lim);
48 } 50 }
49 if (val > cptr->info->def.type_int.max_value) { 51 if (val < lim) break;
50 break; 52 lim = cptr->info->def.type_int.max_value;
53 if (cptr->info->get_max_value) {
54 cptr->info->get_max_value(cptr,&lim);
51 } 55 }
56 if (val > lim) break;
52 } else if (cptr->info->type == pvr2_ctl_enum) { 57 } else if (cptr->info->type == pvr2_ctl_enum) {
53 if (val >= cptr->info->def.type_enum.count) { 58 if (val >= cptr->info->def.type_enum.count) {
54 break; 59 break;
@@ -91,7 +96,9 @@ int pvr2_ctrl_get_max(struct pvr2_ctrl *cptr)
91 int ret = 0; 96 int ret = 0;
92 if (!cptr) return 0; 97 if (!cptr) return 0;
93 LOCK_TAKE(cptr->hdw->big_lock); do { 98 LOCK_TAKE(cptr->hdw->big_lock); do {
94 if (cptr->info->type == pvr2_ctl_int) { 99 if (cptr->info->get_max_value) {
100 cptr->info->get_max_value(cptr,&ret);
101 } else if (cptr->info->type == pvr2_ctl_int) {
95 ret = cptr->info->def.type_int.max_value; 102 ret = cptr->info->def.type_int.max_value;
96 } 103 }
97 } while(0); LOCK_GIVE(cptr->hdw->big_lock); 104 } while(0); LOCK_GIVE(cptr->hdw->big_lock);
@@ -105,7 +112,9 @@ int pvr2_ctrl_get_min(struct pvr2_ctrl *cptr)
105 int ret = 0; 112 int ret = 0;
106 if (!cptr) return 0; 113 if (!cptr) return 0;
107 LOCK_TAKE(cptr->hdw->big_lock); do { 114 LOCK_TAKE(cptr->hdw->big_lock); do {
108 if (cptr->info->type == pvr2_ctl_int) { 115 if (cptr->info->get_min_value) {
116 cptr->info->get_min_value(cptr,&ret);
117 } else if (cptr->info->type == pvr2_ctl_int) {
109 ret = cptr->info->def.type_int.min_value; 118 ret = cptr->info->def.type_int.min_value;
110 } 119 }
111 } while(0); LOCK_GIVE(cptr->hdw->big_lock); 120 } while(0); LOCK_GIVE(cptr->hdw->big_lock);
diff --git a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
index c80c26be6e4d..df8feac16aee 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-cx2584x-v4l.c
@@ -221,7 +221,7 @@ static unsigned int decoder_describe(struct pvr2_v4l_cx2584x *ctxt,
221static void decoder_reset(struct pvr2_v4l_cx2584x *ctxt) 221static void decoder_reset(struct pvr2_v4l_cx2584x *ctxt)
222{ 222{
223 int ret; 223 int ret;
224 ret = pvr2_i2c_client_cmd(ctxt->client,VIDIOC_INT_RESET,NULL); 224 ret = pvr2_i2c_client_cmd(ctxt->client,VIDIOC_INT_RESET,0);
225 pvr2_trace(PVR2_TRACE_CHIPS,"i2c cx25840 decoder_reset (ret=%d)",ret); 225 pvr2_trace(PVR2_TRACE_CHIPS,"i2c cx25840 decoder_reset (ret=%d)",ret);
226} 226}
227 227
diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c
index 18a7073501c6..c94f97b79392 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-encoder.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-encoder.c
@@ -317,7 +317,7 @@ int pvr2_encoder_configure(struct pvr2_hdw *hdw)
317 317
318 if (ret) { 318 if (ret) {
319 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 319 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
320 "Failed to configure cx32416"); 320 "Failed to configure cx23416");
321 return ret; 321 return ret;
322 } 322 }
323 323
@@ -337,7 +337,7 @@ int pvr2_encoder_configure(struct pvr2_hdw *hdw)
337 337
338 if (ret) { 338 if (ret) {
339 pvr2_trace(PVR2_TRACE_ERROR_LEGS, 339 pvr2_trace(PVR2_TRACE_ERROR_LEGS,
340 "Failed to initialize cx32416 video input"); 340 "Failed to initialize cx23416 video input");
341 return ret; 341 return ret;
342 } 342 }
343 343
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
index 0d6dc33ca320..34b08fbcc6ea 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
@@ -33,7 +33,6 @@
33 33
34*/ 34*/
35 35
36#include <linux/config.h>
37#include <linux/videodev2.h> 36#include <linux/videodev2.h>
38#include <linux/i2c.h> 37#include <linux/i2c.h>
39#include <linux/mutex.h> 38#include <linux/mutex.h>
@@ -41,32 +40,6 @@
41#include "pvrusb2-io.h" 40#include "pvrusb2-io.h"
42#include <media/cx2341x.h> 41#include <media/cx2341x.h>
43 42
44/* Legal values for the SRATE state variable */
45#define PVR2_CVAL_SRATE_48 0
46#define PVR2_CVAL_SRATE_44_1 1
47
48/* Legal values for the AUDIOBITRATE state variable */
49#define PVR2_CVAL_AUDIOBITRATE_384 0
50#define PVR2_CVAL_AUDIOBITRATE_320 1
51#define PVR2_CVAL_AUDIOBITRATE_256 2
52#define PVR2_CVAL_AUDIOBITRATE_224 3
53#define PVR2_CVAL_AUDIOBITRATE_192 4
54#define PVR2_CVAL_AUDIOBITRATE_160 5
55#define PVR2_CVAL_AUDIOBITRATE_128 6
56#define PVR2_CVAL_AUDIOBITRATE_112 7
57#define PVR2_CVAL_AUDIOBITRATE_96 8
58#define PVR2_CVAL_AUDIOBITRATE_80 9
59#define PVR2_CVAL_AUDIOBITRATE_64 10
60#define PVR2_CVAL_AUDIOBITRATE_56 11
61#define PVR2_CVAL_AUDIOBITRATE_48 12
62#define PVR2_CVAL_AUDIOBITRATE_32 13
63#define PVR2_CVAL_AUDIOBITRATE_VBR 14
64
65/* Legal values for the AUDIOEMPHASIS state variable */
66#define PVR2_CVAL_AUDIOEMPHASIS_NONE 0
67#define PVR2_CVAL_AUDIOEMPHASIS_50_15 1
68#define PVR2_CVAL_AUDIOEMPHASIS_CCITT 2
69
70/* Legal values for PVR2_CID_HSM */ 43/* Legal values for PVR2_CID_HSM */
71#define PVR2_CVAL_HSM_FAIL 0 44#define PVR2_CVAL_HSM_FAIL 0
72#define PVR2_CVAL_HSM_FULL 1 45#define PVR2_CVAL_HSM_FULL 1
@@ -107,6 +80,8 @@ struct pvr2_ctl_info {
107 80
108 /* Control's implementation */ 81 /* Control's implementation */
109 pvr2_ctlf_get_value get_value; /* Get its value */ 82 pvr2_ctlf_get_value get_value; /* Get its value */
83 pvr2_ctlf_get_value get_min_value; /* Get minimum allowed value */
84 pvr2_ctlf_get_value get_max_value; /* Get maximum allowed value */
110 pvr2_ctlf_set_value set_value; /* Set its value */ 85 pvr2_ctlf_set_value set_value; /* Set its value */
111 pvr2_ctlf_val_to_sym val_to_sym; /* Custom convert value->symbol */ 86 pvr2_ctlf_val_to_sym val_to_sym; /* Custom convert value->symbol */
112 pvr2_ctlf_sym_to_val sym_to_val; /* Custom convert symbol->value */ 87 pvr2_ctlf_sym_to_val sym_to_val; /* Custom convert symbol->value */
@@ -193,9 +168,7 @@ struct pvr2_decoder_ctrl {
193 168
194/* Known major hardware variants, keyed from device ID */ 169/* Known major hardware variants, keyed from device ID */
195#define PVR2_HDW_TYPE_29XXX 0 170#define PVR2_HDW_TYPE_29XXX 0
196#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
197#define PVR2_HDW_TYPE_24XXX 1 171#define PVR2_HDW_TYPE_24XXX 1
198#endif
199 172
200typedef int (*pvr2_i2c_func)(struct pvr2_hdw *,u8,u8 *,u16,u8 *, u16); 173typedef int (*pvr2_i2c_func)(struct pvr2_hdw *,u8,u8 *,u16,u8 *, u16);
201#define PVR2_I2C_FUNC_CNT 128 174#define PVR2_I2C_FUNC_CNT 128
diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw.c b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
index be1e5cc78081..88604365777c 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c
@@ -38,9 +38,7 @@
38 38
39struct usb_device_id pvr2_device_table[] = { 39struct usb_device_id pvr2_device_table[] = {
40 [PVR2_HDW_TYPE_29XXX] = { USB_DEVICE(0x2040, 0x2900) }, 40 [PVR2_HDW_TYPE_29XXX] = { USB_DEVICE(0x2040, 0x2900) },
41#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
42 [PVR2_HDW_TYPE_24XXX] = { USB_DEVICE(0x2040, 0x2400) }, 41 [PVR2_HDW_TYPE_24XXX] = { USB_DEVICE(0x2040, 0x2400) },
43#endif
44 { } 42 { }
45}; 43};
46 44
@@ -48,9 +46,7 @@ MODULE_DEVICE_TABLE(usb, pvr2_device_table);
48 46
49static const char *pvr2_device_names[] = { 47static const char *pvr2_device_names[] = {
50 [PVR2_HDW_TYPE_29XXX] = "WinTV PVR USB2 Model Category 29xxxx", 48 [PVR2_HDW_TYPE_29XXX] = "WinTV PVR USB2 Model Category 29xxxx",
51#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
52 [PVR2_HDW_TYPE_24XXX] = "WinTV PVR USB2 Model Category 24xxxx", 49 [PVR2_HDW_TYPE_24XXX] = "WinTV PVR USB2 Model Category 24xxxx",
53#endif
54}; 50};
55 51
56struct pvr2_string_table { 52struct pvr2_string_table {
@@ -58,14 +54,12 @@ struct pvr2_string_table {
58 unsigned int cnt; 54 unsigned int cnt;
59}; 55};
60 56
61#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
62// Names of other client modules to request for 24xxx model hardware 57// Names of other client modules to request for 24xxx model hardware
63static const char *pvr2_client_24xxx[] = { 58static const char *pvr2_client_24xxx[] = {
64 "cx25840", 59 "cx25840",
65 "tuner", 60 "tuner",
66 "wm8775", 61 "wm8775",
67}; 62};
68#endif
69 63
70// Names of other client modules to request for 29xxx model hardware 64// Names of other client modules to request for 29xxx model hardware
71static const char *pvr2_client_29xxx[] = { 65static const char *pvr2_client_29xxx[] = {
@@ -79,12 +73,10 @@ static struct pvr2_string_table pvr2_client_lists[] = {
79 pvr2_client_29xxx, 73 pvr2_client_29xxx,
80 sizeof(pvr2_client_29xxx)/sizeof(pvr2_client_29xxx[0]), 74 sizeof(pvr2_client_29xxx)/sizeof(pvr2_client_29xxx[0]),
81 }, 75 },
82#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
83 [PVR2_HDW_TYPE_24XXX] = { 76 [PVR2_HDW_TYPE_24XXX] = {
84 pvr2_client_24xxx, 77 pvr2_client_24xxx,
85 sizeof(pvr2_client_24xxx)/sizeof(pvr2_client_24xxx[0]), 78 sizeof(pvr2_client_24xxx)/sizeof(pvr2_client_24xxx[0]),
86 }, 79 },
87#endif
88}; 80};
89 81
90static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; 82static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL};
@@ -221,14 +213,15 @@ static const struct pvr2_mpeg_ids mpeg_ids[] = {
221}; 213};
222#define MPEGDEF_COUNT (sizeof(mpeg_ids)/sizeof(mpeg_ids[0])) 214#define MPEGDEF_COUNT (sizeof(mpeg_ids)/sizeof(mpeg_ids[0]))
223 215
216
224static const char *control_values_srate[] = { 217static const char *control_values_srate[] = {
225 [PVR2_CVAL_SRATE_48] = "48KHz", 218 [V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100] = "44.1 kHz",
226 [PVR2_CVAL_SRATE_44_1] = "44.1KHz", 219 [V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000] = "48 kHz",
220 [V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000] = "32 kHz",
227}; 221};
228 222
229 223
230 224
231
232static const char *control_values_input[] = { 225static const char *control_values_input[] = {
233 [PVR2_CVAL_INPUT_TV] = "television", /*xawtv needs this name*/ 226 [PVR2_CVAL_INPUT_TV] = "television", /*xawtv needs this name*/
234 [PVR2_CVAL_INPUT_RADIO] = "radio", 227 [PVR2_CVAL_INPUT_RADIO] = "radio",
@@ -362,6 +355,50 @@ static int ctrl_freq_set(struct pvr2_ctrl *cptr,int m,int v)
362 return 0; 355 return 0;
363} 356}
364 357
358static int ctrl_hres_max_get(struct pvr2_ctrl *cptr,int *vp)
359{
360 /* If we're dealing with a 24xxx device, force the horizontal
361 maximum to be 720 no matter what, since we can't get the device
362 to work properly with any other value. Otherwise just return
363 the normal value. */
364 *vp = cptr->info->def.type_int.max_value;
365 if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) *vp = 720;
366 return 0;
367}
368
369static int ctrl_hres_min_get(struct pvr2_ctrl *cptr,int *vp)
370{
371 /* If we're dealing with a 24xxx device, force the horizontal
372 minimum to be 720 no matter what, since we can't get the device
373 to work properly with any other value. Otherwise just return
374 the normal value. */
375 *vp = cptr->info->def.type_int.min_value;
376 if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) *vp = 720;
377 return 0;
378}
379
380static int ctrl_vres_max_get(struct pvr2_ctrl *cptr,int *vp)
381{
382 /* Actual maximum depends on the video standard in effect. */
383 if (cptr->hdw->std_mask_cur & V4L2_STD_525_60) {
384 *vp = 480;
385 } else {
386 *vp = 576;
387 }
388 return 0;
389}
390
391static int ctrl_vres_min_get(struct pvr2_ctrl *cptr,int *vp)
392{
393 /* Actual minimum depends on device type. */
394 if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) {
395 *vp = 75;
396 } else {
397 *vp = 17;
398 }
399 return 0;
400}
401
365static int ctrl_cx2341x_is_dirty(struct pvr2_ctrl *cptr) 402static int ctrl_cx2341x_is_dirty(struct pvr2_ctrl *cptr)
366{ 403{
367 return cptr->hdw->enc_stale != 0; 404 return cptr->hdw->enc_stale != 0;
@@ -719,19 +756,27 @@ static const struct pvr2_ctl_info control_defs[] = {
719 .internal_id = PVR2_CID_HRES, 756 .internal_id = PVR2_CID_HRES,
720 .default_value = 720, 757 .default_value = 720,
721 DEFREF(res_hor), 758 DEFREF(res_hor),
722 DEFINT(320,720), 759 DEFINT(19,720),
760 /* Hook in check for clamp on horizontal resolution in
761 order to avoid unsolved problem involving cx25840. */
762 .get_max_value = ctrl_hres_max_get,
763 .get_min_value = ctrl_hres_min_get,
723 },{ 764 },{
724 .desc = "Vertical capture resolution", 765 .desc = "Vertical capture resolution",
725 .name = "resolution_ver", 766 .name = "resolution_ver",
726 .internal_id = PVR2_CID_VRES, 767 .internal_id = PVR2_CID_VRES,
727 .default_value = 480, 768 .default_value = 480,
728 DEFREF(res_ver), 769 DEFREF(res_ver),
729 DEFINT(200,625), 770 DEFINT(17,576),
771 /* Hook in check for video standard and adjust maximum
772 depending on the standard. */
773 .get_max_value = ctrl_vres_max_get,
774 .get_min_value = ctrl_vres_min_get,
730 },{ 775 },{
731 .v4l_id = V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, 776 .v4l_id = V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ,
732 .desc = "Sample rate", 777 .default_value = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000,
778 .desc = "Audio Sampling Frequency",
733 .name = "srate", 779 .name = "srate",
734 .default_value = PVR2_CVAL_SRATE_48,
735 DEFREF(srate), 780 DEFREF(srate),
736 DEFENUM(control_values_srate), 781 DEFENUM(control_values_srate),
737 },{ 782 },{
@@ -935,22 +980,18 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw)
935 static const char *fw_files_29xxx[] = { 980 static const char *fw_files_29xxx[] = {
936 "v4l-pvrusb2-29xxx-01.fw", 981 "v4l-pvrusb2-29xxx-01.fw",
937 }; 982 };
938#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
939 static const char *fw_files_24xxx[] = { 983 static const char *fw_files_24xxx[] = {
940 "v4l-pvrusb2-24xxx-01.fw", 984 "v4l-pvrusb2-24xxx-01.fw",
941 }; 985 };
942#endif
943 static const struct pvr2_string_table fw_file_defs[] = { 986 static const struct pvr2_string_table fw_file_defs[] = {
944 [PVR2_HDW_TYPE_29XXX] = { 987 [PVR2_HDW_TYPE_29XXX] = {
945 fw_files_29xxx, 988 fw_files_29xxx,
946 sizeof(fw_files_29xxx)/sizeof(fw_files_29xxx[0]), 989 sizeof(fw_files_29xxx)/sizeof(fw_files_29xxx[0]),
947 }, 990 },
948#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
949 [PVR2_HDW_TYPE_24XXX] = { 991 [PVR2_HDW_TYPE_24XXX] = {
950 fw_files_24xxx, 992 fw_files_24xxx,
951 sizeof(fw_files_24xxx)/sizeof(fw_files_24xxx[0]), 993 sizeof(fw_files_24xxx)/sizeof(fw_files_24xxx[0]),
952 }, 994 },
953#endif
954 }; 995 };
955 hdw->fw1_state = FW1_STATE_FAILED; // default result 996 hdw->fw1_state = FW1_STATE_FAILED; // default result
956 997
@@ -2237,11 +2278,14 @@ static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw)
2237 } 2278 }
2238 2279
2239 if (hdw->std_dirty || 2280 if (hdw->std_dirty ||
2281 hdw->enc_stale ||
2282 hdw->srate_dirty ||
2283 hdw->res_ver_dirty ||
2284 hdw->res_hor_dirty ||
2240 0) { 2285 0) {
2241 /* If any of this changes, then the encoder needs to be 2286 /* If any of this changes, then the encoder needs to be
2242 reconfigured, and we need to reset the stream. */ 2287 reconfigured, and we need to reset the stream. */
2243 stale_subsys_mask |= (1<<PVR2_SUBSYS_B_ENC_CFG); 2288 stale_subsys_mask |= (1<<PVR2_SUBSYS_B_ENC_CFG);
2244 stale_subsys_mask |= hdw->subsys_stream_mask;
2245 } 2289 }
2246 2290
2247 if (hdw->srate_dirty) { 2291 if (hdw->srate_dirty) {
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c
index fbe6039aeb6a..ed3e8105292a 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-chips-v4l2.c
@@ -26,10 +26,8 @@
26#include "pvrusb2-audio.h" 26#include "pvrusb2-audio.h"
27#include "pvrusb2-tuner.h" 27#include "pvrusb2-tuner.h"
28#include "pvrusb2-video-v4l.h" 28#include "pvrusb2-video-v4l.h"
29#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
30#include "pvrusb2-cx2584x-v4l.h" 29#include "pvrusb2-cx2584x-v4l.h"
31#include "pvrusb2-wm8775.h" 30#include "pvrusb2-wm8775.h"
32#endif
33 31
34#define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__) 32#define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__)
35 33
@@ -71,7 +69,6 @@ void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
71 return; 69 return;
72 } 70 }
73 } 71 }
74#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
75 if (id == I2C_DRIVERID_CX25840) { 72 if (id == I2C_DRIVERID_CX25840) {
76 if (pvr2_i2c_cx2584x_v4l_setup(hdw,cp)) { 73 if (pvr2_i2c_cx2584x_v4l_setup(hdw,cp)) {
77 return; 74 return;
@@ -82,7 +79,6 @@ void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp)
82 return; 79 return;
83 } 80 }
84 } 81 }
85#endif
86 if (id == I2C_DRIVERID_SAA711X) { 82 if (id == I2C_DRIVERID_SAA711X) {
87 if (pvr2_i2c_decoder_v4l_setup(hdw,cp)) { 83 if (pvr2_i2c_decoder_v4l_setup(hdw,cp)) {
88 return; 84 return;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c
index 8a9933dec912..05ea17afe903 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c
@@ -31,7 +31,7 @@ static void set_standard(struct pvr2_hdw *hdw)
31 v4l2_std_id vs; 31 v4l2_std_id vs;
32 vs = hdw->std_mask_cur; 32 vs = hdw->std_mask_cur;
33 pvr2_trace(PVR2_TRACE_CHIPS, 33 pvr2_trace(PVR2_TRACE_CHIPS,
34 "i2c v4l2 set_standard(0x%llx)",(__u64)vs); 34 "i2c v4l2 set_standard(0x%llx)",(long long unsigned)vs);
35 35
36 pvr2_i2c_core_cmd(hdw,VIDIOC_S_STD,&vs); 36 pvr2_i2c_core_cmd(hdw,VIDIOC_S_STD,&vs);
37} 37}
diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
index 7fca47982277..3b9012f8e380 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c
@@ -185,8 +185,6 @@ static int pvr2_i2c_basic_op(struct pvr2_hdw *hdw,
185 } 185 }
186} 186}
187 187
188#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
189
190/* This is a special entry point that is entered if an I2C operation is 188/* This is a special entry point that is entered if an I2C operation is
191 attempted to a wm8775 chip on model 24xxx hardware. Autodetect of this 189 attempted to a wm8775 chip on model 24xxx hardware. Autodetect of this
192 part doesn't work, but we know it is really there. So let's look for 190 part doesn't work, but we know it is really there. So let's look for
@@ -289,8 +287,6 @@ static int i2c_hack_cx25840(struct pvr2_hdw *hdw,
289 return -EIO; 287 return -EIO;
290} 288}
291 289
292#endif /* CONFIG_VIDEO_PVRUSB2_24XXX */
293
294/* This is a very, very limited I2C adapter implementation. We can only 290/* This is a very, very limited I2C adapter implementation. We can only
295 support what we actually know will work on the device... */ 291 support what we actually know will work on the device... */
296static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap, 292static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap,
@@ -897,14 +893,12 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw)
897 hdw->i2c_func[idx] = pvr2_i2c_basic_op; 893 hdw->i2c_func[idx] = pvr2_i2c_basic_op;
898 } 894 }
899 895
900#ifdef CONFIG_VIDEO_PVRUSB2_24XXX
901 // If however we're dealing with new hardware, insert some hacks in 896 // If however we're dealing with new hardware, insert some hacks in
902 // the I2C transfer stack to let things work better. 897 // the I2C transfer stack to let things work better.
903 if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { 898 if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) {
904 hdw->i2c_func[0x1b] = i2c_hack_wm8775; 899 hdw->i2c_func[0x1b] = i2c_hack_wm8775;
905 hdw->i2c_func[0x44] = i2c_hack_cx25840; 900 hdw->i2c_func[0x44] = i2c_hack_cx25840;
906 } 901 }
907#endif
908 902
909 // Configure the adapter and set up everything else related to it. 903 // Configure the adapter and set up everything else related to it.
910 memcpy(&hdw->i2c_adap,&pvr2_i2c_adap_template,sizeof(hdw->i2c_adap)); 904 memcpy(&hdw->i2c_adap,&pvr2_i2c_adap_template,sizeof(hdw->i2c_adap));
diff --git a/drivers/media/video/pvrusb2/pvrusb2-main.c b/drivers/media/video/pvrusb2/pvrusb2-main.c
index 8f1a5afdd34e..e976c484c058 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-main.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-main.c
@@ -20,7 +20,6 @@
20 * 20 *
21 */ 21 */
22 22
23#include <linux/config.h>
24#include <linux/kernel.h> 23#include <linux/kernel.h>
25#include <linux/errno.h> 24#include <linux/errno.h>
26#include <linux/slab.h> 25#include <linux/slab.h>
diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
index d1dda5caf406..c294f46db9b9 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c
@@ -19,7 +19,6 @@
19 * 19 *
20 */ 20 */
21 21
22#include <linux/config.h>
23#include <linux/string.h> 22#include <linux/string.h>
24#include <linux/slab.h> 23#include <linux/slab.h>
25#include <asm/semaphore.h> 24#include <asm/semaphore.h>
@@ -40,8 +39,6 @@ struct pvr2_sysfs {
40#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ 39#endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */
41 struct pvr2_sysfs_ctl_item *item_first; 40 struct pvr2_sysfs_ctl_item *item_first;
42 struct pvr2_sysfs_ctl_item *item_last; 41 struct pvr2_sysfs_ctl_item *item_last;
43 struct sysfs_ops kops;
44 struct kobj_type ktype;
45 struct class_device_attribute attr_v4l_minor_number; 42 struct class_device_attribute attr_v4l_minor_number;
46 struct class_device_attribute attr_unit_number; 43 struct class_device_attribute attr_unit_number;
47 int v4l_minor_number_created_ok; 44 int v4l_minor_number_created_ok;
diff --git a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
index 0caf70b8c0de..3608c2f81df9 100644
--- a/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
+++ b/drivers/media/video/pvrusb2/pvrusb2-v4l2.c
@@ -459,18 +459,26 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
459 ret = 0; 459 ret = 0;
460 switch(vf->type) { 460 switch(vf->type) {
461 case V4L2_BUF_TYPE_VIDEO_CAPTURE: { 461 case V4L2_BUF_TYPE_VIDEO_CAPTURE: {
462 int lmin,lmax;
463 struct pvr2_ctrl *hcp,*vcp;
462 int h = vf->fmt.pix.height; 464 int h = vf->fmt.pix.height;
463 int w = vf->fmt.pix.width; 465 int w = vf->fmt.pix.width;
464 466 hcp = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_HRES);
465 if (h < 200) { 467 vcp = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_VRES);
466 h = 200; 468
467 } else if (h > 625) { 469 lmin = pvr2_ctrl_get_min(hcp);
468 h = 625; 470 lmax = pvr2_ctrl_get_max(hcp);
471 if (w < lmin) {
472 w = lmin;
473 } else if (w > lmax) {
474 w = lmax;
469 } 475 }
470 if (w < 320) { 476 lmin = pvr2_ctrl_get_min(vcp);
471 w = 320; 477 lmax = pvr2_ctrl_get_max(vcp);
472 } else if (w > 720) { 478 if (h < lmin) {
473 w = 720; 479 h = lmin;
480 } else if (h > lmax) {
481 h = lmax;
474 } 482 }
475 483
476 memcpy(vf, &pvr_format[PVR_FORMAT_PIX], 484 memcpy(vf, &pvr_format[PVR_FORMAT_PIX],
@@ -479,14 +487,8 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file,
479 vf->fmt.pix.height = h; 487 vf->fmt.pix.height = h;
480 488
481 if (cmd == VIDIOC_S_FMT) { 489 if (cmd == VIDIOC_S_FMT) {
482 pvr2_ctrl_set_value( 490 pvr2_ctrl_set_value(hcp,vf->fmt.pix.width);
483 pvr2_hdw_get_ctrl_by_id(hdw, 491 pvr2_ctrl_set_value(vcp,vf->fmt.pix.height);
484 PVR2_CID_HRES),
485 vf->fmt.pix.width);
486 pvr2_ctrl_set_value(
487 pvr2_hdw_get_ctrl_by_id(hdw,
488 PVR2_CID_VRES),
489 vf->fmt.pix.height);
490 } 492 }
491 } break; 493 } break;
492 case V4L2_BUF_TYPE_VBI_CAPTURE: 494 case V4L2_BUF_TYPE_VBI_CAPTURE:
diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c
index 59a187272c83..77bb940a1a4f 100644
--- a/drivers/media/video/saa5246a.c
+++ b/drivers/media/video/saa5246a.c
@@ -830,7 +830,6 @@ static struct video_device saa_template =
830 .owner = THIS_MODULE, 830 .owner = THIS_MODULE,
831 .name = IF_NAME, 831 .name = IF_NAME,
832 .type = VID_TYPE_TELETEXT, 832 .type = VID_TYPE_TELETEXT,
833 .hardware = VID_HARDWARE_SAA5249,
834 .fops = &saa_fops, 833 .fops = &saa_fops,
835 .release = video_device_release, 834 .release = video_device_release,
836 .minor = -1, 835 .minor = -1,
diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c
index 19a8d65699f8..bb3fb4387f65 100644
--- a/drivers/media/video/saa5249.c
+++ b/drivers/media/video/saa5249.c
@@ -713,7 +713,6 @@ static struct video_device saa_template =
713 .owner = THIS_MODULE, 713 .owner = THIS_MODULE,
714 .name = IF_NAME, 714 .name = IF_NAME,
715 .type = VID_TYPE_TELETEXT, /*| VID_TYPE_TUNER ?? */ 715 .type = VID_TYPE_TELETEXT, /*| VID_TYPE_TUNER ?? */
716 .hardware = VID_HARDWARE_SAA5249,
717 .fops = &saa_fops, 716 .fops = &saa_fops,
718}; 717};
719 718
diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c
index b59c11717273..974179d4d389 100644
--- a/drivers/media/video/saa7115.c
+++ b/drivers/media/video/saa7115.c
@@ -1,4 +1,6 @@
1/* saa7115 - Philips SAA7113/SAA7114/SAA7115 video decoder driver 1/* saa711x - Philips SAA711x video decoder driver
2 * This driver can work with saa7111, saa7111a, saa7113, saa7114,
3 * saa7115 and saa7118.
2 * 4 *
3 * Based on saa7114 driver by Maxim Yevtyushkin, which is based on 5 * Based on saa7114 driver by Maxim Yevtyushkin, which is based on
4 * the saa7111 driver by Dave Perks. 6 * the saa7111 driver by Dave Perks.
@@ -16,7 +18,9 @@
16 * (2/17/2003) 18 * (2/17/2003)
17 * 19 *
18 * VBI support (2004) and cleanups (2005) by Hans Verkuil <hverkuil@xs4all.nl> 20 * VBI support (2004) and cleanups (2005) by Hans Verkuil <hverkuil@xs4all.nl>
19 * SAA7113 support by Mauro Carvalho Chehab <mchehab@infradead.org> 21 *
22 * Copyright (c) 2005-2006 Mauro Carvalho Chehab <mchehab@infradead.org>
23 * SAA7111, SAA7113 and SAA7118 support
20 * 24 *
21 * This program is free software; you can redistribute it and/or 25 * This program is free software; you can redistribute it and/or
22 * modify it under the terms of the GNU General Public License 26 * modify it under the terms of the GNU General Public License
@@ -33,6 +37,7 @@
33 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 37 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
34 */ 38 */
35 39
40#include "saa711x_regs.h"
36 41
37#include <linux/kernel.h> 42#include <linux/kernel.h>
38#include <linux/module.h> 43#include <linux/module.h>
@@ -43,7 +48,9 @@
43#include <media/saa7115.h> 48#include <media/saa7115.h>
44#include <asm/div64.h> 49#include <asm/div64.h>
45 50
46MODULE_DESCRIPTION("Philips SAA7113/SAA7114/SAA7115 video decoder driver"); 51#define VRES_60HZ (480+16)
52
53MODULE_DESCRIPTION("Philips SAA7111/SAA7113/SAA7114/SAA7115/SAA7118 video decoder driver");
47MODULE_AUTHOR( "Maxim Yevtyushkin, Kevin Thayer, Chris Kennedy, " 54MODULE_AUTHOR( "Maxim Yevtyushkin, Kevin Thayer, Chris Kennedy, "
48 "Hans Verkuil, Mauro Carvalho Chehab"); 55 "Hans Verkuil, Mauro Carvalho Chehab");
49MODULE_LICENSE("GPL"); 56MODULE_LICENSE("GPL");
@@ -54,14 +61,14 @@ module_param(debug, bool, 0644);
54MODULE_PARM_DESC(debug, "Debug level (0-1)"); 61MODULE_PARM_DESC(debug, "Debug level (0-1)");
55 62
56static unsigned short normal_i2c[] = { 63static unsigned short normal_i2c[] = {
57 0x4a >> 1, 0x48 >> 1, /* SAA7113 */ 64 0x4a >> 1, 0x48 >> 1, /* SAA7111, SAA7111A and SAA7113 */
58 0x42 >> 1, 0x40 >> 1, /* SAA7114 and SAA7115 */ 65 0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */
59 I2C_CLIENT_END }; 66 I2C_CLIENT_END };
60 67
61 68
62I2C_CLIENT_INSMOD; 69I2C_CLIENT_INSMOD;
63 70
64struct saa7115_state { 71struct saa711x_state {
65 v4l2_std_id std; 72 v4l2_std_id std;
66 int input; 73 int input;
67 int enable; 74 int enable;
@@ -70,6 +77,8 @@ struct saa7115_state {
70 int contrast; 77 int contrast;
71 int hue; 78 int hue;
72 int sat; 79 int sat;
80 int width;
81 int height;
73 enum v4l2_chip_ident ident; 82 enum v4l2_chip_ident ident;
74 u32 audclk_freq; 83 u32 audclk_freq;
75 u32 crystal_freq; 84 u32 crystal_freq;
@@ -80,420 +89,508 @@ struct saa7115_state {
80 89
81/* ----------------------------------------------------------------------- */ 90/* ----------------------------------------------------------------------- */
82 91
83static inline int saa7115_write(struct i2c_client *client, u8 reg, u8 value) 92static inline int saa711x_write(struct i2c_client *client, u8 reg, u8 value)
84{ 93{
85 return i2c_smbus_write_byte_data(client, reg, value); 94 return i2c_smbus_write_byte_data(client, reg, value);
86} 95}
87 96
88static int saa7115_writeregs(struct i2c_client *client, const unsigned char *regs) 97/* Sanity routine to check if a register is present */
98static int saa711x_has_reg(const int id, const u8 reg)
89{ 99{
100 if (id == V4L2_IDENT_SAA7111)
101 return reg < 0x20 && reg != 0x01 && reg != 0x0f &&
102 (reg < 0x13 || reg > 0x19) && reg != 0x1d && reg != 0x1e;
103
104 /* common for saa7113/4/5/8 */
105 if (unlikely((reg >= 0x3b && reg <= 0x3f) || reg == 0x5c || reg == 0x5f ||
106 reg == 0xa3 || reg == 0xa7 || reg == 0xab || reg == 0xaf || (reg >= 0xb5 && reg <= 0xb7) ||
107 reg == 0xd3 || reg == 0xd7 || reg == 0xdb || reg == 0xdf || (reg >= 0xe5 && reg <= 0xe7) ||
108 reg == 0x82 || (reg >= 0x89 && reg <= 0x8e)))
109 return 0;
110
111 switch (id) {
112 case V4L2_IDENT_SAA7113:
113 return reg != 0x14 && (reg < 0x18 || reg > 0x1e) && (reg < 0x20 || reg > 0x3f) &&
114 reg != 0x5d && reg < 0x63;
115 case V4L2_IDENT_SAA7114:
116 return (reg < 0x1a || reg > 0x1e) && (reg < 0x20 || reg > 0x2f) &&
117 (reg < 0x63 || reg > 0x7f) && reg != 0x33 && reg != 0x37 &&
118 reg != 0x81 && reg < 0xf0;
119 case V4L2_IDENT_SAA7115:
120 return (reg < 0x20 || reg > 0x2f) && reg != 0x65 && (reg < 0xfc || reg > 0xfe);
121 case V4L2_IDENT_SAA7118:
122 return (reg < 0x1a || reg > 0x1d) && (reg < 0x20 || reg > 0x22) &&
123 (reg < 0x26 || reg > 0x28) && reg != 0x33 && reg != 0x37 &&
124 (reg < 0x63 || reg > 0x7f) && reg != 0x81 && reg < 0xf0;
125 }
126 return 1;
127}
128
129static int saa711x_writeregs(struct i2c_client *client, const unsigned char *regs)
130{
131 struct saa711x_state *state = i2c_get_clientdata(client);
90 unsigned char reg, data; 132 unsigned char reg, data;
91 133
92 while (*regs != 0x00) { 134 while (*regs != 0x00) {
93 reg = *(regs++); 135 reg = *(regs++);
94 data = *(regs++); 136 data = *(regs++);
95 if (saa7115_write(client, reg, data) < 0) 137
96 return -1; 138 /* According with datasheets, reserved regs should be
139 filled with 0 - seems better not to touch on they */
140 if (saa711x_has_reg(state->ident,reg)) {
141 if (saa711x_write(client, reg, data) < 0)
142 return -1;
143 } else {
144 v4l_dbg(1, debug, client, "tried to access reserved reg 0x%02x\n", reg);
145 }
97 } 146 }
98 return 0; 147 return 0;
99} 148}
100 149
101static inline int saa7115_read(struct i2c_client *client, u8 reg) 150static inline int saa711x_read(struct i2c_client *client, u8 reg)
102{ 151{
103 return i2c_smbus_read_byte_data(client, reg); 152 return i2c_smbus_read_byte_data(client, reg);
104} 153}
105 154
106/* ----------------------------------------------------------------------- */ 155/* ----------------------------------------------------------------------- */
107 156
157/* SAA7111 initialization table */
158static const unsigned char saa7111_init[] = {
159 R_01_INC_DELAY, 0x00, /* reserved */
160
161 /*front end */
162 R_02_INPUT_CNTL_1, 0xd0, /* FUSE=3, GUDL=2, MODE=0 */
163 R_03_INPUT_CNTL_2, 0x23, /* HLNRS=0, VBSL=1, WPOFF=0, HOLDG=0,
164 * GAFIX=0, GAI1=256, GAI2=256 */
165 R_04_INPUT_CNTL_3, 0x00, /* GAI1=256 */
166 R_05_INPUT_CNTL_4, 0x00, /* GAI2=256 */
167
168 /* decoder */
169 R_06_H_SYNC_START, 0xf3, /* HSB at 13(50Hz) / 17(60Hz)
170 * pixels after end of last line */
171 R_07_H_SYNC_STOP, 0xe8, /* HSS seems to be needed to
172 * work with NTSC, too */
173 R_08_SYNC_CNTL, 0xc8, /* AUFD=1, FSEL=1, EXFIL=0,
174 * VTRC=1, HPLL=0, VNOI=0 */
175 R_09_LUMA_CNTL, 0x01, /* BYPS=0, PREF=0, BPSS=0,
176 * VBLB=0, UPTCV=0, APER=1 */
177 R_0A_LUMA_BRIGHT_CNTL, 0x80,
178 R_0B_LUMA_CONTRAST_CNTL, 0x47, /* 0b - CONT=1.109 */
179 R_0C_CHROMA_SAT_CNTL, 0x40,
180 R_0D_CHROMA_HUE_CNTL, 0x00,
181 R_0E_CHROMA_CNTL_1, 0x01, /* 0e - CDTO=0, CSTD=0, DCCF=0,
182 * FCTC=0, CHBW=1 */
183 R_0F_CHROMA_GAIN_CNTL, 0x00, /* reserved */
184 R_10_CHROMA_CNTL_2, 0x48, /* 10 - OFTS=1, HDEL=0, VRLN=1, YDEL=0 */
185 R_11_MODE_DELAY_CNTL, 0x1c, /* 11 - GPSW=0, CM99=0, FECO=0, COMPO=1,
186 * OEYC=1, OEHV=1, VIPB=0, COLO=0 */
187 R_12_RT_SIGNAL_CNTL, 0x00, /* 12 - output control 2 */
188 R_13_RT_X_PORT_OUT_CNTL, 0x00, /* 13 - output control 3 */
189 R_14_ANAL_ADC_COMPAT_CNTL, 0x00,
190 R_15_VGATE_START_FID_CHG, 0x00,
191 R_16_VGATE_STOP, 0x00,
192 R_17_MISC_VGATE_CONF_AND_MSB, 0x00,
193
194 0x00, 0x00
195};
196
197/* SAA7113 init codes */
198static const unsigned char saa7113_init[] = {
199 R_01_INC_DELAY, 0x08,
200 R_02_INPUT_CNTL_1, 0xc2,
201 R_03_INPUT_CNTL_2, 0x30,
202 R_04_INPUT_CNTL_3, 0x00,
203 R_05_INPUT_CNTL_4, 0x00,
204 R_06_H_SYNC_START, 0x89,
205 R_07_H_SYNC_STOP, 0x0d,
206 R_08_SYNC_CNTL, 0x88,
207 R_09_LUMA_CNTL, 0x01,
208 R_0A_LUMA_BRIGHT_CNTL, 0x80,
209 R_0B_LUMA_CONTRAST_CNTL, 0x47,
210 R_0C_CHROMA_SAT_CNTL, 0x40,
211 R_0D_CHROMA_HUE_CNTL, 0x00,
212 R_0E_CHROMA_CNTL_1, 0x01,
213 R_0F_CHROMA_GAIN_CNTL, 0x2a,
214 R_10_CHROMA_CNTL_2, 0x08,
215 R_11_MODE_DELAY_CNTL, 0x0c,
216 R_12_RT_SIGNAL_CNTL, 0x07,
217 R_13_RT_X_PORT_OUT_CNTL, 0x00,
218 R_14_ANAL_ADC_COMPAT_CNTL, 0x00,
219 R_15_VGATE_START_FID_CHG, 0x00,
220 R_16_VGATE_STOP, 0x00,
221 R_17_MISC_VGATE_CONF_AND_MSB, 0x00,
222
223 0x00, 0x00
224};
225
108/* If a value differs from the Hauppauge driver values, then the comment starts with 226/* If a value differs from the Hauppauge driver values, then the comment starts with
109 'was 0xXX' to denote the Hauppauge value. Otherwise the value is identical to what the 227 'was 0xXX' to denote the Hauppauge value. Otherwise the value is identical to what the
110 Hauppauge driver sets. */ 228 Hauppauge driver sets. */
111 229
230/* SAA7114 and SAA7115 initialization table */
112static const unsigned char saa7115_init_auto_input[] = { 231static const unsigned char saa7115_init_auto_input[] = {
113 /* Front-End Part */ 232 /* Front-End Part */
114 0x01, 0x48, /* white peak control disabled */ 233 R_01_INC_DELAY, 0x48, /* white peak control disabled */
115 0x03, 0x20, /* was 0x30. 0x20: long vertical blanking */ 234 R_03_INPUT_CNTL_2, 0x20, /* was 0x30. 0x20: long vertical blanking */
116 0x04, 0x90, /* analog gain set to 0 */ 235 R_04_INPUT_CNTL_3, 0x90, /* analog gain set to 0 */
117 0x05, 0x90, /* analog gain set to 0 */ 236 R_05_INPUT_CNTL_4, 0x90, /* analog gain set to 0 */
118 /* Decoder Part */ 237 /* Decoder Part */
119 0x06, 0xeb, /* horiz sync begin = -21 */ 238 R_06_H_SYNC_START, 0xeb, /* horiz sync begin = -21 */
120 0x07, 0xe0, /* horiz sync stop = -17 */ 239 R_07_H_SYNC_STOP, 0xe0, /* horiz sync stop = -17 */
121 0x0a, 0x80, /* was 0x88. decoder brightness, 0x80 is itu standard */ 240 R_09_LUMA_CNTL, 0x53, /* 0x53, was 0x56 for 60hz. luminance control */
122 0x0b, 0x44, /* was 0x48. decoder contrast, 0x44 is itu standard */ 241 R_0A_LUMA_BRIGHT_CNTL, 0x80, /* was 0x88. decoder brightness, 0x80 is itu standard */
123 0x0c, 0x40, /* was 0x47. decoder saturation, 0x40 is itu standard */ 242 R_0B_LUMA_CONTRAST_CNTL, 0x44, /* was 0x48. decoder contrast, 0x44 is itu standard */
124 0x0d, 0x00, /* chrominance hue control */ 243 R_0C_CHROMA_SAT_CNTL, 0x40, /* was 0x47. decoder saturation, 0x40 is itu standard */
125 0x0f, 0x00, /* chrominance gain control: use automicatic mode */ 244 R_0D_CHROMA_HUE_CNTL, 0x00,
126 0x10, 0x06, /* chrominance/luminance control: active adaptive combfilter */ 245 R_0F_CHROMA_GAIN_CNTL, 0x00, /* use automatic gain */
127 0x11, 0x00, /* delay control */ 246 R_10_CHROMA_CNTL_2, 0x06, /* chroma: active adaptive combfilter */
128 0x12, 0x9d, /* RTS0 output control: VGATE */ 247 R_11_MODE_DELAY_CNTL, 0x00,
129 0x13, 0x80, /* X-port output control: ITU656 standard mode, RTCO output enable RTCE */ 248 R_12_RT_SIGNAL_CNTL, 0x9d, /* RTS0 output control: VGATE */
130 0x14, 0x00, /* analog/ADC/auto compatibility control */ 249 R_13_RT_X_PORT_OUT_CNTL, 0x80, /* ITU656 standard mode, RTCO output enable RTCE */
131 0x18, 0x40, /* raw data gain 0x00 = nominal */ 250 R_14_ANAL_ADC_COMPAT_CNTL, 0x00,
132 0x19, 0x80, /* raw data offset 0x80 = 0 LSB */ 251 R_18_RAW_DATA_GAIN_CNTL, 0x40, /* gain 0x00 = nominal */
133 0x1a, 0x77, /* color killer level control 0x77 = recommended */ 252 R_19_RAW_DATA_OFF_CNTL, 0x80,
134 0x1b, 0x42, /* misc chroma control 0x42 = recommended */ 253 R_1A_COLOR_KILL_LVL_CNTL, 0x77, /* recommended value */
135 0x1c, 0xa9, /* combfilter control 0xA9 = recommended */ 254 R_1B_MISC_TVVCRDET, 0x42, /* recommended value */
136 0x1d, 0x01, /* combfilter control 0x01 = recommended */ 255 R_1C_ENHAN_COMB_CTRL1, 0xa9, /* recommended value */
256 R_1D_ENHAN_COMB_CTRL2, 0x01, /* recommended value */
257
258
259 R_80_GLOBAL_CNTL_1, 0x0, /* No tasks enabled at init */
137 260
138 /* Power Device Control */ 261 /* Power Device Control */
139 0x88, 0xd0, /* reset device */ 262 R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, /* reset device */
140 0x88, 0xf0, /* set device programmed, all in operational mode */ 263 R_88_POWER_SAVE_ADC_PORT_CNTL, 0xf0, /* set device programmed, all in operational mode */
141 0x00, 0x00 264 0x00, 0x00
142}; 265};
143 266
267/* Used to reset saa7113, saa7114 and saa7115 */
144static const unsigned char saa7115_cfg_reset_scaler[] = { 268static const unsigned char saa7115_cfg_reset_scaler[] = {
145 0x87, 0x00, /* disable I-port output */ 269 R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, 0x00, /* disable I-port output */
146 0x88, 0xd0, /* reset scaler */ 270 R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, /* reset scaler */
147 0x88, 0xf0, /* activate scaler */ 271 R_88_POWER_SAVE_ADC_PORT_CNTL, 0xf0, /* activate scaler */
148 0x87, 0x01, /* enable I-port output */ 272 R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, 0x01, /* enable I-port output */
149 0x00, 0x00 273 0x00, 0x00
150}; 274};
151 275
152/* ============== SAA7715 VIDEO templates ============= */ 276/* ============== SAA7715 VIDEO templates ============= */
153 277
154static const unsigned char saa7115_cfg_60hz_fullres_x[] = { 278static const unsigned char saa7115_cfg_60hz_video[] = {
155 0xcc, 0xd0, /* hsize low (output), hor. output window size = 0x2d0 = 720 */ 279 R_80_GLOBAL_CNTL_1, 0x00, /* reset tasks */
156 0xcd, 0x02, /* hsize hi (output) */ 280 R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, /* reset scaler */
157 281
158 /* Why not in 60hz-Land, too? */ 282 R_15_VGATE_START_FID_CHG, 0x03,
159 0xd0, 0x01, /* downscale = 1 */ 283 R_16_VGATE_STOP, 0x11,
160 0xd8, 0x00, /* hor lum scaling 0x0400 = 1 */ 284 R_17_MISC_VGATE_CONF_AND_MSB, 0x9c,
161 0xd9, 0x04,
162 0xdc, 0x00, /* hor chrom scaling 0x0200. must be hor lum scaling / 2 */
163 0xdd, 0x02, /* H-scaling incr chroma */
164 285
165 0x00, 0x00 286 R_08_SYNC_CNTL, 0x68, /* 0xBO: auto detection, 0x68 = NTSC */
166}; 287 R_0E_CHROMA_CNTL_1, 0x07, /* video autodetection is on */
167static const unsigned char saa7115_cfg_60hz_fullres_y[] = {
168 0xce, 0xf8, /* vsize low (output), ver. output window size = 248 (but 60hz is 240?) */
169 0xcf, 0x00, /* vsize hi (output) */
170 288
171 /* Why not in 60hz-Land, too? */ 289 R_5A_V_OFF_FOR_SLICER, 0x06, /* standard 60hz value for ITU656 line counting */
172 0xd5, 0x40, /* Lum contrast, nominal value = 0x40 */
173 0xd6, 0x40, /* Chroma satur. nominal value = 0x80 */
174 290
175 0xe0, 0x00, /* V-scaling incr luma low */ 291 /* Task A */
176 0xe1, 0x04, /* " hi */ 292 R_90_A_TASK_HANDLING_CNTL, 0x80,
177 0xe2, 0x00, /* V-scaling incr chroma low */ 293 R_91_A_X_PORT_FORMATS_AND_CONF, 0x48,
178 0xe3, 0x04, /* " hi */ 294 R_92_A_X_PORT_INPUT_REFERENCE_SIGNAL, 0x40,
295 R_93_A_I_PORT_OUTPUT_FORMATS_AND_CONF, 0x84,
179 296
180 0x00, 0x00 297 /* hoffset low (input), 0x0002 is minimum */
181}; 298 R_94_A_HORIZ_INPUT_WINDOW_START, 0x01,
299 R_95_A_HORIZ_INPUT_WINDOW_START_MSB, 0x00,
182 300
183static const unsigned char saa7115_cfg_60hz_video[] = { 301 /* hsize low (input), 0x02d0 = 720 */
184 0x80, 0x00, /* reset tasks */ 302 R_96_A_HORIZ_INPUT_WINDOW_LENGTH, 0xd0,
185 0x88, 0xd0, /* reset scaler */ 303 R_97_A_HORIZ_INPUT_WINDOW_LENGTH_MSB, 0x02,
186 304
187 0x15, 0x03, /* VGATE pulse start */ 305 R_98_A_VERT_INPUT_WINDOW_START, 0x05,
188 0x16, 0x11, /* VGATE pulse stop */ 306 R_99_A_VERT_INPUT_WINDOW_START_MSB, 0x00,
189 0x17, 0x9c, /* VGATE MSB and other values */
190 307
191 0x08, 0x68, /* 0xBO: auto detection, 0x68 = NTSC */ 308 R_9A_A_VERT_INPUT_WINDOW_LENGTH, 0x0c,
192 0x0e, 0x07, /* lots of different stuff... video autodetection is on */ 309 R_9B_A_VERT_INPUT_WINDOW_LENGTH_MSB, 0x00,
193 310
194 0x5a, 0x06, /* Vertical offset, standard 60hz value for ITU656 line counting */ 311 R_9C_A_HORIZ_OUTPUT_WINDOW_LENGTH, 0xa0,
312 R_9D_A_HORIZ_OUTPUT_WINDOW_LENGTH_MSB, 0x05,
195 313
196 /* Task A */ 314 R_9E_A_VERT_OUTPUT_WINDOW_LENGTH, 0x0c,
197 0x90, 0x80, /* Task Handling Control */ 315 R_9F_A_VERT_OUTPUT_WINDOW_LENGTH_MSB, 0x00,
198 0x91, 0x48, /* X-port formats/config */
199 0x92, 0x40, /* Input Ref. signal Def. */
200 0x93, 0x84, /* I-port config */
201 0x94, 0x01, /* hoffset low (input), 0x0002 is minimum */
202 0x95, 0x00, /* hoffset hi (input) */
203 0x96, 0xd0, /* hsize low (input), 0x02d0 = 720 */
204 0x97, 0x02, /* hsize hi (input) */
205 0x98, 0x05, /* voffset low (input) */
206 0x99, 0x00, /* voffset hi (input) */
207 0x9a, 0x0c, /* vsize low (input), 0x0c = 12 */
208 0x9b, 0x00, /* vsize hi (input) */
209 0x9c, 0xa0, /* hsize low (output), 0x05a0 = 1440 */
210 0x9d, 0x05, /* hsize hi (output) */
211 0x9e, 0x0c, /* vsize low (output), 0x0c = 12 */
212 0x9f, 0x00, /* vsize hi (output) */
213 316
214 /* Task B */ 317 /* Task B */
215 0xc0, 0x00, /* Task Handling Control */ 318 R_C0_B_TASK_HANDLING_CNTL, 0x00,
216 0xc1, 0x08, /* X-port formats/config */ 319 R_C1_B_X_PORT_FORMATS_AND_CONF, 0x08,
217 0xc2, 0x00, /* Input Ref. signal Def. */ 320 R_C2_B_INPUT_REFERENCE_SIGNAL_DEFINITION, 0x00,
218 0xc3, 0x80, /* I-port config */ 321 R_C3_B_I_PORT_FORMATS_AND_CONF, 0x80,
219 0xc4, 0x02, /* hoffset low (input), 0x0002 is minimum */
220 0xc5, 0x00, /* hoffset hi (input) */
221 0xc6, 0xd0, /* hsize low (input), 0x02d0 = 720 */
222 0xc7, 0x02, /* hsize hi (input) */
223 0xc8, 0x12, /* voffset low (input), 0x12 = 18 */
224 0xc9, 0x00, /* voffset hi (input) */
225 0xca, 0xf8, /* vsize low (input), 0xf8 = 248 */
226 0xcb, 0x00, /* vsize hi (input) */
227 0xcc, 0xd0, /* hsize low (output), 0x02d0 = 720 */
228 0xcd, 0x02, /* hsize hi (output) */
229
230 0xf0, 0xad, /* Set PLL Register. 60hz 525 lines per frame, 27 MHz */
231 0xf1, 0x05, /* low bit with 0xF0 */
232 0xf5, 0xad, /* Set pulse generator register */
233 0xf6, 0x01,
234
235 0x87, 0x00, /* Disable I-port output */
236 0x88, 0xd0, /* reset scaler */
237 0x80, 0x20, /* Activate only task "B", continuous mode (was 0xA0) */
238 0x88, 0xf0, /* activate scaler */
239 0x87, 0x01, /* Enable I-port output */
240 0x00, 0x00
241};
242 322
243static const unsigned char saa7115_cfg_50hz_fullres_x[] = { 323 /* 0x0002 is minimum */
244 0xcc, 0xd0, /* hsize low (output), 720 same as 60hz */ 324 R_C4_B_HORIZ_INPUT_WINDOW_START, 0x02,
245 0xcd, 0x02, /* hsize hi (output) */ 325 R_C5_B_HORIZ_INPUT_WINDOW_START_MSB, 0x00,
246 326
247 0xd0, 0x01, /* down scale = 1 */ 327 /* 0x02d0 = 720 */
248 0xd8, 0x00, /* hor lum scaling 0x0400 = 1 */ 328 R_C6_B_HORIZ_INPUT_WINDOW_LENGTH, 0xd0,
249 0xd9, 0x04, 329 R_C7_B_HORIZ_INPUT_WINDOW_LENGTH_MSB, 0x02,
250 0xdc, 0x00, /* hor chrom scaling 0x0200. must be hor lum scaling / 2 */
251 0xdd, 0x02, /* H-scaling incr chroma */
252 330
253 0x00, 0x00 331 /* vwindow start 0x12 = 18 */
254}; 332 R_C8_B_VERT_INPUT_WINDOW_START, 0x12,
255static const unsigned char saa7115_cfg_50hz_fullres_y[] = { 333 R_C9_B_VERT_INPUT_WINDOW_START_MSB, 0x00,
256 0xce, 0x20, /* vsize low (output), 0x0120 = 288 */ 334
257 0xcf, 0x01, /* vsize hi (output) */ 335 /* vwindow length 0xf8 = 248 */
336 R_CA_B_VERT_INPUT_WINDOW_LENGTH, VRES_60HZ>>1,
337 R_CB_B_VERT_INPUT_WINDOW_LENGTH_MSB, VRES_60HZ>>9,
258 338
259 0xd5, 0x40, /* Lum contrast, nominal value = 0x40 */ 339 /* hwindow 0x02d0 = 720 */
260 0xd6, 0x40, /* Chroma satur. nominal value = 0x80 */ 340 R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH, 0xd0,
341 R_CD_B_HORIZ_OUTPUT_WINDOW_LENGTH_MSB, 0x02,
261 342
262 0xe0, 0x00, /* V-scaling incr luma low */ 343 R_F0_LFCO_PER_LINE, 0xad, /* Set PLL Register. 60hz 525 lines per frame, 27 MHz */
263 0xe1, 0x04, /* " hi */ 344 R_F1_P_I_PARAM_SELECT, 0x05, /* low bit with 0xF0 */
264 0xe2, 0x00, /* V-scaling incr chroma low */ 345 R_F5_PULSGEN_LINE_LENGTH, 0xad,
265 0xe3, 0x04, /* " hi */ 346 R_F6_PULSE_A_POS_LSB_AND_PULSEGEN_CONFIG, 0x01,
266 347
267 0x00, 0x00 348 0x00, 0x00
268}; 349};
269 350
270static const unsigned char saa7115_cfg_50hz_video[] = { 351static const unsigned char saa7115_cfg_50hz_video[] = {
271 0x80, 0x00, /* reset tasks */ 352 R_80_GLOBAL_CNTL_1, 0x00,
272 0x88, 0xd0, /* reset scaler */ 353 R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, /* reset scaler */
273 354
274 0x15, 0x37, /* VGATE start */ 355 R_15_VGATE_START_FID_CHG, 0x37, /* VGATE start */
275 0x16, 0x16, /* VGATE stop */ 356 R_16_VGATE_STOP, 0x16,
276 0x17, 0x99, /* VGATE MSB and other values */ 357 R_17_MISC_VGATE_CONF_AND_MSB, 0x99,
277 358
278 0x08, 0x28, /* 0x28 = PAL */ 359 R_08_SYNC_CNTL, 0x28, /* 0x28 = PAL */
279 0x0e, 0x07, /* chrominance control 1 */ 360 R_0E_CHROMA_CNTL_1, 0x07,
280 361
281 0x5a, 0x03, /* Vertical offset, standard 50hz value */ 362 R_5A_V_OFF_FOR_SLICER, 0x03, /* standard 50hz value */
282 363
283 /* Task A */ 364 /* Task A */
284 0x90, 0x81, /* Task Handling Control */ 365 R_90_A_TASK_HANDLING_CNTL, 0x81,
285 0x91, 0x48, /* X-port formats/config */ 366 R_91_A_X_PORT_FORMATS_AND_CONF, 0x48,
286 0x92, 0x40, /* Input Ref. signal Def. */ 367 R_92_A_X_PORT_INPUT_REFERENCE_SIGNAL, 0x40,
287 0x93, 0x84, /* I-port config */ 368 R_93_A_I_PORT_OUTPUT_FORMATS_AND_CONF, 0x84,
369
288 /* This is weird: the datasheet says that you should use 2 as the minimum value, */ 370 /* This is weird: the datasheet says that you should use 2 as the minimum value, */
289 /* but Hauppauge uses 0, and changing that to 2 causes indeed problems (for 50hz) */ 371 /* but Hauppauge uses 0, and changing that to 2 causes indeed problems (for 50hz) */
290 0x94, 0x00, /* hoffset low (input), 0x0002 is minimum */ 372 /* hoffset low (input), 0x0002 is minimum */
291 0x95, 0x00, /* hoffset hi (input) */ 373 R_94_A_HORIZ_INPUT_WINDOW_START, 0x00,
292 0x96, 0xd0, /* hsize low (input), 0x02d0 = 720 */ 374 R_95_A_HORIZ_INPUT_WINDOW_START_MSB, 0x00,
293 0x97, 0x02, /* hsize hi (input) */ 375
294 0x98, 0x03, /* voffset low (input) */ 376 /* hsize low (input), 0x02d0 = 720 */
295 0x99, 0x00, /* voffset hi (input) */ 377 R_96_A_HORIZ_INPUT_WINDOW_LENGTH, 0xd0,
296 0x9a, 0x12, /* vsize low (input), 0x12 = 18 */ 378 R_97_A_HORIZ_INPUT_WINDOW_LENGTH_MSB, 0x02,
297 0x9b, 0x00, /* vsize hi (input) */ 379
298 0x9c, 0xa0, /* hsize low (output), 0x05a0 = 1440 */ 380 R_98_A_VERT_INPUT_WINDOW_START, 0x03,
299 0x9d, 0x05, /* hsize hi (output) */ 381 R_99_A_VERT_INPUT_WINDOW_START_MSB, 0x00,
300 0x9e, 0x12, /* vsize low (output), 0x12 = 18 */ 382
301 0x9f, 0x00, /* vsize hi (output) */ 383 /* vsize 0x12 = 18 */
384 R_9A_A_VERT_INPUT_WINDOW_LENGTH, 0x12,
385 R_9B_A_VERT_INPUT_WINDOW_LENGTH_MSB, 0x00,
386
387 /* hsize 0x05a0 = 1440 */
388 R_9C_A_HORIZ_OUTPUT_WINDOW_LENGTH, 0xa0,
389 R_9D_A_HORIZ_OUTPUT_WINDOW_LENGTH_MSB, 0x05, /* hsize hi (output) */
390 R_9E_A_VERT_OUTPUT_WINDOW_LENGTH, 0x12, /* vsize low (output), 0x12 = 18 */
391 R_9F_A_VERT_OUTPUT_WINDOW_LENGTH_MSB, 0x00, /* vsize hi (output) */
302 392
303 /* Task B */ 393 /* Task B */
304 0xc0, 0x00, /* Task Handling Control */ 394 R_C0_B_TASK_HANDLING_CNTL, 0x00,
305 0xc1, 0x08, /* X-port formats/config */ 395 R_C1_B_X_PORT_FORMATS_AND_CONF, 0x08,
306 0xc2, 0x00, /* Input Ref. signal Def. */ 396 R_C2_B_INPUT_REFERENCE_SIGNAL_DEFINITION, 0x00,
307 0xc3, 0x80, /* I-port config */ 397 R_C3_B_I_PORT_FORMATS_AND_CONF, 0x80,
308 0xc4, 0x00, /* hoffset low (input), 0x0002 is minimum. See comment at 0x94 above. */ 398
309 0xc5, 0x00, /* hoffset hi (input) */ 399 /* This is weird: the datasheet says that you should use 2 as the minimum value, */
310 0xc6, 0xd0, /* hsize low (input), 0x02d0 = 720 */ 400 /* but Hauppauge uses 0, and changing that to 2 causes indeed problems (for 50hz) */
311 0xc7, 0x02, /* hsize hi (input) */ 401 /* hoffset low (input), 0x0002 is minimum. See comment above. */
312 0xc8, 0x16, /* voffset low (input), 0x16 = 22 */ 402 R_C4_B_HORIZ_INPUT_WINDOW_START, 0x00,
313 0xc9, 0x00, /* voffset hi (input) */ 403 R_C5_B_HORIZ_INPUT_WINDOW_START_MSB, 0x00,
314 0xca, 0x20, /* vsize low (input), 0x0120 = 288 */ 404
315 0xcb, 0x01, /* vsize hi (input) */ 405 /* hsize 0x02d0 = 720 */
316 0xcc, 0xd0, /* hsize low (output), 0x02d0 = 720 */ 406 R_C6_B_HORIZ_INPUT_WINDOW_LENGTH, 0xd0,
317 0xcd, 0x02, /* hsize hi (output) */ 407 R_C7_B_HORIZ_INPUT_WINDOW_LENGTH_MSB, 0x02,
318 0xce, 0x20, /* vsize low (output), 0x0120 = 288 */ 408
319 0xcf, 0x01, /* vsize hi (output) */ 409 /* voffset 0x16 = 22 */
320 410 R_C8_B_VERT_INPUT_WINDOW_START, 0x16,
321 0xf0, 0xb0, /* Set PLL Register. 50hz 625 lines per frame, 27 MHz */ 411 R_C9_B_VERT_INPUT_WINDOW_START_MSB, 0x00,
322 0xf1, 0x05, /* low bit with 0xF0, (was 0x05) */ 412
323 0xf5, 0xb0, /* Set pulse generator register */ 413 /* vsize 0x0120 = 288 */
324 0xf6, 0x01, 414 R_CA_B_VERT_INPUT_WINDOW_LENGTH, 0x20,
325 415 R_CB_B_VERT_INPUT_WINDOW_LENGTH_MSB, 0x01,
326 0x87, 0x00, /* Disable I-port output */ 416
327 0x88, 0xd0, /* reset scaler (was 0xD0) */ 417 /* hsize 0x02d0 = 720 */
328 0x80, 0x20, /* Activate only task "B" */ 418 R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH, 0xd0,
329 0x88, 0xf0, /* activate scaler */ 419 R_CD_B_HORIZ_OUTPUT_WINDOW_LENGTH_MSB, 0x02,
330 0x87, 0x01, /* Enable I-port output */ 420
421 R_F0_LFCO_PER_LINE, 0xb0, /* Set PLL Register. 50hz 625 lines per frame, 27 MHz */
422 R_F1_P_I_PARAM_SELECT, 0x05, /* low bit with 0xF0, (was 0x05) */
423 R_F5_PULSGEN_LINE_LENGTH, 0xb0,
424 R_F6_PULSE_A_POS_LSB_AND_PULSEGEN_CONFIG, 0x01,
425
331 0x00, 0x00 426 0x00, 0x00
332}; 427};
333 428
334/* ============== SAA7715 VIDEO templates (end) ======= */ 429/* ============== SAA7715 VIDEO templates (end) ======= */
335 430
336static const unsigned char saa7115_cfg_vbi_on[] = { 431static const unsigned char saa7115_cfg_vbi_on[] = {
337 0x80, 0x00, /* reset tasks */ 432 R_80_GLOBAL_CNTL_1, 0x00, /* reset tasks */
338 0x88, 0xd0, /* reset scaler */ 433 R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, /* reset scaler */
339 0x80, 0x30, /* Activate both tasks */ 434 R_80_GLOBAL_CNTL_1, 0x30, /* Activate both tasks */
340 0x88, 0xf0, /* activate scaler */ 435 R_88_POWER_SAVE_ADC_PORT_CNTL, 0xf0, /* activate scaler */
341 0x87, 0x01, /* Enable I-port output */ 436 R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, 0x01, /* Enable I-port output */
437
342 0x00, 0x00 438 0x00, 0x00
343}; 439};
344 440
345static const unsigned char saa7115_cfg_vbi_off[] = { 441static const unsigned char saa7115_cfg_vbi_off[] = {
346 0x80, 0x00, /* reset tasks */ 442 R_80_GLOBAL_CNTL_1, 0x00, /* reset tasks */
347 0x88, 0xd0, /* reset scaler */ 443 R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, /* reset scaler */
348 0x80, 0x20, /* Activate only task "B" */ 444 R_80_GLOBAL_CNTL_1, 0x20, /* Activate only task "B" */
349 0x88, 0xf0, /* activate scaler */ 445 R_88_POWER_SAVE_ADC_PORT_CNTL, 0xf0, /* activate scaler */
350 0x87, 0x01, /* Enable I-port output */ 446 R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, 0x01, /* Enable I-port output */
351 0x00, 0x00
352};
353 447
354static const unsigned char saa7113_init_auto_input[] = {
355 0x01, 0x08, /* PH7113_INCREMENT_DELAY - (1) (1) (1) (1) IDEL3 IDEL2 IDELL1 IDEL0 */
356 0x02, 0xc2, /* PH7113_ANALOG_INPUT_CONTR_1 - FUSE1 FUSE0 GUDL1 GUDL0 MODE3 MODE2 MODE1 MODE0 */
357 0x03, 0x30, /* PH7113_ANALOG_INPUT_CONTR_2 - (1) HLNRS VBSL WPOFF HOLDG GAFIX GAI28 GAI18 */
358 0x04, 0x00, /* PH7113_ANALOG_INPUT_CONTR_3 - GAI17 GAI16 GAI15 GAI14 GAI13 GAI12 GAI11 GAI10 */
359 0x05, 0x00, /* PH7113_ANALOG_INPUT_CONTR_4 - GAI27 GAI26 GAI25 GAI24 GAI23 GAI22 GAI21 GAI20 */
360 0x06, 0x89, /* PH7113_HORIZONTAL_SYNC_START - HSB7 HSB6 HSB5 HSB4 HSB3 HSB2 HSB1 HSB0 */
361 0x07, 0x0d, /* PH7113_HORIZONTAL_SYNC_STOP - HSS7 HSS6 HSS5 HSS4 HSS3 HSS2 HSS1 HSS0 */
362 0x08, 0x88, /* PH7113_SYNC_CONTROL - AUFD FSEL FOET HTC1 HTC0 HPLL VNOI1 VNOI0 */
363 0x09, 0x01, /* PH7113_LUMINANCE_CONTROL - BYPS PREF BPSS1 BPSS0 VBLB UPTCV APER1 APER0 */
364 0x0a, 0x80, /* PH7113_LUMINANCE_BRIGHTNESS - BRIG7 BRIG6 BRIG5 BRIG4 BRIG3 BRIG2 BRIG1 BRIG0 */
365 0x0b, 0x47, /* PH7113_LUMINANCE_CONTRAST - CONT7 CONT6 CONT5 CONT4 CONT3 CONT2 CONT1 CONT0 */
366 0x0c, 0x40, /* PH7113_CHROMA_SATURATION - SATN7 SATN6 SATN5 SATN4 SATN3 SATN2 SATN1 SATN0 */
367 0x0d, 0x00, /* PH7113_CHROMA_HUE_CONTROL - HUEC7 HUEC6 HUEC5 HUEC4 HUEC3 HUEC2 HUEC1 HUEC0 */
368 0x0e, 0x01, /* PH7113_CHROMA_CONTROL - CDTO CSTD2 CSTD1 CSTD0 DCCF FCTC CHBW1 CHBW0 */
369 0x0f, 0x2a, /* PH7113_CHROMA_GAIN_CONTROL - ACGC CGAIN6 CGAIN5 CGAIN4 CGAIN3 CGAIN2 CGAIN1 CGAIN0 */
370 0x10, 0x08, /* PH7113_FORMAT_DELAY_CONTROL - OFTS1 OFTS0 HDEL1 HDEL0 VRLN YDEL2 YDEL1 YDEL0 */
371 0x11, 0x0c, /* PH7113_OUTPUT_CONTROL_1 - GPSW1 CM99 GPSW0 HLSEL OEYC OERT VIPB COLO */
372 0x12, 0x07, /* PH7113_OUTPUT_CONTROL_2 - RTSE13 RTSE12 RTSE11 RTSE10 RTSE03 RTSE02 RTSE01 RTSE00 */
373 0x13, 0x00, /* PH7113_OUTPUT_CONTROL_3 - ADLSB (1) (1) OLDSB FIDP (1) AOSL1 AOSL0 */
374 0x14, 0x00, /* RESERVED 14 - (1) (1) (1) (1) (1) (1) (1) (1) */
375 0x15, 0x00, /* PH7113_V_GATE1_START - VSTA7 VSTA6 VSTA5 VSTA4 VSTA3 VSTA2 VSTA1 VSTA0 */
376 0x16, 0x00, /* PH7113_V_GATE1_STOP - VSTO7 VSTO6 VSTO5 VSTO4 VSTO3 VSTO2 VSTO1 VSTO0 */
377 0x17, 0x00, /* PH7113_V_GATE1_MSB - (1) (1) (1) (1) (1) (1) VSTO8 VSTA8 */
378 0x00, 0x00 448 0x00, 0x00
379}; 449};
380 450
451
381static const unsigned char saa7115_init_misc[] = { 452static const unsigned char saa7115_init_misc[] = {
382 0x81, 0x01, /* reg 0x15,0x16 define blanking window */ 453 R_81_V_SYNC_FLD_ID_SRC_SEL_AND_RETIMED_V_F, 0x01,
383 0x82, 0x00, 454 R_83_X_PORT_I_O_ENA_AND_OUT_CLK, 0x01,
384 0x83, 0x01, /* I port settings */ 455 R_84_I_PORT_SIGNAL_DEF, 0x20,
385 0x84, 0x20, 456 R_85_I_PORT_SIGNAL_POLAR, 0x21,
386 0x85, 0x21, 457 R_86_I_PORT_FIFO_FLAG_CNTL_AND_ARBIT, 0xc5,
387 0x86, 0xc5, 458 R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, 0x01,
388 0x87, 0x01,
389 459
390 /* Task A */ 460 /* Task A */
391 0xa0, 0x01, /* down scale = 1 */ 461 R_A0_A_HORIZ_PRESCALING, 0x01,
392 0xa1, 0x00, /* prescale accumulation length = 1 */ 462 R_A1_A_ACCUMULATION_LENGTH, 0x00,
393 0xa2, 0x00, /* dc gain and fir prefilter control */ 463 R_A2_A_PRESCALER_DC_GAIN_AND_FIR_PREFILTER, 0x00,
394 0xa4, 0x80, /* Lum Brightness, nominal value = 0x80 */ 464
395 0xa5, 0x40, /* Lum contrast, nominal value = 0x40 */ 465 /* Configure controls at nominal value*/
396 0xa6, 0x40, /* Chroma satur. nominal value = 0x80 */ 466 R_A4_A_LUMA_BRIGHTNESS_CNTL, 0x80,
397 0xa8, 0x00, /* hor lum scaling 0x0200 = 2 zoom */ 467 R_A5_A_LUMA_CONTRAST_CNTL, 0x40,
398 0xa9, 0x02, /* note: 2 x zoom ensures that VBI lines have same length as video lines. */ 468 R_A6_A_CHROMA_SATURATION_CNTL, 0x40,
399 0xaa, 0x00, /* H-phase offset Luma = 0 */ 469
400 0xac, 0x00, /* hor chrom scaling 0x0200. must be hor lum scaling / 2 */ 470 /* note: 2 x zoom ensures that VBI lines have same length as video lines. */
401 0xad, 0x01, /* H-scaling incr chroma */ 471 R_A8_A_HORIZ_LUMA_SCALING_INC, 0x00,
402 0xae, 0x00, /* H-phase offset chroma. must be offset luma / 2 */ 472 R_A9_A_HORIZ_LUMA_SCALING_INC_MSB, 0x02,
403 473
404 0xb0, 0x00, /* V-scaling incr luma low */ 474 R_AA_A_HORIZ_LUMA_PHASE_OFF, 0x00,
405 0xb1, 0x04, /* " hi */ 475
406 0xb2, 0x00, /* V-scaling incr chroma low */ 476 /* must be horiz lum scaling / 2 */
407 0xb3, 0x04, /* " hi */ 477 R_AC_A_HORIZ_CHROMA_SCALING_INC, 0x00,
408 0xb4, 0x01, /* V-scaling mode control */ 478 R_AD_A_HORIZ_CHROMA_SCALING_INC_MSB, 0x01,
409 0xb8, 0x00, /* V-phase offset chroma 00 */ 479
410 0xb9, 0x00, /* V-phase offset chroma 01 */ 480 /* must be offset luma / 2 */
411 0xba, 0x00, /* V-phase offset chroma 10 */ 481 R_AE_A_HORIZ_CHROMA_PHASE_OFF, 0x00,
412 0xbb, 0x00, /* V-phase offset chroma 11 */ 482
413 0xbc, 0x00, /* V-phase offset luma 00 */ 483 R_B0_A_VERT_LUMA_SCALING_INC, 0x00,
414 0xbd, 0x00, /* V-phase offset luma 01 */ 484 R_B1_A_VERT_LUMA_SCALING_INC_MSB, 0x04,
415 0xbe, 0x00, /* V-phase offset luma 10 */ 485
416 0xbf, 0x00, /* V-phase offset luma 11 */ 486 R_B2_A_VERT_CHROMA_SCALING_INC, 0x00,
487 R_B3_A_VERT_CHROMA_SCALING_INC_MSB, 0x04,
488
489 R_B4_A_VERT_SCALING_MODE_CNTL, 0x01,
490
491 R_B8_A_VERT_CHROMA_PHASE_OFF_00, 0x00,
492 R_B9_A_VERT_CHROMA_PHASE_OFF_01, 0x00,
493 R_BA_A_VERT_CHROMA_PHASE_OFF_10, 0x00,
494 R_BB_A_VERT_CHROMA_PHASE_OFF_11, 0x00,
495
496 R_BC_A_VERT_LUMA_PHASE_OFF_00, 0x00,
497 R_BD_A_VERT_LUMA_PHASE_OFF_01, 0x00,
498 R_BE_A_VERT_LUMA_PHASE_OFF_10, 0x00,
499 R_BF_A_VERT_LUMA_PHASE_OFF_11, 0x00,
417 500
418 /* Task B */ 501 /* Task B */
419 0xd0, 0x01, /* down scale = 1 */ 502 R_D0_B_HORIZ_PRESCALING, 0x01,
420 0xd1, 0x00, /* prescale accumulation length = 1 */ 503 R_D1_B_ACCUMULATION_LENGTH, 0x00,
421 0xd2, 0x00, /* dc gain and fir prefilter control */ 504 R_D2_B_PRESCALER_DC_GAIN_AND_FIR_PREFILTER, 0x00,
422 0xd4, 0x80, /* Lum Brightness, nominal value = 0x80 */ 505
423 0xd5, 0x40, /* Lum contrast, nominal value = 0x40 */ 506 /* Configure controls at nominal value*/
424 0xd6, 0x40, /* Chroma satur. nominal value = 0x80 */ 507 R_D4_B_LUMA_BRIGHTNESS_CNTL, 0x80,
425 0xd8, 0x00, /* hor lum scaling 0x0400 = 1 */ 508 R_D5_B_LUMA_CONTRAST_CNTL, 0x40,
426 0xd9, 0x04, 509 R_D6_B_CHROMA_SATURATION_CNTL, 0x40,
427 0xda, 0x00, /* H-phase offset Luma = 0 */ 510
428 0xdc, 0x00, /* hor chrom scaling 0x0200. must be hor lum scaling / 2 */ 511 /* hor lum scaling 0x0400 = 1 */
429 0xdd, 0x02, /* H-scaling incr chroma */ 512 R_D8_B_HORIZ_LUMA_SCALING_INC, 0x00,
430 0xde, 0x00, /* H-phase offset chroma. must be offset luma / 2 */ 513 R_D9_B_HORIZ_LUMA_SCALING_INC_MSB, 0x04,
431 514
432 0xe0, 0x00, /* V-scaling incr luma low */ 515 R_DA_B_HORIZ_LUMA_PHASE_OFF, 0x00,
433 0xe1, 0x04, /* " hi */ 516
434 0xe2, 0x00, /* V-scaling incr chroma low */ 517 /* must be hor lum scaling / 2 */
435 0xe3, 0x04, /* " hi */ 518 R_DC_B_HORIZ_CHROMA_SCALING, 0x00,
436 0xe4, 0x01, /* V-scaling mode control */ 519 R_DD_B_HORIZ_CHROMA_SCALING_MSB, 0x02,
437 0xe8, 0x00, /* V-phase offset chroma 00 */ 520
438 0xe9, 0x00, /* V-phase offset chroma 01 */ 521 /* must be offset luma / 2 */
439 0xea, 0x00, /* V-phase offset chroma 10 */ 522 R_DE_B_HORIZ_PHASE_OFFSET_CRHOMA, 0x00,
440 0xeb, 0x00, /* V-phase offset chroma 11 */ 523
441 0xec, 0x00, /* V-phase offset luma 00 */ 524 R_E0_B_VERT_LUMA_SCALING_INC, 0x00,
442 0xed, 0x00, /* V-phase offset luma 01 */ 525 R_E1_B_VERT_LUMA_SCALING_INC_MSB, 0x04,
443 0xee, 0x00, /* V-phase offset luma 10 */ 526
444 0xef, 0x00, /* V-phase offset luma 11 */ 527 R_E2_B_VERT_CHROMA_SCALING_INC, 0x00,
445 528 R_E3_B_VERT_CHROMA_SCALING_INC_MSB, 0x04,
446 0xf2, 0x50, /* crystal clock = 24.576 MHz, target = 27MHz */ 529
447 0xf3, 0x46, 530 R_E4_B_VERT_SCALING_MODE_CNTL, 0x01,
448 0xf4, 0x00, 531
449 0xf7, 0x4b, /* not the recommended settings! */ 532 R_E8_B_VERT_CHROMA_PHASE_OFF_00, 0x00,
450 0xf8, 0x00, 533 R_E9_B_VERT_CHROMA_PHASE_OFF_01, 0x00,
451 0xf9, 0x4b, 534 R_EA_B_VERT_CHROMA_PHASE_OFF_10, 0x00,
452 0xfa, 0x00, 535 R_EB_B_VERT_CHROMA_PHASE_OFF_11, 0x00,
453 0xfb, 0x4b, 536
454 0xff, 0x88, /* PLL2 lock detection settings: 71 lines 50% phase error */ 537 R_EC_B_VERT_LUMA_PHASE_OFF_00, 0x00,
538 R_ED_B_VERT_LUMA_PHASE_OFF_01, 0x00,
539 R_EE_B_VERT_LUMA_PHASE_OFF_10, 0x00,
540 R_EF_B_VERT_LUMA_PHASE_OFF_11, 0x00,
541
542 R_F2_NOMINAL_PLL2_DTO, 0x50, /* crystal clock = 24.576 MHz, target = 27MHz */
543 R_F3_PLL_INCREMENT, 0x46,
544 R_F4_PLL2_STATUS, 0x00,
545 R_F7_PULSE_A_POS_MSB, 0x4b, /* not the recommended settings! */
546 R_F8_PULSE_B_POS, 0x00,
547 R_F9_PULSE_B_POS_MSB, 0x4b,
548 R_FA_PULSE_C_POS, 0x00,
549 R_FB_PULSE_C_POS_MSB, 0x4b,
550
551 /* PLL2 lock detection settings: 71 lines 50% phase error */
552 R_FF_S_PLL_MAX_PHASE_ERR_THRESH_NUM_LINES, 0x88,
455 553
456 /* Turn off VBI */ 554 /* Turn off VBI */
457 0x40, 0x20, /* No framing code errors allowed. */ 555 R_40_SLICER_CNTL_1, 0x20, /* No framing code errors allowed. */
458 0x41, 0xff, 556 R_41_LCR_BASE, 0xff,
459 0x42, 0xff, 557 R_41_LCR_BASE+1, 0xff,
460 0x43, 0xff, 558 R_41_LCR_BASE+2, 0xff,
461 0x44, 0xff, 559 R_41_LCR_BASE+3, 0xff,
462 0x45, 0xff, 560 R_41_LCR_BASE+4, 0xff,
463 0x46, 0xff, 561 R_41_LCR_BASE+5, 0xff,
464 0x47, 0xff, 562 R_41_LCR_BASE+6, 0xff,
465 0x48, 0xff, 563 R_41_LCR_BASE+7, 0xff,
466 0x49, 0xff, 564 R_41_LCR_BASE+8, 0xff,
467 0x4a, 0xff, 565 R_41_LCR_BASE+9, 0xff,
468 0x4b, 0xff, 566 R_41_LCR_BASE+10, 0xff,
469 0x4c, 0xff, 567 R_41_LCR_BASE+11, 0xff,
470 0x4d, 0xff, 568 R_41_LCR_BASE+12, 0xff,
471 0x4e, 0xff, 569 R_41_LCR_BASE+13, 0xff,
472 0x4f, 0xff, 570 R_41_LCR_BASE+14, 0xff,
473 0x50, 0xff, 571 R_41_LCR_BASE+15, 0xff,
474 0x51, 0xff, 572 R_41_LCR_BASE+16, 0xff,
475 0x52, 0xff, 573 R_41_LCR_BASE+17, 0xff,
476 0x53, 0xff, 574 R_41_LCR_BASE+18, 0xff,
477 0x54, 0xff, 575 R_41_LCR_BASE+19, 0xff,
478 0x55, 0xff, 576 R_41_LCR_BASE+20, 0xff,
479 0x56, 0xff, 577 R_41_LCR_BASE+21, 0xff,
480 0x57, 0xff, 578 R_41_LCR_BASE+22, 0xff,
481 0x58, 0x40, 579 R_58_PROGRAM_FRAMING_CODE, 0x40,
482 0x59, 0x47, 580 R_59_H_OFF_FOR_SLICER, 0x47,
483 0x5b, 0x83, 581 R_5B_FLD_OFF_AND_MSB_FOR_H_AND_V_OFF, 0x83,
484 0x5d, 0xbd, 582 R_5D_DID, 0xbd,
485 0x5e, 0x35, 583 R_5E_SDID, 0x35,
486 584
487 0x02, 0x84, /* input tuner -> input 4, amplifier active */ 585 R_02_INPUT_CNTL_1, 0x84, /* input tuner -> input 4, amplifier active */
488 0x09, 0x53, /* 0x53, was 0x56 for 60hz. luminance control */ 586
489 587 R_80_GLOBAL_CNTL_1, 0x20, /* enable task B */
490 0x80, 0x20, /* enable task B */ 588 R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0,
491 0x88, 0xd0, 589 R_88_POWER_SAVE_ADC_PORT_CNTL, 0xf0,
492 0x88, 0xf0,
493 0x00, 0x00 590 0x00, 0x00
494}; 591};
495 592
496static int saa7115_odd_parity(u8 c) 593static int saa711x_odd_parity(u8 c)
497{ 594{
498 c ^= (c >> 4); 595 c ^= (c >> 4);
499 c ^= (c >> 2); 596 c ^= (c >> 2);
@@ -502,7 +599,7 @@ static int saa7115_odd_parity(u8 c)
502 return c & 1; 599 return c & 1;
503} 600}
504 601
505static int saa7115_decode_vps(u8 * dst, u8 * p) 602static int saa711x_decode_vps(u8 * dst, u8 * p)
506{ 603{
507 static const u8 biphase_tbl[] = { 604 static const u8 biphase_tbl[] = {
508 0xf0, 0x78, 0x70, 0xf0, 0xb4, 0x3c, 0x34, 0xb4, 605 0xf0, 0x78, 0x70, 0xf0, 0xb4, 0x3c, 0x34, 0xb4,
@@ -549,7 +646,7 @@ static int saa7115_decode_vps(u8 * dst, u8 * p)
549 return err & 0xf0; 646 return err & 0xf0;
550} 647}
551 648
552static int saa7115_decode_wss(u8 * p) 649static int saa711x_decode_wss(u8 * p)
553{ 650{
554 static const int wss_bits[8] = { 651 static const int wss_bits[8] = {
555 0, 0, 0, 1, 0, 1, 1, 1 652 0, 0, 0, 1, 0, 1, 1, 1
@@ -576,26 +673,25 @@ static int saa7115_decode_wss(u8 * p)
576 return wss; 673 return wss;
577} 674}
578 675
579 676static int saa711x_set_audio_clock_freq(struct i2c_client *client, u32 freq)
580static int saa7115_set_audio_clock_freq(struct i2c_client *client, u32 freq)
581{ 677{
582 struct saa7115_state *state = i2c_get_clientdata(client); 678 struct saa711x_state *state = i2c_get_clientdata(client);
583 u32 acpf; 679 u32 acpf;
584 u32 acni; 680 u32 acni;
585 u32 hz; 681 u32 hz;
586 u64 f; 682 u64 f;
587 u8 acc = 0; /* reg 0x3a, audio clock control */ 683 u8 acc = 0; /* reg 0x3a, audio clock control */
588 684
685 /* Checks for chips that don't have audio clock (saa7111, saa7113) */
686 if (!saa711x_has_reg(state->ident,R_30_AUD_MAST_CLK_CYCLES_PER_FIELD))
687 return 0;
688
589 v4l_dbg(1, debug, client, "set audio clock freq: %d\n", freq); 689 v4l_dbg(1, debug, client, "set audio clock freq: %d\n", freq);
590 690
591 /* sanity check */ 691 /* sanity check */
592 if (freq < 32000 || freq > 48000) 692 if (freq < 32000 || freq > 48000)
593 return -EINVAL; 693 return -EINVAL;
594 694
595 /* The saa7113 has no audio clock */
596 if (state->ident == V4L2_IDENT_SAA7113)
597 return 0;
598
599 /* hz is the refresh rate times 100 */ 695 /* hz is the refresh rate times 100 */
600 hz = (state->std & V4L2_STD_525_60) ? 5994 : 5000; 696 hz = (state->std & V4L2_STD_525_60) ? 5994 : 5000;
601 /* acpf = (256 * freq) / field_frequency == (256 * 100 * freq) / hz */ 697 /* acpf = (256 * freq) / field_frequency == (256 * 100 * freq) / hz */
@@ -617,22 +713,26 @@ static int saa7115_set_audio_clock_freq(struct i2c_client *client, u32 freq)
617 if (state->apll) 713 if (state->apll)
618 acc |= 0x08; 714 acc |= 0x08;
619 715
620 saa7115_write(client, 0x38, 0x03); 716 saa711x_write(client, R_38_CLK_RATIO_AMXCLK_TO_ASCLK, 0x03);
621 saa7115_write(client, 0x39, 0x10); 717 saa711x_write(client, R_39_CLK_RATIO_ASCLK_TO_ALRCLK, 0x10);
622 saa7115_write(client, 0x3a, acc); 718 saa711x_write(client, R_3A_AUD_CLK_GEN_BASIC_SETUP, acc);
623 saa7115_write(client, 0x30, acpf & 0xff); 719
624 saa7115_write(client, 0x31, (acpf >> 8) & 0xff); 720 saa711x_write(client, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD, acpf & 0xff);
625 saa7115_write(client, 0x32, (acpf >> 16) & 0x03); 721 saa711x_write(client, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD+1,
626 saa7115_write(client, 0x34, acni & 0xff); 722 (acpf >> 8) & 0xff);
627 saa7115_write(client, 0x35, (acni >> 8) & 0xff); 723 saa711x_write(client, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD+2,
628 saa7115_write(client, 0x36, (acni >> 16) & 0x3f); 724 (acpf >> 16) & 0x03);
725
726 saa711x_write(client, R_34_AUD_MAST_CLK_NOMINAL_INC, acni & 0xff);
727 saa711x_write(client, R_34_AUD_MAST_CLK_NOMINAL_INC+1, (acni >> 8) & 0xff);
728 saa711x_write(client, R_34_AUD_MAST_CLK_NOMINAL_INC+2, (acni >> 16) & 0x3f);
629 state->audclk_freq = freq; 729 state->audclk_freq = freq;
630 return 0; 730 return 0;
631} 731}
632 732
633static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) 733static int saa711x_set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)
634{ 734{
635 struct saa7115_state *state = i2c_get_clientdata(client); 735 struct saa711x_state *state = i2c_get_clientdata(client);
636 736
637 switch (ctrl->id) { 737 switch (ctrl->id) {
638 case V4L2_CID_BRIGHTNESS: 738 case V4L2_CID_BRIGHTNESS:
@@ -642,7 +742,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c
642 } 742 }
643 743
644 state->bright = ctrl->value; 744 state->bright = ctrl->value;
645 saa7115_write(client, 0x0a, state->bright); 745 saa711x_write(client, R_0A_LUMA_BRIGHT_CNTL, state->bright);
646 break; 746 break;
647 747
648 case V4L2_CID_CONTRAST: 748 case V4L2_CID_CONTRAST:
@@ -652,7 +752,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c
652 } 752 }
653 753
654 state->contrast = ctrl->value; 754 state->contrast = ctrl->value;
655 saa7115_write(client, 0x0b, state->contrast); 755 saa711x_write(client, R_0B_LUMA_CONTRAST_CNTL, state->contrast);
656 break; 756 break;
657 757
658 case V4L2_CID_SATURATION: 758 case V4L2_CID_SATURATION:
@@ -662,7 +762,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c
662 } 762 }
663 763
664 state->sat = ctrl->value; 764 state->sat = ctrl->value;
665 saa7115_write(client, 0x0c, state->sat); 765 saa711x_write(client, R_0C_CHROMA_SAT_CNTL, state->sat);
666 break; 766 break;
667 767
668 case V4L2_CID_HUE: 768 case V4L2_CID_HUE:
@@ -672,7 +772,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c
672 } 772 }
673 773
674 state->hue = ctrl->value; 774 state->hue = ctrl->value;
675 saa7115_write(client, 0x0d, state->hue); 775 saa711x_write(client, R_0D_CHROMA_HUE_CNTL, state->hue);
676 break; 776 break;
677 777
678 default: 778 default:
@@ -682,9 +782,9 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c
682 return 0; 782 return 0;
683} 783}
684 784
685static int saa7115_get_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) 785static int saa711x_get_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl)
686{ 786{
687 struct saa7115_state *state = i2c_get_clientdata(client); 787 struct saa711x_state *state = i2c_get_clientdata(client);
688 788
689 switch (ctrl->id) { 789 switch (ctrl->id) {
690 case V4L2_CID_BRIGHTNESS: 790 case V4L2_CID_BRIGHTNESS:
@@ -706,10 +806,115 @@ static int saa7115_get_v4lctrl(struct i2c_client *client, struct v4l2_control *c
706 return 0; 806 return 0;
707} 807}
708 808
709static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std) 809static int saa711x_set_size(struct i2c_client *client, int width, int height)
810{
811 struct saa711x_state *state = i2c_get_clientdata(client);
812 int HPSC, HFSC;
813 int VSCY;
814 int res;
815 int is_50hz = state->std & V4L2_STD_625_50;
816 int Vsrc = is_50hz ? 576 : 480;
817
818 v4l_dbg(1, debug, client, "decoder set size to %ix%i\n",width,height);
819
820 /* FIXME need better bounds checking here */
821 if ((width < 1) || (width > 1440))
822 return -EINVAL;
823 if ((height < 1) || (height > Vsrc))
824 return -EINVAL;
825
826 if (!saa711x_has_reg(state->ident,R_D0_B_HORIZ_PRESCALING)) {
827 /* Decoder only supports 720 columns and 480 or 576 lines */
828 if (width != 720)
829 return -EINVAL;
830 if (height != Vsrc)
831 return -EINVAL;
832 }
833
834 state->width = width;
835 state->height = height;
836
837 if (!saa711x_has_reg(state->ident, R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH))
838 return 0;
839
840 /* probably have a valid size, let's set it */
841 /* Set output width/height */
842 /* width */
843
844 saa711x_write(client, R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH,
845 (u8) (width & 0xff));
846 saa711x_write(client, R_CD_B_HORIZ_OUTPUT_WINDOW_LENGTH_MSB,
847 (u8) ((width >> 8) & 0xff));
848
849 /* Vertical Scaling uses height/2 */
850 res=height/2;
851
852 /* On 60Hz, it is using a higher Vertical Output Size */
853 if (!is_50hz)
854 res+=(VRES_60HZ-480)>>1;
855
856 /* height */
857 saa711x_write(client, R_CE_B_VERT_OUTPUT_WINDOW_LENGTH,
858 (u8) (res & 0xff));
859 saa711x_write(client, R_CF_B_VERT_OUTPUT_WINDOW_LENGTH_MSB,
860 (u8) ((res >> 8) & 0xff));
861
862 /* Scaling settings */
863 /* Hprescaler is floor(inres/outres) */
864 HPSC = (int)(720 / width);
865 /* 0 is not allowed (div. by zero) */
866 HPSC = HPSC ? HPSC : 1;
867 HFSC = (int)((1024 * 720) / (HPSC * width));
868 /* FIXME hardcodes to "Task B"
869 * write H prescaler integer */
870 saa711x_write(client, R_D0_B_HORIZ_PRESCALING,
871 (u8) (HPSC & 0x3f));
872
873 v4l_dbg(1, debug, client, "Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC);
874 /* write H fine-scaling (luminance) */
875 saa711x_write(client, R_D8_B_HORIZ_LUMA_SCALING_INC,
876 (u8) (HFSC & 0xff));
877 saa711x_write(client, R_D9_B_HORIZ_LUMA_SCALING_INC_MSB,
878 (u8) ((HFSC >> 8) & 0xff));
879 /* write H fine-scaling (chrominance)
880 * must be lum/2, so i'll just bitshift :) */
881 saa711x_write(client, R_DC_B_HORIZ_CHROMA_SCALING,
882 (u8) ((HFSC >> 1) & 0xff));
883 saa711x_write(client, R_DD_B_HORIZ_CHROMA_SCALING_MSB,
884 (u8) ((HFSC >> 9) & 0xff));
885
886 VSCY = (int)((1024 * Vsrc) / height);
887 v4l_dbg(1, debug, client, "Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY);
888
889 /* Correct Contrast and Luminance */
890 saa711x_write(client, R_D5_B_LUMA_CONTRAST_CNTL,
891 (u8) (64 * 1024 / VSCY));
892 saa711x_write(client, R_D6_B_CHROMA_SATURATION_CNTL,
893 (u8) (64 * 1024 / VSCY));
894
895 /* write V fine-scaling (luminance) */
896 saa711x_write(client, R_E0_B_VERT_LUMA_SCALING_INC,
897 (u8) (VSCY & 0xff));
898 saa711x_write(client, R_E1_B_VERT_LUMA_SCALING_INC_MSB,
899 (u8) ((VSCY >> 8) & 0xff));
900 /* write V fine-scaling (chrominance) */
901 saa711x_write(client, R_E2_B_VERT_CHROMA_SCALING_INC,
902 (u8) (VSCY & 0xff));
903 saa711x_write(client, R_E3_B_VERT_CHROMA_SCALING_INC_MSB,
904 (u8) ((VSCY >> 8) & 0xff));
905
906 saa711x_writeregs(client, saa7115_cfg_reset_scaler);
907
908 /* Activates task "B" */
909 saa711x_write(client, R_80_GLOBAL_CNTL_1,
910 saa711x_read(client,R_80_GLOBAL_CNTL_1)|0x20);
911
912 return 0;
913}
914
915static void saa711x_set_v4lstd(struct i2c_client *client, v4l2_std_id std)
710{ 916{
711 struct saa7115_state *state = i2c_get_clientdata(client); 917 struct saa711x_state *state = i2c_get_clientdata(client);
712 int taskb = saa7115_read(client, 0x80) & 0x10;
713 918
714 /* Prevent unnecessary standard changes. During a standard 919 /* Prevent unnecessary standard changes. During a standard
715 change the I-Port is temporarily disabled. Any devices 920 change the I-Port is temporarily disabled. Any devices
@@ -721,17 +926,21 @@ static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std)
721 if (std == state->std) 926 if (std == state->std)
722 return; 927 return;
723 928
929 state->std = std;
930
724 // This works for NTSC-M, SECAM-L and the 50Hz PAL variants. 931 // This works for NTSC-M, SECAM-L and the 50Hz PAL variants.
725 if (std & V4L2_STD_525_60) { 932 if (std & V4L2_STD_525_60) {
726 v4l_dbg(1, debug, client, "decoder set standard 60 Hz\n"); 933 v4l_dbg(1, debug, client, "decoder set standard 60 Hz\n");
727 saa7115_writeregs(client, saa7115_cfg_60hz_video); 934 saa711x_writeregs(client, saa7115_cfg_60hz_video);
935 saa711x_set_size(client,720,480);
728 } else { 936 } else {
729 v4l_dbg(1, debug, client, "decoder set standard 50 Hz\n"); 937 v4l_dbg(1, debug, client, "decoder set standard 50 Hz\n");
730 saa7115_writeregs(client, saa7115_cfg_50hz_video); 938 saa711x_writeregs(client, saa7115_cfg_50hz_video);
939 saa711x_set_size(client,720,576);
731 } 940 }
732 941
733 /* Register 0E - Bits D6-D4 on NO-AUTO mode 942 /* Register 0E - Bits D6-D4 on NO-AUTO mode
734 (SAA7113 doesn't have auto mode) 943 (SAA7111 and SAA7113 doesn't have auto mode)
735 50 Hz / 625 lines 60 Hz / 525 lines 944 50 Hz / 625 lines 60 Hz / 525 lines
736 000 PAL BGDHI (4.43Mhz) NTSC M (3.58MHz) 945 000 PAL BGDHI (4.43Mhz) NTSC M (3.58MHz)
737 001 NTSC 4.43 (50 Hz) PAL 4.43 (60 Hz) 946 001 NTSC 4.43 (50 Hz) PAL 4.43 (60 Hz)
@@ -739,8 +948,9 @@ static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std)
739 011 NTSC N (3.58MHz) PAL M (3.58MHz) 948 011 NTSC N (3.58MHz) PAL M (3.58MHz)
740 100 reserved NTSC-Japan (3.58MHz) 949 100 reserved NTSC-Japan (3.58MHz)
741 */ 950 */
742 if (state->ident == V4L2_IDENT_SAA7113) { 951 if (state->ident == V4L2_IDENT_SAA7111 ||
743 u8 reg = saa7115_read(client, 0x0e) & 0x8f; 952 state->ident == V4L2_IDENT_SAA7113) {
953 u8 reg = saa711x_read(client, R_0E_CHROMA_CNTL_1) & 0x8f;
744 954
745 if (std == V4L2_STD_PAL_M) { 955 if (std == V4L2_STD_PAL_M) {
746 reg |= 0x30; 956 reg |= 0x30;
@@ -751,31 +961,30 @@ static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std)
751 } else if (std == V4L2_STD_NTSC_M_JP) { 961 } else if (std == V4L2_STD_NTSC_M_JP) {
752 reg |= 0x40; 962 reg |= 0x40;
753 } 963 }
754 saa7115_write(client, 0x0e, reg); 964 saa711x_write(client, R_0E_CHROMA_CNTL_1, reg);
755 } 965 } else {
756 966 /* restart task B if needed */
967 int taskb = saa711x_read(client, R_80_GLOBAL_CNTL_1) & 0x10;
757 968
758 state->std = std; 969 if (taskb && state->ident == V4L2_IDENT_SAA7114) {
970 saa711x_writeregs(client, saa7115_cfg_vbi_on);
971 }
759 972
760 /* restart task B if needed */ 973 /* switch audio mode too! */
761 if (taskb && state->ident != V4L2_IDENT_SAA7115) { 974 saa711x_set_audio_clock_freq(client, state->audclk_freq);
762 saa7115_writeregs(client, saa7115_cfg_vbi_on);
763 } 975 }
764
765 /* switch audio mode too! */
766 saa7115_set_audio_clock_freq(client, state->audclk_freq);
767} 976}
768 977
769static v4l2_std_id saa7115_get_v4lstd(struct i2c_client *client) 978static v4l2_std_id saa711x_get_v4lstd(struct i2c_client *client)
770{ 979{
771 struct saa7115_state *state = i2c_get_clientdata(client); 980 struct saa711x_state *state = i2c_get_clientdata(client);
772 981
773 return state->std; 982 return state->std;
774} 983}
775 984
776static void saa7115_log_status(struct i2c_client *client) 985static void saa711x_log_status(struct i2c_client *client)
777{ 986{
778 struct saa7115_state *state = i2c_get_clientdata(client); 987 struct saa711x_state *state = i2c_get_clientdata(client);
779 int reg1e, reg1f; 988 int reg1e, reg1f;
780 int signalOk; 989 int signalOk;
781 int vcr; 990 int vcr;
@@ -783,7 +992,7 @@ static void saa7115_log_status(struct i2c_client *client)
783 v4l_info(client, "Audio frequency: %d Hz\n", state->audclk_freq); 992 v4l_info(client, "Audio frequency: %d Hz\n", state->audclk_freq);
784 if (state->ident != V4L2_IDENT_SAA7115) { 993 if (state->ident != V4L2_IDENT_SAA7115) {
785 /* status for the saa7114 */ 994 /* status for the saa7114 */
786 reg1f = saa7115_read(client, 0x1f); 995 reg1f = saa711x_read(client, R_1F_STATUS_BYTE_2_VD_DEC);
787 signalOk = (reg1f & 0xc1) == 0x81; 996 signalOk = (reg1f & 0xc1) == 0x81;
788 v4l_info(client, "Video signal: %s\n", signalOk ? "ok" : "bad"); 997 v4l_info(client, "Video signal: %s\n", signalOk ? "ok" : "bad");
789 v4l_info(client, "Frequency: %s\n", (reg1f & 0x20) ? "60 Hz" : "50 Hz"); 998 v4l_info(client, "Frequency: %s\n", (reg1f & 0x20) ? "60 Hz" : "50 Hz");
@@ -791,8 +1000,8 @@ static void saa7115_log_status(struct i2c_client *client)
791 } 1000 }
792 1001
793 /* status for the saa7115 */ 1002 /* status for the saa7115 */
794 reg1e = saa7115_read(client, 0x1e); 1003 reg1e = saa711x_read(client, R_1E_STATUS_BYTE_1_VD_DEC);
795 reg1f = saa7115_read(client, 0x1f); 1004 reg1f = saa711x_read(client, R_1F_STATUS_BYTE_2_VD_DEC);
796 1005
797 signalOk = (reg1f & 0xc1) == 0x81 && (reg1e & 0xc0) == 0x80; 1006 signalOk = (reg1f & 0xc1) == 0x81 && (reg1e & 0xc0) == 0x80;
798 vcr = !(reg1f & 0x10); 1007 vcr = !(reg1f & 0x10);
@@ -819,19 +1028,27 @@ static void saa7115_log_status(struct i2c_client *client)
819 v4l_info(client, "Detected format: BW/No color\n"); 1028 v4l_info(client, "Detected format: BW/No color\n");
820 break; 1029 break;
821 } 1030 }
1031 v4l_info(client, "Width, Height: %d, %d\n", state->width, state->height);
822} 1032}
823 1033
824/* setup the sliced VBI lcr registers according to the sliced VBI format */ 1034/* setup the sliced VBI lcr registers according to the sliced VBI format */
825static void saa7115_set_lcr(struct i2c_client *client, struct v4l2_sliced_vbi_format *fmt) 1035static void saa711x_set_lcr(struct i2c_client *client, struct v4l2_sliced_vbi_format *fmt)
826{ 1036{
827 struct saa7115_state *state = i2c_get_clientdata(client); 1037 struct saa711x_state *state = i2c_get_clientdata(client);
828 int is_50hz = (state->std & V4L2_STD_625_50); 1038 int is_50hz = (state->std & V4L2_STD_625_50);
829 u8 lcr[24]; 1039 u8 lcr[24];
830 int i, x; 1040 int i, x;
831 1041
832 /* saa7113/7114 doesn't yet support VBI */ 1042#if 1
1043 /* saa7113/7114/7118 VBI support are experimental */
1044 if (!saa711x_has_reg(state->ident,R_41_LCR_BASE))
1045 return;
1046
1047#else
1048 /* SAA7113 and SAA7118 also should support VBI - Need testing */
833 if (state->ident != V4L2_IDENT_SAA7115) 1049 if (state->ident != V4L2_IDENT_SAA7115)
834 return; 1050 return;
1051#endif
835 1052
836 for (i = 0; i <= 23; i++) 1053 for (i = 0; i <= 23; i++)
837 lcr[i] = 0xff; 1054 lcr[i] = 0xff;
@@ -888,14 +1105,16 @@ static void saa7115_set_lcr(struct i2c_client *client, struct v4l2_sliced_vbi_fo
888 1105
889 /* write the lcr registers */ 1106 /* write the lcr registers */
890 for (i = 2; i <= 23; i++) { 1107 for (i = 2; i <= 23; i++) {
891 saa7115_write(client, i - 2 + 0x41, lcr[i]); 1108 saa711x_write(client, i - 2 + R_41_LCR_BASE, lcr[i]);
892 } 1109 }
893 1110
894 /* enable/disable raw VBI capturing */ 1111 /* enable/disable raw VBI capturing */
895 saa7115_writeregs(client, fmt->service_set == 0 ? saa7115_cfg_vbi_on : saa7115_cfg_vbi_off); 1112 saa711x_writeregs(client, fmt->service_set == 0 ?
1113 saa7115_cfg_vbi_on :
1114 saa7115_cfg_vbi_off);
896} 1115}
897 1116
898static int saa7115_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) 1117static int saa711x_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt)
899{ 1118{
900 static u16 lcr2vbi[] = { 1119 static u16 lcr2vbi[] = {
901 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ 1120 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */
@@ -911,10 +1130,10 @@ static int saa7115_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
911 return -EINVAL; 1130 return -EINVAL;
912 memset(sliced, 0, sizeof(*sliced)); 1131 memset(sliced, 0, sizeof(*sliced));
913 /* done if using raw VBI */ 1132 /* done if using raw VBI */
914 if (saa7115_read(client, 0x80) & 0x10) 1133 if (saa711x_read(client, R_80_GLOBAL_CNTL_1) & 0x10)
915 return 0; 1134 return 0;
916 for (i = 2; i <= 23; i++) { 1135 for (i = 2; i <= 23; i++) {
917 u8 v = saa7115_read(client, i - 2 + 0x41); 1136 u8 v = saa711x_read(client, i - 2 + R_41_LCR_BASE);
918 1137
919 sliced->service_lines[0][i] = lcr2vbi[v >> 4]; 1138 sliced->service_lines[0][i] = lcr2vbi[v >> 4];
920 sliced->service_lines[1][i] = lcr2vbi[v & 0xf]; 1139 sliced->service_lines[1][i] = lcr2vbi[v & 0xf];
@@ -924,114 +1143,31 @@ static int saa7115_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt
924 return 0; 1143 return 0;
925} 1144}
926 1145
927static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) 1146static int saa711x_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt)
928{ 1147{
929 struct saa7115_state *state = i2c_get_clientdata(client);
930 struct v4l2_pix_format *pix;
931 int HPSC, HFSC;
932 int VSCY, Vsrc;
933 int is_50hz = state->std & V4L2_STD_625_50;
934
935 if (fmt->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) { 1148 if (fmt->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) {
936 saa7115_set_lcr(client, &fmt->fmt.sliced); 1149 saa711x_set_lcr(client, &fmt->fmt.sliced);
937 return 0; 1150 return 0;
938 } 1151 }
939 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) 1152 if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
940 return -EINVAL; 1153 return -EINVAL;
941 1154
942 pix = &(fmt->fmt.pix); 1155 return saa711x_set_size(client,fmt->fmt.pix.width,fmt->fmt.pix.height);
943
944 v4l_dbg(1, debug, client, "decoder set size\n");
945
946 /* FIXME need better bounds checking here */
947 if ((pix->width < 1) || (pix->width > 1440))
948 return -EINVAL;
949 if ((pix->height < 1) || (pix->height > 960))
950 return -EINVAL;
951
952 /* probably have a valid size, let's set it */
953 /* Set output width/height */
954 /* width */
955 saa7115_write(client, 0xcc, (u8) (pix->width & 0xff));
956 saa7115_write(client, 0xcd, (u8) ((pix->width >> 8) & 0xff));
957 /* height */
958 saa7115_write(client, 0xce, (u8) (pix->height & 0xff));
959 saa7115_write(client, 0xcf, (u8) ((pix->height >> 8) & 0xff));
960
961 /* Scaling settings */
962 /* Hprescaler is floor(inres/outres) */
963 /* FIXME hardcoding input res */
964 if (pix->width != 720) {
965 HPSC = (int)(720 / pix->width);
966 /* 0 is not allowed (div. by zero) */
967 HPSC = HPSC ? HPSC : 1;
968 HFSC = (int)((1024 * 720) / (HPSC * pix->width));
969
970 v4l_dbg(1, debug, client, "Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC);
971 /* FIXME hardcodes to "Task B"
972 * write H prescaler integer */
973 saa7115_write(client, 0xd0, (u8) (HPSC & 0x3f));
974
975 /* write H fine-scaling (luminance) */
976 saa7115_write(client, 0xd8, (u8) (HFSC & 0xff));
977 saa7115_write(client, 0xd9, (u8) ((HFSC >> 8) & 0xff));
978 /* write H fine-scaling (chrominance)
979 * must be lum/2, so i'll just bitshift :) */
980 saa7115_write(client, 0xDC, (u8) ((HFSC >> 1) & 0xff));
981 saa7115_write(client, 0xDD, (u8) ((HFSC >> 9) & 0xff));
982 } else {
983 if (is_50hz) {
984 v4l_dbg(1, debug, client, "Setting full 50hz width\n");
985 saa7115_writeregs(client, saa7115_cfg_50hz_fullres_x);
986 } else {
987 v4l_dbg(1, debug, client, "Setting full 60hz width\n");
988 saa7115_writeregs(client, saa7115_cfg_60hz_fullres_x);
989 }
990 }
991
992 Vsrc = is_50hz ? 576 : 480;
993
994 if (pix->height != Vsrc) {
995 VSCY = (int)((1024 * Vsrc) / pix->height);
996 v4l_dbg(1, debug, client, "Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY);
997
998 /* Correct Contrast and Luminance */
999 saa7115_write(client, 0xd5, (u8) (64 * 1024 / VSCY));
1000 saa7115_write(client, 0xd6, (u8) (64 * 1024 / VSCY));
1001
1002 /* write V fine-scaling (luminance) */
1003 saa7115_write(client, 0xe0, (u8) (VSCY & 0xff));
1004 saa7115_write(client, 0xe1, (u8) ((VSCY >> 8) & 0xff));
1005 /* write V fine-scaling (chrominance) */
1006 saa7115_write(client, 0xe2, (u8) (VSCY & 0xff));
1007 saa7115_write(client, 0xe3, (u8) ((VSCY >> 8) & 0xff));
1008 } else {
1009 if (is_50hz) {
1010 v4l_dbg(1, debug, client, "Setting full 50Hz height\n");
1011 saa7115_writeregs(client, saa7115_cfg_50hz_fullres_y);
1012 } else {
1013 v4l_dbg(1, debug, client, "Setting full 60hz height\n");
1014 saa7115_writeregs(client, saa7115_cfg_60hz_fullres_y);
1015 }
1016 }
1017
1018 saa7115_writeregs(client, saa7115_cfg_reset_scaler);
1019 return 0;
1020} 1156}
1021 1157
1022/* Decode the sliced VBI data stream as created by the saa7115. 1158/* Decode the sliced VBI data stream as created by the saa7115.
1023 The format is described in the saa7115 datasheet in Tables 25 and 26 1159 The format is described in the saa7115 datasheet in Tables 25 and 26
1024 and in Figure 33. 1160 and in Figure 33.
1025 The current implementation uses SAV/EAV codes and not the ancillary data 1161 The current implementation uses SAV/EAV codes and not the ancillary data
1026 headers. The vbi->p pointer points to the SDID byte right after the SAV 1162 headers. The vbi->p pointer points to the R_5E_SDID byte right after the SAV
1027 code. */ 1163 code. */
1028static void saa7115_decode_vbi_line(struct i2c_client *client, 1164static void saa711x_decode_vbi_line(struct i2c_client *client,
1029 struct v4l2_decode_vbi_line *vbi) 1165 struct v4l2_decode_vbi_line *vbi)
1030{ 1166{
1031 static const char vbi_no_data_pattern[] = { 1167 static const char vbi_no_data_pattern[] = {
1032 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0 1168 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0
1033 }; 1169 };
1034 struct saa7115_state *state = i2c_get_clientdata(client); 1170 struct saa711x_state *state = i2c_get_clientdata(client);
1035 u8 *p = vbi->p; 1171 u8 *p = vbi->p;
1036 u32 wss; 1172 u32 wss;
1037 int id1, id2; /* the ID1 and ID2 bytes from the internal header */ 1173 int id1, id2; /* the ID1 and ID2 bytes from the internal header */
@@ -1066,12 +1202,12 @@ static void saa7115_decode_vbi_line(struct i2c_client *client,
1066 vbi->type = V4L2_SLICED_TELETEXT_B; 1202 vbi->type = V4L2_SLICED_TELETEXT_B;
1067 break; 1203 break;
1068 case 4: 1204 case 4:
1069 if (!saa7115_odd_parity(p[0]) || !saa7115_odd_parity(p[1])) 1205 if (!saa711x_odd_parity(p[0]) || !saa711x_odd_parity(p[1]))
1070 return; 1206 return;
1071 vbi->type = V4L2_SLICED_CAPTION_525; 1207 vbi->type = V4L2_SLICED_CAPTION_525;
1072 break; 1208 break;
1073 case 5: 1209 case 5:
1074 wss = saa7115_decode_wss(p); 1210 wss = saa711x_decode_wss(p);
1075 if (wss == -1) 1211 if (wss == -1)
1076 return; 1212 return;
1077 p[0] = wss & 0xff; 1213 p[0] = wss & 0xff;
@@ -1079,7 +1215,7 @@ static void saa7115_decode_vbi_line(struct i2c_client *client,
1079 vbi->type = V4L2_SLICED_WSS_625; 1215 vbi->type = V4L2_SLICED_WSS_625;
1080 break; 1216 break;
1081 case 7: 1217 case 7:
1082 if (saa7115_decode_vps(p, p) != 0) 1218 if (saa711x_decode_vps(p, p) != 0)
1083 return; 1219 return;
1084 vbi->type = V4L2_SLICED_VPS; 1220 vbi->type = V4L2_SLICED_VPS;
1085 break; 1221 break;
@@ -1090,21 +1226,21 @@ static void saa7115_decode_vbi_line(struct i2c_client *client,
1090 1226
1091/* ============ SAA7115 AUDIO settings (end) ============= */ 1227/* ============ SAA7115 AUDIO settings (end) ============= */
1092 1228
1093static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *arg) 1229static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *arg)
1094{ 1230{
1095 struct saa7115_state *state = i2c_get_clientdata(client); 1231 struct saa711x_state *state = i2c_get_clientdata(client);
1096 int *iarg = arg; 1232 int *iarg = arg;
1097 1233
1098 /* ioctls to allow direct access to the saa7115 registers for testing */ 1234 /* ioctls to allow direct access to the saa7115 registers for testing */
1099 switch (cmd) { 1235 switch (cmd) {
1100 case VIDIOC_S_FMT: 1236 case VIDIOC_S_FMT:
1101 return saa7115_set_v4lfmt(client, (struct v4l2_format *)arg); 1237 return saa711x_set_v4lfmt(client, (struct v4l2_format *)arg);
1102 1238
1103 case VIDIOC_G_FMT: 1239 case VIDIOC_G_FMT:
1104 return saa7115_get_v4lfmt(client, (struct v4l2_format *)arg); 1240 return saa711x_get_v4lfmt(client, (struct v4l2_format *)arg);
1105 1241
1106 case VIDIOC_INT_AUDIO_CLOCK_FREQ: 1242 case VIDIOC_INT_AUDIO_CLOCK_FREQ:
1107 return saa7115_set_audio_clock_freq(client, *(u32 *)arg); 1243 return saa711x_set_audio_clock_freq(client, *(u32 *)arg);
1108 1244
1109 case VIDIOC_G_TUNER: 1245 case VIDIOC_G_TUNER:
1110 { 1246 {
@@ -1113,7 +1249,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1113 1249
1114 if (state->radio) 1250 if (state->radio)
1115 break; 1251 break;
1116 status = saa7115_read(client, 0x1f); 1252 status = saa711x_read(client, R_1F_STATUS_BYTE_2_VD_DEC);
1117 1253
1118 v4l_dbg(1, debug, client, "status: 0x%02x\n", status); 1254 v4l_dbg(1, debug, client, "status: 0x%02x\n", status);
1119 vt->signal = ((status & (1 << 6)) == 0) ? 0xffff : 0x0; 1255 vt->signal = ((status & (1 << 6)) == 0) ? 0xffff : 0x0;
@@ -1121,14 +1257,14 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1121 } 1257 }
1122 1258
1123 case VIDIOC_LOG_STATUS: 1259 case VIDIOC_LOG_STATUS:
1124 saa7115_log_status(client); 1260 saa711x_log_status(client);
1125 break; 1261 break;
1126 1262
1127 case VIDIOC_G_CTRL: 1263 case VIDIOC_G_CTRL:
1128 return saa7115_get_v4lctrl(client, (struct v4l2_control *)arg); 1264 return saa711x_get_v4lctrl(client, (struct v4l2_control *)arg);
1129 1265
1130 case VIDIOC_S_CTRL: 1266 case VIDIOC_S_CTRL:
1131 return saa7115_set_v4lctrl(client, (struct v4l2_control *)arg); 1267 return saa711x_set_v4lctrl(client, (struct v4l2_control *)arg);
1132 1268
1133 case VIDIOC_QUERYCTRL: 1269 case VIDIOC_QUERYCTRL:
1134 { 1270 {
@@ -1146,12 +1282,12 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1146 } 1282 }
1147 1283
1148 case VIDIOC_G_STD: 1284 case VIDIOC_G_STD:
1149 *(v4l2_std_id *)arg = saa7115_get_v4lstd(client); 1285 *(v4l2_std_id *)arg = saa711x_get_v4lstd(client);
1150 break; 1286 break;
1151 1287
1152 case VIDIOC_S_STD: 1288 case VIDIOC_S_STD:
1153 state->radio = 0; 1289 state->radio = 0;
1154 saa7115_set_v4lstd(client, *(v4l2_std_id *)arg); 1290 saa711x_set_v4lstd(client, *(v4l2_std_id *)arg);
1155 break; 1291 break;
1156 1292
1157 case AUDC_SET_RADIO: 1293 case AUDC_SET_RADIO:
@@ -1187,13 +1323,13 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1187 state->input = route->input; 1323 state->input = route->input;
1188 1324
1189 /* select mode */ 1325 /* select mode */
1190 saa7115_write(client, 0x02, 1326 saa711x_write(client, R_02_INPUT_CNTL_1,
1191 (saa7115_read(client, 0x02) & 0xf0) | 1327 (saa711x_read(client, R_02_INPUT_CNTL_1) & 0xf0) |
1192 state->input); 1328 state->input);
1193 1329
1194 /* bypass chrominance trap for S-Video modes */ 1330 /* bypass chrominance trap for S-Video modes */
1195 saa7115_write(client, 0x09, 1331 saa711x_write(client, R_09_LUMA_CNTL,
1196 (saa7115_read(client, 0x09) & 0x7f) | 1332 (saa711x_read(client, R_09_LUMA_CNTL) & 0x7f) |
1197 (state->input >= SAA7115_SVIDEO0 ? 0x80 : 0x0)); 1333 (state->input >= SAA7115_SVIDEO0 ? 0x80 : 0x0));
1198 break; 1334 break;
1199 } 1335 }
@@ -1205,7 +1341,9 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1205 1341
1206 if (state->enable != (cmd == VIDIOC_STREAMON)) { 1342 if (state->enable != (cmd == VIDIOC_STREAMON)) {
1207 state->enable = (cmd == VIDIOC_STREAMON); 1343 state->enable = (cmd == VIDIOC_STREAMON);
1208 saa7115_write(client, 0x87, state->enable); 1344 saa711x_write(client,
1345 R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED,
1346 state->enable);
1209 } 1347 }
1210 break; 1348 break;
1211 1349
@@ -1220,17 +1358,17 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1220 state->cgcdiv = (freq->flags & SAA7115_FREQ_FL_CGCDIV) ? 3 : 4; 1358 state->cgcdiv = (freq->flags & SAA7115_FREQ_FL_CGCDIV) ? 3 : 4;
1221 state->ucgc = (freq->flags & SAA7115_FREQ_FL_UCGC) ? 1 : 0; 1359 state->ucgc = (freq->flags & SAA7115_FREQ_FL_UCGC) ? 1 : 0;
1222 state->apll = (freq->flags & SAA7115_FREQ_FL_APLL) ? 1 : 0; 1360 state->apll = (freq->flags & SAA7115_FREQ_FL_APLL) ? 1 : 0;
1223 saa7115_set_audio_clock_freq(client, state->audclk_freq); 1361 saa711x_set_audio_clock_freq(client, state->audclk_freq);
1224 break; 1362 break;
1225 } 1363 }
1226 1364
1227 case VIDIOC_INT_DECODE_VBI_LINE: 1365 case VIDIOC_INT_DECODE_VBI_LINE:
1228 saa7115_decode_vbi_line(client, arg); 1366 saa711x_decode_vbi_line(client, arg);
1229 break; 1367 break;
1230 1368
1231 case VIDIOC_INT_RESET: 1369 case VIDIOC_INT_RESET:
1232 v4l_dbg(1, debug, client, "decoder RESET\n"); 1370 v4l_dbg(1, debug, client, "decoder RESET\n");
1233 saa7115_writeregs(client, saa7115_cfg_reset_scaler); 1371 saa711x_writeregs(client, saa7115_cfg_reset_scaler);
1234 break; 1372 break;
1235 1373
1236 case VIDIOC_INT_G_VBI_DATA: 1374 case VIDIOC_INT_G_VBI_DATA:
@@ -1239,25 +1377,25 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1239 1377
1240 switch (data->id) { 1378 switch (data->id) {
1241 case V4L2_SLICED_WSS_625: 1379 case V4L2_SLICED_WSS_625:
1242 if (saa7115_read(client, 0x6b) & 0xc0) 1380 if (saa711x_read(client, 0x6b) & 0xc0)
1243 return -EIO; 1381 return -EIO;
1244 data->data[0] = saa7115_read(client, 0x6c); 1382 data->data[0] = saa711x_read(client, 0x6c);
1245 data->data[1] = saa7115_read(client, 0x6d); 1383 data->data[1] = saa711x_read(client, 0x6d);
1246 return 0; 1384 return 0;
1247 case V4L2_SLICED_CAPTION_525: 1385 case V4L2_SLICED_CAPTION_525:
1248 if (data->field == 0) { 1386 if (data->field == 0) {
1249 /* CC */ 1387 /* CC */
1250 if (saa7115_read(client, 0x66) & 0xc0) 1388 if (saa711x_read(client, 0x66) & 0xc0)
1251 return -EIO; 1389 return -EIO;
1252 data->data[0] = saa7115_read(client, 0x67); 1390 data->data[0] = saa711x_read(client, 0x67);
1253 data->data[1] = saa7115_read(client, 0x68); 1391 data->data[1] = saa711x_read(client, 0x68);
1254 return 0; 1392 return 0;
1255 } 1393 }
1256 /* XDS */ 1394 /* XDS */
1257 if (saa7115_read(client, 0x66) & 0x30) 1395 if (saa711x_read(client, 0x66) & 0x30)
1258 return -EIO; 1396 return -EIO;
1259 data->data[0] = saa7115_read(client, 0x69); 1397 data->data[0] = saa711x_read(client, 0x69);
1260 data->data[1] = saa7115_read(client, 0x6a); 1398 data->data[1] = saa711x_read(client, 0x6a);
1261 return 0; 1399 return 0;
1262 default: 1400 default:
1263 return -EINVAL; 1401 return -EINVAL;
@@ -1272,7 +1410,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1272 1410
1273 if (reg->i2c_id != I2C_DRIVERID_SAA711X) 1411 if (reg->i2c_id != I2C_DRIVERID_SAA711X)
1274 return -EINVAL; 1412 return -EINVAL;
1275 reg->val = saa7115_read(client, reg->reg & 0xff); 1413 reg->val = saa711x_read(client, reg->reg & 0xff);
1276 break; 1414 break;
1277 } 1415 }
1278 1416
@@ -1284,7 +1422,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1284 return -EINVAL; 1422 return -EINVAL;
1285 if (!capable(CAP_SYS_ADMIN)) 1423 if (!capable(CAP_SYS_ADMIN))
1286 return -EPERM; 1424 return -EPERM;
1287 saa7115_write(client, reg->reg & 0xff, reg->val & 0xff); 1425 saa711x_write(client, reg->reg & 0xff, reg->val & 0xff);
1288 break; 1426 break;
1289 } 1427 }
1290#endif 1428#endif
@@ -1302,12 +1440,14 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar
1302 1440
1303/* ----------------------------------------------------------------------- */ 1441/* ----------------------------------------------------------------------- */
1304 1442
1305static struct i2c_driver i2c_driver_saa7115; 1443static struct i2c_driver i2c_driver_saa711x;
1306 1444
1307static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) 1445static int saa711x_attach(struct i2c_adapter *adapter, int address, int kind)
1308{ 1446{
1309 struct i2c_client *client; 1447 struct i2c_client *client;
1310 struct saa7115_state *state; 1448 struct saa711x_state *state;
1449 int i;
1450 char name[17];
1311 u8 chip_id; 1451 u8 chip_id;
1312 1452
1313 /* Check if the adapter supports the needed features */ 1453 /* Check if the adapter supports the needed features */
@@ -1319,28 +1459,31 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
1319 return -ENOMEM; 1459 return -ENOMEM;
1320 client->addr = address; 1460 client->addr = address;
1321 client->adapter = adapter; 1461 client->adapter = adapter;
1322 client->driver = &i2c_driver_saa7115; 1462 client->driver = &i2c_driver_saa711x;
1323 snprintf(client->name, sizeof(client->name) - 1, "saa7115"); 1463 snprintf(client->name, sizeof(client->name) - 1, "saa7115");
1324 1464
1325 v4l_dbg(1, debug, client, "detecting saa7115 client on address 0x%x\n", address << 1); 1465 v4l_dbg(1, debug, client, "detecting saa7115 client on address 0x%x\n", address << 1);
1326 1466
1327 saa7115_write(client, 0, 5); 1467 for (i=0;i<0x0f;i++) {
1328 chip_id = saa7115_read(client, 0) & 0x0f; 1468 saa711x_write(client, 0, i);
1329 if (chip_id < 3 && chip_id > 5) { 1469 name[i] = (saa711x_read(client, 0) &0x0f) +'0';
1330 v4l_dbg(1, debug, client, "saa7115 not found\n"); 1470 if (name[i]>'9')
1331 kfree(client); 1471 name[i]+='a'-'9'-1;
1332 return 0;
1333 } 1472 }
1473 name[i]='\0';
1474
1475 saa711x_write(client, 0, 5);
1476 chip_id = saa711x_read(client, 0) & 0x0f;
1477
1334 snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); 1478 snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id);
1335 v4l_info(client, "saa711%d found @ 0x%x (%s)\n", chip_id, address << 1, adapter->name); 1479 v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, address << 1, adapter->name);
1336 1480
1337 state = kzalloc(sizeof(struct saa7115_state), GFP_KERNEL); 1481 state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL);
1338 i2c_set_clientdata(client, state); 1482 i2c_set_clientdata(client, state);
1339 if (state == NULL) { 1483 if (state == NULL) {
1340 kfree(client); 1484 kfree(client);
1341 return -ENOMEM; 1485 return -ENOMEM;
1342 } 1486 }
1343 state->std = V4L2_STD_NTSC;
1344 state->input = -1; 1487 state->input = -1;
1345 state->enable = 1; 1488 state->enable = 1;
1346 state->radio = 0; 1489 state->radio = 0;
@@ -1349,15 +1492,25 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
1349 state->hue = 0; 1492 state->hue = 0;
1350 state->sat = 64; 1493 state->sat = 64;
1351 switch (chip_id) { 1494 switch (chip_id) {
1495 case 1:
1496 state->ident = V4L2_IDENT_SAA7111;
1497 break;
1352 case 3: 1498 case 3:
1353 state->ident = V4L2_IDENT_SAA7113; 1499 state->ident = V4L2_IDENT_SAA7113;
1354 break; 1500 break;
1355 case 4: 1501 case 4:
1356 state->ident = V4L2_IDENT_SAA7114; 1502 state->ident = V4L2_IDENT_SAA7114;
1357 break; 1503 break;
1358 default: 1504 case 5:
1359 state->ident = V4L2_IDENT_SAA7115; 1505 state->ident = V4L2_IDENT_SAA7115;
1360 break; 1506 break;
1507 case 8:
1508 state->ident = V4L2_IDENT_SAA7118;
1509 break;
1510 default:
1511 state->ident = V4L2_IDENT_SAA7111;
1512 v4l_info(client, "WARNING: Chip is not known - Falling back to saa7111\n");
1513
1361 } 1514 }
1362 1515
1363 state->audclk_freq = 48000; 1516 state->audclk_freq = 48000;
@@ -1365,38 +1518,39 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind)
1365 v4l_dbg(1, debug, client, "writing init values\n"); 1518 v4l_dbg(1, debug, client, "writing init values\n");
1366 1519
1367 /* init to 60hz/48khz */ 1520 /* init to 60hz/48khz */
1368 if (state->ident == V4L2_IDENT_SAA7113) { 1521 state->crystal_freq = SAA7115_FREQ_24_576_MHZ;
1369 state->crystal_freq = SAA7115_FREQ_24_576_MHZ; 1522 switch (state->ident) {
1370 saa7115_writeregs(client, saa7113_init_auto_input); 1523 case V4L2_IDENT_SAA7111:
1371 } else { 1524 saa711x_writeregs(client, saa7111_init);
1525 break;
1526 case V4L2_IDENT_SAA7113:
1527 saa711x_writeregs(client, saa7113_init);
1528 break;
1529 default:
1372 state->crystal_freq = SAA7115_FREQ_32_11_MHZ; 1530 state->crystal_freq = SAA7115_FREQ_32_11_MHZ;
1373 saa7115_writeregs(client, saa7115_init_auto_input); 1531 saa711x_writeregs(client, saa7115_init_auto_input);
1374 } 1532 }
1375 saa7115_writeregs(client, saa7115_init_misc); 1533 saa711x_writeregs(client, saa7115_init_misc);
1376 saa7115_writeregs(client, saa7115_cfg_60hz_fullres_x); 1534 saa711x_set_v4lstd(client, V4L2_STD_NTSC);
1377 saa7115_writeregs(client, saa7115_cfg_60hz_fullres_y);
1378 saa7115_writeregs(client, saa7115_cfg_60hz_video);
1379 saa7115_set_audio_clock_freq(client, state->audclk_freq);
1380 saa7115_writeregs(client, saa7115_cfg_reset_scaler);
1381 1535
1382 i2c_attach_client(client); 1536 i2c_attach_client(client);
1383 1537
1384 v4l_dbg(1, debug, client, "status: (1E) 0x%02x, (1F) 0x%02x\n", 1538 v4l_dbg(1, debug, client, "status: (1E) 0x%02x, (1F) 0x%02x\n",
1385 saa7115_read(client, 0x1e), saa7115_read(client, 0x1f)); 1539 saa711x_read(client, R_1E_STATUS_BYTE_1_VD_DEC), saa711x_read(client, R_1F_STATUS_BYTE_2_VD_DEC));
1386 1540
1387 return 0; 1541 return 0;
1388} 1542}
1389 1543
1390static int saa7115_probe(struct i2c_adapter *adapter) 1544static int saa711x_probe(struct i2c_adapter *adapter)
1391{ 1545{
1392 if (adapter->class & I2C_CLASS_TV_ANALOG) 1546 if (adapter->class & I2C_CLASS_TV_ANALOG)
1393 return i2c_probe(adapter, &addr_data, &saa7115_attach); 1547 return i2c_probe(adapter, &addr_data, &saa711x_attach);
1394 return 0; 1548 return 0;
1395} 1549}
1396 1550
1397static int saa7115_detach(struct i2c_client *client) 1551static int saa711x_detach(struct i2c_client *client)
1398{ 1552{
1399 struct saa7115_state *state = i2c_get_clientdata(client); 1553 struct saa711x_state *state = i2c_get_clientdata(client);
1400 int err; 1554 int err;
1401 1555
1402 err = i2c_detach_client(client); 1556 err = i2c_detach_client(client);
@@ -1412,26 +1566,26 @@ static int saa7115_detach(struct i2c_client *client)
1412/* ----------------------------------------------------------------------- */ 1566/* ----------------------------------------------------------------------- */
1413 1567
1414/* i2c implementation */ 1568/* i2c implementation */
1415static struct i2c_driver i2c_driver_saa7115 = { 1569static struct i2c_driver i2c_driver_saa711x = {
1416 .driver = { 1570 .driver = {
1417 .name = "saa7115", 1571 .name = "saa7115",
1418 }, 1572 },
1419 .id = I2C_DRIVERID_SAA711X, 1573 .id = I2C_DRIVERID_SAA711X,
1420 .attach_adapter = saa7115_probe, 1574 .attach_adapter = saa711x_probe,
1421 .detach_client = saa7115_detach, 1575 .detach_client = saa711x_detach,
1422 .command = saa7115_command, 1576 .command = saa711x_command,
1423}; 1577};
1424 1578
1425 1579
1426static int __init saa7115_init_module(void) 1580static int __init saa711x_init_module(void)
1427{ 1581{
1428 return i2c_add_driver(&i2c_driver_saa7115); 1582 return i2c_add_driver(&i2c_driver_saa711x);
1429} 1583}
1430 1584
1431static void __exit saa7115_cleanup_module(void) 1585static void __exit saa711x_cleanup_module(void)
1432{ 1586{
1433 i2c_del_driver(&i2c_driver_saa7115); 1587 i2c_del_driver(&i2c_driver_saa711x);
1434} 1588}
1435 1589
1436module_init(saa7115_init_module); 1590module_init(saa711x_init_module);
1437module_exit(saa7115_cleanup_module); 1591module_exit(saa711x_cleanup_module);
diff --git a/drivers/media/video/saa711x_regs.h b/drivers/media/video/saa711x_regs.h
new file mode 100644
index 000000000000..4e5f2eb0a2c1
--- /dev/null
+++ b/drivers/media/video/saa711x_regs.h
@@ -0,0 +1,549 @@
1/* saa711x - Philips SAA711x video decoder register specifications
2 *
3 * Copyright (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org>
4 *
5 * This program is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU General Public License
7 * as published by the Free Software Foundation; either version 2
8 * of the License, or (at your option) any later version.
9 *
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
14 */
15
16#define R_00_CHIP_VERSION 0x00
17/* Video Decoder */
18 /* Video Decoder - Frontend part */
19#define R_01_INC_DELAY 0x01
20#define R_02_INPUT_CNTL_1 0x02
21#define R_03_INPUT_CNTL_2 0x03
22#define R_04_INPUT_CNTL_3 0x04
23#define R_05_INPUT_CNTL_4 0x05
24 /* Video Decoder - Decoder part */
25#define R_06_H_SYNC_START 0x06
26#define R_07_H_SYNC_STOP 0x07
27#define R_08_SYNC_CNTL 0x08
28#define R_09_LUMA_CNTL 0x09
29#define R_0A_LUMA_BRIGHT_CNTL 0x0a
30#define R_0B_LUMA_CONTRAST_CNTL 0x0b
31#define R_0C_CHROMA_SAT_CNTL 0x0c
32#define R_0D_CHROMA_HUE_CNTL 0x0d
33#define R_0E_CHROMA_CNTL_1 0x0e
34#define R_0F_CHROMA_GAIN_CNTL 0x0f
35#define R_10_CHROMA_CNTL_2 0x10
36#define R_11_MODE_DELAY_CNTL 0x11
37#define R_12_RT_SIGNAL_CNTL 0x12
38#define R_13_RT_X_PORT_OUT_CNTL 0x13
39#define R_14_ANAL_ADC_COMPAT_CNTL 0x14
40#define R_15_VGATE_START_FID_CHG 0x15
41#define R_16_VGATE_STOP 0x16
42#define R_17_MISC_VGATE_CONF_AND_MSB 0x17
43#define R_18_RAW_DATA_GAIN_CNTL 0x18
44#define R_19_RAW_DATA_OFF_CNTL 0x19
45#define R_1A_COLOR_KILL_LVL_CNTL 0x1a
46#define R_1B_MISC_TVVCRDET 0x1b
47#define R_1C_ENHAN_COMB_CTRL1 0x1c
48#define R_1D_ENHAN_COMB_CTRL2 0x1d
49#define R_1E_STATUS_BYTE_1_VD_DEC 0x1e
50#define R_1F_STATUS_BYTE_2_VD_DEC 0x1f
51
52/* Component processing and interrupt masking part */
53#define R_23_INPUT_CNTL_5 0x23
54#define R_24_INPUT_CNTL_6 0x24
55#define R_25_INPUT_CNTL_7 0x25
56#define R_29_COMP_DELAY 0x29
57#define R_2A_COMP_BRIGHT_CNTL 0x2a
58#define R_2B_COMP_CONTRAST_CNTL 0x2b
59#define R_2C_COMP_SAT_CNTL 0x2c
60#define R_2D_INTERRUPT_MASK_1 0x2d
61#define R_2E_INTERRUPT_MASK_2 0x2e
62#define R_2F_INTERRUPT_MASK_3 0x2f
63
64/* Audio clock generator part */
65#define R_30_AUD_MAST_CLK_CYCLES_PER_FIELD 0x30
66#define R_34_AUD_MAST_CLK_NOMINAL_INC 0x34
67#define R_38_CLK_RATIO_AMXCLK_TO_ASCLK 0x38
68#define R_39_CLK_RATIO_ASCLK_TO_ALRCLK 0x39
69#define R_3A_AUD_CLK_GEN_BASIC_SETUP 0x3a
70
71/* General purpose VBI data slicer part */
72#define R_40_SLICER_CNTL_1 0x40
73#define R_41_LCR_BASE 0x41
74#define R_58_PROGRAM_FRAMING_CODE 0x58
75#define R_59_H_OFF_FOR_SLICER 0x59
76#define R_5A_V_OFF_FOR_SLICER 0x5a
77#define R_5B_FLD_OFF_AND_MSB_FOR_H_AND_V_OFF 0x5b
78#define R_5D_DID 0x5d
79#define R_5E_SDID 0x5e
80#define R_60_SLICER_STATUS_BYTE_0 0x60
81#define R_61_SLICER_STATUS_BYTE_1 0x61
82#define R_62_SLICER_STATUS_BYTE_2 0x62
83
84/* X port, I port and the scaler part */
85 /* Task independent global settings */
86#define R_80_GLOBAL_CNTL_1 0x80
87#define R_81_V_SYNC_FLD_ID_SRC_SEL_AND_RETIMED_V_F 0x81
88#define R_83_X_PORT_I_O_ENA_AND_OUT_CLK 0x83
89#define R_84_I_PORT_SIGNAL_DEF 0x84
90#define R_85_I_PORT_SIGNAL_POLAR 0x85
91#define R_86_I_PORT_FIFO_FLAG_CNTL_AND_ARBIT 0x86
92#define R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED 0x87
93#define R_88_POWER_SAVE_ADC_PORT_CNTL 0x88
94#define R_8F_STATUS_INFO_SCALER 0x8f
95 /* Task A definition */
96 /* Basic settings and acquisition window definition */
97#define R_90_A_TASK_HANDLING_CNTL 0x90
98#define R_91_A_X_PORT_FORMATS_AND_CONF 0x91
99#define R_92_A_X_PORT_INPUT_REFERENCE_SIGNAL 0x92
100#define R_93_A_I_PORT_OUTPUT_FORMATS_AND_CONF 0x93
101#define R_94_A_HORIZ_INPUT_WINDOW_START 0x94
102#define R_95_A_HORIZ_INPUT_WINDOW_START_MSB 0x95
103#define R_96_A_HORIZ_INPUT_WINDOW_LENGTH 0x96
104#define R_97_A_HORIZ_INPUT_WINDOW_LENGTH_MSB 0x97
105#define R_98_A_VERT_INPUT_WINDOW_START 0x98
106#define R_99_A_VERT_INPUT_WINDOW_START_MSB 0x99
107#define R_9A_A_VERT_INPUT_WINDOW_LENGTH 0x9a
108#define R_9B_A_VERT_INPUT_WINDOW_LENGTH_MSB 0x9b
109#define R_9C_A_HORIZ_OUTPUT_WINDOW_LENGTH 0x9c
110#define R_9D_A_HORIZ_OUTPUT_WINDOW_LENGTH_MSB 0x9d
111#define R_9E_A_VERT_OUTPUT_WINDOW_LENGTH 0x9e
112#define R_9F_A_VERT_OUTPUT_WINDOW_LENGTH_MSB 0x9f
113 /* FIR filtering and prescaling */
114#define R_A0_A_HORIZ_PRESCALING 0xa0
115#define R_A1_A_ACCUMULATION_LENGTH 0xa1
116#define R_A2_A_PRESCALER_DC_GAIN_AND_FIR_PREFILTER 0xa2
117#define R_A4_A_LUMA_BRIGHTNESS_CNTL 0xa4
118#define R_A5_A_LUMA_CONTRAST_CNTL 0xa5
119#define R_A6_A_CHROMA_SATURATION_CNTL 0xa6
120 /* Horizontal phase scaling */
121#define R_A8_A_HORIZ_LUMA_SCALING_INC 0xa8
122#define R_A9_A_HORIZ_LUMA_SCALING_INC_MSB 0xa9
123#define R_AA_A_HORIZ_LUMA_PHASE_OFF 0xaa
124#define R_AC_A_HORIZ_CHROMA_SCALING_INC 0xac
125#define R_AD_A_HORIZ_CHROMA_SCALING_INC_MSB 0xad
126#define R_AE_A_HORIZ_CHROMA_PHASE_OFF 0xae
127#define R_AF_A_HORIZ_CHROMA_PHASE_OFF_MSB 0xaf
128 /* Vertical scaling */
129#define R_B0_A_VERT_LUMA_SCALING_INC 0xb0
130#define R_B1_A_VERT_LUMA_SCALING_INC_MSB 0xb1
131#define R_B2_A_VERT_CHROMA_SCALING_INC 0xb2
132#define R_B3_A_VERT_CHROMA_SCALING_INC_MSB 0xb3
133#define R_B4_A_VERT_SCALING_MODE_CNTL 0xb4
134#define R_B8_A_VERT_CHROMA_PHASE_OFF_00 0xb8
135#define R_B9_A_VERT_CHROMA_PHASE_OFF_01 0xb9
136#define R_BA_A_VERT_CHROMA_PHASE_OFF_10 0xba
137#define R_BB_A_VERT_CHROMA_PHASE_OFF_11 0xbb
138#define R_BC_A_VERT_LUMA_PHASE_OFF_00 0xbc
139#define R_BD_A_VERT_LUMA_PHASE_OFF_01 0xbd
140#define R_BE_A_VERT_LUMA_PHASE_OFF_10 0xbe
141#define R_BF_A_VERT_LUMA_PHASE_OFF_11 0xbf
142 /* Task B definition */
143 /* Basic settings and acquisition window definition */
144#define R_C0_B_TASK_HANDLING_CNTL 0xc0
145#define R_C1_B_X_PORT_FORMATS_AND_CONF 0xc1
146#define R_C2_B_INPUT_REFERENCE_SIGNAL_DEFINITION 0xc2
147#define R_C3_B_I_PORT_FORMATS_AND_CONF 0xc3
148#define R_C4_B_HORIZ_INPUT_WINDOW_START 0xc4
149#define R_C5_B_HORIZ_INPUT_WINDOW_START_MSB 0xc5
150#define R_C6_B_HORIZ_INPUT_WINDOW_LENGTH 0xc6
151#define R_C7_B_HORIZ_INPUT_WINDOW_LENGTH_MSB 0xc7
152#define R_C8_B_VERT_INPUT_WINDOW_START 0xc8
153#define R_C9_B_VERT_INPUT_WINDOW_START_MSB 0xc9
154#define R_CA_B_VERT_INPUT_WINDOW_LENGTH 0xca
155#define R_CB_B_VERT_INPUT_WINDOW_LENGTH_MSB 0xcb
156#define R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH 0xcc
157#define R_CD_B_HORIZ_OUTPUT_WINDOW_LENGTH_MSB 0xcd
158#define R_CE_B_VERT_OUTPUT_WINDOW_LENGTH 0xce
159#define R_CF_B_VERT_OUTPUT_WINDOW_LENGTH_MSB 0xcf
160 /* FIR filtering and prescaling */
161#define R_D0_B_HORIZ_PRESCALING 0xd0
162#define R_D1_B_ACCUMULATION_LENGTH 0xd1
163#define R_D2_B_PRESCALER_DC_GAIN_AND_FIR_PREFILTER 0xd2
164#define R_D4_B_LUMA_BRIGHTNESS_CNTL 0xd4
165#define R_D5_B_LUMA_CONTRAST_CNTL 0xd5
166#define R_D6_B_CHROMA_SATURATION_CNTL 0xd6
167 /* Horizontal phase scaling */
168#define R_D8_B_HORIZ_LUMA_SCALING_INC 0xd8
169#define R_D9_B_HORIZ_LUMA_SCALING_INC_MSB 0xd9
170#define R_DA_B_HORIZ_LUMA_PHASE_OFF 0xda
171#define R_DC_B_HORIZ_CHROMA_SCALING 0xdc
172#define R_DD_B_HORIZ_CHROMA_SCALING_MSB 0xdd
173#define R_DE_B_HORIZ_PHASE_OFFSET_CRHOMA 0xde
174 /* Vertical scaling */
175#define R_E0_B_VERT_LUMA_SCALING_INC 0xe0
176#define R_E1_B_VERT_LUMA_SCALING_INC_MSB 0xe1
177#define R_E2_B_VERT_CHROMA_SCALING_INC 0xe2
178#define R_E3_B_VERT_CHROMA_SCALING_INC_MSB 0xe3
179#define R_E4_B_VERT_SCALING_MODE_CNTL 0xe4
180#define R_E8_B_VERT_CHROMA_PHASE_OFF_00 0xe8
181#define R_E9_B_VERT_CHROMA_PHASE_OFF_01 0xe9
182#define R_EA_B_VERT_CHROMA_PHASE_OFF_10 0xea
183#define R_EB_B_VERT_CHROMA_PHASE_OFF_11 0xeb
184#define R_EC_B_VERT_LUMA_PHASE_OFF_00 0xec
185#define R_ED_B_VERT_LUMA_PHASE_OFF_01 0xed
186#define R_EE_B_VERT_LUMA_PHASE_OFF_10 0xee
187#define R_EF_B_VERT_LUMA_PHASE_OFF_11 0xef
188
189/* second PLL (PLL2) and Pulsegenerator Programming */
190#define R_F0_LFCO_PER_LINE 0xf0
191#define R_F1_P_I_PARAM_SELECT 0xf1
192#define R_F2_NOMINAL_PLL2_DTO 0xf2
193#define R_F3_PLL_INCREMENT 0xf3
194#define R_F4_PLL2_STATUS 0xf4
195#define R_F5_PULSGEN_LINE_LENGTH 0xf5
196#define R_F6_PULSE_A_POS_LSB_AND_PULSEGEN_CONFIG 0xf6
197#define R_F7_PULSE_A_POS_MSB 0xf7
198#define R_F8_PULSE_B_POS 0xf8
199#define R_F9_PULSE_B_POS_MSB 0xf9
200#define R_FA_PULSE_C_POS 0xfa
201#define R_FB_PULSE_C_POS_MSB 0xfb
202#define R_FF_S_PLL_MAX_PHASE_ERR_THRESH_NUM_LINES 0xff
203
204#if 0
205/* Those structs will be used in the future for debug purposes */
206struct saa711x_reg_descr {
207 u8 reg;
208 int count;
209 char *name;
210};
211
212struct saa711x_reg_descr saa711x_regs[] = {
213 /* REG COUNT NAME */
214 {R_00_CHIP_VERSION,1,
215 "Chip version"},
216
217 /* Video Decoder: R_01_INC_DELAY to R_1F_STATUS_BYTE_2_VD_DEC */
218
219 /* Video Decoder - Frontend part: R_01_INC_DELAY to R_05_INPUT_CNTL_4 */
220 {R_01_INC_DELAY,1,
221 "Increment delay"},
222 {R_02_INPUT_CNTL_1,1,
223 "Analog input control 1"},
224 {R_03_INPUT_CNTL_2,1,
225 "Analog input control 2"},
226 {R_04_INPUT_CNTL_3,1,
227 "Analog input control 3"},
228 {R_05_INPUT_CNTL_4,1,
229 "Analog input control 4"},
230
231 /* Video Decoder - Decoder part: R_06_H_SYNC_START to R_1F_STATUS_BYTE_2_VD_DEC */
232 {R_06_H_SYNC_START,1,
233 "Horizontal sync start"},
234 {R_07_H_SYNC_STOP,1,
235 "Horizontal sync stop"},
236 {R_08_SYNC_CNTL,1,
237 "Sync control"},
238 {R_09_LUMA_CNTL,1,
239 "Luminance control"},
240 {R_0A_LUMA_BRIGHT_CNTL,1,
241 "Luminance brightness control"},
242 {R_0B_LUMA_CONTRAST_CNTL,1,
243 "Luminance contrast control"},
244 {R_0C_CHROMA_SAT_CNTL,1,
245 "Chrominance saturation control"},
246 {R_0D_CHROMA_HUE_CNTL,1,
247 "Chrominance hue control"},
248 {R_0E_CHROMA_CNTL_1,1,
249 "Chrominance control 1"},
250 {R_0F_CHROMA_GAIN_CNTL,1,
251 "Chrominance gain control"},
252 {R_10_CHROMA_CNTL_2,1,
253 "Chrominance control 2"},
254 {R_11_MODE_DELAY_CNTL,1,
255 "Mode/delay control"},
256 {R_12_RT_SIGNAL_CNTL,1,
257 "RT signal control"},
258 {R_13_RT_X_PORT_OUT_CNTL,1,
259 "RT/X port output control"},
260 {R_14_ANAL_ADC_COMPAT_CNTL,1,
261 "Analog/ADC/compatibility control"},
262 {R_15_VGATE_START_FID_CHG, 1,
263 "VGATE start FID change"},
264 {R_16_VGATE_STOP,1,
265 "VGATE stop"},
266 {R_17_MISC_VGATE_CONF_AND_MSB, 1,
267 "Miscellaneous VGATE configuration and MSBs"},
268 {R_18_RAW_DATA_GAIN_CNTL,1,
269 "Raw data gain control",},
270 {R_19_RAW_DATA_OFF_CNTL,1,
271 "Raw data offset control",},
272 {R_1A_COLOR_KILL_LVL_CNTL,1,
273 "Color Killer Level Control"},
274 { R_1B_MISC_TVVCRDET, 1,
275 "MISC /TVVCRDET"},
276 { R_1C_ENHAN_COMB_CTRL1, 1,
277 "Enhanced comb ctrl1"},
278 { R_1D_ENHAN_COMB_CTRL2, 1,
279 "Enhanced comb ctrl1"},
280 {R_1E_STATUS_BYTE_1_VD_DEC,1,
281 "Status byte 1 video decoder"},
282 {R_1F_STATUS_BYTE_2_VD_DEC,1,
283 "Status byte 2 video decoder"},
284
285 /* Component processing and interrupt masking part: 0x20h to R_2F_INTERRUPT_MASK_3 */
286 /* 0x20 to 0x22 - Reserved */
287 {R_23_INPUT_CNTL_5,1,
288 "Analog input control 5"},
289 {R_24_INPUT_CNTL_6,1,
290 "Analog input control 6"},
291 {R_25_INPUT_CNTL_7,1,
292 "Analog input control 7"},
293 /* 0x26 to 0x28 - Reserved */
294 {R_29_COMP_DELAY,1,
295 "Component delay"},
296 {R_2A_COMP_BRIGHT_CNTL,1,
297 "Component brightness control"},
298 {R_2B_COMP_CONTRAST_CNTL,1,
299 "Component contrast control"},
300 {R_2C_COMP_SAT_CNTL,1,
301 "Component saturation control"},
302 {R_2D_INTERRUPT_MASK_1,1,
303 "Interrupt mask 1"},
304 {R_2E_INTERRUPT_MASK_2,1,
305 "Interrupt mask 2"},
306 {R_2F_INTERRUPT_MASK_3,1,
307 "Interrupt mask 3"},
308
309 /* Audio clock generator part: R_30_AUD_MAST_CLK_CYCLES_PER_FIELD to 0x3f */
310 {R_30_AUD_MAST_CLK_CYCLES_PER_FIELD,3,
311 "Audio master clock cycles per field"},
312 /* 0x33 - Reserved */
313 {R_34_AUD_MAST_CLK_NOMINAL_INC,3,
314 "Audio master clock nominal increment"},
315 /* 0x37 - Reserved */
316 {R_38_CLK_RATIO_AMXCLK_TO_ASCLK,1,
317 "Clock ratio AMXCLK to ASCLK"},
318 {R_39_CLK_RATIO_ASCLK_TO_ALRCLK,1,
319 "Clock ratio ASCLK to ALRCLK"},
320 {R_3A_AUD_CLK_GEN_BASIC_SETUP,1,
321 "Audio clock generator basic setup"},
322 /* 0x3b-0x3f - Reserved */
323
324 /* General purpose VBI data slicer part: R_40_SLICER_CNTL_1 to 0x7f */
325 {R_40_SLICER_CNTL_1,1,
326 "Slicer control 1"},
327 {R_41_LCR,23,
328 "R_41_LCR"},
329 {R_58_PROGRAM_FRAMING_CODE,1,
330 "Programmable framing code"},
331 {R_59_H_OFF_FOR_SLICER,1,
332 "Horizontal offset for slicer"},
333 {R_5A_V_OFF_FOR_SLICER,1,
334 "Vertical offset for slicer"},
335 {R_5B_FLD_OFF_AND_MSB_FOR_H_AND_V_OFF,1,
336 "Field offset and MSBs for horizontal and vertical offset"},
337 {R_5D_DID,1,
338 "Header and data identification (R_5D_DID)"},
339 {R_5E_SDID,1,
340 "Sliced data identification (R_5E_SDID) code"},
341 {R_60_SLICER_STATUS_BYTE_0,1,
342 "Slicer status byte 0"},
343 {R_61_SLICER_STATUS_BYTE_1,1,
344 "Slicer status byte 1"},
345 {R_62_SLICER_STATUS_BYTE_2,1,
346 "Slicer status byte 2"},
347 /* 0x63-0x7f - Reserved */
348
349 /* X port, I port and the scaler part: R_80_GLOBAL_CNTL_1 to R_EF_B_VERT_LUMA_PHASE_OFF_11 */
350 /* Task independent global settings: R_80_GLOBAL_CNTL_1 to R_8F_STATUS_INFO_SCALER */
351 {R_80_GLOBAL_CNTL_1,1,
352 "Global control 1"},
353 {R_81_V_SYNC_FLD_ID_SRC_SEL_AND_RETIMED_V_F,1,
354 "Vertical sync and Field ID source selection, retimed V and F signals"},
355 /* 0x82 - Reserved */
356 {R_83_X_PORT_I_O_ENA_AND_OUT_CLK,1,
357 "X port I/O enable and output clock"},
358 {R_84_I_PORT_SIGNAL_DEF,1,
359 "I port signal definitions"},
360 {R_85_I_PORT_SIGNAL_POLAR,1,
361 "I port signal polarities"},
362 {R_86_I_PORT_FIFO_FLAG_CNTL_AND_ARBIT,1,
363 "I port FIFO flag control and arbitration"},
364 {R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, 1,
365 "I port I/O enable output clock and gated"},
366 {R_88_POWER_SAVE_ADC_PORT_CNTL,1,
367 "Power save/ADC port control"},
368 /* 089-0x8e - Reserved */
369 {R_8F_STATUS_INFO_SCALER,1,
370 "Status information scaler part"},
371
372 /* Task A definition: R_90_A_TASK_HANDLING_CNTL to R_BF_A_VERT_LUMA_PHASE_OFF_11 */
373 /* Task A: Basic settings and acquisition window definition */
374 {R_90_A_TASK_HANDLING_CNTL,1,
375 "Task A: Task handling control"},
376 {R_91_A_X_PORT_FORMATS_AND_CONF,1,
377 "Task A: X port formats and configuration"},
378 {R_92_A_X_PORT_INPUT_REFERENCE_SIGNAL,1,
379 "Task A: X port input reference signal definition"},
380 {R_93_A_I_PORT_OUTPUT_FORMATS_AND_CONF,1,
381 "Task A: I port output formats and configuration"},
382 {R_94_A_HORIZ_INPUT_WINDOW_START,2,
383 "Task A: Horizontal input window start"},
384 {R_96_A_HORIZ_INPUT_WINDOW_LENGTH,2,
385 "Task A: Horizontal input window length"},
386 {R_98_A_VERT_INPUT_WINDOW_START,2,
387 "Task A: Vertical input window start"},
388 {R_9A_A_VERT_INPUT_WINDOW_LENGTH,2,
389 "Task A: Vertical input window length"},
390 {R_9C_A_HORIZ_OUTPUT_WINDOW_LENGTH,2,
391 "Task A: Horizontal output window length"},
392 {R_9E_A_VERT_OUTPUT_WINDOW_LENGTH,2,
393 "Task A: Vertical output window length"},
394
395 /* Task A: FIR filtering and prescaling */
396 {R_A0_A_HORIZ_PRESCALING,1,
397 "Task A: Horizontal prescaling"},
398 {R_A1_A_ACCUMULATION_LENGTH,1,
399 "Task A: Accumulation length"},
400 {R_A2_A_PRESCALER_DC_GAIN_AND_FIR_PREFILTER,1,
401 "Task A: Prescaler DC gain and FIR prefilter"},
402 /* 0xa3 - Reserved */
403 {R_A4_A_LUMA_BRIGHTNESS_CNTL,1,
404 "Task A: Luminance brightness control"},
405 {R_A5_A_LUMA_CONTRAST_CNTL,1,
406 "Task A: Luminance contrast control"},
407 {R_A6_A_CHROMA_SATURATION_CNTL,1,
408 "Task A: Chrominance saturation control"},
409 /* 0xa7 - Reserved */
410
411 /* Task A: Horizontal phase scaling */
412 {R_A8_A_HORIZ_LUMA_SCALING_INC,2,
413 "Task A: Horizontal luminance scaling increment"},
414 {R_AA_A_HORIZ_LUMA_PHASE_OFF,1,
415 "Task A: Horizontal luminance phase offset"},
416 /* 0xab - Reserved */
417 {R_AC_A_HORIZ_CHROMA_SCALING_INC,2,
418 "Task A: Horizontal chrominance scaling increment"},
419 {R_AE_A_HORIZ_CHROMA_PHASE_OFF,1,
420 "Task A: Horizontal chrominance phase offset"},
421 /* 0xaf - Reserved */
422
423 /* Task A: Vertical scaling */
424 {R_B0_A_VERT_LUMA_SCALING_INC,2,
425 "Task A: Vertical luminance scaling increment"},
426 {R_B2_A_VERT_CHROMA_SCALING_INC,2,
427 "Task A: Vertical chrominance scaling increment"},
428 {R_B4_A_VERT_SCALING_MODE_CNTL,1,
429 "Task A: Vertical scaling mode control"},
430 /* 0xb5-0xb7 - Reserved */
431 {R_B8_A_VERT_CHROMA_PHASE_OFF_00,1,
432 "Task A: Vertical chrominance phase offset '00'"},
433 {R_B9_A_VERT_CHROMA_PHASE_OFF_01,1,
434 "Task A: Vertical chrominance phase offset '01'"},
435 {R_BA_A_VERT_CHROMA_PHASE_OFF_10,1,
436 "Task A: Vertical chrominance phase offset '10'"},
437 {R_BB_A_VERT_CHROMA_PHASE_OFF_11,1,
438 "Task A: Vertical chrominance phase offset '11'"},
439 {R_BC_A_VERT_LUMA_PHASE_OFF_00,1,
440 "Task A: Vertical luminance phase offset '00'"},
441 {R_BD_A_VERT_LUMA_PHASE_OFF_01,1,
442 "Task A: Vertical luminance phase offset '01'"},
443 {R_BE_A_VERT_LUMA_PHASE_OFF_10,1,
444 "Task A: Vertical luminance phase offset '10'"},
445 {R_BF_A_VERT_LUMA_PHASE_OFF_11,1,
446 "Task A: Vertical luminance phase offset '11'"},
447
448 /* Task B definition: R_C0_B_TASK_HANDLING_CNTL to R_EF_B_VERT_LUMA_PHASE_OFF_11 */
449 /* Task B: Basic settings and acquisition window definition */
450 {R_C0_B_TASK_HANDLING_CNTL,1,
451 "Task B: Task handling control"},
452 {R_C1_B_X_PORT_FORMATS_AND_CONF,1,
453 "Task B: X port formats and configuration"},
454 {R_C2_B_INPUT_REFERENCE_SIGNAL_DEFINITION,1,
455 "Task B: Input reference signal definition"},
456 {R_C3_B_I_PORT_FORMATS_AND_CONF,1,
457 "Task B: I port formats and configuration"},
458 {R_C4_B_HORIZ_INPUT_WINDOW_START,2,
459 "Task B: Horizontal input window start"},
460 {R_C6_B_HORIZ_INPUT_WINDOW_LENGTH,2,
461 "Task B: Horizontal input window length"},
462 {R_C8_B_VERT_INPUT_WINDOW_START,2,
463 "Task B: Vertical input window start"},
464 {R_CA_B_VERT_INPUT_WINDOW_LENGTH,2,
465 "Task B: Vertical input window length"},
466 {R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH,2,
467 "Task B: Horizontal output window length"},
468 {R_CE_B_VERT_OUTPUT_WINDOW_LENGTH,2,
469 "Task B: Vertical output window length"},
470
471 /* Task B: FIR filtering and prescaling */
472 {R_D0_B_HORIZ_PRESCALING,1,
473 "Task B: Horizontal prescaling"},
474 {R_D1_B_ACCUMULATION_LENGTH,1,
475 "Task B: Accumulation length"},
476 {R_D2_B_PRESCALER_DC_GAIN_AND_FIR_PREFILTER,1,
477 "Task B: Prescaler DC gain and FIR prefilter"},
478 /* 0xd3 - Reserved */
479 {R_D4_B_LUMA_BRIGHTNESS_CNTL,1,
480 "Task B: Luminance brightness control"},
481 {R_D5_B_LUMA_CONTRAST_CNTL,1,
482 "Task B: Luminance contrast control"},
483 {R_D6_B_CHROMA_SATURATION_CNTL,1,
484 "Task B: Chrominance saturation control"},
485 /* 0xd7 - Reserved */
486
487 /* Task B: Horizontal phase scaling */
488 {R_D8_B_HORIZ_LUMA_SCALING_INC,2,
489 "Task B: Horizontal luminance scaling increment"},
490 {R_DA_B_HORIZ_LUMA_PHASE_OFF,1,
491 "Task B: Horizontal luminance phase offset"},
492 /* 0xdb - Reserved */
493 {R_DC_B_HORIZ_CHROMA_SCALING,2,
494 "Task B: Horizontal chrominance scaling"},
495 {R_DE_B_HORIZ_PHASE_OFFSET_CRHOMA,1,
496 "Task B: Horizontal Phase Offset Chroma"},
497 /* 0xdf - Reserved */
498
499 /* Task B: Vertical scaling */
500 {R_E0_B_VERT_LUMA_SCALING_INC,2,
501 "Task B: Vertical luminance scaling increment"},
502 {R_E2_B_VERT_CHROMA_SCALING_INC,2,
503 "Task B: Vertical chrominance scaling increment"},
504 {R_E4_B_VERT_SCALING_MODE_CNTL,1,
505 "Task B: Vertical scaling mode control"},
506 /* 0xe5-0xe7 - Reserved */
507 {R_E8_B_VERT_CHROMA_PHASE_OFF_00,1,
508 "Task B: Vertical chrominance phase offset '00'"},
509 {R_E9_B_VERT_CHROMA_PHASE_OFF_01,1,
510 "Task B: Vertical chrominance phase offset '01'"},
511 {R_EA_B_VERT_CHROMA_PHASE_OFF_10,1,
512 "Task B: Vertical chrominance phase offset '10'"},
513 {R_EB_B_VERT_CHROMA_PHASE_OFF_11,1,
514 "Task B: Vertical chrominance phase offset '11'"},
515 {R_EC_B_VERT_LUMA_PHASE_OFF_00,1,
516 "Task B: Vertical luminance phase offset '00'"},
517 {R_ED_B_VERT_LUMA_PHASE_OFF_01,1,
518 "Task B: Vertical luminance phase offset '01'"},
519 {R_EE_B_VERT_LUMA_PHASE_OFF_10,1,
520 "Task B: Vertical luminance phase offset '10'"},
521 {R_EF_B_VERT_LUMA_PHASE_OFF_11,1,
522 "Task B: Vertical luminance phase offset '11'"},
523
524 /* second PLL (PLL2) and Pulsegenerator Programming */
525 { R_F0_LFCO_PER_LINE, 1,
526 "LFCO's per line"},
527 { R_F1_P_I_PARAM_SELECT,1,
528 "P-/I- Param. Select., PLL Mode, PLL H-Src., LFCO's per line"},
529 { R_F2_NOMINAL_PLL2_DTO,1,
530 "Nominal PLL2 DTO"},
531 {R_F3_PLL_INCREMENT,1,
532 "PLL2 Increment"},
533 {R_F4_PLL2_STATUS,1,
534 "PLL2 Status"},
535 {R_F5_PULSGEN_LINE_LENGTH,1,
536 "Pulsgen. line length"},
537 {R_F6_PULSE_A_POS_LSB_AND_PULSEGEN_CONFIG,1,
538 "Pulse A Position, Pulsgen Resync., Pulsgen. H-Src., Pulsgen. line length"},
539 {R_F7_PULSE_A_POS_MSB,1,
540 "Pulse A Position"},
541 {R_F8_PULSE_B_POS,2,
542 "Pulse B Position"},
543 {R_FA_PULSE_C_POS,2,
544 "Pulse C Position"},
545 /* 0xfc to 0xfe - Reserved */
546 {R_FF_S_PLL_MAX_PHASE_ERR_THRESH_NUM_LINES,1,
547 "S_PLL max. phase, error threshold, PLL2 no. of lines, threshold"},
548};
549#endif
diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig
index f5543166d193..59da79ce2efd 100644
--- a/drivers/media/video/saa7134/Kconfig
+++ b/drivers/media/video/saa7134/Kconfig
@@ -41,53 +41,15 @@ config VIDEO_SAA7134_DVB
41 select VIDEO_BUF_DVB 41 select VIDEO_BUF_DVB
42 select FW_LOADER 42 select FW_LOADER
43 select DVB_PLL 43 select DVB_PLL
44 select DVB_MT352 if !DVB_FE_CUSTOMISE
45 select DVB_TDA1004X if !DVB_FE_CUSTOMISE
46 select DVB_NXT200X if !DVB_FE_CUSTOMISE
47 select DVB_TDA10086 if !DVB_FE_CUSTOMISE
48 select DVB_TDA826X if !DVB_FE_CUSTOMISE
49 select DVB_ISL6421 if !DVB_FE_CUSTOMISE
44 ---help--- 50 ---help---
45 This adds support for DVB cards based on the 51 This adds support for DVB cards based on the
46 Philips saa7134 chip. 52 Philips saa7134 chip.
47 53
48 To compile this driver as a module, choose M here: the 54 To compile this driver as a module, choose M here: the
49 module will be called saa7134-dvb. 55 module will be called saa7134-dvb.
50
51 You must also select one or more DVB demodulators.
52 If you are unsure which you need, choose all of them.
53
54config VIDEO_SAA7134_DVB_ALL_FRONTENDS
55 bool "Build all supported frontends for saa7134 based TV cards"
56 default y
57 depends on VIDEO_SAA7134_DVB
58 select DVB_MT352
59 select DVB_TDA1004X
60 select DVB_NXT200X
61 ---help---
62 This builds saa7134-dvb with all currently supported frontend
63 demodulators. If you wish to tweak your configuration, and
64 only include support for the hardware that you need, choose N here.
65
66 If you are unsure, choose Y.
67
68config VIDEO_SAA7134_DVB_MT352
69 bool "Zarlink MT352 DVB-T Support"
70 default y
71 depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS
72 select DVB_MT352
73 ---help---
74 This adds DVB-T support for cards based on the
75 Philips saa7134 chip and the MT352 demodulator.
76
77config VIDEO_SAA7134_DVB_TDA1004X
78 bool "Phillips TDA10045H/TDA10046H DVB-T Support"
79 default y
80 depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS
81 select DVB_TDA1004X
82 ---help---
83 This adds DVB-T support for cards based on the
84 Philips saa7134 chip and the TDA10045H/TDA10046H demodulator.
85
86config VIDEO_SAA7134_DVB_NXT200X
87 bool "NXT2002/NXT2004 ATSC Support"
88 default y
89 depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS
90 select DVB_NXT200X
91 ---help---
92 This adds ATSC 8VSB and QAM64/256 support for cards based on the
93 Philips saa7134 chip and the NXT2002/NXT2004 demodulator.
diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile
index be7b9ee697d6..89a1565b4256 100644
--- a/drivers/media/video/saa7134/Makefile
+++ b/drivers/media/video/saa7134/Makefile
@@ -16,8 +16,5 @@ EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core
16EXTRA_CFLAGS += -Idrivers/media/dvb/frontends 16EXTRA_CFLAGS += -Idrivers/media/dvb/frontends
17 17
18extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1 18extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1
19extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1
20extra-cflags-$(CONFIG_DVB_TDA1004X) += -DHAVE_TDA1004X=1
21extra-cflags-$(CONFIG_DVB_NXT200X) += -DHAVE_NXT200X=1
22 19
23EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m) 20EXTRA_CFLAGS += $(extra-cflags-y) $(extra-cflags-m)
diff --git a/drivers/media/video/saa7134/saa7134-alsa.c b/drivers/media/video/saa7134/saa7134-alsa.c
index d73cff1970ae..a39e0136ce3b 100644
--- a/drivers/media/video/saa7134/saa7134-alsa.c
+++ b/drivers/media/video/saa7134/saa7134-alsa.c
@@ -590,6 +590,11 @@ static int snd_card_saa7134_hw_free(struct snd_pcm_substream * substream)
590 590
591static int snd_card_saa7134_capture_close(struct snd_pcm_substream * substream) 591static int snd_card_saa7134_capture_close(struct snd_pcm_substream * substream)
592{ 592{
593 snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream);
594 struct saa7134_dev *dev = saa7134->dev;
595
596 dev->ctl_mute = 1;
597 saa7134_tvaudio_setmute(dev);
593 return 0; 598 return 0;
594} 599}
595 600
@@ -631,6 +636,9 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream)
631 runtime->private_free = snd_card_saa7134_runtime_free; 636 runtime->private_free = snd_card_saa7134_runtime_free;
632 runtime->hw = snd_card_saa7134_capture; 637 runtime->hw = snd_card_saa7134_capture;
633 638
639 dev->ctl_mute = 0;
640 saa7134_tvaudio_setmute(dev);
641
634 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) 642 if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
635 return err; 643 return err;
636 644
diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c
index 927413aded10..aa1db509f3d4 100644
--- a/drivers/media/video/saa7134/saa7134-cards.c
+++ b/drivers/media/video/saa7134/saa7134-cards.c
@@ -1911,7 +1911,7 @@ struct saa7134_board saa7134_boards[] = {
1911 }, 1911 },
1912 }, 1912 },
1913 [SAA7134_BOARD_FLYDVBT_DUO_CARDBUS] = { 1913 [SAA7134_BOARD_FLYDVBT_DUO_CARDBUS] = {
1914 .name = "LifeView/Typhoon FlyDVB-T Duo Cardbus", 1914 .name = "LifeView/Typhoon/Genius FlyDVB-T Duo Cardbus",
1915 .audio_clock = 0x00200000, 1915 .audio_clock = 0x00200000,
1916 .tuner_type = TUNER_PHILIPS_TDA8290, 1916 .tuner_type = TUNER_PHILIPS_TDA8290,
1917 .radio_type = UNSET, 1917 .radio_type = UNSET,
@@ -2891,6 +2891,80 @@ struct saa7134_board saa7134_boards[] = {
2891 .gpio = 0x8000, 2891 .gpio = 0x8000,
2892 }, 2892 },
2893 }, 2893 },
2894 [SAA7134_BOARD_MEDION_MD8800_QUADRO] = {
2895 .name = "Medion Md8800 Quadro",
2896 .audio_clock = 0x00187de7,
2897 .tuner_type = TUNER_PHILIPS_TDA8290,
2898 .radio_type = UNSET,
2899 .tuner_addr = ADDR_UNSET,
2900 .radio_addr = ADDR_UNSET,
2901 .mpeg = SAA7134_MPEG_DVB,
2902 .inputs = {{
2903 .name = name_tv,
2904 .vmux = 1,
2905 .amux = TV,
2906 .tv = 1,
2907 },{
2908 .name = name_comp1,
2909 .vmux = 0,
2910 .amux = LINE2,
2911 },{
2912 .name = name_svideo,
2913 .vmux = 8,
2914 .amux = LINE2,
2915 }},
2916 },
2917 [SAA7134_BOARD_FLYDVBS_LR300] = {
2918 /* LifeView FlyDVB-s */
2919 /* Igor M. Liplianin <liplianin@tut.by> */
2920 .name = "LifeView FlyDVB-S /Acorp TV134DS",
2921 .audio_clock = 0x00200000,
2922 .tuner_type = TUNER_ABSENT,
2923 .radio_type = UNSET,
2924 .tuner_addr = ADDR_UNSET,
2925 .radio_addr = ADDR_UNSET,
2926 .mpeg = SAA7134_MPEG_DVB,
2927 .inputs = {{
2928 .name = name_comp1, /* Composite input */
2929 .vmux = 3,
2930 .amux = LINE1,
2931 },{
2932 .name = name_svideo, /* S-Video signal on S-Video input */
2933 .vmux = 8,
2934 .amux = LINE1,
2935 }},
2936 },
2937 [SAA7134_BOARD_PROTEUS_2309] = {
2938 .name = "Proteus Pro 2309",
2939 .audio_clock = 0x00187de7,
2940 .tuner_type = TUNER_PHILIPS_FM1216ME_MK3,
2941 .radio_type = UNSET,
2942 .tuner_addr = ADDR_UNSET,
2943 .radio_addr = ADDR_UNSET,
2944 .tda9887_conf = TDA9887_PRESENT,
2945 .inputs = {{
2946 .name = name_tv,
2947 .vmux = 1,
2948 .amux = LINE2,
2949 .tv = 1,
2950 },{
2951 .name = name_comp1,
2952 .vmux = 0,
2953 .amux = LINE2,
2954 },{
2955 .name = name_comp2,
2956 .vmux = 3,
2957 .amux = LINE2,
2958 },{
2959 .name = name_svideo,
2960 .vmux = 8,
2961 .amux = LINE2,
2962 }},
2963 .mute = {
2964 .name = name_mute,
2965 .amux = LINE1,
2966 },
2967 },
2894}; 2968};
2895 2969
2896const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); 2970const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards);
@@ -3375,7 +3449,7 @@ struct pci_device_id saa7134_pci_tbl[] = {
3375 .driver_data = SAA7134_BOARD_FLYDVB_TRIO, 3449 .driver_data = SAA7134_BOARD_FLYDVB_TRIO,
3376 },{ 3450 },{
3377 .vendor = PCI_VENDOR_ID_PHILIPS, 3451 .vendor = PCI_VENDOR_ID_PHILIPS,
3378 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, /* SAA 7131E */ 3452 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
3379 .subvendor = 0x1461, 3453 .subvendor = 0x1461,
3380 .subdevice = 0x2c05, 3454 .subdevice = 0x2c05,
3381 .driver_data = SAA7134_BOARD_AVERMEDIA_777, 3455 .driver_data = SAA7134_BOARD_AVERMEDIA_777,
@@ -3422,6 +3496,18 @@ struct pci_device_id saa7134_pci_tbl[] = {
3422 .subdevice = 0x0005, 3496 .subdevice = 0x0005,
3423 .driver_data = SAA7134_BOARD_MD7134_BRIDGE_2, 3497 .driver_data = SAA7134_BOARD_MD7134_BRIDGE_2,
3424 },{ 3498 },{
3499 .vendor = PCI_VENDOR_ID_PHILIPS,
3500 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
3501 .subvendor = 0x5168,
3502 .subdevice = 0x0300,
3503 .driver_data = SAA7134_BOARD_FLYDVBS_LR300,
3504 },{
3505 .vendor = PCI_VENDOR_ID_PHILIPS,
3506 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
3507 .subvendor = 0x4e42,
3508 .subdevice = 0x0300,/* LR300 */
3509 .driver_data = SAA7134_BOARD_FLYDVBS_LR300,
3510 },{
3425 .vendor = PCI_VENDOR_ID_PHILIPS, 3511 .vendor = PCI_VENDOR_ID_PHILIPS,
3426 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 3512 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
3427 .subvendor = 0x1489, 3513 .subvendor = 0x1489,
@@ -3446,6 +3532,36 @@ struct pci_device_id saa7134_pci_tbl[] = {
3446 .subdevice = 0x3502, /* whats the difference to 0x3306 ?*/ 3532 .subdevice = 0x3502, /* whats the difference to 0x3306 ?*/
3447 .driver_data = SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS, 3533 .driver_data = SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS,
3448 },{ 3534 },{
3535 .vendor = PCI_VENDOR_ID_PHILIPS,
3536 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
3537 .subvendor = 0x16be,
3538 .subdevice = 0x0007,
3539 .driver_data = SAA7134_BOARD_MEDION_MD8800_QUADRO,
3540 },{
3541 .vendor = PCI_VENDOR_ID_PHILIPS,
3542 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
3543 .subvendor = 0x16be,
3544 .subdevice = 0x0008,
3545 .driver_data = SAA7134_BOARD_MEDION_MD8800_QUADRO,
3546 },{
3547 .vendor = PCI_VENDOR_ID_PHILIPS,
3548 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
3549 .subvendor = 0x1461,
3550 .subdevice = 0x2c05,
3551 .driver_data = SAA7134_BOARD_AVERMEDIA_777,
3552 },{
3553 .vendor = PCI_VENDOR_ID_PHILIPS,
3554 .device = PCI_DEVICE_ID_PHILIPS_SAA7133,
3555 .subvendor = 0x1489,
3556 .subdevice = 0x0502, /* Cardbus version */
3557 .driver_data = SAA7134_BOARD_FLYDVBT_DUO_CARDBUS,
3558 },{
3559 .vendor = PCI_VENDOR_ID_PHILIPS,
3560 .device = PCI_DEVICE_ID_PHILIPS_SAA7130,
3561 .subvendor = 0x0919, /* Philips Proteus PRO 2309 */
3562 .subdevice = 0x2003,
3563 .driver_data = SAA7134_BOARD_PROTEUS_2309,
3564 },{
3449 /* --- boards without eeprom + subsystem ID --- */ 3565 /* --- boards without eeprom + subsystem ID --- */
3450 .vendor = PCI_VENDOR_ID_PHILIPS, 3566 .vendor = PCI_VENDOR_ID_PHILIPS,
3451 .device = PCI_DEVICE_ID_PHILIPS_SAA7134, 3567 .device = PCI_DEVICE_ID_PHILIPS_SAA7134,
@@ -3548,6 +3664,12 @@ int saa7134_board_init1(struct saa7134_dev *dev)
3548 case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: 3664 case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS:
3549 case SAA7134_BOARD_FLYDVBT_LR301: 3665 case SAA7134_BOARD_FLYDVBT_LR301:
3550 case SAA7134_BOARD_FLYDVBTDUO: 3666 case SAA7134_BOARD_FLYDVBTDUO:
3667 case SAA7134_BOARD_PROTEUS_2309:
3668 dev->has_remote = SAA7134_REMOTE_GPIO;
3669 break;
3670 case SAA7134_BOARD_FLYDVBS_LR300:
3671 saa_writeb(SAA7134_GPIO_GPMODE3, 0x80);
3672 saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x40);
3551 dev->has_remote = SAA7134_REMOTE_GPIO; 3673 dev->has_remote = SAA7134_REMOTE_GPIO;
3552 break; 3674 break;
3553 case SAA7134_BOARD_MD5044: 3675 case SAA7134_BOARD_MD5044:
@@ -3732,6 +3854,7 @@ int saa7134_board_init2(struct saa7134_dev *dev)
3732 case SAA7134_BOARD_PHILIPS_TIGER: 3854 case SAA7134_BOARD_PHILIPS_TIGER:
3733 case SAA7134_BOARD_TEVION_DVBT_220RF: 3855 case SAA7134_BOARD_TEVION_DVBT_220RF:
3734 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 3856 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
3857 case SAA7134_BOARD_MEDION_MD8800_QUADRO:
3735 /* this is a hybrid board, initialize to analog mode 3858 /* this is a hybrid board, initialize to analog mode
3736 * and configure firmware eeprom address 3859 * and configure firmware eeprom address
3737 */ 3860 */
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index be3a81fc90a2..09aa62f61af7 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -843,7 +843,7 @@ static int __devinit saa7134_initdev(struct pci_dev *pci_dev,
843 latency = 0x0A; 843 latency = 0x0A;
844 } 844 }
845#endif 845#endif
846 if (pci_pci_problems & PCIPCI_FAIL) { 846 if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL)) {
847 printk(KERN_INFO "%s: quirk: this driver and your " 847 printk(KERN_INFO "%s: quirk: this driver and your "
848 "chipset may not work together" 848 "chipset may not work together"
849 " in overlay mode.\n",dev->name); 849 " in overlay mode.\n",dev->name);
diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c
index 279828b8f299..b6881541e704 100644
--- a/drivers/media/video/saa7134/saa7134-dvb.c
+++ b/drivers/media/video/saa7134/saa7134-dvb.c
@@ -34,17 +34,14 @@
34#include <media/v4l2-common.h> 34#include <media/v4l2-common.h>
35#include "dvb-pll.h" 35#include "dvb-pll.h"
36 36
37#ifdef HAVE_MT352 37#include "mt352.h"
38# include "mt352.h" 38#include "mt352_priv.h" /* FIXME */
39# include "mt352_priv.h" /* FIXME */ 39#include "tda1004x.h"
40#endif 40#include "nxt200x.h"
41#ifdef HAVE_TDA1004X 41
42# include "tda1004x.h" 42#include "tda10086.h"
43#endif 43#include "tda826x.h"
44#ifdef HAVE_NXT200X 44#include "isl6421.h"
45# include "nxt200x.h"
46#endif
47
48MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); 45MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]");
49MODULE_LICENSE("GPL"); 46MODULE_LICENSE("GPL");
50 47
@@ -54,8 +51,6 @@ module_param(antenna_pwr, int, 0444);
54MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); 51MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)");
55 52
56/* ------------------------------------------------------------------ */ 53/* ------------------------------------------------------------------ */
57
58#ifdef HAVE_MT352
59static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) 54static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on)
60{ 55{
61 u32 ok; 56 u32 ok;
@@ -185,12 +180,8 @@ static struct mt352_config avermedia_777 = {
185 .demod_address = 0xf, 180 .demod_address = 0xf,
186 .demod_init = mt352_aver777_init, 181 .demod_init = mt352_aver777_init,
187}; 182};
188#endif
189 183
190/* ------------------------------------------------------------------ */ 184/* ------------------------------------------------------------------ */
191
192#ifdef HAVE_TDA1004X
193
194static int philips_tda6651_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_frontend_parameters *params) 185static int philips_tda6651_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
195{ 186{
196 struct saa7134_dev *dev = fe->dvb->priv; 187 struct saa7134_dev *dev = fe->dvb->priv;
@@ -969,11 +960,58 @@ static struct tda1004x_config tevion_dvbt220rf_config = {
969 .request_firmware = NULL, 960 .request_firmware = NULL,
970}; 961};
971 962
972#endif 963/* ------------------------------------------------------------------ */
964
965static int md8800_dvbt_analog_mode(struct dvb_frontend *fe)
966{
967 struct saa7134_dev *dev = fe->dvb->priv;
968 static u8 data[] = { 0x3c, 0x33, 0x68};
969 struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)};
970
971 i2c_transfer(&dev->i2c_adap, &msg, 1);
972 philips_tda827xa_tuner_sleep( 0x61, fe);
973 return 0;
974}
975
976static int md8800_dvbt_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params)
977{
978 int ret;
979 struct saa7134_dev *dev = fe->dvb->priv;
980 static u8 tda8290_close[] = { 0x21, 0xc0};
981 static u8 tda8290_open[] = { 0x21, 0x80};
982 struct i2c_msg tda8290_msg = {.addr = 0x4b,.flags = 0, .len = 2};
983 /* close tda8290 i2c bridge */
984 tda8290_msg.buf = tda8290_close;
985 ret = i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1);
986 if (ret != 1)
987 return -EIO;
988 msleep(20);
989 ret = philips_tda827xa_pll_set(0x60, fe, params);
990 if (ret != 0)
991 return ret;
992 /* open tda8290 i2c bridge */
993 tda8290_msg.buf = tda8290_open;
994 i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1);
995 return ret;
996}
997
998static struct tda1004x_config md8800_dvbt_config = {
999 .demod_address = 0x08,
1000 .invert = 1,
1001 .invert_oclk = 0,
1002 .xtal_freq = TDA10046_XTAL_16M,
1003 .agc_config = TDA10046_AGC_TDA827X,
1004 .if_freq = TDA10046_FREQ_045,
1005 .request_firmware = NULL,
1006};
1007
1008static struct tda10086_config flydvbs = {
1009 .demod_address = 0x0e,
1010 .invert = 0,
1011};
973 1012
974/* ------------------------------------------------------------------ */ 1013/* ------------------------------------------------------------------ */
975 1014
976#ifdef HAVE_NXT200X
977static struct nxt200x_config avertvhda180 = { 1015static struct nxt200x_config avertvhda180 = {
978 .demod_address = 0x0a, 1016 .demod_address = 0x0a,
979}; 1017};
@@ -991,7 +1029,6 @@ static struct nxt200x_config kworldatsc110 = {
991 .demod_address = 0x0a, 1029 .demod_address = 0x0a,
992 .set_pll_input = nxt200x_set_pll_input, 1030 .set_pll_input = nxt200x_set_pll_input,
993}; 1031};
994#endif
995 1032
996/* ------------------------------------------------------------------ */ 1033/* ------------------------------------------------------------------ */
997 1034
@@ -1009,29 +1046,26 @@ static int dvb_init(struct saa7134_dev *dev)
1009 dev); 1046 dev);
1010 1047
1011 switch (dev->board) { 1048 switch (dev->board) {
1012#ifdef HAVE_MT352
1013 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: 1049 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL:
1014 printk("%s: pinnacle 300i dvb setup\n",dev->name); 1050 printk("%s: pinnacle 300i dvb setup\n",dev->name);
1015 dev->dvb.frontend = mt352_attach(&pinnacle_300i, 1051 dev->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i,
1016 &dev->i2c_adap); 1052 &dev->i2c_adap);
1017 if (dev->dvb.frontend) { 1053 if (dev->dvb.frontend) {
1018 dev->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params; 1054 dev->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params;
1019 } 1055 }
1020 break; 1056 break;
1021
1022 case SAA7134_BOARD_AVERMEDIA_777: 1057 case SAA7134_BOARD_AVERMEDIA_777:
1023 printk("%s: avertv 777 dvb setup\n",dev->name); 1058 printk("%s: avertv 777 dvb setup\n",dev->name);
1024 dev->dvb.frontend = mt352_attach(&avermedia_777, 1059 dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777,
1025 &dev->i2c_adap); 1060 &dev->i2c_adap);
1026 if (dev->dvb.frontend) { 1061 if (dev->dvb.frontend) {
1027 dev->dvb.frontend->ops.tuner_ops.calc_regs = mt352_aver777_tuner_calc_regs; 1062 dev->dvb.frontend->ops.tuner_ops.calc_regs = mt352_aver777_tuner_calc_regs;
1028 } 1063 }
1029 break; 1064 break;
1030#endif
1031#ifdef HAVE_TDA1004X
1032 case SAA7134_BOARD_MD7134: 1065 case SAA7134_BOARD_MD7134:
1033 dev->dvb.frontend = tda10046_attach(&medion_cardbus, 1066 dev->dvb.frontend = dvb_attach(tda10046_attach,
1034 &dev->i2c_adap); 1067 &medion_cardbus,
1068 &dev->i2c_adap);
1035 if (dev->dvb.frontend) { 1069 if (dev->dvb.frontend) {
1036 dev->dvb.frontend->ops.tuner_ops.init = philips_fmd1216_tuner_init; 1070 dev->dvb.frontend->ops.tuner_ops.init = philips_fmd1216_tuner_init;
1037 dev->dvb.frontend->ops.tuner_ops.sleep = philips_fmd1216_tuner_sleep; 1071 dev->dvb.frontend->ops.tuner_ops.sleep = philips_fmd1216_tuner_sleep;
@@ -1039,16 +1073,18 @@ static int dvb_init(struct saa7134_dev *dev)
1039 } 1073 }
1040 break; 1074 break;
1041 case SAA7134_BOARD_PHILIPS_TOUGH: 1075 case SAA7134_BOARD_PHILIPS_TOUGH:
1042 dev->dvb.frontend = tda10046_attach(&philips_tu1216_60_config, 1076 dev->dvb.frontend = dvb_attach(tda10046_attach,
1043 &dev->i2c_adap); 1077 &philips_tu1216_60_config,
1078 &dev->i2c_adap);
1044 if (dev->dvb.frontend) { 1079 if (dev->dvb.frontend) {
1045 dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_tuner_60_init; 1080 dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_tuner_60_init;
1046 dev->dvb.frontend->ops.tuner_ops.set_params = philips_tu1216_tuner_60_set_params; 1081 dev->dvb.frontend->ops.tuner_ops.set_params = philips_tu1216_tuner_60_set_params;
1047 } 1082 }
1048 break; 1083 break;
1049 case SAA7134_BOARD_FLYDVBTDUO: 1084 case SAA7134_BOARD_FLYDVBTDUO:
1050 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, 1085 dev->dvb.frontend = dvb_attach(tda10046_attach,
1051 &dev->i2c_adap); 1086 &tda827x_lifeview_config,
1087 &dev->i2c_adap);
1052 if (dev->dvb.frontend) { 1088 if (dev->dvb.frontend) {
1053 dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; 1089 dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init;
1054 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; 1090 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep;
@@ -1056,8 +1092,9 @@ static int dvb_init(struct saa7134_dev *dev)
1056 } 1092 }
1057 break; 1093 break;
1058 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: 1094 case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS:
1059 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, 1095 dev->dvb.frontend = dvb_attach(tda10046_attach,
1060 &dev->i2c_adap); 1096 &tda827x_lifeview_config,
1097 &dev->i2c_adap);
1061 if (dev->dvb.frontend) { 1098 if (dev->dvb.frontend) {
1062 dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; 1099 dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init;
1063 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; 1100 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep;
@@ -1065,8 +1102,9 @@ static int dvb_init(struct saa7134_dev *dev)
1065 } 1102 }
1066 break; 1103 break;
1067 case SAA7134_BOARD_PHILIPS_EUROPA: 1104 case SAA7134_BOARD_PHILIPS_EUROPA:
1068 dev->dvb.frontend = tda10046_attach(&philips_europa_config, 1105 dev->dvb.frontend = dvb_attach(tda10046_attach,
1069 &dev->i2c_adap); 1106 &philips_europa_config,
1107 &dev->i2c_adap);
1070 if (dev->dvb.frontend) { 1108 if (dev->dvb.frontend) {
1071 dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; 1109 dev->original_demod_sleep = dev->dvb.frontend->ops.sleep;
1072 dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; 1110 dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep;
@@ -1076,8 +1114,9 @@ static int dvb_init(struct saa7134_dev *dev)
1076 } 1114 }
1077 break; 1115 break;
1078 case SAA7134_BOARD_VIDEOMATE_DVBT_300: 1116 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
1079 dev->dvb.frontend = tda10046_attach(&philips_europa_config, 1117 dev->dvb.frontend = dvb_attach(tda10046_attach,
1080 &dev->i2c_adap); 1118 &philips_europa_config,
1119 &dev->i2c_adap);
1081 if (dev->dvb.frontend) { 1120 if (dev->dvb.frontend) {
1082 dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; 1121 dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init;
1083 dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; 1122 dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep;
@@ -1085,16 +1124,18 @@ static int dvb_init(struct saa7134_dev *dev)
1085 } 1124 }
1086 break; 1125 break;
1087 case SAA7134_BOARD_VIDEOMATE_DVBT_200: 1126 case SAA7134_BOARD_VIDEOMATE_DVBT_200:
1088 dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config, 1127 dev->dvb.frontend = dvb_attach(tda10046_attach,
1089 &dev->i2c_adap); 1128 &philips_tu1216_61_config,
1129 &dev->i2c_adap);
1090 if (dev->dvb.frontend) { 1130 if (dev->dvb.frontend) {
1091 dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_tuner_61_init; 1131 dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_tuner_61_init;
1092 dev->dvb.frontend->ops.tuner_ops.set_params = philips_tu1216_tuner_61_set_params; 1132 dev->dvb.frontend->ops.tuner_ops.set_params = philips_tu1216_tuner_61_set_params;
1093 } 1133 }
1094 break; 1134 break;
1095 case SAA7134_BOARD_PHILIPS_TIGER: 1135 case SAA7134_BOARD_PHILIPS_TIGER:
1096 dev->dvb.frontend = tda10046_attach(&philips_tiger_config, 1136 dev->dvb.frontend = dvb_attach(tda10046_attach,
1097 &dev->i2c_adap); 1137 &philips_tiger_config,
1138 &dev->i2c_adap);
1098 if (dev->dvb.frontend) { 1139 if (dev->dvb.frontend) {
1099 dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; 1140 dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init;
1100 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep; 1141 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep;
@@ -1102,8 +1143,9 @@ static int dvb_init(struct saa7134_dev *dev)
1102 } 1143 }
1103 break; 1144 break;
1104 case SAA7134_BOARD_ASUSTeK_P7131_DUAL: 1145 case SAA7134_BOARD_ASUSTeK_P7131_DUAL:
1105 dev->dvb.frontend = tda10046_attach(&philips_tiger_config, 1146 dev->dvb.frontend = dvb_attach(tda10046_attach,
1106 &dev->i2c_adap); 1147 &philips_tiger_config,
1148 &dev->i2c_adap);
1107 if (dev->dvb.frontend) { 1149 if (dev->dvb.frontend) {
1108 dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; 1150 dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init;
1109 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep; 1151 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep;
@@ -1111,8 +1153,9 @@ static int dvb_init(struct saa7134_dev *dev)
1111 } 1153 }
1112 break; 1154 break;
1113 case SAA7134_BOARD_FLYDVBT_LR301: 1155 case SAA7134_BOARD_FLYDVBT_LR301:
1114 dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, 1156 dev->dvb.frontend = dvb_attach(tda10046_attach,
1115 &dev->i2c_adap); 1157 &tda827x_lifeview_config,
1158 &dev->i2c_adap);
1116 if (dev->dvb.frontend) { 1159 if (dev->dvb.frontend) {
1117 dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; 1160 dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init;
1118 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; 1161 dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep;
@@ -1120,16 +1163,18 @@ static int dvb_init(struct saa7134_dev *dev)
1120 } 1163 }
1121 break; 1164 break;
1122 case SAA7134_BOARD_FLYDVB_TRIO: 1165 case SAA7134_BOARD_FLYDVB_TRIO:
1123 dev->dvb.frontend = tda10046_attach(&lifeview_trio_config, 1166 dev->dvb.frontend = dvb_attach(tda10046_attach,
1124 &dev->i2c_adap); 1167 &lifeview_trio_config,
1168 &dev->i2c_adap);
1125 if (dev->dvb.frontend) { 1169 if (dev->dvb.frontend) {
1126 dev->dvb.frontend->ops.tuner_ops.sleep = lifeview_trio_tuner_sleep; 1170 dev->dvb.frontend->ops.tuner_ops.sleep = lifeview_trio_tuner_sleep;
1127 dev->dvb.frontend->ops.tuner_ops.set_params = lifeview_trio_tuner_set_params; 1171 dev->dvb.frontend->ops.tuner_ops.set_params = lifeview_trio_tuner_set_params;
1128 } 1172 }
1129 break; 1173 break;
1130 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: 1174 case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331:
1131 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, 1175 dev->dvb.frontend = dvb_attach(tda10046_attach,
1132 &dev->i2c_adap); 1176 &ads_tech_duo_config,
1177 &dev->i2c_adap);
1133 if (dev->dvb.frontend) { 1178 if (dev->dvb.frontend) {
1134 dev->dvb.frontend->ops.tuner_ops.init = ads_duo_tuner_init; 1179 dev->dvb.frontend->ops.tuner_ops.init = ads_duo_tuner_init;
1135 dev->dvb.frontend->ops.tuner_ops.sleep = ads_duo_tuner_sleep; 1180 dev->dvb.frontend->ops.tuner_ops.sleep = ads_duo_tuner_sleep;
@@ -1137,37 +1182,63 @@ static int dvb_init(struct saa7134_dev *dev)
1137 } 1182 }
1138 break; 1183 break;
1139 case SAA7134_BOARD_TEVION_DVBT_220RF: 1184 case SAA7134_BOARD_TEVION_DVBT_220RF:
1140 dev->dvb.frontend = tda10046_attach(&tevion_dvbt220rf_config, 1185 dev->dvb.frontend = dvb_attach(tda10046_attach,
1141 &dev->i2c_adap); 1186 &tevion_dvbt220rf_config,
1187 &dev->i2c_adap);
1142 if (dev->dvb.frontend) { 1188 if (dev->dvb.frontend) {
1143 dev->dvb.frontend->ops.tuner_ops.sleep = tevion_dvb220rf_tuner_sleep; 1189 dev->dvb.frontend->ops.tuner_ops.sleep = tevion_dvb220rf_tuner_sleep;
1144 dev->dvb.frontend->ops.tuner_ops.set_params = tevion_dvb220rf_tuner_set_params; 1190 dev->dvb.frontend->ops.tuner_ops.set_params = tevion_dvb220rf_tuner_set_params;
1145 } 1191 }
1146 break; 1192 break;
1147 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: 1193 case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS:
1148 dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, 1194 dev->dvb.frontend = dvb_attach(tda10046_attach,
1149 &dev->i2c_adap); 1195 &ads_tech_duo_config,
1196 &dev->i2c_adap);
1150 if (dev->dvb.frontend) { 1197 if (dev->dvb.frontend) {
1151 dev->dvb.frontend->ops.tuner_ops.init = ads_duo_tuner_init; 1198 dev->dvb.frontend->ops.tuner_ops.init = ads_duo_tuner_init;
1152 dev->dvb.frontend->ops.tuner_ops.sleep = ads_duo_tuner_sleep; 1199 dev->dvb.frontend->ops.tuner_ops.sleep = ads_duo_tuner_sleep;
1153 dev->dvb.frontend->ops.tuner_ops.set_params = ads_duo_tuner_set_params; 1200 dev->dvb.frontend->ops.tuner_ops.set_params = ads_duo_tuner_set_params;
1154 } 1201 }
1155 break; 1202 break;
1156#endif 1203 case SAA7134_BOARD_MEDION_MD8800_QUADRO:
1157#ifdef HAVE_NXT200X 1204 dev->dvb.frontend = tda10046_attach(&md8800_dvbt_config,
1205 &dev->i2c_adap);
1206 if (dev->dvb.frontend) {
1207 dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init;
1208 dev->dvb.frontend->ops.tuner_ops.sleep = md8800_dvbt_analog_mode;
1209 dev->dvb.frontend->ops.tuner_ops.set_params = md8800_dvbt_pll_set;
1210 }
1211 break;
1158 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: 1212 case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180:
1159 dev->dvb.frontend = nxt200x_attach(&avertvhda180, &dev->i2c_adap); 1213 dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180,
1214 &dev->i2c_adap);
1160 if (dev->dvb.frontend) { 1215 if (dev->dvb.frontend) {
1161 dvb_pll_attach(dev->dvb.frontend, 0x61, &dev->i2c_adap, &dvb_pll_tdhu2); 1216 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
1217 NULL, &dvb_pll_tdhu2);
1162 } 1218 }
1163 break; 1219 break;
1164 case SAA7134_BOARD_KWORLD_ATSC110: 1220 case SAA7134_BOARD_KWORLD_ATSC110:
1165 dev->dvb.frontend = nxt200x_attach(&kworldatsc110, &dev->i2c_adap); 1221 dev->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110,
1222 &dev->i2c_adap);
1223 if (dev->dvb.frontend) {
1224 dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61,
1225 NULL, &dvb_pll_tuv1236d);
1226 }
1227 break;
1228 case SAA7134_BOARD_FLYDVBS_LR300:
1229 dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs,
1230 &dev->i2c_adap);
1166 if (dev->dvb.frontend) { 1231 if (dev->dvb.frontend) {
1167 dvb_pll_attach(dev->dvb.frontend, 0x61, &dev->i2c_adap, &dvb_pll_tuv1236d); 1232 if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60,
1233 &dev->i2c_adap, 0) == NULL) {
1234 printk("%s: No tda826x found!\n", __FUNCTION__);
1235 }
1236 if (dvb_attach(isl6421_attach, dev->dvb.frontend,
1237 &dev->i2c_adap, 0x08, 0, 0) == NULL) {
1238 printk("%s: No ISL6421 found!\n", __FUNCTION__);
1239 }
1168 } 1240 }
1169 break; 1241 break;
1170#endif
1171 default: 1242 default:
1172 printk("%s: Huh? unknown DVB card?\n",dev->name); 1243 printk("%s: Huh? unknown DVB card?\n",dev->name);
1173 break; 1244 break;
diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c
index 7c595492c56b..f7ea857d5d73 100644
--- a/drivers/media/video/saa7134/saa7134-input.c
+++ b/drivers/media/video/saa7134/saa7134-input.c
@@ -228,6 +228,12 @@ int saa7134_input_init1(struct saa7134_dev *dev)
228 mask_keyup = 0x400000; 228 mask_keyup = 0x400000;
229 polling = 50; // ms 229 polling = 50; // ms
230 break; 230 break;
231 case SAA7134_BOARD_PROTEUS_2309:
232 ir_codes = ir_codes_proteus_2309;
233 mask_keycode = 0x00007F;
234 mask_keyup = 0x000080;
235 polling = 50; // ms
236 break;
231 case SAA7134_BOARD_VIDEOMATE_DVBT_300: 237 case SAA7134_BOARD_VIDEOMATE_DVBT_300:
232 case SAA7134_BOARD_VIDEOMATE_DVBT_200: 238 case SAA7134_BOARD_VIDEOMATE_DVBT_200:
233 ir_codes = ir_codes_videomate_tv_pvr; 239 ir_codes = ir_codes_videomate_tv_pvr;
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index 0db53d192b2a..d31220d20495 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -1046,6 +1046,7 @@ int saa7134_tvaudio_do_scan(struct saa7134_dev *dev)
1046} 1046}
1047 1047
1048EXPORT_SYMBOL(saa_dsp_writel); 1048EXPORT_SYMBOL(saa_dsp_writel);
1049EXPORT_SYMBOL(saa7134_tvaudio_setmute);
1049 1050
1050/* ----------------------------------------------------------- */ 1051/* ----------------------------------------------------------- */
1051/* 1052/*
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index c04ce6152fd5..7db7b9705953 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -223,6 +223,9 @@ struct saa7134_format {
223#define SAA7134_BOARD_MD7134_BRIDGE_2 93 223#define SAA7134_BOARD_MD7134_BRIDGE_2 93
224#define SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS 94 224#define SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS 94
225#define SAA7134_BOARD_FLYVIDEO3000_NTSC 95 225#define SAA7134_BOARD_FLYVIDEO3000_NTSC 95
226#define SAA7134_BOARD_MEDION_MD8800_QUADRO 96
227#define SAA7134_BOARD_FLYDVBS_LR300 97
228#define SAA7134_BOARD_PROTEUS_2309 98
226 229
227#define SAA7134_MAXBOARDS 8 230#define SAA7134_MAXBOARDS 8
228#define SAA7134_INPUT_MAX 8 231#define SAA7134_INPUT_MAX 8
diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c
index 8dab481d384a..87ffb0e84a7a 100644
--- a/drivers/media/video/tda9887.c
+++ b/drivers/media/video/tda9887.c
@@ -480,6 +480,8 @@ static int tda9887_set_config(struct tuner *t, char *buf)
480 } 480 }
481 if ((t->tda9887_config & TDA9887_INTERCARRIER_NTSC) && (t->std & V4L2_STD_NTSC)) 481 if ((t->tda9887_config & TDA9887_INTERCARRIER_NTSC) && (t->std & V4L2_STD_NTSC))
482 buf[1] &= ~cQSS; 482 buf[1] &= ~cQSS;
483 if (t->tda9887_config & TDA9887_GATING_18)
484 buf[3] &= ~cGating_36;
483 return 0; 485 return 0;
484} 486}
485 487
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c
index abe37cf632c6..63db4e97ae6c 100644
--- a/drivers/media/video/tuner-simple.c
+++ b/drivers/media/video/tuner-simple.c
@@ -10,7 +10,7 @@
10#include <media/v4l2-common.h> 10#include <media/v4l2-common.h>
11 11
12static int offset = 0; 12static int offset = 0;
13module_param(offset, int, 0666); 13module_param(offset, int, 0664);
14MODULE_PARM_DESC(offset,"Allows to specify an offset for tuner"); 14MODULE_PARM_DESC(offset,"Allows to specify an offset for tuner");
15 15
16/* ---------------------------------------------------------------------- */ 16/* ---------------------------------------------------------------------- */
@@ -331,6 +331,8 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq)
331 else if (params->default_top_high) 331 else if (params->default_top_high)
332 config |= TDA9887_TOP(params->default_top_high); 332 config |= TDA9887_TOP(params->default_top_high);
333 } 333 }
334 if (params->default_pll_gating_18)
335 config |= TDA9887_GATING_18;
334 i2c_clients_command(c->adapter, TDA9887_SET_CONFIG, &config); 336 i2c_clients_command(c->adapter, TDA9887_SET_CONFIG, &config);
335 } 337 }
336 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n", 338 tuner_dbg("tv 0x%02x 0x%02x 0x%02x 0x%02x\n",
@@ -439,8 +441,6 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq)
439 buffer[3] = 0xa4; 441 buffer[3] = 0xa4;
440 break; 442 break;
441 } 443 }
442 buffer[0] = (div>>8) & 0x7f;
443 buffer[1] = div & 0xff;
444 if (params->cb_first_if_lower_freq && div < t->last_div) { 444 if (params->cb_first_if_lower_freq && div < t->last_div) {
445 buffer[0] = buffer[2]; 445 buffer[0] = buffer[2];
446 buffer[1] = buffer[3]; 446 buffer[1] = buffer[3];
diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c
index 8b542599ed47..8fff642fad56 100644
--- a/drivers/media/video/tuner-types.c
+++ b/drivers/media/video/tuner-types.c
@@ -650,6 +650,7 @@ static struct tuner_params tuner_microtune_4049_fm5_params[] = {
650 .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges), 650 .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges),
651 .has_tda9887 = 1, 651 .has_tda9887 = 1,
652 .port1_invert_for_secam_lc = 1, 652 .port1_invert_for_secam_lc = 1,
653 .default_pll_gating_18 = 1,
653 }, 654 },
654}; 655};
655 656
diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c
index 936e3f746fba..fcaef4bf8289 100644
--- a/drivers/media/video/tvaudio.c
+++ b/drivers/media/video/tvaudio.c
@@ -28,6 +28,7 @@
28#include <linux/i2c-algo-bit.h> 28#include <linux/i2c-algo-bit.h>
29#include <linux/init.h> 29#include <linux/init.h>
30#include <linux/smp_lock.h> 30#include <linux/smp_lock.h>
31#include <linux/kthread.h>
31 32
32#include <media/tvaudio.h> 33#include <media/tvaudio.h>
33#include <media/v4l2-common.h> 34#include <media/v4l2-common.h>
@@ -124,11 +125,8 @@ struct CHIPSTATE {
124 int input; 125 int input;
125 126
126 /* thread */ 127 /* thread */
127 pid_t tpid; 128 struct task_struct *thread;
128 struct completion texit;
129 wait_queue_head_t wq;
130 struct timer_list wt; 129 struct timer_list wt;
131 int done;
132 int watch_stereo; 130 int watch_stereo;
133 int audmode; 131 int audmode;
134}; 132};
@@ -264,28 +262,23 @@ static int chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd)
264static void chip_thread_wake(unsigned long data) 262static void chip_thread_wake(unsigned long data)
265{ 263{
266 struct CHIPSTATE *chip = (struct CHIPSTATE*)data; 264 struct CHIPSTATE *chip = (struct CHIPSTATE*)data;
267 wake_up_interruptible(&chip->wq); 265 wake_up_process(chip->thread);
268} 266}
269 267
270static int chip_thread(void *data) 268static int chip_thread(void *data)
271{ 269{
272 DECLARE_WAITQUEUE(wait, current);
273 struct CHIPSTATE *chip = data; 270 struct CHIPSTATE *chip = data;
274 struct CHIPDESC *desc = chiplist + chip->type; 271 struct CHIPDESC *desc = chiplist + chip->type;
275 272
276 daemonize("%s", chip->c.name);
277 allow_signal(SIGTERM);
278 v4l_dbg(1, debug, &chip->c, "%s: thread started\n", chip->c.name); 273 v4l_dbg(1, debug, &chip->c, "%s: thread started\n", chip->c.name);
279 274
280 for (;;) { 275 for (;;) {
281 add_wait_queue(&chip->wq, &wait); 276 set_current_state(TASK_INTERRUPTIBLE);
282 if (!chip->done) { 277 if (!kthread_should_stop())
283 set_current_state(TASK_INTERRUPTIBLE);
284 schedule(); 278 schedule();
285 } 279 set_current_state(TASK_RUNNING);
286 remove_wait_queue(&chip->wq, &wait);
287 try_to_freeze(); 280 try_to_freeze();
288 if (chip->done || signal_pending(current)) 281 if (kthread_should_stop())
289 break; 282 break;
290 v4l_dbg(1, debug, &chip->c, "%s: thread wakeup\n", chip->c.name); 283 v4l_dbg(1, debug, &chip->c, "%s: thread wakeup\n", chip->c.name);
291 284
@@ -301,7 +294,6 @@ static int chip_thread(void *data)
301 } 294 }
302 295
303 v4l_dbg(1, debug, &chip->c, "%s: thread exiting\n", chip->c.name); 296 v4l_dbg(1, debug, &chip->c, "%s: thread exiting\n", chip->c.name);
304 complete_and_exit(&chip->texit, 0);
305 return 0; 297 return 0;
306} 298}
307 299
@@ -1536,19 +1528,18 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind)
1536 chip_write(chip,desc->treblereg,desc->treblefunc(chip->treble)); 1528 chip_write(chip,desc->treblereg,desc->treblefunc(chip->treble));
1537 } 1529 }
1538 1530
1539 chip->tpid = -1; 1531 chip->thread = NULL;
1540 if (desc->checkmode) { 1532 if (desc->checkmode) {
1541 /* start async thread */ 1533 /* start async thread */
1542 init_timer(&chip->wt); 1534 init_timer(&chip->wt);
1543 chip->wt.function = chip_thread_wake; 1535 chip->wt.function = chip_thread_wake;
1544 chip->wt.data = (unsigned long)chip; 1536 chip->wt.data = (unsigned long)chip;
1545 init_waitqueue_head(&chip->wq); 1537 chip->thread = kthread_run(chip_thread, chip, chip->c.name);
1546 init_completion(&chip->texit); 1538 if (IS_ERR(chip->thread)) {
1547 chip->tpid = kernel_thread(chip_thread,(void *)chip,0); 1539 v4l_warn(&chip->c, "%s: failed to create kthread\n",
1548 if (chip->tpid < 0)
1549 v4l_warn(&chip->c, "%s: kernel_thread() failed\n",
1550 chip->c.name); 1540 chip->c.name);
1551 wake_up_interruptible(&chip->wq); 1541 chip->thread = NULL;
1542 }
1552 } 1543 }
1553 return 0; 1544 return 0;
1554} 1545}
@@ -1569,11 +1560,10 @@ static int chip_detach(struct i2c_client *client)
1569 struct CHIPSTATE *chip = i2c_get_clientdata(client); 1560 struct CHIPSTATE *chip = i2c_get_clientdata(client);
1570 1561
1571 del_timer_sync(&chip->wt); 1562 del_timer_sync(&chip->wt);
1572 if (chip->tpid >= 0) { 1563 if (chip->thread) {
1573 /* shutdown async thread */ 1564 /* shutdown async thread */
1574 chip->done = 1; 1565 kthread_stop(chip->thread);
1575 wake_up_interruptible(&chip->wq); 1566 chip->thread = NULL;
1576 wait_for_completion(&chip->texit);
1577 } 1567 }
1578 1568
1579 i2c_detach_client(&chip->c); 1569 i2c_detach_client(&chip->c);
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c
index d95529e8e513..cd1502ac9560 100644
--- a/drivers/media/video/tveeprom.c
+++ b/drivers/media/video/tveeprom.c
@@ -605,6 +605,8 @@ void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
605 tvee->tuner_formats |= hauppauge_tuner_fmt[i].id; 605 tvee->tuner_formats |= hauppauge_tuner_fmt[i].id;
606 t_fmt_name1[j++] = hauppauge_tuner_fmt[i].name; 606 t_fmt_name1[j++] = hauppauge_tuner_fmt[i].name;
607 } 607 }
608 }
609 for (i = j = 0; i < 8; i++) {
608 if (t_format2 & (1 << i)) { 610 if (t_format2 & (1 << i)) {
609 tvee->tuner2_formats |= hauppauge_tuner_fmt[i].id; 611 tvee->tuner2_formats |= hauppauge_tuner_fmt[i].id;
610 t_fmt_name2[j++] = hauppauge_tuner_fmt[i].name; 612 t_fmt_name2[j++] = hauppauge_tuner_fmt[i].name;
diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c
index b167ffab2520..bc0a4fc27b24 100644
--- a/drivers/media/video/tvp5150.c
+++ b/drivers/media/video/tvp5150.c
@@ -294,7 +294,7 @@ static inline void tvp5150_selmux(struct i2c_client *c)
294 if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable) 294 if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable)
295 input = 8; 295 input = 8;
296 296
297 switch (input) { 297 switch (decoder->route.input) {
298 case TVP5150_COMPOSITE1: 298 case TVP5150_COMPOSITE1:
299 input |= 2; 299 input |= 2;
300 /* fall through */ 300 /* fall through */
@@ -308,6 +308,11 @@ static inline void tvp5150_selmux(struct i2c_client *c)
308 break; 308 break;
309 } 309 }
310 310
311 tvp5150_dbg( 1, "Selecting video route: route input=%i, output=%i "
312 "=> tvp5150 input=%i, opmode=%i\n",
313 decoder->route.input,decoder->route.output,
314 input, opmode );
315
311 tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode); 316 tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode);
312 tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input); 317 tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input);
313}; 318};
diff --git a/drivers/media/video/usbvideo/konicawc.c b/drivers/media/video/usbvideo/konicawc.c
index 6f31ecc88843..4eee8be88314 100644
--- a/drivers/media/video/usbvideo/konicawc.c
+++ b/drivers/media/video/usbvideo/konicawc.c
@@ -222,6 +222,7 @@ static void konicawc_adjust_picture(struct uvd *uvd)
222static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev) 222static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev)
223{ 223{
224 struct input_dev *input_dev; 224 struct input_dev *input_dev;
225 int error;
225 226
226 usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname)); 227 usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname));
227 strncat(cam->input_physname, "/input0", sizeof(cam->input_physname)); 228 strncat(cam->input_physname, "/input0", sizeof(cam->input_physname));
@@ -242,7 +243,13 @@ static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev
242 243
243 input_dev->private = cam; 244 input_dev->private = cam;
244 245
245 input_register_device(cam->input); 246 error = input_register_device(cam->input);
247 if (error) {
248 warn("Failed to register camera's input device, err: %d\n",
249 error);
250 input_free_device(cam->input);
251 cam->input = NULL;
252 }
246} 253}
247 254
248static void konicawc_unregister_input(struct konicawc *cam) 255static void konicawc_unregister_input(struct konicawc *cam)
diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c
index 90d48e8510ba..08f9559a6bfa 100644
--- a/drivers/media/video/usbvideo/vicam.c
+++ b/drivers/media/video/usbvideo/vicam.c
@@ -7,6 +7,7 @@
7 * Monroe Williams (monroe@pobox.com) 7 * Monroe Williams (monroe@pobox.com)
8 * 8 *
9 * Supports 3COM HomeConnect PC Digital WebCam 9 * Supports 3COM HomeConnect PC Digital WebCam
10 * Supports Compro PS39U WebCam
10 * 11 *
11 * This program is free software; you can redistribute it and/or modify 12 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by 13 * it under the terms of the GNU General Public License as published by
@@ -60,6 +61,8 @@
60/* Define these values to match your device */ 61/* Define these values to match your device */
61#define USB_VICAM_VENDOR_ID 0x04c1 62#define USB_VICAM_VENDOR_ID 0x04c1
62#define USB_VICAM_PRODUCT_ID 0x009d 63#define USB_VICAM_PRODUCT_ID 0x009d
64#define USB_COMPRO_VENDOR_ID 0x0602
65#define USB_COMPRO_PRODUCT_ID 0x1001
63 66
64#define VICAM_BYTES_PER_PIXEL 3 67#define VICAM_BYTES_PER_PIXEL 3
65#define VICAM_MAX_READ_SIZE (512*242+128) 68#define VICAM_MAX_READ_SIZE (512*242+128)
@@ -1254,6 +1257,7 @@ static struct video_device vicam_template = {
1254/* table of devices that work with this driver */ 1257/* table of devices that work with this driver */
1255static struct usb_device_id vicam_table[] = { 1258static struct usb_device_id vicam_table[] = {
1256 {USB_DEVICE(USB_VICAM_VENDOR_ID, USB_VICAM_PRODUCT_ID)}, 1259 {USB_DEVICE(USB_VICAM_VENDOR_ID, USB_VICAM_PRODUCT_ID)},
1260 {USB_DEVICE(USB_COMPRO_VENDOR_ID, USB_COMPRO_PRODUCT_ID)},
1257 {} /* Terminating entry */ 1261 {} /* Terminating entry */
1258}; 1262};
1259 1263
diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c
index d7c3fcbc80f7..1d899e2db394 100644
--- a/drivers/media/video/v4l1-compat.c
+++ b/drivers/media/video/v4l1-compat.c
@@ -349,6 +349,8 @@ v4l_compat_translate_ioctl(struct inode *inode,
349 { 349 {
350 struct video_buffer *buffer = arg; 350 struct video_buffer *buffer = arg;
351 351
352 memset(buffer, 0, sizeof(*buffer));
353
352 err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2); 354 err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2);
353 if (err < 0) { 355 if (err < 0) {
354 dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n",err); 356 dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n",err);
@@ -361,7 +363,7 @@ v4l_compat_translate_ioctl(struct inode *inode,
361 switch (fbuf2.fmt.pixelformat) { 363 switch (fbuf2.fmt.pixelformat) {
362 case V4L2_PIX_FMT_RGB332: 364 case V4L2_PIX_FMT_RGB332:
363 buffer->depth = 8; 365 buffer->depth = 8;
364 break; 366 break;
365 case V4L2_PIX_FMT_RGB555: 367 case V4L2_PIX_FMT_RGB555:
366 buffer->depth = 15; 368 buffer->depth = 15;
367 break; 369 break;
@@ -377,9 +379,13 @@ v4l_compat_translate_ioctl(struct inode *inode,
377 default: 379 default:
378 buffer->depth = 0; 380 buffer->depth = 0;
379 } 381 }
380 if (0 != fbuf2.fmt.bytesperline) 382 if (fbuf2.fmt.bytesperline) {
381 buffer->bytesperline = fbuf2.fmt.bytesperline; 383 buffer->bytesperline = fbuf2.fmt.bytesperline;
382 else { 384 if (!buffer->depth && buffer->width)
385 buffer->depth = ((fbuf2.fmt.bytesperline<<3)
386 + (buffer->width-1) )
387 /buffer->width;
388 } else {
383 buffer->bytesperline = 389 buffer->bytesperline =
384 (buffer->width * buffer->depth + 7) & 7; 390 (buffer->width * buffer->depth + 7) & 7;
385 buffer->bytesperline >>= 3; 391 buffer->bytesperline >>= 3;
diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c
index 8d972ffdaf98..78d28b03ec93 100644
--- a/drivers/media/video/v4l2-common.c
+++ b/drivers/media/video/v4l2-common.c
@@ -938,6 +938,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
938 case VIDIOC_INT_AUDIO_CLOCK_FREQ: 938 case VIDIOC_INT_AUDIO_CLOCK_FREQ:
939 case VIDIOC_INT_I2S_CLOCK_FREQ: 939 case VIDIOC_INT_I2S_CLOCK_FREQ:
940 case VIDIOC_INT_S_STANDBY: 940 case VIDIOC_INT_S_STANDBY:
941 case VIDIOC_INT_RESET:
941 { 942 {
942 u32 *p=arg; 943 u32 *p=arg;
943 944
diff --git a/drivers/media/video/video-buf-dvb.c b/drivers/media/video/video-buf-dvb.c
index 7ee8a53cd336..f53edf1923b7 100644
--- a/drivers/media/video/video-buf-dvb.c
+++ b/drivers/media/video/video-buf-dvb.c
@@ -223,6 +223,7 @@ fail_dmxdev:
223fail_dmx: 223fail_dmx:
224 dvb_unregister_frontend(dvb->frontend); 224 dvb_unregister_frontend(dvb->frontend);
225fail_frontend: 225fail_frontend:
226 dvb_frontend_detach(dvb->frontend);
226 dvb_unregister_adapter(&dvb->adapter); 227 dvb_unregister_adapter(&dvb->adapter);
227fail_adapter: 228fail_adapter:
228 return result; 229 return result;
@@ -236,6 +237,7 @@ void videobuf_dvb_unregister(struct videobuf_dvb *dvb)
236 dvb_dmxdev_release(&dvb->dmxdev); 237 dvb_dmxdev_release(&dvb->dmxdev);
237 dvb_dmx_release(&dvb->demux); 238 dvb_dmx_release(&dvb->demux);
238 dvb_unregister_frontend(dvb->frontend); 239 dvb_unregister_frontend(dvb->frontend);
240 dvb_frontend_detach(dvb->frontend);
239 dvb_unregister_adapter(&dvb->adapter); 241 dvb_unregister_adapter(&dvb->adapter);
240} 242}
241 243
diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c
index edd7b83c3464..479a0675cf60 100644
--- a/drivers/media/video/videodev.c
+++ b/drivers/media/video/videodev.c
@@ -739,13 +739,13 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
739 case VIDIOC_DQBUF: 739 case VIDIOC_DQBUF:
740 { 740 {
741 struct v4l2_buffer *p=arg; 741 struct v4l2_buffer *p=arg;
742 if (!vfd->vidioc_qbuf) 742 if (!vfd->vidioc_dqbuf)
743 break; 743 break;
744 ret = check_fmt (vfd, p->type); 744 ret = check_fmt (vfd, p->type);
745 if (ret) 745 if (ret)
746 break; 746 break;
747 747
748 ret=vfd->vidioc_qbuf(file, fh, p); 748 ret=vfd->vidioc_dqbuf(file, fh, p);
749 if (!ret) 749 if (!ret)
750 dbgbuf(cmd,vfd,p); 750 dbgbuf(cmd,vfd,p);
751 break; 751 break;
@@ -836,7 +836,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
836 break; 836 break;
837 } 837 }
838 838
839 if (index < 0 || index >= vfd->tvnormsize) { 839 if (index<0 || index >= vfd->tvnormsize) {
840 ret=-EINVAL; 840 ret=-EINVAL;
841 break; 841 break;
842 } 842 }
@@ -1283,9 +1283,29 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
1283 case VIDIOC_G_PARM: 1283 case VIDIOC_G_PARM:
1284 { 1284 {
1285 struct v4l2_streamparm *p=arg; 1285 struct v4l2_streamparm *p=arg;
1286 if (!vfd->vidioc_g_parm) 1286 if (vfd->vidioc_g_parm) {
1287 break; 1287 ret=vfd->vidioc_g_parm(file, fh, p);
1288 ret=vfd->vidioc_g_parm(file, fh, p); 1288 } else {
1289 struct v4l2_standard s;
1290
1291 if (!vfd->tvnormsize) {
1292 printk (KERN_WARNING "%s: no TV norms defined!\n",
1293 vfd->name);
1294 break;
1295 }
1296
1297 if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
1298 return -EINVAL;
1299
1300 v4l2_video_std_construct(&s, vfd->tvnorms[vfd->current_norm].id,
1301 vfd->tvnorms[vfd->current_norm].name);
1302
1303 memset(p,0,sizeof(*p));
1304
1305 p->parm.capture.timeperframe = s.frameperiod;
1306 ret=0;
1307 }
1308
1289 dbgarg (cmd, "type=%d\n", p->type); 1309 dbgarg (cmd, "type=%d\n", p->type);
1290 break; 1310 break;
1291 } 1311 }
diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c
index 268e69fdefc6..d1e04f7c530b 100644
--- a/drivers/media/video/vino.c
+++ b/drivers/media/video/vino.c
@@ -4404,7 +4404,6 @@ static struct video_device v4l_device_template = {
4404 .name = "NOT SET", 4404 .name = "NOT SET",
4405 //.type = VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE | 4405 //.type = VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE |
4406 // VID_TYPE_CLIPPING | VID_TYPE_SCALES, VID_TYPE_OVERLAY 4406 // VID_TYPE_CLIPPING | VID_TYPE_SCALES, VID_TYPE_OVERLAY
4407 .hardware = VID_HARDWARE_VINO,
4408 .fops = &vino_fops, 4407 .fops = &vino_fops,
4409 .minor = -1, 4408 .minor = -1,
4410}; 4409};
diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c
index 841884af0cc0..e7c01d560b64 100644
--- a/drivers/media/video/vivi.c
+++ b/drivers/media/video/vivi.c
@@ -992,7 +992,8 @@ static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf)
992 struct vivi_fh *fh=priv; 992 struct vivi_fh *fh=priv;
993 struct videobuf_queue *q=&fh->vb_vidq; 993 struct videobuf_queue *q=&fh->vb_vidq;
994 struct v4l2_requestbuffers req; 994 struct v4l2_requestbuffers req;
995 unsigned int i, ret; 995 unsigned int i;
996 int ret;
996 997
997 req.type = q->type; 998 req.type = q->type;
998 req.count = 8; 999 req.count = 8;
@@ -1359,6 +1360,8 @@ static int __init vivi_init(void)
1359 dev->vidq.timeout.data = (unsigned long)dev; 1360 dev->vidq.timeout.data = (unsigned long)dev;
1360 init_timer(&dev->vidq.timeout); 1361 init_timer(&dev->vidq.timeout);
1361 1362
1363 vivi.current_norm = tvnorms[0].id;
1364
1362 ret = video_register_device(&vivi, VFL_TYPE_GRABBER, video_nr); 1365 ret = video_register_device(&vivi, VFL_TYPE_GRABBER, video_nr);
1363 printk(KERN_INFO "Video Technology Magazine Virtual Video Capture Board (Load status: %d)\n", ret); 1366 printk(KERN_INFO "Video Technology Magazine Virtual Video Capture Board (Load status: %d)\n", ret);
1364 return ret; 1367 return ret;
diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c
index 1eca7e65d235..8ef31ed7d3f1 100644
--- a/drivers/media/video/vpx3220.c
+++ b/drivers/media/video/vpx3220.c
@@ -744,6 +744,6 @@ vpx3220_cleanup (void)
744module_init(vpx3220_init); 744module_init(vpx3220_init);
745module_exit(vpx3220_cleanup); 745module_exit(vpx3220_cleanup);
746 746
747MODULE_DESCRIPTION("vpx3220a/vpx3216b/vpx3214c video encoder driver"); 747MODULE_DESCRIPTION("vpx3220a/vpx3216b/vpx3214c video decoder driver");
748MODULE_AUTHOR("Laurent Pinchart"); 748MODULE_AUTHOR("Laurent Pinchart");
749MODULE_LICENSE("GPL"); 749MODULE_LICENSE("GPL");
diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c
index 29f59c36f001..9f21d0ba0f0f 100644
--- a/drivers/media/video/zoran_card.c
+++ b/drivers/media/video/zoran_card.c
@@ -1620,10 +1620,10 @@ init_dc10_cards (void)
1620 dprintk(5, KERN_DEBUG "Jotti is een held!\n"); 1620 dprintk(5, KERN_DEBUG "Jotti is een held!\n");
1621 1621
1622 /* some mainboards might not do PCI-PCI data transfer well */ 1622 /* some mainboards might not do PCI-PCI data transfer well */
1623 if (pci_pci_problems & PCIPCI_FAIL) { 1623 if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL|PCIPCI_ALIMAGIK)) {
1624 dprintk(1, 1624 dprintk(1,
1625 KERN_WARNING 1625 KERN_WARNING
1626 "%s: chipset may not support reliable PCI-PCI DMA\n", 1626 "%s: chipset does not support reliable PCI-PCI DMA\n",
1627 ZORAN_NAME); 1627 ZORAN_NAME);
1628 } 1628 }
1629 1629
@@ -1631,7 +1631,7 @@ init_dc10_cards (void)
1631 for (i = 0; i < zoran_num; i++) { 1631 for (i = 0; i < zoran_num; i++) {
1632 struct zoran *zr = &zoran[i]; 1632 struct zoran *zr = &zoran[i];
1633 1633
1634 if (pci_pci_problems & PCIPCI_NATOMA && zr->revision <= 1) { 1634 if ((pci_pci_problems & PCIPCI_NATOMA) && zr->revision <= 1) {
1635 zr->jpg_buffers.need_contiguous = 1; 1635 zr->jpg_buffers.need_contiguous = 1;
1636 dprintk(1, 1636 dprintk(1,
1637 KERN_INFO 1637 KERN_INFO
diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c
index 5f90db27892b..862a984c2155 100644
--- a/drivers/media/video/zoran_driver.c
+++ b/drivers/media/video/zoran_driver.c
@@ -1512,6 +1512,13 @@ setup_fbuffer (struct file *file,
1512 if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RAWIO)) 1512 if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RAWIO))
1513 return -EPERM; 1513 return -EPERM;
1514 1514
1515 /* Don't allow frame buffer overlay if PCI or AGP is buggy, or on
1516 ALi Magik (that needs very low latency while the card needs a
1517 higher value always) */
1518
1519 if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK))
1520 return -ENXIO;
1521
1515 /* we need a bytesperline value, even if not given */ 1522 /* we need a bytesperline value, even if not given */
1516 if (!bytesperline) 1523 if (!bytesperline)
1517 bytesperline = width * ((fmt->depth + 7) & ~7) / 8; 1524 bytesperline = width * ((fmt->depth + 7) & ~7) / 8;
diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c
index 50437383ed62..9240638a0134 100644
--- a/drivers/media/video/zr36120.c
+++ b/drivers/media/video/zr36120.c
@@ -987,6 +987,8 @@ int zoran_ioctl(struct video_device* dev, unsigned int cmd, void *arg)
987 VID_TYPE_SCALES; 987 VID_TYPE_SCALES;
988 if (ztv->have_tuner) 988 if (ztv->have_tuner)
989 c.type |= VID_TYPE_TUNER; 989 c.type |= VID_TYPE_TUNER;
990 if (pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL))
991 c.type &= ~VID_TYPE_OVERLAY;
990 if (ztv->have_decoder) { 992 if (ztv->have_decoder) {
991 c.channels = ztv->card->video_inputs; 993 c.channels = ztv->card->video_inputs;
992 c.audios = ztv->card->audio_inputs; 994 c.audios = ztv->card->audio_inputs;
@@ -1284,6 +1286,8 @@ int zoran_ioctl(struct video_device* dev, unsigned int cmd, void *arg)
1284 struct video_buffer v; 1286 struct video_buffer v;
1285 if(!capable(CAP_SYS_ADMIN)) 1287 if(!capable(CAP_SYS_ADMIN))
1286 return -EPERM; 1288 return -EPERM;
1289 if (pcipci_problems & (PCIPCI_FAIL|PCIAGP_FAIL))
1290 return -ENXIO;
1287 if (copy_from_user(&v, arg,sizeof(v))) 1291 if (copy_from_user(&v, arg,sizeof(v)))
1288 return -EFAULT; 1292 return -EFAULT;
1289 DEBUG(printk(CARD_DEBUG "VIDIOCSFBUF(%p,%d,%d,%d,%d)\n",CARD,v.base, v.width,v.height,v.depth,v.bytesperline)); 1293 DEBUG(printk(CARD_DEBUG "VIDIOCSFBUF(%p,%d,%d,%d,%d)\n",CARD,v.base, v.width,v.height,v.depth,v.bytesperline));
@@ -2030,7 +2034,7 @@ void release_zoran(int max)
2030 /* free it */ 2034 /* free it */
2031 free_irq(ztv->dev->irq,ztv); 2035 free_irq(ztv->dev->irq,ztv);
2032 2036
2033 /* unregister i2c_bus */ 2037 /* unregister i2c_bus */
2034 i2c_unregister_bus((&ztv->i2c)); 2038 i2c_unregister_bus((&ztv->i2c));
2035 2039
2036 /* unmap and free memory */ 2040 /* unmap and free memory */