diff options
Diffstat (limited to 'drivers/media/video')
70 files changed, 2615 insertions, 1279 deletions
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 94d078b..d1183c9 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -16,6 +16,320 @@ config VIDEO_ADV_DEBUG V4L devices. In doubt, say N. +config VIDEO_HELPER_CHIPS_AUTO + bool "Autoselect pertinent encoders/decoders and other helper chips" + default y + ---help--- + Most video cards may require additional modules to encode or + decode audio/video standards. This option will autoselect + all pertinent modules to each selected video module. + + Unselect this only if you know exaclty what you are doing, since + it may break support on some boards. + + In doubt, say Y. + +# +# Encoder / Decoder module configuration +# + +menu "Encoders/decoders and other helper chips" + depends on VIDEO_DEV && !VIDEO_HELPER_CHIPS_AUTO + +comment "Audio Decoders" + +config VIDEO_TVAUDIO + tristate "Simple audio decoder chips" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for several audio decoder chips found on some bt8xx boards: + Philips: tda9840, tda9873h, tda9874h/a, tda9850, tda985x, tea6300, + tea6320, tea6420, tda8425, ta8874z. + Microchip: pic16c54 based design on ProVideo PV951 board. + + To compile this driver as a module, choose M here: the + module will be called tvaudio. + +config VIDEO_TDA7432 + tristate "Philips TDA7432 audio processor chip" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for tda7432 audio decoder chip found on some bt8xx boards. + + To compile this driver as a module, choose M here: the + module will be called tda7432. + +config VIDEO_TDA9840 + tristate "Philips TDA9840 audio processor chip" + depends on VIDEO_DEV && I2C + ---help--- + Support for tda9840 audio decoder chip found on some Zoran boards. + + To compile this driver as a module, choose M here: the + module will be called tda9840. + +config VIDEO_TDA9875 + tristate "Philips TDA9875 audio processor chip" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for tda9875 audio decoder chip found on some bt8xx boards. + + To compile this driver as a module, choose M here: the + module will be called tda9875. + +config VIDEO_TEA6415C + tristate "Philips TEA6415C audio processor chip" + depends on VIDEO_DEV && I2C + ---help--- + Support for tea6415c audio decoder chip found on some bt8xx boards. + + To compile this driver as a module, choose M here: the + module will be called tea6415c. + +config VIDEO_TEA6420 + tristate "Philips TEA6420 audio processor chip" + depends on VIDEO_DEV && I2C + ---help--- + Support for tea6420 audio decoder chip found on some bt8xx boards. + + To compile this driver as a module, choose M here: the + module will be called tea6420. + +config VIDEO_MSP3400 + tristate "Micronas MSP34xx audio decoders" + depends on VIDEO_V4L2 && I2C + ---help--- + Support for the Micronas MSP34xx series of audio decoders. + + To compile this driver as a module, choose M here: the + module will be called msp3400. + +config VIDEO_CS53L32A + tristate "Cirrus Logic CS53L32A audio ADC" + depends on VIDEO_V4L2 && I2C && EXPERIMENTAL + ---help--- + Support for the Cirrus Logic CS53L32A low voltage + stereo A/D converter. + + To compile this driver as a module, choose M here: the + module will be called cs53l32a. + +config VIDEO_TLV320AIC23B + tristate "Texas Instruments TLV320AIC23B audio codec" + depends on VIDEO_V4L2 && I2C && EXPERIMENTAL + ---help--- + Support for the Texas Instruments TLV320AIC23B audio codec. + + To compile this driver as a module, choose M here: the + module will be called tlv320aic23b. + +config VIDEO_WM8775 + tristate "Wolfson Microelectronics WM8775 audio ADC with input mixer" + depends on VIDEO_V4L2 && I2C && EXPERIMENTAL + ---help--- + Support for the Wolfson Microelectronics WM8775 high + performance stereo A/D Converter with a 4 channel input mixer. + + To compile this driver as a module, choose M here: the + module will be called wm8775. + +config VIDEO_WM8739 + tristate "Wolfson Microelectronics WM8739 stereo audio ADC" + depends on VIDEO_V4L2 && I2C && EXPERIMENTAL + ---help--- + Support for the Wolfson Microelectronics WM8739 + stereo A/D Converter. + + To compile this driver as a module, choose M here: the + module will be called wm8739. + +comment "MPEG video encoders" + +config VIDEO_CX2341X + tristate "Conexant CX2341x MPEG encoders" + depends on VIDEO_V4L2 && EXPERIMENTAL + ---help--- + Support for the Conexant CX23416 MPEG encoders + and CX23415 MPEG encoder/decoders. + + This module currently supports the encoding functions only. + + To compile this driver as a module, choose M here: the + module will be called cx2341x. + +source "drivers/media/video/cx25840/Kconfig" + +comment "Video encoders" + +config VIDEO_SAA7127 + tristate "Philips SAA7127/9 digital video encoders" + depends on VIDEO_V4L2 && I2C && EXPERIMENTAL + ---help--- + Support for the Philips SAA7127/9 digital video encoders. + + To compile this driver as a module, choose M here: the + module will be called saa7127. + +config VIDEO_SAA7185 + tristate "Philips SAA7185 video encoder" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for the Philips SAA7185 video encoder. + + To compile this driver as a module, choose M here: the + module will be called saa7185. + +config VIDEO_ADV7170 + tristate "Analog Devices ADV7170 video encoder driver" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for the Analog Devices ADV7170 video encoder driver + + To compile this driver as a module, choose M here: the + module will be called adv7170. + +config VIDEO_ADV7175 + tristate "Analog Devices ADV7175 video encoder driver" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for the Analog Devices ADV7175 video encoder driver + + To compile this driver as a module, choose M here: the + module will be called adv7175. + +comment "Video decoders" + +config VIDEO_BT819 + tristate "BT819A VideoStream Decoder" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for BT819A video decoder. + + To compile this driver as a module, choose M here: the + module will be called bt819. + +config VIDEO_BT856 + tristate "BT856 VideoStream Decoder" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for BT856 video decoder. + + To compile this driver as a module, choose M here: the + module will be called bt856. + +config VIDEO_BT866 + tristate "BT866 VideoStream Decoder" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for BT866 video decoder. + + To compile this driver as a module, choose M here: the + module will be called bt866. + +config VIDEO_KS0127 + tristate "KS0127 video decoder" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for KS0127 video decoder. + + This chip is used on AverMedia AVS6EYES Zoran-based MJPEG + cards. + + To compile this driver as a module, choose M here: the + module will be called ks0127. + +config VIDEO_SAA7110 + tristate "Philips SAA7110 video decoder" + depends on VIDEO_V4L1 + ---help--- + Support for the Philips SAA7110 video decoders. + + To compile this driver as a module, choose M here: the + module will be called saa7110. + +config VIDEO_SAA7111 + tristate "Philips SAA7111 video decoder" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for the Philips SAA711 video decoder. + + To compile this driver as a module, choose M here: the + module will be called saa7111. + +config VIDEO_SAA7114 + tristate "Philips SAA7114 video decoder" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for the Philips SAA7114 video decoder. This driver + is used only on Zoran driver and should be moved soon to + SAA711x module. + + To compile this driver as a module, choose M here: the + module will be called saa7114. + +config VIDEO_SAA711X + tristate "Philips SAA7113/4/5 video decoders" + depends on VIDEO_V4L2 && I2C && EXPERIMENTAL + ---help--- + Support for the Philips SAA7113/4/5 video decoders. + + To compile this driver as a module, choose M here: the + module will be called saa7115. + +config VIDEO_SAA7191 + tristate "Philips SAA7191 video decoder" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for the Philips SAA7191 video decoder. + + To compile this driver as a module, choose M here: the + module will be called saa7191. + +config VIDEO_TVP5150 + tristate "Texas Instruments TVP5150 video decoder" + depends on VIDEO_V4L2 && I2C + ---help--- + Support for the Texas Instruments TVP5150 video decoder. + + To compile this driver as a module, choose M here: the + module will be called tvp5150. + +config VIDEO_VPX3220 + tristate "vpx3220a, vpx3216b & vpx3214c video decoder driver" + depends on VIDEO_V4L1 && I2C + ---help--- + Support for VPX322x video decoders. + + To compile this driver as a module, choose M here: the + module will be called vpx3220. + +comment "Video improvement chips" + +config VIDEO_UPD64031A + tristate "NEC Electronics uPD64031A Ghost Reduction" + depends on VIDEO_V4L2 && I2C && EXPERIMENTAL + ---help--- + Support for the NEC Electronics uPD64031A Ghost Reduction + video chip. It is most often found in NTSC TV cards made for + Japan and is used to reduce the 'ghosting' effect that can + be present in analog TV broadcasts. + + To compile this driver as a module, choose M here: the + module will be called upd64031a. + +config VIDEO_UPD64083 + tristate "NEC Electronics uPD64083 3-Dimensional Y/C separation" + depends on VIDEO_V4L2 && I2C && EXPERIMENTAL + ---help--- + Support for the NEC Electronics uPD64083 3-Dimensional Y/C + separation video chip. It is used to improve the quality of + the colors of a composite signal. + + To compile this driver as a module, choose M here: the + module will be called upd64083. + +endmenu # encoder / decoder chips + config VIDEO_VIVI tristate "Virtual Video Driver" depends on VIDEO_V4L2 && !SPARC32 && !SPARC64 @@ -135,7 +449,7 @@ source "drivers/media/video/cpia2/Kconfig" config VIDEO_SAA5246A tristate "SAA5246A, SAA5281 Teletext processor" - depends on I2C && VIDEO_V4L1 + depends on I2C && VIDEO_V4L2 help Support for I2C bus based teletext using the SAA5246A or SAA5281 chip. Useful only if you live in Europe. @@ -145,7 +459,7 @@ config VIDEO_SAA5246A config VIDEO_SAA5249 tristate "SAA5249 Teletext processor" - depends on VIDEO_DEV && I2C && VIDEO_V4L1 + depends on VIDEO_DEV && I2C && VIDEO_V4L2 help Support for I2C bus based teletext using the SAA5249 chip. At the moment this is only useful on some European WinTV cards. @@ -162,8 +476,9 @@ config TUNER_3036 config VIDEO_VINO tristate "SGI Vino Video For Linux (EXPERIMENTAL)" - depends on I2C && SGI_IP22 && EXPERIMENTAL && VIDEO_V4L1 + depends on I2C && SGI_IP22 && EXPERIMENTAL && VIDEO_V4L2 select I2C_ALGO_SGI + select VIDEO_SAA7191 if VIDEO_HELPER_CHIPS_AUTO help Say Y here to build in support for the Vino video input system found on SGI Indy machines. @@ -176,6 +491,9 @@ config VIDEO_STRADIS driver for PCI. There is a product page at <http://www.stradis.com/>. +config VIDEO_ZORAN_ZR36060 + tristate + config VIDEO_ZORAN tristate "Zoran ZR36057/36067 Video For Linux" depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && !PPC64 @@ -192,12 +510,18 @@ config VIDEO_ZORAN config VIDEO_ZORAN_BUZ tristate "Iomega Buz support" depends on VIDEO_ZORAN + select VIDEO_SAA7111 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_SAA7185 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_ZORAN_ZR36060 help Support for the Iomega Buz MJPEG capture/playback card. config VIDEO_ZORAN_DC10 tristate "Pinnacle/Miro DC10(+) support" depends on VIDEO_ZORAN + select VIDEO_SAA7110 + select VIDEO_ADV7175 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_ZORAN_ZR36060 help Support for the Pinnacle/Miro DC10(+) MJPEG capture/playback card. @@ -205,6 +529,8 @@ config VIDEO_ZORAN_DC10 config VIDEO_ZORAN_DC30 tristate "Pinnacle/Miro DC30(+) support" depends on VIDEO_ZORAN + select VIDEO_ADV7175 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_VPX3220 if VIDEO_HELPER_CHIPS_AUTO help Support for the Pinnacle/Miro DC30(+) MJPEG capture/playback card. This also supports really old DC10 cards based on the @@ -213,6 +539,9 @@ config VIDEO_ZORAN_DC30 config VIDEO_ZORAN_LML33 tristate "Linux Media Labs LML33 support" depends on VIDEO_ZORAN + select VIDEO_BT819 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_BT856 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_ZORAN_ZR36060 help Support for the Linux Media Labs LML33 MJPEG capture/playback card. @@ -220,6 +549,9 @@ config VIDEO_ZORAN_LML33 config VIDEO_ZORAN_LML33R10 tristate "Linux Media Labs LML33R10 support" depends on VIDEO_ZORAN + select VIDEO_SAA7114 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_ADV7170 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_ZORAN_ZR36060 help support for the Linux Media Labs LML33R10 MJPEG capture/playback card. @@ -227,6 +559,9 @@ config VIDEO_ZORAN_LML33R10 config VIDEO_ZORAN_AVS6EYES tristate "AverMedia 6 Eyes support (EXPERIMENTAL)" depends on VIDEO_ZORAN && EXPERIMENTAL && VIDEO_V4L1 + select VIDEO_BT856 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_KS0127 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_ZORAN_ZR36060 help Support for the AverMedia 6 Eyes video surveillance card. @@ -263,6 +598,10 @@ config VIDEO_MXB depends on PCI && VIDEO_V4L1 && I2C select VIDEO_SAA7146_VV select VIDEO_TUNER + select VIDEO_SAA7111 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_TDA9840 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_TEA6415C if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_TEA6420 if VIDEO_HELPER_CHIPS_AUTO ---help--- This is a video4linux driver for the 'Multimedia eXtension Board' TV card by Siemens-Nixdorf. @@ -274,7 +613,7 @@ config VIDEO_DPC tristate "Philips-Semiconductors 'dpc7146 demonstration board'" depends on PCI && VIDEO_V4L1 && I2C select VIDEO_SAA7146_VV - select VIDEO_V4L2 + select VIDEO_SAA7111 if VIDEO_HELPER_CHIPS_AUTO ---help--- This is a video4linux driver for the 'dpc7146 demonstration board' by Philips-Semiconductors. It's the reference design @@ -287,9 +626,8 @@ config VIDEO_DPC config VIDEO_HEXIUM_ORION tristate "Hexium HV-PCI6 and Orion frame grabber" - depends on PCI && VIDEO_V4L1 && I2C + depends on PCI && VIDEO_V4L2 && I2C select VIDEO_SAA7146_VV - select VIDEO_V4L2 ---help--- This is a video4linux driver for the Hexium HV-PCI6 and Orion frame grabber cards by Hexium. @@ -299,9 +637,8 @@ config VIDEO_HEXIUM_ORION config VIDEO_HEXIUM_GEMINI tristate "Hexium Gemini frame grabber" - depends on PCI && VIDEO_V4L1 && I2C + depends on PCI && VIDEO_V4L2 && I2C select VIDEO_SAA7146_VV - select VIDEO_V4L2 ---help--- This is a video4linux driver for the Hexium Gemini frame grabber card by Hexium. Please note that the Gemini Dual @@ -320,123 +657,16 @@ config VIDEO_M32R_AR camera module. config VIDEO_M32R_AR_M64278 - tristate "Use Colour AR module M64278(VGA)" - depends on VIDEO_M32R_AR && PLAT_M32700UT - ---help--- - Say Y here to use the Renesas M64278E-800 camera module, - which supports VGA(640x480 pixcels) size of images. - -# -# Encoder / Decoder module configuration -# - -menu "Encoders and Decoders" - depends on VIDEO_DEV - -config VIDEO_MSP3400 - tristate "Micronas MSP34xx audio decoders" - depends on VIDEO_DEV && I2C - ---help--- - Support for the Micronas MSP34xx series of audio decoders. - - To compile this driver as a module, choose M here: the - module will be called msp3400. - -config VIDEO_CS53L32A - tristate "Cirrus Logic CS53L32A audio ADC" - depends on VIDEO_DEV && I2C && EXPERIMENTAL - ---help--- - Support for the Cirrus Logic CS53L32A low voltage - stereo A/D converter. - - To compile this driver as a module, choose M here: the - module will be called cs53l32a. - -config VIDEO_TLV320AIC23B - tristate "Texas Instruments TLV320AIC23B audio codec" - depends on VIDEO_DEV && I2C && EXPERIMENTAL + tristate "AR device with color module M64278(VGA)" + depends on PLAT_M32700UT + select VIDEO_M32R_AR ---help--- - Support for the Texas Instruments TLV320AIC23B audio codec. - - To compile this driver as a module, choose M here: the - module will be called tlv320aic23b. - -config VIDEO_WM8775 - tristate "Wolfson Microelectronics WM8775 audio ADC with input mixer" - depends on VIDEO_DEV && I2C && EXPERIMENTAL - ---help--- - Support for the Wolfson Microelectronics WM8775 high - performance stereo A/D Converter with a 4 channel input mixer. + This is a video4linux driver for the Renesas AR (Artificial + Retina) with M64278E-800 camera module. + This module supports VGA(640x480 pixels) resolutions. To compile this driver as a module, choose M here: the - module will be called wm8775. - -config VIDEO_WM8739 - tristate "Wolfson Microelectronics WM8739 stereo audio ADC" - depends on VIDEO_DEV && I2C && EXPERIMENTAL - ---help--- - Support for the Wolfson Microelectronics WM8739 - stereo A/D Converter. - - To compile this driver as a module, choose M here: the - module will be called wm8739. - -config VIDEO_CX2341X - tristate "Conexant CX2341x MPEG encoders" - depends on VIDEO_V4L2 && EXPERIMENTAL - ---help--- - Support for the Conexant CX23416 MPEG encoders - and CX23415 MPEG encoder/decoders. - - This module currently supports the encoding functions only. - - To compile this driver as a module, choose M here: the - module will be called cx2341x. - -source "drivers/media/video/cx25840/Kconfig" - -config VIDEO_SAA711X - tristate "Philips SAA7113/4/5 video decoders" - depends on VIDEO_DEV && I2C && EXPERIMENTAL - ---help--- - Support for the Philips SAA7113/4/5 video decoders. - - To compile this driver as a module, choose M here: the - module will be called saa7115. - -config VIDEO_SAA7127 - tristate "Philips SAA7127/9 digital video encoders" - depends on VIDEO_V4L2 && I2C && EXPERIMENTAL - ---help--- - Support for the Philips SAA7127/9 digital video encoders. - - To compile this driver as a module, choose M here: the - module will be called saa7127. - -config VIDEO_UPD64031A - tristate "NEC Electronics uPD64031A Ghost Reduction" - depends on VIDEO_V4L2 && I2C && EXPERIMENTAL - ---help--- - Support for the NEC Electronics uPD64031A Ghost Reduction - video chip. It is most often found in NTSC TV cards made for - Japan and is used to reduce the 'ghosting' effect that can - be present in analog TV broadcasts. - - To compile this driver as a module, choose M here: the - module will be called upd64031a. - -config VIDEO_UPD64083 - tristate "NEC Electronics uPD64083 3-Dimensional Y/C separation" - depends on VIDEO_V4L2 && I2C && EXPERIMENTAL - ---help--- - Support for the NEC Electronics uPD64083 3-Dimensional Y/C - separation video chip. It is used to improve the quality of - the colors of a composite signal. - - To compile this driver as a module, choose M here: the - module will be called upd64083. - -endmenu # encoder / decoder chips + module will be called arv. # # USB Multimedia device configuration @@ -445,8 +675,6 @@ endmenu # encoder / decoder chips menu "V4L USB devices" depends on USB && VIDEO_DEV -source "drivers/media/video/pvrusb2/Kconfig" - source "drivers/media/video/em28xx/Kconfig" source "drivers/media/video/usbvideo/Kconfig" diff --git a/drivers/media/video/Makefile b/drivers/media/video/Makefile index e82e511..af57abc 100644 --- a/drivers/media/video/Makefile +++ b/drivers/media/video/Makefile @@ -17,7 +17,10 @@ ifeq ($(CONFIG_VIDEO_V4L1_COMPAT),y) endif obj-$(CONFIG_VIDEO_BT848) += bt8xx/ -obj-$(CONFIG_VIDEO_BT848) += tvaudio.o tda7432.o tda9875.o ir-kbd-i2c.o +obj-$(CONFIG_VIDEO_BT848) += ir-kbd-i2c.o +obj-$(CONFIG_VIDEO_TVAUDIO) += tvaudio.o +obj-$(CONFIG_VIDEO_TDA7432) += tda7432.o +obj-$(CONFIG_VIDEO_TDA9875) += tda9875.o obj-$(CONFIG_SOUND_TVMIXER) += tvmixer.o obj-$(CONFIG_VIDEO_ZR36120) += zoran.o @@ -27,17 +30,32 @@ obj-$(CONFIG_VIDEO_SAA5249) += saa5249.o obj-$(CONFIG_VIDEO_CQCAM) += c-qcam.o obj-$(CONFIG_VIDEO_BWQCAM) += bw-qcam.o obj-$(CONFIG_VIDEO_W9966) += w9966.o -obj-$(CONFIG_VIDEO_ZORAN_BUZ) += saa7111.o saa7185.o zr36060.o -obj-$(CONFIG_VIDEO_ZORAN_DC10) += saa7110.o adv7175.o zr36060.o -obj-$(CONFIG_VIDEO_ZORAN_DC30) += adv7175.o vpx3220.o zr36050.o \ - zr36016.o -obj-$(CONFIG_VIDEO_ZORAN_LML33) += bt819.o bt856.o zr36060.o -obj-$(CONFIG_VIDEO_ZORAN_LML33R10) += saa7114.o adv7170.o zr36060.o -obj-$(CONFIG_VIDEO_ZORAN_AVS6EYES) += bt866.o ks0127.o zr36060.o + +obj-$(CONFIG_VIDEO_TDA9840) += tda9840.o +obj-$(CONFIG_VIDEO_TEA6415C) += tea6415c.o +obj-$(CONFIG_VIDEO_TEA6420) += tea6420.o +obj-$(CONFIG_VIDEO_SAA7110) += saa7110.o +obj-$(CONFIG_VIDEO_SAA7111) += saa7111.o +obj-$(CONFIG_VIDEO_SAA7114) += saa7114.o +obj-$(CONFIG_VIDEO_SAA711X) += saa7115.o +obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o +obj-$(CONFIG_VIDEO_SAA7185) += saa7185.o +obj-$(CONFIG_VIDEO_SAA7191) += saa7191.o +obj-$(CONFIG_VIDEO_ADV7170) += adv7170.o +obj-$(CONFIG_VIDEO_ADV7175) += adv7175.o +obj-$(CONFIG_VIDEO_VPX3220) += vpx3220.o +obj-$(CONFIG_VIDEO_BT819) += bt819.o +obj-$(CONFIG_VIDEO_BT856) += bt856.o +obj-$(CONFIG_VIDEO_BT866) += bt866.o +obj-$(CONFIG_VIDEO_KS0127) += ks0127.o + obj-$(CONFIG_VIDEO_ZORAN) += zr36067.o videocodec.o +obj-$(CONFIG_VIDEO_ZORAN_DC30) += zr36050.o zr36016.o +obj-$(CONFIG_VIDEO_ZORAN_ZR36060) += zr36060.o + obj-$(CONFIG_VIDEO_PMS) += pms.o obj-$(CONFIG_VIDEO_PLANB) += planb.o -obj-$(CONFIG_VIDEO_VINO) += vino.o saa7191.o indycam.o +obj-$(CONFIG_VIDEO_VINO) += vino.o indycam.o obj-$(CONFIG_VIDEO_STRADIS) += stradis.o obj-$(CONFIG_VIDEO_CPIA) += cpia.o obj-$(CONFIG_VIDEO_CPIA_PP) += cpia_pp.o @@ -46,7 +64,7 @@ obj-$(CONFIG_VIDEO_MEYE) += meye.o obj-$(CONFIG_VIDEO_SAA7134) += ir-kbd-i2c.o saa7134/ obj-$(CONFIG_VIDEO_CX88) += cx88/ obj-$(CONFIG_VIDEO_EM28XX) += em28xx/ -obj-$(CONFIG_VIDEO_EM28XX) += tvp5150.o +obj-$(CONFIG_VIDEO_TVP5150) += tvp5150.o obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2/ obj-$(CONFIG_VIDEO_MSP3400) += msp3400.o obj-$(CONFIG_VIDEO_CS53L32A) += cs53l32a.o @@ -55,10 +73,10 @@ obj-$(CONFIG_VIDEO_WM8775) += wm8775.o obj-$(CONFIG_VIDEO_WM8739) += wm8739.o obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip/ obj-$(CONFIG_VIDEO_CPIA2) += cpia2/ -obj-$(CONFIG_VIDEO_MXB) += saa7111.o tda9840.o tea6415c.o tea6420.o mxb.o +obj-$(CONFIG_VIDEO_MXB) += mxb.o obj-$(CONFIG_VIDEO_HEXIUM_ORION) += hexium_orion.o obj-$(CONFIG_VIDEO_HEXIUM_GEMINI) += hexium_gemini.o -obj-$(CONFIG_VIDEO_DPC) += saa7111.o dpc7146.o +obj-$(CONFIG_VIDEO_DPC) += dpc7146.o obj-$(CONFIG_TUNER_3036) += tuner-3036.o obj-$(CONFIG_VIDEO_TUNER) += tuner.o @@ -70,8 +88,6 @@ obj-$(CONFIG_VIDEO_TVEEPROM) += tveeprom.o obj-$(CONFIG_VIDEO_M32R_AR_M64278) += arv.o obj-$(CONFIG_VIDEO_CX25840) += cx25840/ -obj-$(CONFIG_VIDEO_SAA711X) += saa7115.o -obj-$(CONFIG_VIDEO_SAA7127) += saa7127.o obj-$(CONFIG_VIDEO_UPD64031A) += upd64031a.o obj-$(CONFIG_VIDEO_UPD64083) += upd64083.o obj-$(CONFIG_VIDEO_CX2341X) += cx2341x.o @@ -96,4 +112,3 @@ obj-$(CONFIG_VIDEO_VIVI) += vivi.o EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core extra-cflags-$(CONFIG_VIDEO_V4L1_COMPAT) += -DCONFIG_VIDEO_V4L1_COMPAT - diff --git a/drivers/media/video/bt866.c b/drivers/media/video/bt866.c index 05e42bb..772fd52 100644 --- a/drivers/media/video/bt866.c +++ b/drivers/media/video/bt866.c @@ -65,7 +65,7 @@ MODULE_LICENSE("GPL"); struct bt866 { struct i2c_client *i2c; int addr; - unsigned char reg[128]; + unsigned char reg[256]; int norm; int enable; diff --git a/drivers/media/video/bt8xx/Kconfig b/drivers/media/video/bt8xx/Kconfig index cdcf556..58eae88 100644 --- a/drivers/media/video/bt8xx/Kconfig +++ b/drivers/media/video/bt8xx/Kconfig @@ -8,7 +8,10 @@ config VIDEO_BT848 select VIDEO_IR select VIDEO_TUNER select VIDEO_TVEEPROM - select VIDEO_MSP3400 + select VIDEO_MSP3400 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_TVAUDIO if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_TDA7432 if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_TDA9875 if VIDEO_HELPER_CHIPS_AUTO ---help--- Support for BT848 based frame grabber/overlay boards. This includes 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 de14818..d23a42b 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) int pcipci_fail = 0; struct pci_dev *dev = NULL; - if (pci_pci_problems & PCIPCI_FAIL) + if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL)) /* should check if target is AGP */ pcipci_fail = 1; if (pci_pci_problems & (PCIPCI_TRITON|PCIPCI_NATOMA|PCIPCI_VIAETBF)) triton1 = 1; diff --git a/drivers/media/video/bt8xx/bttv-driver.c b/drivers/media/video/bt8xx/bttv-driver.c index 20dff7c..50dde828 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, fbuf->bytesperline = btv->fbuf.fmt.bytesperline; if (fh->ovfmt) fbuf->depth = fh->ovfmt->depth; + else { + if (fbuf->width) + fbuf->depth = ((fbuf->bytesperline<<3) + + (fbuf->width-1) ) + /fbuf->width; + else + fbuf->depth = 0; + } return 0; } case VIDIOCSFBUF: @@ -4186,6 +4194,7 @@ static void __devexit bttv_remove(struct pci_dev *pci_dev) return; } +#ifdef CONFIG_PM static int bttv_suspend(struct pci_dev *pci_dev, pm_message_t state) { struct bttv *btv = pci_get_drvdata(pci_dev); @@ -4266,6 +4275,7 @@ static int bttv_resume(struct pci_dev *pci_dev) spin_unlock_irqrestore(&btv->s_lock,flags); return 0; } +#endif static struct pci_device_id bttv_pci_tbl[] = { {PCI_VENDOR_ID_BROOKTREE, PCI_DEVICE_ID_BT848, @@ -4286,8 +4296,10 @@ static struct pci_driver bttv_pci_driver = { .id_table = bttv_pci_tbl, .probe = bttv_probe, .remove = __devexit_p(bttv_remove), +#ifdef CONFIG_PM .suspend = bttv_suspend, .resume = bttv_resume, +#endif }; static int bttv_init_module(void) diff --git a/drivers/media/video/bt8xx/bttv-i2c.c b/drivers/media/video/bt8xx/bttv-i2c.c index 0dfbcc8..70de6c9 100644 --- a/drivers/media/video/bt8xx/bttv-i2c.c +++ b/drivers/media/video/bt8xx/bttv-i2c.c @@ -8,6 +8,9 @@ & Marcus Metzler (mocm@thp.uni-koeln.de) (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org> + (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org> + - Multituner support and i2c address binding + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -45,10 +48,18 @@ static int i2c_debug; static int i2c_hw; static int i2c_scan; module_param(i2c_debug, int, 0644); +MODULE_PARM_DESC(i2c_hw,"configure i2c debug level"); module_param(i2c_hw, int, 0444); +MODULE_PARM_DESC(i2c_hw,"force use of hardware i2c support, " + "instead of software bitbang"); module_param(i2c_scan, int, 0444); MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); +static unsigned int i2c_udelay = 5; +module_param(i2c_udelay, int, 0444); +MODULE_PARM_DESC(i2c_udelay,"soft i2c delay at insmod time, in usecs " + "(should be 5 or higher). Lower value means higher bus speed."); + /* ----------------------------------------------------------------------- */ /* I2C functions - bitbanging adapter (software i2c) */ @@ -425,6 +436,11 @@ int __devinit init_bttv_i2c(struct bttv *btv) sizeof(bttv_i2c_adap_hw_template)); } else { /* bt848 */ + /* Prevents usage of invalid delay values */ + if (i2c_udelay<5) + i2c_udelay=5; + bttv_i2c_algo_bit_template.udelay=i2c_udelay; + memcpy(&btv->c.i2c_adap, &bttv_i2c_adap_sw_template, sizeof(bttv_i2c_adap_sw_template)); 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 b69ee11..d82a488 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 return 0; } + struct video_buffer32 { compat_caddr_t base; 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 struct video_buffer vb; struct video_window vw; struct video_code vc; + struct video_audio va; #endif struct v4l2_format v2f; struct v4l2_buffer v2b; @@ -635,31 +637,31 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg /* First, convert the command. */ switch(cmd) { #ifdef CONFIG_VIDEO_V4L1_COMPAT - case VIDIOCGTUNER32: cmd = VIDIOCGTUNER; break; - case VIDIOCSTUNER32: cmd = VIDIOCSTUNER; break; - case VIDIOCGWIN32: cmd = VIDIOCGWIN; break; - case VIDIOCGFBUF32: cmd = VIDIOCGFBUF; break; - case VIDIOCSFBUF32: cmd = VIDIOCSFBUF; break; - case VIDIOCGFREQ32: cmd = VIDIOCGFREQ; break; - case VIDIOCSFREQ32: cmd = VIDIOCSFREQ; break; - case VIDIOCSMICROCODE32: cmd = VIDIOCSMICROCODE; break; + case VIDIOCGTUNER32: realcmd = cmd = VIDIOCGTUNER; break; + case VIDIOCSTUNER32: realcmd = cmd = VIDIOCSTUNER; break; + case VIDIOCGWIN32: realcmd = cmd = VIDIOCGWIN; break; + case VIDIOCGFBUF32: realcmd = cmd = VIDIOCGFBUF; break; + case VIDIOCSFBUF32: realcmd = cmd = VIDIOCSFBUF; break; + case VIDIOCGFREQ32: realcmd = cmd = VIDIOCGFREQ; break; + case VIDIOCSFREQ32: realcmd = cmd = VIDIOCSFREQ; break; + case VIDIOCSMICROCODE32: realcmd = cmd = VIDIOCSMICROCODE; break; #endif - case VIDIOC_G_FMT32: cmd = VIDIOC_G_FMT; break; - case VIDIOC_S_FMT32: cmd = VIDIOC_S_FMT; break; - case VIDIOC_QUERYBUF32: cmd = VIDIOC_QUERYBUF; break; - case VIDIOC_QBUF32: cmd = VIDIOC_QBUF; break; - case VIDIOC_DQBUF32: cmd = VIDIOC_DQBUF; break; - case VIDIOC_STREAMON32: cmd = VIDIOC_STREAMON; break; - case VIDIOC_STREAMOFF32: cmd = VIDIOC_STREAMOFF; break; - case VIDIOC_G_FBUF32: cmd = VIDIOC_G_FBUF; break; - case VIDIOC_S_FBUF32: cmd = VIDIOC_S_FBUF; break; - case VIDIOC_OVERLAY32: cmd = VIDIOC_OVERLAY; break; + case VIDIOC_G_FMT32: realcmd = cmd = VIDIOC_G_FMT; break; + case VIDIOC_S_FMT32: realcmd = cmd = VIDIOC_S_FMT; break; + case VIDIOC_QUERYBUF32: realcmd = cmd = VIDIOC_QUERYBUF; break; + case VIDIOC_QBUF32: realcmd = cmd = VIDIOC_QBUF; break; + case VIDIOC_DQBUF32: realcmd = cmd = VIDIOC_DQBUF; break; + case VIDIOC_STREAMON32: realcmd = cmd = VIDIOC_STREAMON; break; + case VIDIOC_STREAMOFF32: realcmd = cmd = VIDIOC_STREAMOFF; break; + case VIDIOC_G_FBUF32: realcmd = cmd = VIDIOC_G_FBUF; break; + case VIDIOC_S_FBUF32: realcmd = cmd = VIDIOC_S_FBUF; break; + case VIDIOC_OVERLAY32: realcmd = cmd = VIDIOC_OVERLAY; break; case VIDIOC_ENUMSTD32: realcmd = VIDIOC_ENUMSTD; break; case VIDIOC_ENUMINPUT32: realcmd = VIDIOC_ENUMINPUT; break; - case VIDIOC_S_CTRL32: cmd = VIDIOC_S_CTRL; break; - case VIDIOC_G_INPUT32: cmd = VIDIOC_G_INPUT; break; - case VIDIOC_S_INPUT32: cmd = VIDIOC_S_INPUT; break; - case VIDIOC_TRY_FMT32: cmd = VIDIOC_TRY_FMT; break; + case VIDIOC_S_CTRL32: realcmd = cmd = VIDIOC_S_CTRL; break; + case VIDIOC_G_INPUT32: realcmd = cmd = VIDIOC_G_INPUT; break; + case VIDIOC_S_INPUT32: realcmd = cmd = VIDIOC_S_INPUT; break; + case VIDIOC_TRY_FMT32: realcmd = cmd = VIDIOC_TRY_FMT; break; }; switch(cmd) { @@ -676,6 +678,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg compatible_arg = 0; break; + case VIDIOCSFREQ: #endif case VIDIOC_S_INPUT: @@ -683,7 +686,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg case VIDIOC_STREAMON: case VIDIOC_STREAMOFF: err = get_user(karg.vx, (u32 __user *)up); - compatible_arg = 0; + compatible_arg = 1; break; case VIDIOC_S_FBUF: @@ -739,6 +742,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg case VIDIOC_G_FBUF: case VIDIOC_G_INPUT: compatible_arg = 0; + break; #ifdef CONFIG_VIDEO_V4L1_COMPAT case VIDIOCSMICROCODE: err = microcode32(&karg.vc, up); @@ -755,7 +759,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg mm_segment_t old_fs = get_fs(); set_fs(KERNEL_DS); - err = native_ioctl(file, realcmd, (unsigned long)&karg); + err = native_ioctl(file, realcmd, (unsigned long) &karg); set_fs(old_fs); } if(err == 0) { @@ -772,6 +776,7 @@ static int do_video_ioctl(struct file *file, unsigned int cmd, unsigned long arg case VIDIOCGFBUF: err = put_video_buffer32(&karg.vb, up); break; + #endif case VIDIOC_G_FBUF: err = put_v4l2_framebuffer32(&karg.v2fb, up); @@ -841,10 +846,14 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) case VIDIOCSFBUF32: case VIDIOCGFREQ32: case VIDIOCSFREQ32: + case VIDIOCGAUDIO: + case VIDIOCSAUDIO: #endif case VIDIOC_QUERYCAP: case VIDIOC_ENUM_FMT: case VIDIOC_G_FMT32: + case VIDIOC_CROPCAP: + case VIDIOC_S_CROP: case VIDIOC_S_FMT32: case VIDIOC_REQBUFS: case VIDIOC_QUERYBUF32: @@ -882,8 +891,6 @@ long v4l_compat_ioctl32(struct file *file, unsigned int cmd, unsigned long arg) case VIDIOCSPICT: case VIDIOCCAPTURE: case VIDIOCKEY: - case VIDIOCGAUDIO: - case VIDIOCSAUDIO: case VIDIOCSYNC: case VIDIOCMCAPTURE: case VIDIOCGMBUF: diff --git a/drivers/media/video/cpia2/cpia2.h b/drivers/media/video/cpia2/cpia2.h index c5ecb2b..8d2dfc1 100644 --- a/drivers/media/video/cpia2/cpia2.h +++ b/drivers/media/video/cpia2/cpia2.h @@ -50,10 +50,6 @@ /*** * Image defines ***/ -#ifndef true -#define true 1 -#define false 0 -#endif /* Misc constants */ #define ALLOW_CORRUPT 0 /* Causes collater to discard checksum */ diff --git a/drivers/media/video/cx2341x.c b/drivers/media/video/cx2341x.c index 65f00fc..657e0b9 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) .video_luma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_LUMA_SPATIAL_FILTER_TYPE_1D_HOR, .video_chroma_spatial_filter_type = V4L2_MPEG_CX2341X_VIDEO_CHROMA_SPATIAL_FILTER_TYPE_1D_HOR, .video_temporal_filter_mode = V4L2_MPEG_CX2341X_VIDEO_TEMPORAL_FILTER_MODE_MANUAL, - .video_temporal_filter = 0, + .video_temporal_filter = 8, .video_median_filter_type = V4L2_MPEG_CX2341X_VIDEO_MEDIAN_FILTER_TYPE_OFF, .video_luma_median_filter_top = 255, .video_luma_median_filter_bottom = 0, @@ -731,6 +731,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, }; int err = 0; + u16 temporal = new->video_temporal_filter; cx2341x_api(priv, func, CX2341X_ENC_SET_OUTPUT_PORT, 2, new->port, 0); @@ -741,6 +742,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, if (old == NULL || old->width != new->width || old->height != new->height || old->video_encoding != new->video_encoding) { + int is_scaling; u16 w = new->width; u16 h = new->height; @@ -750,6 +752,20 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, } err = cx2341x_api(priv, func, CX2341X_ENC_SET_FRAME_SIZE, 2, h, w); if (err) return err; + + /* Adjust temporal filter if necessary. The problem with the temporal + filter is that it works well with full resolution capturing, but + not when the capture window is scaled (the filter introduces + a ghosting effect). So if the capture window changed, and there is + no updated filter value, then the filter is set depending on whether + the new window is full resolution or not. + + For full resolution a setting of 8 really improves the video + quality, especially if the original video quality is suboptimal. */ + is_scaling = new->width != 720 || new->height != (new->is_50hz ? 576 : 480); + if (old && old->video_temporal_filter == temporal) { + temporal = is_scaling ? 0 : 8; + } } if (old == NULL || old->stream_type != new->stream_type) { @@ -815,9 +831,9 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, } if (old == NULL || old->video_spatial_filter != new->video_spatial_filter || - old->video_temporal_filter != new->video_temporal_filter) { + old->video_temporal_filter != temporal) { err = cx2341x_api(priv, func, CX2341X_ENC_SET_DNR_FILTER_PROPS, 2, - new->video_spatial_filter, new->video_temporal_filter); + new->video_spatial_filter, temporal); if (err) return err; } 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) printk(KERN_INFO "%s: Stream: %s\n", prefix, cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_TYPE)); + printk(KERN_INFO "%s: VBI Format: %s\n", + prefix, + cx2341x_menu_item(p, V4L2_CID_MPEG_STREAM_VBI_FMT)); /* Video */ 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 854264e..7cf29a0 100644 --- a/drivers/media/video/cx25840/Kconfig +++ b/drivers/media/video/cx25840/Kconfig @@ -1,6 +1,6 @@ config VIDEO_CX25840 tristate "Conexant CX2584x audio/video decoders" - depends on VIDEO_DEV && I2C && EXPERIMENTAL + depends on VIDEO_V4L2 && I2C && EXPERIMENTAL select FW_LOADER ---help--- 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 6cc8bf2..48014a2 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) uv_lpf=0; comb=0; sc=0x0a425f; + } else if (std == V4L2_STD_PAL_Nc) { + uv_lpf=1; + comb=0x20; + sc=556453; } else { uv_lpf=1; comb=0x20; diff --git a/drivers/media/video/cx88/Kconfig b/drivers/media/video/cx88/Kconfig index 7a94e6a..51d68f3 100644 --- a/drivers/media/video/cx88/Kconfig +++ b/drivers/media/video/cx88/Kconfig @@ -1,7 +1,3 @@ -config VIDEO_CX88_VP3054 - tristate - depends on VIDEO_CX88_DVB && DVB_MT352 - config VIDEO_CX88 tristate "Conexant 2388x (bt878 successor) support" depends on VIDEO_DEV && PCI && I2C @@ -52,6 +48,14 @@ config VIDEO_CX88_DVB depends on VIDEO_CX88 && DVB_CORE select VIDEO_BUF_DVB select DVB_PLL + select DVB_MT352 if !DVB_FE_CUSTOMISE + select DVB_ZL10353 if !DVB_FE_CUSTOMISE + select DVB_OR51132 if !DVB_FE_CUSTOMISE + select DVB_CX22702 if !DVB_FE_CUSTOMISE + select DVB_LGDT330X if !DVB_FE_CUSTOMISE + select DVB_NXT200X if !DVB_FE_CUSTOMISE + select DVB_CX24123 if !DVB_FE_CUSTOMISE + select DVB_ISL6421 if !DVB_FE_CUSTOMISE ---help--- This adds support for DVB/ATSC cards based on the Conexant 2388x chip. @@ -59,101 +63,12 @@ config VIDEO_CX88_DVB To compile this driver as a module, choose M here: the module will be called cx88-dvb. - You must also select one or more DVB/ATSC demodulators. - If you are unsure which you need, choose all of them. - -config VIDEO_CX88_DVB_ALL_FRONTENDS - bool "Build all supported frontends for cx2388x based TV cards" - default y - depends on VIDEO_CX88_DVB - select DVB_MT352 - select VIDEO_CX88_VP3054 - select DVB_ZL10353 - select DVB_OR51132 - select DVB_CX22702 - select DVB_LGDT330X - select DVB_NXT200X - select DVB_CX24123 - select DVB_ISL6421 - ---help--- - This builds cx88-dvb with all currently supported frontend - demodulators. If you wish to tweak your configuration, and - only include support for the hardware that you need, choose N here. - - If you are unsure, choose Y. - -config VIDEO_CX88_DVB_MT352 - bool "Zarlink MT352 DVB-T Support" - default y - depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS - select DVB_MT352 - ---help--- - This adds DVB-T support for cards based on the - Connexant 2388x chip and the MT352 demodulator. - -config VIDEO_CX88_DVB_VP3054 - bool "VP-3054 Secondary I2C Bus Support" - default y - depends on VIDEO_CX88_DVB_MT352 - select VIDEO_CX88_VP3054 +config VIDEO_CX88_VP3054 + tristate "VP-3054 Secondary I2C Bus Support" + default m + depends on VIDEO_CX88_DVB && DVB_MT352 ---help--- This adds DVB-T support for cards based on the Connexant 2388x chip and the MT352 demodulator, which also require support for the VP-3054 Secondary I2C bus, such at DNTV Live! DVB-T Pro. - -config VIDEO_CX88_DVB_ZL10353 - bool "Zarlink ZL10353 DVB-T Support" - default y - depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS - select DVB_ZL10353 - ---help--- - This adds DVB-T support for cards based on the - Connexant 2388x chip and the ZL10353 demodulator, - successor to the Zarlink MT352. - -config VIDEO_CX88_DVB_OR51132 - bool "OR51132 ATSC Support" - default y - depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS - select DVB_OR51132 - ---help--- - This adds ATSC 8VSB and QAM64/256 support for cards based on the - Connexant 2388x chip and the OR51132 demodulator. - -config VIDEO_CX88_DVB_CX22702 - bool "Conexant CX22702 DVB-T Support" - default y - depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS - select DVB_CX22702 - ---help--- - This adds DVB-T support for cards based on the - Connexant 2388x chip and the CX22702 demodulator. - -config VIDEO_CX88_DVB_LGDT330X - bool "LG Electronics DT3302/DT3303 ATSC Support" - default y - depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS - select DVB_LGDT330X - ---help--- - This adds ATSC 8VSB and QAM64/256 support for cards based on the - Connexant 2388x chip and the LGDT3302/LGDT3303 demodulator. - -config VIDEO_CX88_DVB_NXT200X - bool "NXT2002/NXT2004 ATSC Support" - default y - depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS - select DVB_NXT200X - ---help--- - This adds ATSC 8VSB and QAM64/256 support for cards based on the - Connexant 2388x chip and the NXT2002/NXT2004 demodulator. - -config VIDEO_CX88_DVB_CX24123 - bool "Conexant CX24123 DVB-S Support" - default y - depends on VIDEO_CX88_DVB && !VIDEO_CX88_DVB_ALL_FRONTENDS - select DVB_CX24123 - select DVB_ISL6421 - ---help--- - This adds DVB-S support for cards based on the - Connexant 2388x chip and the CX24123 demodulator. diff --git a/drivers/media/video/cx88/Makefile b/drivers/media/video/cx88/Makefile index 352b919..639c3b6 100644 --- a/drivers/media/video/cx88/Makefile +++ b/drivers/media/video/cx88/Makefile @@ -14,13 +14,6 @@ EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core EXTRA_CFLAGS += -Idrivers/media/dvb/frontends extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1 -extra-cflags-$(CONFIG_DVB_CX22702) += -DHAVE_CX22702=1 -extra-cflags-$(CONFIG_DVB_OR51132) += -DHAVE_OR51132=1 -extra-cflags-$(CONFIG_DVB_LGDT330X) += -DHAVE_LGDT330X=1 -extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1 -extra-cflags-$(CONFIG_DVB_ZL10353) += -DHAVE_ZL10353=1 -extra-cflags-$(CONFIG_DVB_NXT200X) += -DHAVE_NXT200X=1 -extra-cflags-$(CONFIG_DVB_CX24123) += -DHAVE_CX24123=1 extra-cflags-$(CONFIG_VIDEO_CX88_VP3054)+= -DHAVE_VP3054_I2C=1 EXTRA_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 b60177f..a7921f9d 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 = { .id_table = cx8802_pci_tbl, .probe = blackbird_probe, .remove = __devexit_p(blackbird_remove), +#ifdef CONFIG_PM .suspend = cx8802_suspend_common, .resume = cx8802_resume_common, +#endif }; static int blackbird_init(void) diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 14bd486..6214eb8 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[] = { .input = {{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, - .gpio0 = 0x000027df, + .gpio0 = 0x000067df, },{ .type = CX88_VMUX_SVIDEO, .vmux = 2, - .gpio0 = 0x000027df, + .gpio0 = 0x000067df, }}, .dvb = 1, }, @@ -1209,6 +1209,100 @@ struct cx88_board cx88_boards[] = { }}, .dvb = 1, }, + [CX88_BOARD_HAUPPAUGE_HVR3000] = { + /* FIXME: Add dvb & radio support */ + .name = "Hauppauge WinTV-HVR3000 TriMode Analog/DVB-S/DVB-T", + .tuner_type = TUNER_PHILIPS_FMD1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x84bf, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x84bf, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x84bf, + }}, + }, + [CX88_BOARD_NORWOOD_MICRO] = { + .name = "Norwood Micro TV Tuner", + .tuner_type = TUNER_TNF_5335MF, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x0709, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x070b, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x070b, + }}, + }, + [CX88_BOARD_TE_DTV_250_OEM_SWANN] = { + .name = "Shenzhen Tungsten Ages Tech TE-DTV-250 / Swann OEM", + .tuner_type = TUNER_LG_PAL_NEW_TAPC, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x003fffff, + .gpio1 = 0x00e00000, + .gpio2 = 0x003fffff, + .gpio3 = 0x02000000, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x003fffff, + .gpio1 = 0x00e00000, + .gpio2 = 0x003fffff, + .gpio3 = 0x02000000, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x003fffff, + .gpio1 = 0x00e00000, + .gpio2 = 0x003fffff, + .gpio3 = 0x02000000, + }}, + }, + [CX88_BOARD_HAUPPAUGE_HVR1300] = { + .name = "Hauppauge WinTV-HVR1300 DVB-T/Hybrid MPEG Encoder", + .tuner_type = TUNER_PHILIPS_FMD1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0xe780, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0xe780, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0xe780, + }}, + /* fixme: Add radio support */ + .dvb = 1, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); @@ -1254,7 +1348,7 @@ struct cx88_subid cx88_subids[] = { .card = CX88_BOARD_LEADTEK_PVR2000, },{ .subvendor = 0x107d, - .subdevice = 0x663C, + .subdevice = 0x663c, .card = CX88_BOARD_LEADTEK_PVR2000, },{ .subvendor = 0x1461, @@ -1458,6 +1552,35 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x14f1, .subdevice = 0x0084, .card = CX88_BOARD_GENIATECH_DVBS, + },{ + .subvendor = 0x0070, + .subdevice = 0x1404, + .card = CX88_BOARD_HAUPPAUGE_HVR3000, + },{ + .subvendor = 0x1461, + .subdevice = 0xc111, /* AverMedia M150-D */ + /* This board is known to work with the ASUS PVR416 config */ + .card = CX88_BOARD_ASUS_PVR_416, + },{ + .subvendor = 0xc180, + .subdevice = 0xc980, + .card = CX88_BOARD_TE_DTV_250_OEM_SWANN, + },{ + .subvendor = 0x0070, + .subdevice = 0x9600, + .card = CX88_BOARD_HAUPPAUGE_HVR1300, + },{ + .subvendor = 0x0070, + .subdevice = 0x9601, + .card = CX88_BOARD_HAUPPAUGE_HVR1300, + },{ + .subvendor = 0x0070, + .subdevice = 0x9602, + .card = CX88_BOARD_HAUPPAUGE_HVR1300, + },{ + .subvendor = 0x107d, + .subdevice = 0x6632, + .card = CX88_BOARD_LEADTEK_PVR2000, }, }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); @@ -1501,6 +1624,7 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data) /* Make sure we support the board model */ switch (tv.model) { + case 14569: /* WinTV-HVR3000 (OEM, no IR, no back panel video) */ case 28552: /* WinTV-PVR 'Roslyn' (No IR) */ case 34519: /* WinTV-PCI-FM */ case 90002: /* Nova-T-PCI (9002) */ @@ -1512,6 +1636,11 @@ static void hauppauge_eeprom(struct cx88_core *core, u8 *eeprom_data) case 92000: /* Nova-SE2 (OEM, No Video or IR) */ case 94009: /* WinTV-HVR1100 (Video and IR Retail) */ case 94501: /* WinTV-HVR1100 (Video and IR OEM) */ + case 96009: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX) */ + case 96019: /* WinTV-HVR1300 (PAL Video, MPEG Video and IR RX/TX) */ + case 96559: /* WinTV-HVR1300 (PAL Video, MPEG Video no IR) */ + case 96569: /* WinTV-HVR1300 () */ + case 96659: /* WinTV-HVR1300 () */ case 98559: /* WinTV-HVR1100LP (Video no IR, Retail - Low Profile) */ /* known */ break; @@ -1638,6 +1767,22 @@ void cx88_card_list(struct cx88_core *core, struct pci_dev *pci) core->name, i, cx88_boards[i].name); } +void cx88_card_setup_pre_i2c(struct cx88_core *core) +{ + switch (core->board) { + case CX88_BOARD_HAUPPAUGE_HVR1300: + /* Bring the 702 demod up before i2c scanning/attach or devices are hidden */ + /* We leave here with the 702 on the bus */ + cx_write(MO_GP0_IO, 0x0000e780); + udelay(1000); + cx_clear(MO_GP0_IO, 0x00000080); + udelay(50); + cx_set(MO_GP0_IO, 0x00000080); /* 702 out of reset */ + udelay(1000); + break; + } +} + void cx88_card_setup(struct cx88_core *core) { static u8 eeprom[256]; @@ -1666,6 +1811,8 @@ void cx88_card_setup(struct cx88_core *core) case CX88_BOARD_HAUPPAUGE_DVB_T1: case CX88_BOARD_HAUPPAUGE_HVR1100: case CX88_BOARD_HAUPPAUGE_HVR1100LP: + case CX88_BOARD_HAUPPAUGE_HVR3000: + case CX88_BOARD_HAUPPAUGE_HVR1300: if (0 == core->i2c_rc) hauppauge_eeprom(core,eeprom); break; @@ -1673,9 +1820,15 @@ void cx88_card_setup(struct cx88_core *core) cx_write(MO_GP0_IO, 0x000007f8); cx_write(MO_GP1_IO, 0x00000001); break; + case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: + /* GPIO0:6 is hooked to FX2 reset pin */ + cx_set(MO_GP0_IO, 0x00004040); + cx_clear(MO_GP0_IO, 0x00000040); + msleep(1000); + cx_set(MO_GP0_IO, 0x00004040); + /* FALLTHROUGH */ case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: - case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: /* GPIO0:0 is hooked to mt352 reset pin */ 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 973d3f3..f379ede 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, *(rp++)=cpu_to_le32(sg_dma_address(sg)+offset); offset+=bpl; } else { - /* scanline needs to be splitted */ + /* scanline needs to be split */ todo = bpl; *(rp++)=cpu_to_le32(RISC_WRITE|RISC_SOL| (sg_dma_len(sg)-offset)); @@ -792,6 +792,11 @@ int cx88_start_audio_dma(struct cx88_core *core) { /* constant 128 made buzz in analog Nicam-stereo for bigger fifo_size */ int bpl = cx88_sram_channels[SRAM_CH25].fifo_size/4; + + /* If downstream RISC is enabled, bail out; ALSA is managing DMA */ + if (cx_read(MO_AUD_DMACNTRL) & 0x10) + return 0; + /* setup fifo + format */ cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH25], bpl, 0); 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) /* start dma */ cx_write(MO_AUD_DMACNTRL, 0x0003); /* Up and Down fifo enable */ + return 0; } int cx88_stop_audio_dma(struct cx88_core *core) { + /* If downstream RISC is enabled, bail out; ALSA is managing DMA */ + if (cx_read(MO_AUD_DMACNTRL) & 0x10) + return 0; + /* stop dma */ cx_write(MO_AUD_DMACNTRL, 0x0000); @@ -1123,6 +1133,7 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) /* init hardware */ cx88_reset(core); + cx88_card_setup_pre_i2c(core); cx88_i2c_init(core,pci); cx88_call_i2c_clients (core, TUNER_SET_STANDBY, NULL); cx88_card_setup(core); diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index afde378..c87041d 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -33,32 +33,18 @@ #include "dvb-pll.h" #include <media/v4l2-common.h> -#ifdef HAVE_MT352 -# include "mt352.h" -# include "mt352_priv.h" -# ifdef HAVE_VP3054_I2C -# include "cx88-vp3054-i2c.h" -# endif -#endif -#ifdef HAVE_ZL10353 -# include "zl10353.h" -#endif -#ifdef HAVE_CX22702 -# include "cx22702.h" -#endif -#ifdef HAVE_OR51132 -# include "or51132.h" -#endif -#ifdef HAVE_LGDT330X -# include "lgdt330x.h" -# include "lg_h06xf.h" -#endif -#ifdef HAVE_NXT200X -# include "nxt200x.h" -#endif -#ifdef HAVE_CX24123 -# include "cx24123.h" +#include "mt352.h" +#include "mt352_priv.h" +#ifdef HAVE_VP3054_I2C +# include "cx88-vp3054-i2c.h" #endif +#include "zl10353.h" +#include "cx22702.h" +#include "or51132.h" +#include "lgdt330x.h" +#include "lg_h06xf.h" +#include "nxt200x.h" +#include "cx24123.h" #include "isl6421.h" MODULE_DESCRIPTION("driver for cx2388x based DVB cards"); @@ -114,8 +100,6 @@ static struct videobuf_queue_ops dvb_qops = { }; /* ------------------------------------------------------------------ */ - -#ifdef HAVE_MT352 static int dvico_fusionhdtv_demod_init(struct dvb_frontend* fe) { static u8 clock_config [] = { CLOCK_CTL, 0x38, 0x39 }; @@ -181,7 +165,7 @@ static int dntv_live_dvbt_demod_init(struct dvb_frontend* fe) } static struct mt352_config dvico_fusionhdtv = { - .demod_address = 0x0F, + .demod_address = 0x0f, .demod_init = dvico_fusionhdtv_demod_init, }; @@ -191,7 +175,7 @@ static struct mt352_config dntv_live_dvbt_config = { }; static struct mt352_config dvico_fusionhdtv_dual = { - .demod_address = 0x0F, + .demod_address = 0x0f, .demod_init = dvico_dual_demod_init, }; @@ -266,8 +250,8 @@ static int dntv_live_dvbt_pro_tuner_set_params(struct dvb_frontend* fe, if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { printk(KERN_WARNING "cx88-dvb: %s error " - "(addr %02x <- %02x, err = %i)\n", - __FUNCTION__, dev->core->pll_addr, buf[0], err); + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, dev->core->pll_addr, buf[0], err); if (err < 0) return err; else @@ -283,9 +267,7 @@ static struct mt352_config dntv_live_dvbt_pro_config = { .demod_init = dntv_live_dvbt_pro_demod_init, }; #endif -#endif -#ifdef HAVE_ZL10353 static int dvico_hybrid_tuner_set_params(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { @@ -304,8 +286,8 @@ static int dvico_hybrid_tuner_set_params(struct dvb_frontend *fe, fe->ops.i2c_gate_ctrl(fe, 1); if ((err = i2c_transfer(&dev->core->i2c_adap, &msg, 1)) != 1) { printk(KERN_WARNING "cx88-dvb: %s error " - "(addr %02x <- %02x, err = %i)\n", - __FUNCTION__, pllbuf[0], pllbuf[1], err); + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, pllbuf[0], pllbuf[1], err); if (err < 0) return err; else @@ -316,16 +298,14 @@ static int dvico_hybrid_tuner_set_params(struct dvb_frontend *fe, } static struct zl10353_config dvico_fusionhdtv_hybrid = { - .demod_address = 0x0F, + .demod_address = 0x0f, .no_tuner = 1, }; static struct zl10353_config dvico_fusionhdtv_plus_v1_1 = { - .demod_address = 0x0F, + .demod_address = 0x0f, }; -#endif -#ifdef HAVE_CX22702 static struct cx22702_config connexant_refboard_config = { .demod_address = 0x43, .output_mode = CX22702_SERIAL_OUTPUT, @@ -339,9 +319,11 @@ static struct cx22702_config hauppauge_hvr1100_config = { .demod_address = 0x63, .output_mode = CX22702_SERIAL_OUTPUT, }; -#endif +static struct cx22702_config hauppauge_hvr1300_config = { + .demod_address = 0x63, + .output_mode = CX22702_SERIAL_OUTPUT, +}; -#ifdef HAVE_OR51132 static int or51132_set_ts_param(struct dvb_frontend* fe, int is_punctured) { @@ -351,12 +333,10 @@ static int or51132_set_ts_param(struct dvb_frontend* fe, } static struct or51132_config pchdtv_hd3000 = { - .demod_address = 0x15, - .set_ts_params = or51132_set_ts_param, + .demod_address = 0x15, + .set_ts_params = or51132_set_ts_param, }; -#endif -#ifdef HAVE_LGDT330X static int lgdt3302_tuner_set_params(struct dvb_frontend* fe, struct dvb_frontend_parameters* params) { @@ -373,14 +353,14 @@ static int lgdt3302_tuner_set_params(struct dvb_frontend* fe, dvb_pll_configure(core->pll_desc, buf, params->frequency, 0); dprintk(1, "%s: tuner at 0x%02x bytes: 0x%02x 0x%02x 0x%02x 0x%02x\n", - __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]); + __FUNCTION__, msg.addr, buf[0],buf[1],buf[2],buf[3]); if (fe->ops.i2c_gate_ctrl) fe->ops.i2c_gate_ctrl(fe, 1); if ((err = i2c_transfer(&core->i2c_adap, &msg, 1)) != 1) { printk(KERN_WARNING "cx88-dvb: %s error " - "(addr %02x <- %02x, err = %i)\n", - __FUNCTION__, buf[0], buf[1], err); + "(addr %02x <- %02x, err = %i)\n", + __FUNCTION__, buf[0], buf[1], err); if (err < 0) return err; else @@ -425,28 +405,26 @@ static int lgdt330x_set_ts_param(struct dvb_frontend* fe, int is_punctured) } static struct lgdt330x_config fusionhdtv_3_gold = { - .demod_address = 0x0e, - .demod_chip = LGDT3302, - .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */ - .set_ts_params = lgdt330x_set_ts_param, + .demod_address = 0x0e, + .demod_chip = LGDT3302, + .serial_mpeg = 0x04, /* TPSERIAL for 3302 in TOP_CONTROL */ + .set_ts_params = lgdt330x_set_ts_param, }; static struct lgdt330x_config fusionhdtv_5_gold = { - .demod_address = 0x0e, - .demod_chip = LGDT3303, - .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ - .set_ts_params = lgdt330x_set_ts_param, + .demod_address = 0x0e, + .demod_chip = LGDT3303, + .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ + .set_ts_params = lgdt330x_set_ts_param, }; static struct lgdt330x_config pchdtv_hd5500 = { - .demod_address = 0x59, - .demod_chip = LGDT3303, - .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ - .set_ts_params = lgdt330x_set_ts_param, + .demod_address = 0x59, + .demod_chip = LGDT3303, + .serial_mpeg = 0x40, /* TPSERIAL for 3303 in TOP_CONTROL */ + .set_ts_params = lgdt330x_set_ts_param, }; -#endif -#ifdef HAVE_NXT200X static int nxt200x_set_ts_param(struct dvb_frontend* fe, int is_punctured) { @@ -465,28 +443,27 @@ static int nxt200x_set_pll_input(u8* buf, int input) } static struct nxt200x_config ati_hdtvwonder = { - .demod_address = 0x0a, - .set_pll_input = nxt200x_set_pll_input, - .set_ts_params = nxt200x_set_ts_param, + .demod_address = 0x0a, + .set_pll_input = nxt200x_set_pll_input, + .set_ts_params = nxt200x_set_ts_param, }; -#endif -#ifdef HAVE_CX24123 static int cx24123_set_ts_param(struct dvb_frontend* fe, int is_punctured) { struct cx8802_dev *dev= fe->dvb->priv; - dev->ts_gen_cntrl = 0x2; + dev->ts_gen_cntrl = 0x02; return 0; } -static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t voltage) +static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe, + fe_sec_voltage_t voltage) { struct cx8802_dev *dev= fe->dvb->priv; struct cx88_core *core = dev->core; if (voltage == SEC_VOLTAGE_OFF) { - cx_write(MO_GP0_IO, 0x000006fB); + cx_write(MO_GP0_IO, 0x000006fb); } else { cx_write(MO_GP0_IO, 0x000006f9); } @@ -496,7 +473,8 @@ static int kworld_dvbs_100_set_voltage(struct dvb_frontend* fe, fe_sec_voltage_t return 0; } -static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t voltage) +static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe, + fe_sec_voltage_t voltage) { struct cx8802_dev *dev= fe->dvb->priv; struct cx88_core *core = dev->core; @@ -512,20 +490,20 @@ static int geniatech_dvbs_set_voltage(struct dvb_frontend *fe, fe_sec_voltage_t } static struct cx24123_config geniatech_dvbs_config = { - .demod_address = 0x55, - .set_ts_params = cx24123_set_ts_param, + .demod_address = 0x55, + .set_ts_params = cx24123_set_ts_param, }; static struct cx24123_config hauppauge_novas_config = { - .demod_address = 0x55, - .set_ts_params = cx24123_set_ts_param, + .demod_address = 0x55, + .set_ts_params = cx24123_set_ts_param, }; static struct cx24123_config kworld_dvbs_100_config = { - .demod_address = 0x15, - .set_ts_params = cx24123_set_ts_param, + .demod_address = 0x15, + .set_ts_params = cx24123_set_ts_param, + .lnb_polarity = 1, }; -#endif static int dvb_register(struct cx8802_dev *dev) { @@ -535,114 +513,114 @@ static int dvb_register(struct cx8802_dev *dev) /* init frontend */ switch (dev->core->board) { -#ifdef HAVE_CX22702 case CX88_BOARD_HAUPPAUGE_DVB_T1: - dev->dvb.frontend = cx22702_attach(&hauppauge_novat_config, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(cx22702_attach, + &hauppauge_novat_config, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_pll_attach(dev->dvb.frontend, 0x61, - &dev->core->i2c_adap, - &dvb_pll_thomson_dtt759x); + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + &dev->core->i2c_adap, + &dvb_pll_thomson_dtt759x); } break; case CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1: case CX88_BOARD_CONEXANT_DVB_T1: case CX88_BOARD_KWORLD_DVB_T_CX22702: case CX88_BOARD_WINFAST_DTV1000: - dev->dvb.frontend = cx22702_attach(&connexant_refboard_config, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(cx22702_attach, + &connexant_refboard_config, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_pll_attach(dev->dvb.frontend, 0x60, - &dev->core->i2c_adap, - &dvb_pll_thomson_dtt7579); + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, + &dev->core->i2c_adap, + &dvb_pll_thomson_dtt7579); } break; case CX88_BOARD_WINFAST_DTV2000H: case CX88_BOARD_HAUPPAUGE_HVR1100: case CX88_BOARD_HAUPPAUGE_HVR1100LP: - dev->dvb.frontend = cx22702_attach(&hauppauge_hvr1100_config, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(cx22702_attach, + &hauppauge_hvr1100_config, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_pll_attach(dev->dvb.frontend, 0x61, - &dev->core->i2c_adap, - &dvb_pll_fmd1216me); + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + &dev->core->i2c_adap, + &dvb_pll_fmd1216me); + } + break; + case CX88_BOARD_HAUPPAUGE_HVR1300: + dev->dvb.frontend = dvb_attach(cx22702_attach, + &hauppauge_hvr1300_config, + &dev->core->i2c_adap); + if (dev->dvb.frontend != NULL) { + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + &dev->core->i2c_adap, + &dvb_pll_fmd1216me); } break; -#endif -#if defined(HAVE_MT352) || defined(HAVE_ZL10353) case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS: -#ifdef HAVE_MT352 - dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(mt352_attach, + &dvico_fusionhdtv, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_pll_attach(dev->dvb.frontend, 0x60, - &dev->core->i2c_adap, - &dvb_pll_thomson_dtt7579); + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, + NULL, &dvb_pll_thomson_dtt7579); break; } -#endif -#ifdef HAVE_ZL10353 /* ZL10353 replaces MT352 on later cards */ - dev->dvb.frontend = zl10353_attach(&dvico_fusionhdtv_plus_v1_1, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(zl10353_attach, + &dvico_fusionhdtv_plus_v1_1, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_pll_attach(dev->dvb.frontend, 0x60, - &dev->core->i2c_adap, - &dvb_pll_thomson_dtt7579); + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x60, + NULL, &dvb_pll_thomson_dtt7579); } -#endif break; case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_DUAL: -#ifdef HAVE_MT352 /* The tin box says DEE1601, but it seems to be DTT7579 * compatible, with a slightly different MT352 AGC gain. */ - dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv_dual, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(mt352_attach, + &dvico_fusionhdtv_dual, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_pll_attach(dev->dvb.frontend, 0x61, - &dev->core->i2c_adap, - &dvb_pll_thomson_dtt7579); + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + NULL, &dvb_pll_thomson_dtt7579); break; } -#endif -#ifdef HAVE_ZL10353 /* ZL10353 replaces MT352 on later cards */ - dev->dvb.frontend = zl10353_attach(&dvico_fusionhdtv_plus_v1_1, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(zl10353_attach, + &dvico_fusionhdtv_plus_v1_1, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_pll_attach(dev->dvb.frontend, 0x61, - &dev->core->i2c_adap, - &dvb_pll_thomson_dtt7579); + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + NULL, &dvb_pll_thomson_dtt7579); } -#endif break; -#endif /* HAVE_MT352 || HAVE_ZL10353 */ -#ifdef HAVE_MT352 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1: - dev->dvb.frontend = mt352_attach(&dvico_fusionhdtv, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(mt352_attach, + &dvico_fusionhdtv, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_pll_attach(dev->dvb.frontend, 0x61, - &dev->core->i2c_adap, - &dvb_pll_lg_z201); + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + NULL, &dvb_pll_lg_z201); } break; case CX88_BOARD_KWORLD_DVB_T: case CX88_BOARD_DNTV_LIVE_DVB_T: case CX88_BOARD_ADSTECH_DVB_T_PCI: - dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_config, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(mt352_attach, + &dntv_live_dvbt_config, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_pll_attach(dev->dvb.frontend, 0x61, - &dev->core->i2c_adap, - &dvb_pll_unknown_1); + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + NULL, &dvb_pll_unknown_1); } break; case CX88_BOARD_DNTV_LIVE_DVB_T_PRO: #ifdef HAVE_VP3054_I2C dev->core->pll_addr = 0x61; dev->core->pll_desc = &dvb_pll_fmd1216me; - dev->dvb.frontend = mt352_attach(&dntv_live_dvbt_pro_config, + dev->dvb.frontend = dvb_attach(mt352_attach, &dntv_live_dvbt_pro_config, &((struct vp3054_i2c_state *)dev->card_priv)->adap); if (dev->dvb.frontend != NULL) { 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) printk("%s: built without vp3054 support\n", dev->core->name); #endif break; -#endif -#ifdef HAVE_ZL10353 case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_HYBRID: dev->core->pll_addr = 0x61; dev->core->pll_desc = &dvb_pll_thomson_fe6600; - dev->dvb.frontend = zl10353_attach(&dvico_fusionhdtv_hybrid, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(zl10353_attach, + &dvico_fusionhdtv_hybrid, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { dev->dvb.frontend->ops.tuner_ops.set_params = dvico_hybrid_tuner_set_params; } break; -#endif -#ifdef HAVE_OR51132 case CX88_BOARD_PCHDTV_HD3000: - dev->dvb.frontend = or51132_attach(&pchdtv_hd3000, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(or51132_attach, + &pchdtv_hd3000, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_pll_attach(dev->dvb.frontend, 0x61, - &dev->core->i2c_adap, - &dvb_pll_thomson_dtt761x); + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + &dev->core->i2c_adap, + &dvb_pll_thomson_dtt761x); } break; -#endif -#ifdef HAVE_LGDT330X case CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_Q: dev->ts_gen_cntrl = 0x08; { @@ -690,8 +664,9 @@ static int dvb_register(struct cx8802_dev *dev) fusionhdtv_3_gold.pll_rf_set = lgdt330x_pll_rf_set; dev->core->pll_addr = 0x61; dev->core->pll_desc = &dvb_pll_microtune_4042; - dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(lgdt330x_attach, + &fusionhdtv_3_gold, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3302_tuner_set_params; } @@ -709,8 +684,9 @@ static int dvb_register(struct cx8802_dev *dev) mdelay(200); dev->core->pll_addr = 0x61; dev->core->pll_desc = &dvb_pll_thomson_dtt761x; - dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_3_gold, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(lgdt330x_attach, + &fusionhdtv_3_gold, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3302_tuner_set_params; } @@ -726,8 +702,9 @@ static int dvb_register(struct cx8802_dev *dev) mdelay(100); cx_set(MO_GP0_IO, 1); mdelay(200); - dev->dvb.frontend = lgdt330x_attach(&fusionhdtv_5_gold, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(lgdt330x_attach, + &fusionhdtv_5_gold, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3303_tuner_set_params; } @@ -743,52 +720,51 @@ static int dvb_register(struct cx8802_dev *dev) mdelay(100); cx_set(MO_GP0_IO, 1); mdelay(200); - dev->dvb.frontend = lgdt330x_attach(&pchdtv_hd5500, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(lgdt330x_attach, + &pchdtv_hd5500, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { dev->dvb.frontend->ops.tuner_ops.set_params = lgdt3303_tuner_set_params; } } break; -#endif -#ifdef HAVE_NXT200X case CX88_BOARD_ATI_HDTVWONDER: - dev->dvb.frontend = nxt200x_attach(&ati_hdtvwonder, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(nxt200x_attach, + &ati_hdtvwonder, + &dev->core->i2c_adap); if (dev->dvb.frontend != NULL) { - dvb_pll_attach(dev->dvb.frontend, 0x61, - &dev->core->i2c_adap, - &dvb_pll_tuv1236d); + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + NULL, &dvb_pll_tuv1236d); } break; -#endif -#ifdef HAVE_CX24123 case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: - dev->dvb.frontend = cx24123_attach(&hauppauge_novas_config, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(cx24123_attach, + &hauppauge_novas_config, + &dev->core->i2c_adap); if (dev->dvb.frontend) { - isl6421_attach(dev->dvb.frontend, &dev->core->i2c_adap, - 0x08, 0x00, 0x00); + dvb_attach(isl6421_attach, dev->dvb.frontend, + &dev->core->i2c_adap, 0x08, 0x00, 0x00); } break; case CX88_BOARD_KWORLD_DVBS_100: - dev->dvb.frontend = cx24123_attach(&kworld_dvbs_100_config, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(cx24123_attach, + &kworld_dvbs_100_config, + &dev->core->i2c_adap); if (dev->dvb.frontend) { dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; dev->dvb.frontend->ops.set_voltage = kworld_dvbs_100_set_voltage; } break; case CX88_BOARD_GENIATECH_DVBS: - dev->dvb.frontend = cx24123_attach(&geniatech_dvbs_config, - &dev->core->i2c_adap); + dev->dvb.frontend = dvb_attach(cx24123_attach, + &geniatech_dvbs_config, + &dev->core->i2c_adap); if (dev->dvb.frontend) { dev->core->prev_set_voltage = dev->dvb.frontend->ops.set_voltage; dev->dvb.frontend->ops.set_voltage = geniatech_dvbs_set_voltage; } break; -#endif default: printk("%s: The frontend of your DVB/ATSC card isn't supported yet\n", dev->core->name); @@ -908,8 +884,10 @@ static struct pci_driver dvb_pci_driver = { .id_table = cx8802_pci_tbl, .probe = dvb_probe, .remove = __devexit_p(dvb_remove), +#ifdef CONFIG_PM .suspend = cx8802_suspend_common, .resume = cx8802_resume_common, +#endif }; static int dvb_init(void) diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 7bea347..27b5dbb 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c @@ -7,6 +7,9 @@ (c) 2002 Yurij Sysoev <yurij@naturesoft.net> (c) 1999-2003 Gerd Knorr <kraxel@bytesex.org> + (c) 2005 Mauro Carvalho Chehab <mchehab@infradead.org> + - Multituner support and i2c address binding + This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or @@ -40,6 +43,11 @@ static unsigned int i2c_scan = 0; module_param(i2c_scan, int, 0444); MODULE_PARM_DESC(i2c_scan,"scan i2c bus at insmod time"); +static unsigned int i2c_udelay = 5; +module_param(i2c_udelay, int, 0644); +MODULE_PARM_DESC(i2c_udelay,"i2c delay at insmod time, in usecs " + "(should be 5 or higher). Lower value means higher bus speed."); + #define dprintk(level,fmt, arg...) if (i2c_debug >= level) \ printk(KERN_DEBUG "%s: " fmt, core->name , ## arg) @@ -198,6 +206,11 @@ static void do_i2c_scan(char *name, struct i2c_client *c) /* init + register i2c algo-bit adapter */ int cx88_i2c_init(struct cx88_core *core, struct pci_dev *pci) { + /* Prevents usage of invalid delay values */ + if (i2c_udelay<5) + i2c_udelay=5; + cx8800_i2c_algo_template.udelay=i2c_udelay; + memcpy(&core->i2c_adap, &cx8800_i2c_adap_template, sizeof(core->i2c_adap)); 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 c255646..83ebf7a 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) (gpio & ir->mask_keydown) ? " down" : "", (gpio & ir->mask_keyup) ? " up" : ""); - if (ir->mask_keydown) { + if (ir->core->board == CX88_BOARD_NORWOOD_MICRO) { + u32 gpio_key = cx_read(MO_GP0_IO); + + data = (data << 4) | ((gpio_key & 0xf0) >> 4); + + ir_input_keydown(ir->input, &ir->ir, data, data); + ir_input_nokey(ir->input, &ir->ir); + + } else if (ir->mask_keydown) { /* bit set on keydown */ if (gpio & ir->mask_keydown) { 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) case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: case CX88_BOARD_HAUPPAUGE_HVR1100: + case CX88_BOARD_HAUPPAUGE_HVR1300: ir_codes = ir_codes_hauppauge_new; ir_type = IR_TYPE_RC5; ir->sampling = 1; @@ -248,6 +257,13 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ir_type = IR_TYPE_PD; ir->sampling = 0xff00; /* address */ break; + case CX88_BOARD_NORWOOD_MICRO: + ir_codes = ir_codes_norwood; + ir->gpio_addr = MO_GP1_IO; + ir->mask_keycode = 0x0e; + ir->mask_keyup = 0x80; + ir->polling = 50; /* ms */ + break; case CX88_BOARD_NPGTECH_REALTV_TOP10FM: ir_codes = ir_codes_npgtech; ir->gpio_addr = MO_GP0_IO; @@ -402,6 +418,7 @@ void cx88_ir_irq(struct cx88_core *core) case CX88_BOARD_HAUPPAUGE_NOVASE2_S1: case CX88_BOARD_HAUPPAUGE_NOVASPLUS_S1: case CX88_BOARD_HAUPPAUGE_HVR1100: + case CX88_BOARD_HAUPPAUGE_HVR1300: ircode = ir_decode_biphase(ir->samples, ir->scount, 5, 7); ir_dprintk("biphase decoded: %x\n", ircode); if ((ircode & 0xfffff000) != 0x3000) diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index 5785c34..741e7c5e 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c @@ -52,7 +52,6 @@ #include <linux/init.h> #include <linux/smp_lock.h> #include <linux/delay.h> -#include <linux/config.h> #include <linux/kthread.h> #include "cx88.h" @@ -138,14 +137,10 @@ static void set_audio_finish(struct cx88_core *core, u32 ctl) { u32 volume; -#ifndef CONFIG_VIDEO_CX88_ALSA /* restart dma; This avoids buzz in NICAM and is good in others */ cx88_stop_audio_dma(core); -#endif cx_write(AUD_RATE_THRES_DMD, 0x000000C0); -#ifndef CONFIG_VIDEO_CX88_ALSA cx88_start_audio_dma(core); -#endif if (cx88_boards[core->board].blackbird) { /* 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 94c92ba..fbc79e9 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, return 0; } +#ifdef CONFIG_PM static int stop_video_dma(struct cx8800_dev *dev) { struct cx88_core *core = dev->core; @@ -512,6 +513,7 @@ static int stop_video_dma(struct cx8800_dev *dev) cx_clear(MO_VID_INTMSK, 0x0f0011); return 0; } +#endif static int restart_video_queue(struct cx8800_dev *dev, struct cx88_dmaqueue *q) @@ -2017,6 +2019,7 @@ static void __devexit cx8800_finidev(struct pci_dev *pci_dev) kfree(dev); } +#ifdef CONFIG_PM static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) { struct cx8800_dev *dev = pci_get_drvdata(pci_dev); @@ -2092,6 +2095,7 @@ static int cx8800_resume(struct pci_dev *pci_dev) return 0; } +#endif /* ----------------------------------------------------------- */ @@ -2112,9 +2116,10 @@ static struct pci_driver cx8800_pci_driver = { .id_table = cx8800_pci_tbl, .probe = cx8800_initdev, .remove = __devexit_p(cx8800_finidev), - +#ifdef CONFIG_PM .suspend = cx8800_suspend, .resume = cx8800_resume, +#endif }; static int cx8800_init(void) diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index e781095..89f12e2 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[]; #define CX88_BOARD_NPGTECH_REALTV_TOP10FM 50 #define CX88_BOARD_WINFAST_DTV2000H 51 #define CX88_BOARD_GENIATECH_DVBS 52 +#define CX88_BOARD_HAUPPAUGE_HVR3000 53 +#define CX88_BOARD_NORWOOD_MICRO 54 +#define CX88_BOARD_TE_DTV_250_OEM_SWANN 55 +#define CX88_BOARD_HAUPPAUGE_HVR1300 56 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, @@ -545,6 +549,7 @@ extern const unsigned int cx88_idcount; extern void cx88_card_list(struct cx88_core *core, struct pci_dev *pci); extern void cx88_card_setup(struct cx88_core *core); +extern void cx88_card_setup_pre_i2c(struct cx88_core *core); /* ----------------------------------------------------------- */ /* cx88-tvaudio.c */ diff --git a/drivers/media/video/em28xx/Kconfig b/drivers/media/video/em28xx/Kconfig index dfb15bf..9285a58 100644 --- a/drivers/media/video/em28xx/Kconfig +++ b/drivers/media/video/em28xx/Kconfig @@ -5,7 +5,8 @@ config VIDEO_EM28XX select VIDEO_TUNER select VIDEO_TVEEPROM select VIDEO_IR - select VIDEO_SAA711X + select VIDEO_SAA711X if VIDEO_HELPER_CHIPS_AUTO + select VIDEO_TVP5150 if VIDEO_HELPER_CHIPS_AUTO ---help--- This is a video4linux driver for Empia 28xx based TV cards. diff --git a/drivers/media/video/em28xx/em28xx-video.c b/drivers/media/video/em28xx/em28xx-video.c index 2a461dde4..20df657 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) route.input = INPUT(dev->ctl_input)->vmux; route.output = 0; - em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, NULL); + em28xx_i2c_call_clients(dev, VIDIOC_INT_RESET, 0); em28xx_i2c_call_clients(dev, VIDIOC_INT_S_VIDEO_ROUTING, &route); em28xx_i2c_call_clients(dev, VIDIOC_STREAMON, NULL); diff --git a/drivers/media/video/ks0127.c b/drivers/media/video/ks0127.c index 3bf7ac4..c1a377f 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) static int __devinit ks0127_init_module(void) { init_reg_defaults(); - i2c_add_driver(&i2c_driver_ks0127); - return 0; + return i2c_add_driver(&i2c_driver_ks0127); } static void __devexit ks0127_cleanup_module(void) diff --git a/drivers/media/video/pvrusb2/Kconfig b/drivers/media/video/pvrusb2/Kconfig index 7e727fe..a52171e 100644 --- a/drivers/media/video/pvrusb2/Kconfig +++ b/drivers/media/video/pvrusb2/Kconfig @@ -5,8 +5,6 @@ config VIDEO_PVRUSB2 select VIDEO_TUNER select VIDEO_TVEEPROM select VIDEO_CX2341X - select VIDEO_SAA711X - select VIDEO_MSP3400 ---help--- This is a video4linux driver for Conexant 23416 based usb2 personal video recorder devices. @@ -14,6 +12,20 @@ config VIDEO_PVRUSB2 To compile this driver as a module, choose M here: the module will be called pvrusb2 +config VIDEO_PVRUSB2_29XXX + bool "Hauppauge WinTV-PVR USB2 support for 29xxx model series" + depends on VIDEO_PVRUSB2 && EXPERIMENTAL + select VIDEO_SAA711X + select VIDEO_MSP3400 + ---help--- + This option enables support for WinTV-PVR USB2 devices whose + model number is of the form "29xxx" (leading prefix of "29" + followed by 3 digits). + To see if you may need this option, examine the white + sticker on the underside of your device. + + If you are in doubt, say Y. + config VIDEO_PVRUSB2_24XXX bool "Hauppauge WinTV-PVR USB2 support for 24xxx model series" depends on VIDEO_PVRUSB2 && EXPERIMENTAL @@ -60,3 +72,5 @@ config VIDEO_PVRUSB2_DEBUGIFC You do not need to select this option unless you plan on debugging the driver or performing a manual firmware extraction. + + If you are in doubt, say N. diff --git a/drivers/media/video/pvrusb2/Makefile b/drivers/media/video/pvrusb2/Makefile index 02e4142..69b3e43 100644 --- a/drivers/media/video/pvrusb2/Makefile +++ b/drivers/media/video/pvrusb2/Makefile @@ -1,10 +1,6 @@ obj-pvrusb2-sysfs-$(CONFIG_VIDEO_PVRUSB2_SYSFS) := pvrusb2-sysfs.o obj-pvrusb2-debugifc-$(CONFIG_VIDEO_PVRUSB2_DEBUGIFC) := pvrusb2-debugifc.o -obj-pvrusb2-24xxx-$(CONFIG_VIDEO_PVRUSB2_24XXX) := \ - pvrusb2-cx2584x-v4l.o \ - pvrusb2-wm8775.o - pvrusb2-objs := pvrusb2-i2c-core.o pvrusb2-i2c-cmd-v4l2.o \ pvrusb2-audio.o pvrusb2-i2c-chips-v4l2.o \ pvrusb2-encoder.o pvrusb2-video-v4l.o \ @@ -12,7 +8,7 @@ pvrusb2-objs := pvrusb2-i2c-core.o pvrusb2-i2c-cmd-v4l2.o \ pvrusb2-main.o pvrusb2-hdw.o pvrusb2-v4l2.o \ pvrusb2-ctrl.o pvrusb2-std.o \ pvrusb2-context.o pvrusb2-io.o pvrusb2-ioread.o \ - $(obj-pvrusb2-24xxx-y) \ + pvrusb2-cx2584x-v4l.o pvrusb2-wm8775.o \ $(obj-pvrusb2-sysfs-y) $(obj-pvrusb2-debugifc-y) obj-$(CONFIG_VIDEO_PVRUSB2) += pvrusb2.o diff --git a/drivers/media/video/pvrusb2/pvrusb2-ctrl.c b/drivers/media/video/pvrusb2/pvrusb2-ctrl.c index fb6198f..c77de85 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) if (cptr->info->type == pvr2_ctl_bitmask) { mask &= cptr->info->def.type_bitmask.valid_bits; } else if (cptr->info->type == pvr2_ctl_int) { - if (val < cptr->info->def.type_int.min_value) { - break; + int lim; + lim = cptr->info->def.type_int.min_value; + if (cptr->info->get_min_value) { + cptr->info->get_min_value(cptr,&lim); } - if (val > cptr->info->def.type_int.max_value) { - break; + if (val < lim) break; + lim = cptr->info->def.type_int.max_value; + if (cptr->info->get_max_value) { + cptr->info->get_max_value(cptr,&lim); } + if (val > lim) break; } else if (cptr->info->type == pvr2_ctl_enum) { if (val >= cptr->info->def.type_enum.count) { break; @@ -91,7 +96,9 @@ int pvr2_ctrl_get_max(struct pvr2_ctrl *cptr) int ret = 0; if (!cptr) return 0; LOCK_TAKE(cptr->hdw->big_lock); do { - if (cptr->info->type == pvr2_ctl_int) { + if (cptr->info->get_max_value) { + cptr->info->get_max_value(cptr,&ret); + } else if (cptr->info->type == pvr2_ctl_int) { ret = cptr->info->def.type_int.max_value; } } while(0); LOCK_GIVE(cptr->hdw->big_lock); @@ -105,7 +112,9 @@ int pvr2_ctrl_get_min(struct pvr2_ctrl *cptr) int ret = 0; if (!cptr) return 0; LOCK_TAKE(cptr->hdw->big_lock); do { - if (cptr->info->type == pvr2_ctl_int) { + if (cptr->info->get_min_value) { + cptr->info->get_min_value(cptr,&ret); + } else if (cptr->info->type == pvr2_ctl_int) { ret = cptr->info->def.type_int.min_value; } } 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 c80c26b..df8feac 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, static void decoder_reset(struct pvr2_v4l_cx2584x *ctxt) { int ret; - ret = pvr2_i2c_client_cmd(ctxt->client,VIDIOC_INT_RESET,NULL); + ret = pvr2_i2c_client_cmd(ctxt->client,VIDIOC_INT_RESET,0); pvr2_trace(PVR2_TRACE_CHIPS,"i2c cx25840 decoder_reset (ret=%d)",ret); } diff --git a/drivers/media/video/pvrusb2/pvrusb2-encoder.c b/drivers/media/video/pvrusb2/pvrusb2-encoder.c index 18a7073..c94f97b 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) if (ret) { pvr2_trace(PVR2_TRACE_ERROR_LEGS, - "Failed to configure cx32416"); + "Failed to configure cx23416"); return ret; } @@ -337,7 +337,7 @@ int pvr2_encoder_configure(struct pvr2_hdw *hdw) if (ret) { pvr2_trace(PVR2_TRACE_ERROR_LEGS, - "Failed to initialize cx32416 video input"); + "Failed to initialize cx23416 video input"); return ret; } diff --git a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h index 0d6dc33..34b08fb 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h @@ -33,7 +33,6 @@ */ -#include <linux/config.h> #include <linux/videodev2.h> #include <linux/i2c.h> #include <linux/mutex.h> @@ -41,32 +40,6 @@ #include "pvrusb2-io.h" #include <media/cx2341x.h> -/* Legal values for the SRATE state variable */ -#define PVR2_CVAL_SRATE_48 0 -#define PVR2_CVAL_SRATE_44_1 1 - -/* Legal values for the AUDIOBITRATE state variable */ -#define PVR2_CVAL_AUDIOBITRATE_384 0 -#define PVR2_CVAL_AUDIOBITRATE_320 1 -#define PVR2_CVAL_AUDIOBITRATE_256 2 -#define PVR2_CVAL_AUDIOBITRATE_224 3 -#define PVR2_CVAL_AUDIOBITRATE_192 4 -#define PVR2_CVAL_AUDIOBITRATE_160 5 -#define PVR2_CVAL_AUDIOBITRATE_128 6 -#define PVR2_CVAL_AUDIOBITRATE_112 7 -#define PVR2_CVAL_AUDIOBITRATE_96 8 -#define PVR2_CVAL_AUDIOBITRATE_80 9 -#define PVR2_CVAL_AUDIOBITRATE_64 10 -#define PVR2_CVAL_AUDIOBITRATE_56 11 -#define PVR2_CVAL_AUDIOBITRATE_48 12 -#define PVR2_CVAL_AUDIOBITRATE_32 13 -#define PVR2_CVAL_AUDIOBITRATE_VBR 14 - -/* Legal values for the AUDIOEMPHASIS state variable */ -#define PVR2_CVAL_AUDIOEMPHASIS_NONE 0 -#define PVR2_CVAL_AUDIOEMPHASIS_50_15 1 -#define PVR2_CVAL_AUDIOEMPHASIS_CCITT 2 - /* Legal values for PVR2_CID_HSM */ #define PVR2_CVAL_HSM_FAIL 0 #define PVR2_CVAL_HSM_FULL 1 @@ -107,6 +80,8 @@ struct pvr2_ctl_info { /* Control's implementation */ pvr2_ctlf_get_value get_value; /* Get its value */ + pvr2_ctlf_get_value get_min_value; /* Get minimum allowed value */ + pvr2_ctlf_get_value get_max_value; /* Get maximum allowed value */ pvr2_ctlf_set_value set_value; /* Set its value */ pvr2_ctlf_val_to_sym val_to_sym; /* Custom convert value->symbol */ pvr2_ctlf_sym_to_val sym_to_val; /* Custom convert symbol->value */ @@ -193,9 +168,7 @@ struct pvr2_decoder_ctrl { /* Known major hardware variants, keyed from device ID */ #define PVR2_HDW_TYPE_29XXX 0 -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX #define PVR2_HDW_TYPE_24XXX 1 -#endif typedef int (*pvr2_i2c_func)(struct pvr2_hdw *,u8,u8 *,u16,u8 *, u16); #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 be1e5cc..8860436 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-hdw.c +++ b/drivers/media/video/pvrusb2/pvrusb2-hdw.c @@ -38,9 +38,7 @@ struct usb_device_id pvr2_device_table[] = { [PVR2_HDW_TYPE_29XXX] = { USB_DEVICE(0x2040, 0x2900) }, -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX [PVR2_HDW_TYPE_24XXX] = { USB_DEVICE(0x2040, 0x2400) }, -#endif { } }; @@ -48,9 +46,7 @@ MODULE_DEVICE_TABLE(usb, pvr2_device_table); static const char *pvr2_device_names[] = { [PVR2_HDW_TYPE_29XXX] = "WinTV PVR USB2 Model Category 29xxxx", -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX [PVR2_HDW_TYPE_24XXX] = "WinTV PVR USB2 Model Category 24xxxx", -#endif }; struct pvr2_string_table { @@ -58,14 +54,12 @@ struct pvr2_string_table { unsigned int cnt; }; -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX // Names of other client modules to request for 24xxx model hardware static const char *pvr2_client_24xxx[] = { "cx25840", "tuner", "wm8775", }; -#endif // Names of other client modules to request for 29xxx model hardware static const char *pvr2_client_29xxx[] = { @@ -79,12 +73,10 @@ static struct pvr2_string_table pvr2_client_lists[] = { pvr2_client_29xxx, sizeof(pvr2_client_29xxx)/sizeof(pvr2_client_29xxx[0]), }, -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX [PVR2_HDW_TYPE_24XXX] = { pvr2_client_24xxx, sizeof(pvr2_client_24xxx)/sizeof(pvr2_client_24xxx[0]), }, -#endif }; static struct pvr2_hdw *unit_pointers[PVR_NUM] = {[ 0 ... PVR_NUM-1 ] = NULL}; @@ -221,14 +213,15 @@ static const struct pvr2_mpeg_ids mpeg_ids[] = { }; #define MPEGDEF_COUNT (sizeof(mpeg_ids)/sizeof(mpeg_ids[0])) + static const char *control_values_srate[] = { - [PVR2_CVAL_SRATE_48] = "48KHz", - [PVR2_CVAL_SRATE_44_1] = "44.1KHz", + [V4L2_MPEG_AUDIO_SAMPLING_FREQ_44100] = "44.1 kHz", + [V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000] = "48 kHz", + [V4L2_MPEG_AUDIO_SAMPLING_FREQ_32000] = "32 kHz", }; - static const char *control_values_input[] = { [PVR2_CVAL_INPUT_TV] = "television", /*xawtv needs this name*/ [PVR2_CVAL_INPUT_RADIO] = "radio", @@ -362,6 +355,50 @@ static int ctrl_freq_set(struct pvr2_ctrl *cptr,int m,int v) return 0; } +static int ctrl_hres_max_get(struct pvr2_ctrl *cptr,int *vp) +{ + /* If we're dealing with a 24xxx device, force the horizontal + maximum to be 720 no matter what, since we can't get the device + to work properly with any other value. Otherwise just return + the normal value. */ + *vp = cptr->info->def.type_int.max_value; + if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) *vp = 720; + return 0; +} + +static int ctrl_hres_min_get(struct pvr2_ctrl *cptr,int *vp) +{ + /* If we're dealing with a 24xxx device, force the horizontal + minimum to be 720 no matter what, since we can't get the device + to work properly with any other value. Otherwise just return + the normal value. */ + *vp = cptr->info->def.type_int.min_value; + if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) *vp = 720; + return 0; +} + +static int ctrl_vres_max_get(struct pvr2_ctrl *cptr,int *vp) +{ + /* Actual maximum depends on the video standard in effect. */ + if (cptr->hdw->std_mask_cur & V4L2_STD_525_60) { + *vp = 480; + } else { + *vp = 576; + } + return 0; +} + +static int ctrl_vres_min_get(struct pvr2_ctrl *cptr,int *vp) +{ + /* Actual minimum depends on device type. */ + if (cptr->hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { + *vp = 75; + } else { + *vp = 17; + } + return 0; +} + static int ctrl_cx2341x_is_dirty(struct pvr2_ctrl *cptr) { return cptr->hdw->enc_stale != 0; @@ -719,19 +756,27 @@ static const struct pvr2_ctl_info control_defs[] = { .internal_id = PVR2_CID_HRES, .default_value = 720, DEFREF(res_hor), - DEFINT(320,720), + DEFINT(19,720), + /* Hook in check for clamp on horizontal resolution in + order to avoid unsolved problem involving cx25840. */ + .get_max_value = ctrl_hres_max_get, + .get_min_value = ctrl_hres_min_get, },{ .desc = "Vertical capture resolution", .name = "resolution_ver", .internal_id = PVR2_CID_VRES, .default_value = 480, DEFREF(res_ver), - DEFINT(200,625), + DEFINT(17,576), + /* Hook in check for video standard and adjust maximum + depending on the standard. */ + .get_max_value = ctrl_vres_max_get, + .get_min_value = ctrl_vres_min_get, },{ .v4l_id = V4L2_CID_MPEG_AUDIO_SAMPLING_FREQ, - .desc = "Sample rate", + .default_value = V4L2_MPEG_AUDIO_SAMPLING_FREQ_48000, + .desc = "Audio Sampling Frequency", .name = "srate", - .default_value = PVR2_CVAL_SRATE_48, DEFREF(srate), DEFENUM(control_values_srate), },{ @@ -935,22 +980,18 @@ static int pvr2_upload_firmware1(struct pvr2_hdw *hdw) static const char *fw_files_29xxx[] = { "v4l-pvrusb2-29xxx-01.fw", }; -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX static const char *fw_files_24xxx[] = { "v4l-pvrusb2-24xxx-01.fw", }; -#endif static const struct pvr2_string_table fw_file_defs[] = { [PVR2_HDW_TYPE_29XXX] = { fw_files_29xxx, sizeof(fw_files_29xxx)/sizeof(fw_files_29xxx[0]), }, -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX [PVR2_HDW_TYPE_24XXX] = { fw_files_24xxx, sizeof(fw_files_24xxx)/sizeof(fw_files_24xxx[0]), }, -#endif }; hdw->fw1_state = FW1_STATE_FAILED; // default result @@ -2237,11 +2278,14 @@ static int pvr2_hdw_commit_ctl_internal(struct pvr2_hdw *hdw) } if (hdw->std_dirty || + hdw->enc_stale || + hdw->srate_dirty || + hdw->res_ver_dirty || + hdw->res_hor_dirty || 0) { /* If any of this changes, then the encoder needs to be reconfigured, and we need to reset the stream. */ stale_subsys_mask |= (1<<PVR2_SUBSYS_B_ENC_CFG); - stale_subsys_mask |= hdw->subsys_stream_mask; } 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 fbe6039..ed3e810 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 @@ #include "pvrusb2-audio.h" #include "pvrusb2-tuner.h" #include "pvrusb2-video-v4l.h" -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX #include "pvrusb2-cx2584x-v4l.h" #include "pvrusb2-wm8775.h" -#endif #define trace_i2c(...) pvr2_trace(PVR2_TRACE_I2C,__VA_ARGS__) @@ -71,7 +69,6 @@ void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp) return; } } -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX if (id == I2C_DRIVERID_CX25840) { if (pvr2_i2c_cx2584x_v4l_setup(hdw,cp)) { return; @@ -82,7 +79,6 @@ void pvr2_i2c_probe(struct pvr2_hdw *hdw,struct pvr2_i2c_client *cp) return; } } -#endif if (id == I2C_DRIVERID_SAA711X) { if (pvr2_i2c_decoder_v4l_setup(hdw,cp)) { return; diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-cmd-v4l2.c index 8a9933d..05ea17a 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) v4l2_std_id vs; vs = hdw->std_mask_cur; pvr2_trace(PVR2_TRACE_CHIPS, - "i2c v4l2 set_standard(0x%llx)",(__u64)vs); + "i2c v4l2 set_standard(0x%llx)",(long long unsigned)vs); pvr2_i2c_core_cmd(hdw,VIDIOC_S_STD,&vs); } diff --git a/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c b/drivers/media/video/pvrusb2/pvrusb2-i2c-core.c index 7fca479..3b9012f8e3 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, } } -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX - /* This is a special entry point that is entered if an I2C operation is attempted to a wm8775 chip on model 24xxx hardware. Autodetect of this 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, return -EIO; } -#endif /* CONFIG_VIDEO_PVRUSB2_24XXX */ - /* This is a very, very limited I2C adapter implementation. We can only support what we actually know will work on the device... */ static int pvr2_i2c_xfer(struct i2c_adapter *i2c_adap, @@ -897,14 +893,12 @@ void pvr2_i2c_core_init(struct pvr2_hdw *hdw) hdw->i2c_func[idx] = pvr2_i2c_basic_op; } -#ifdef CONFIG_VIDEO_PVRUSB2_24XXX // If however we're dealing with new hardware, insert some hacks in // the I2C transfer stack to let things work better. if (hdw->hdw_type == PVR2_HDW_TYPE_24XXX) { hdw->i2c_func[0x1b] = i2c_hack_wm8775; hdw->i2c_func[0x44] = i2c_hack_cx25840; } -#endif // Configure the adapter and set up everything else related to it. 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 8f1a5af..e976c48 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-main.c +++ b/drivers/media/video/pvrusb2/pvrusb2-main.c @@ -20,7 +20,6 @@ * */ -#include <linux/config.h> #include <linux/kernel.h> #include <linux/errno.h> #include <linux/slab.h> diff --git a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c index d1dda5c..c294f46 100644 --- a/drivers/media/video/pvrusb2/pvrusb2-sysfs.c +++ b/drivers/media/video/pvrusb2/pvrusb2-sysfs.c @@ -19,7 +19,6 @@ * */ -#include <linux/config.h> #include <linux/string.h> #include <linux/slab.h> #include <asm/semaphore.h> @@ -40,8 +39,6 @@ struct pvr2_sysfs { #endif /* CONFIG_VIDEO_PVRUSB2_DEBUGIFC */ struct pvr2_sysfs_ctl_item *item_first; struct pvr2_sysfs_ctl_item *item_last; - struct sysfs_ops kops; - struct kobj_type ktype; struct class_device_attribute attr_v4l_minor_number; struct class_device_attribute attr_unit_number; 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 0caf70b..3608c2f 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, ret = 0; switch(vf->type) { case V4L2_BUF_TYPE_VIDEO_CAPTURE: { + int lmin,lmax; + struct pvr2_ctrl *hcp,*vcp; int h = vf->fmt.pix.height; int w = vf->fmt.pix.width; - - if (h < 200) { - h = 200; - } else if (h > 625) { - h = 625; + hcp = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_HRES); + vcp = pvr2_hdw_get_ctrl_by_id(hdw,PVR2_CID_VRES); + + lmin = pvr2_ctrl_get_min(hcp); + lmax = pvr2_ctrl_get_max(hcp); + if (w < lmin) { + w = lmin; + } else if (w > lmax) { + w = lmax; } - if (w < 320) { - w = 320; - } else if (w > 720) { - w = 720; + lmin = pvr2_ctrl_get_min(vcp); + lmax = pvr2_ctrl_get_max(vcp); + if (h < lmin) { + h = lmin; + } else if (h > lmax) { + h = lmax; } memcpy(vf, &pvr_format[PVR_FORMAT_PIX], @@ -479,14 +487,8 @@ static int pvr2_v4l2_do_ioctl(struct inode *inode, struct file *file, vf->fmt.pix.height = h; if (cmd == VIDIOC_S_FMT) { - pvr2_ctrl_set_value( - pvr2_hdw_get_ctrl_by_id(hdw, - PVR2_CID_HRES), - vf->fmt.pix.width); - pvr2_ctrl_set_value( - pvr2_hdw_get_ctrl_by_id(hdw, - PVR2_CID_VRES), - vf->fmt.pix.height); + pvr2_ctrl_set_value(hcp,vf->fmt.pix.width); + pvr2_ctrl_set_value(vcp,vf->fmt.pix.height); } } break; case V4L2_BUF_TYPE_VBI_CAPTURE: diff --git a/drivers/media/video/saa5246a.c b/drivers/media/video/saa5246a.c index 59a1872..77bb940 100644 --- a/drivers/media/video/saa5246a.c +++ b/drivers/media/video/saa5246a.c @@ -830,7 +830,6 @@ static struct video_device saa_template = .owner = THIS_MODULE, .name = IF_NAME, .type = VID_TYPE_TELETEXT, - .hardware = VID_HARDWARE_SAA5249, .fops = &saa_fops, .release = video_device_release, .minor = -1, diff --git a/drivers/media/video/saa5249.c b/drivers/media/video/saa5249.c index 19a8d65..bb3fb43 100644 --- a/drivers/media/video/saa5249.c +++ b/drivers/media/video/saa5249.c @@ -713,7 +713,6 @@ static struct video_device saa_template = .owner = THIS_MODULE, .name = IF_NAME, .type = VID_TYPE_TELETEXT, /*| VID_TYPE_TUNER ?? */ - .hardware = VID_HARDWARE_SAA5249, .fops = &saa_fops, }; diff --git a/drivers/media/video/saa7115.c b/drivers/media/video/saa7115.c index b59c117..974179d 100644 --- a/drivers/media/video/saa7115.c +++ b/drivers/media/video/saa7115.c @@ -1,4 +1,6 @@ -/* saa7115 - Philips SAA7113/SAA7114/SAA7115 video decoder driver +/* saa711x - Philips SAA711x video decoder driver + * This driver can work with saa7111, saa7111a, saa7113, saa7114, + * saa7115 and saa7118. * * Based on saa7114 driver by Maxim Yevtyushkin, which is based on * the saa7111 driver by Dave Perks. @@ -16,7 +18,9 @@ * (2/17/2003) * * VBI support (2004) and cleanups (2005) by Hans Verkuil <hverkuil@xs4all.nl> - * SAA7113 support by Mauro Carvalho Chehab <mchehab@infradead.org> + * + * Copyright (c) 2005-2006 Mauro Carvalho Chehab <mchehab@infradead.org> + * SAA7111, SAA7113 and SAA7118 support * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License @@ -33,6 +37,7 @@ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ +#include "saa711x_regs.h" #include <linux/kernel.h> #include <linux/module.h> @@ -43,7 +48,9 @@ #include <media/saa7115.h> #include <asm/div64.h> -MODULE_DESCRIPTION("Philips SAA7113/SAA7114/SAA7115 video decoder driver"); +#define VRES_60HZ (480+16) + +MODULE_DESCRIPTION("Philips SAA7111/SAA7113/SAA7114/SAA7115/SAA7118 video decoder driver"); MODULE_AUTHOR( "Maxim Yevtyushkin, Kevin Thayer, Chris Kennedy, " "Hans Verkuil, Mauro Carvalho Chehab"); MODULE_LICENSE("GPL"); @@ -54,14 +61,14 @@ module_param(debug, bool, 0644); MODULE_PARM_DESC(debug, "Debug level (0-1)"); static unsigned short normal_i2c[] = { - 0x4a >> 1, 0x48 >> 1, /* SAA7113 */ - 0x42 >> 1, 0x40 >> 1, /* SAA7114 and SAA7115 */ + 0x4a >> 1, 0x48 >> 1, /* SAA7111, SAA7111A and SAA7113 */ + 0x42 >> 1, 0x40 >> 1, /* SAA7114, SAA7115 and SAA7118 */ I2C_CLIENT_END }; I2C_CLIENT_INSMOD; -struct saa7115_state { +struct saa711x_state { v4l2_std_id std; int input; int enable; @@ -70,6 +77,8 @@ struct saa7115_state { int contrast; int hue; int sat; + int width; + int height; enum v4l2_chip_ident ident; u32 audclk_freq; u32 crystal_freq; @@ -80,420 +89,508 @@ struct saa7115_state { /* ----------------------------------------------------------------------- */ -static inline int saa7115_write(struct i2c_client *client, u8 reg, u8 value) +static inline int saa711x_write(struct i2c_client *client, u8 reg, u8 value) { return i2c_smbus_write_byte_data(client, reg, value); } -static int saa7115_writeregs(struct i2c_client *client, const unsigned char *regs) +/* Sanity routine to check if a register is present */ +static int saa711x_has_reg(const int id, const u8 reg) { + if (id == V4L2_IDENT_SAA7111) + return reg < 0x20 && reg != 0x01 && reg != 0x0f && + (reg < 0x13 || reg > 0x19) && reg != 0x1d && reg != 0x1e; + + /* common for saa7113/4/5/8 */ + if (unlikely((reg >= 0x3b && reg <= 0x3f) || reg == 0x5c || reg == 0x5f || + reg == 0xa3 || reg == 0xa7 || reg == 0xab || reg == 0xaf || (reg >= 0xb5 && reg <= 0xb7) || + reg == 0xd3 || reg == 0xd7 || reg == 0xdb || reg == 0xdf || (reg >= 0xe5 && reg <= 0xe7) || + reg == 0x82 || (reg >= 0x89 && reg <= 0x8e))) + return 0; + + switch (id) { + case V4L2_IDENT_SAA7113: + return reg != 0x14 && (reg < 0x18 || reg > 0x1e) && (reg < 0x20 || reg > 0x3f) && + reg != 0x5d && reg < 0x63; + case V4L2_IDENT_SAA7114: + return (reg < 0x1a || reg > 0x1e) && (reg < 0x20 || reg > 0x2f) && + (reg < 0x63 || reg > 0x7f) && reg != 0x33 && reg != 0x37 && + reg != 0x81 && reg < 0xf0; + case V4L2_IDENT_SAA7115: + return (reg < 0x20 || reg > 0x2f) && reg != 0x65 && (reg < 0xfc || reg > 0xfe); + case V4L2_IDENT_SAA7118: + return (reg < 0x1a || reg > 0x1d) && (reg < 0x20 || reg > 0x22) && + (reg < 0x26 || reg > 0x28) && reg != 0x33 && reg != 0x37 && + (reg < 0x63 || reg > 0x7f) && reg != 0x81 && reg < 0xf0; + } + return 1; +} + +static int saa711x_writeregs(struct i2c_client *client, const unsigned char *regs) +{ + struct saa711x_state *state = i2c_get_clientdata(client); unsigned char reg, data; while (*regs != 0x00) { reg = *(regs++); data = *(regs++); - if (saa7115_write(client, reg, data) < 0) - return -1; + + /* According with datasheets, reserved regs should be + filled with 0 - seems better not to touch on they */ + if (saa711x_has_reg(state->ident,reg)) { + if (saa711x_write(client, reg, data) < 0) + return -1; + } else { + v4l_dbg(1, debug, client, "tried to access reserved reg 0x%02x\n", reg); + } } return 0; } -static inline int saa7115_read(struct i2c_client *client, u8 reg) +static inline int saa711x_read(struct i2c_client *client, u8 reg) { return i2c_smbus_read_byte_data(client, reg); } /* ----------------------------------------------------------------------- */ +/* SAA7111 initialization table */ +static const unsigned char saa7111_init[] = { + R_01_INC_DELAY, 0x00, /* reserved */ + + /*front end */ + R_02_INPUT_CNTL_1, 0xd0, /* FUSE=3, GUDL=2, MODE=0 */ + R_03_INPUT_CNTL_2, 0x23, /* HLNRS=0, VBSL=1, WPOFF=0, HOLDG=0, + * GAFIX=0, GAI1=256, GAI2=256 */ + R_04_INPUT_CNTL_3, 0x00, /* GAI1=256 */ + R_05_INPUT_CNTL_4, 0x00, /* GAI2=256 */ + + /* decoder */ + R_06_H_SYNC_START, 0xf3, /* HSB at 13(50Hz) / 17(60Hz) + * pixels after end of last line */ + R_07_H_SYNC_STOP, 0xe8, /* HSS seems to be needed to + * work with NTSC, too */ + R_08_SYNC_CNTL, 0xc8, /* AUFD=1, FSEL=1, EXFIL=0, + * VTRC=1, HPLL=0, VNOI=0 */ + R_09_LUMA_CNTL, 0x01, /* BYPS=0, PREF=0, BPSS=0, + * VBLB=0, UPTCV=0, APER=1 */ + R_0A_LUMA_BRIGHT_CNTL, 0x80, + R_0B_LUMA_CONTRAST_CNTL, 0x47, /* 0b - CONT=1.109 */ + R_0C_CHROMA_SAT_CNTL, 0x40, + R_0D_CHROMA_HUE_CNTL, 0x00, + R_0E_CHROMA_CNTL_1, 0x01, /* 0e - CDTO=0, CSTD=0, DCCF=0, + * FCTC=0, CHBW=1 */ + R_0F_CHROMA_GAIN_CNTL, 0x00, /* reserved */ + R_10_CHROMA_CNTL_2, 0x48, /* 10 - OFTS=1, HDEL=0, VRLN=1, YDEL=0 */ + R_11_MODE_DELAY_CNTL, 0x1c, /* 11 - GPSW=0, CM99=0, FECO=0, COMPO=1, + * OEYC=1, OEHV=1, VIPB=0, COLO=0 */ + R_12_RT_SIGNAL_CNTL, 0x00, /* 12 - output control 2 */ + R_13_RT_X_PORT_OUT_CNTL, 0x00, /* 13 - output control 3 */ + R_14_ANAL_ADC_COMPAT_CNTL, 0x00, + R_15_VGATE_START_FID_CHG, 0x00, + R_16_VGATE_STOP, 0x00, + R_17_MISC_VGATE_CONF_AND_MSB, 0x00, + + 0x00, 0x00 +}; + +/* SAA7113 init codes */ +static const unsigned char saa7113_init[] = { + R_01_INC_DELAY, 0x08, + R_02_INPUT_CNTL_1, 0xc2, + R_03_INPUT_CNTL_2, 0x30, + R_04_INPUT_CNTL_3, 0x00, + R_05_INPUT_CNTL_4, 0x00, + R_06_H_SYNC_START, 0x89, + R_07_H_SYNC_STOP, 0x0d, + R_08_SYNC_CNTL, 0x88, + R_09_LUMA_CNTL, 0x01, + R_0A_LUMA_BRIGHT_CNTL, 0x80, + R_0B_LUMA_CONTRAST_CNTL, 0x47, + R_0C_CHROMA_SAT_CNTL, 0x40, + R_0D_CHROMA_HUE_CNTL, 0x00, + R_0E_CHROMA_CNTL_1, 0x01, + R_0F_CHROMA_GAIN_CNTL, 0x2a, + R_10_CHROMA_CNTL_2, 0x08, + R_11_MODE_DELAY_CNTL, 0x0c, + R_12_RT_SIGNAL_CNTL, 0x07, + R_13_RT_X_PORT_OUT_CNTL, 0x00, + R_14_ANAL_ADC_COMPAT_CNTL, 0x00, + R_15_VGATE_START_FID_CHG, 0x00, + R_16_VGATE_STOP, 0x00, + R_17_MISC_VGATE_CONF_AND_MSB, 0x00, + + 0x00, 0x00 +}; + /* If a value differs from the Hauppauge driver values, then the comment starts with 'was 0xXX' to denote the Hauppauge value. Otherwise the value is identical to what the Hauppauge driver sets. */ +/* SAA7114 and SAA7115 initialization table */ static const unsigned char saa7115_init_auto_input[] = { /* Front-End Part */ - 0x01, 0x48, /* white peak control disabled */ - 0x03, 0x20, /* was 0x30. 0x20: long vertical blanking */ - 0x04, 0x90, /* analog gain set to 0 */ - 0x05, 0x90, /* analog gain set to 0 */ + R_01_INC_DELAY, 0x48, /* white peak control disabled */ + R_03_INPUT_CNTL_2, 0x20, /* was 0x30. 0x20: long vertical blanking */ + R_04_INPUT_CNTL_3, 0x90, /* analog gain set to 0 */ + R_05_INPUT_CNTL_4, 0x90, /* analog gain set to 0 */ /* Decoder Part */ - 0x06, 0xeb, /* horiz sync begin = -21 */ - 0x07, 0xe0, /* horiz sync stop = -17 */ - 0x0a, 0x80, /* was 0x88. decoder brightness, 0x80 is itu standard */ - 0x0b, 0x44, /* was 0x48. decoder contrast, 0x44 is itu standard */ - 0x0c, 0x40, /* was 0x47. decoder saturation, 0x40 is itu standard */ - 0x0d, 0x00, /* chrominance hue control */ - 0x0f, 0x00, /* chrominance gain control: use automicatic mode */ - 0x10, 0x06, /* chrominance/luminance control: active adaptive combfilter */ - 0x11, 0x00, /* delay control */ - 0x12, 0x9d, /* RTS0 output control: VGATE */ - 0x13, 0x80, /* X-port output control: ITU656 standard mode, RTCO output enable RTCE */ - 0x14, 0x00, /* analog/ADC/auto compatibility control */ - 0x18, 0x40, /* raw data gain 0x00 = nominal */ - 0x19, 0x80, /* raw data offset 0x80 = 0 LSB */ - 0x1a, 0x77, /* color killer level control 0x77 = recommended */ - 0x1b, 0x42, /* misc chroma control 0x42 = recommended */ - 0x1c, 0xa9, /* combfilter control 0xA9 = recommended */ - 0x1d, 0x01, /* combfilter control 0x01 = recommended */ + R_06_H_SYNC_START, 0xeb, /* horiz sync begin = -21 */ + R_07_H_SYNC_STOP, 0xe0, /* horiz sync stop = -17 */ + R_09_LUMA_CNTL, 0x53, /* 0x53, was 0x56 for 60hz. luminance control */ + R_0A_LUMA_BRIGHT_CNTL, 0x80, /* was 0x88. decoder brightness, 0x80 is itu standard */ + R_0B_LUMA_CONTRAST_CNTL, 0x44, /* was 0x48. decoder contrast, 0x44 is itu standard */ + R_0C_CHROMA_SAT_CNTL, 0x40, /* was 0x47. decoder saturation, 0x40 is itu standard */ + R_0D_CHROMA_HUE_CNTL, 0x00, + R_0F_CHROMA_GAIN_CNTL, 0x00, /* use automatic gain */ + R_10_CHROMA_CNTL_2, 0x06, /* chroma: active adaptive combfilter */ + R_11_MODE_DELAY_CNTL, 0x00, + R_12_RT_SIGNAL_CNTL, 0x9d, /* RTS0 output control: VGATE */ + R_13_RT_X_PORT_OUT_CNTL, 0x80, /* ITU656 standard mode, RTCO output enable RTCE */ + R_14_ANAL_ADC_COMPAT_CNTL, 0x00, + R_18_RAW_DATA_GAIN_CNTL, 0x40, /* gain 0x00 = nominal */ + R_19_RAW_DATA_OFF_CNTL, 0x80, + R_1A_COLOR_KILL_LVL_CNTL, 0x77, /* recommended value */ + R_1B_MISC_TVVCRDET, 0x42, /* recommended value */ + R_1C_ENHAN_COMB_CTRL1, 0xa9, /* recommended value */ + R_1D_ENHAN_COMB_CTRL2, 0x01, /* recommended value */ + + + R_80_GLOBAL_CNTL_1, 0x0, /* No tasks enabled at init */ /* Power Device Control */ - 0x88, 0xd0, /* reset device */ - 0x88, 0xf0, /* set device programmed, all in operational mode */ + R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, /* reset device */ + R_88_POWER_SAVE_ADC_PORT_CNTL, 0xf0, /* set device programmed, all in operational mode */ 0x00, 0x00 }; +/* Used to reset saa7113, saa7114 and saa7115 */ static const unsigned char saa7115_cfg_reset_scaler[] = { - 0x87, 0x00, /* disable I-port output */ - 0x88, 0xd0, /* reset scaler */ - 0x88, 0xf0, /* activate scaler */ - 0x87, 0x01, /* enable I-port output */ + R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, 0x00, /* disable I-port output */ + R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, /* reset scaler */ + R_88_POWER_SAVE_ADC_PORT_CNTL, 0xf0, /* activate scaler */ + R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, 0x01, /* enable I-port output */ 0x00, 0x00 }; /* ============== SAA7715 VIDEO templates ============= */ -static const unsigned char saa7115_cfg_60hz_fullres_x[] = { - 0xcc, 0xd0, /* hsize low (output), hor. output window size = 0x2d0 = 720 */ - 0xcd, 0x02, /* hsize hi (output) */ +static const unsigned char saa7115_cfg_60hz_video[] = { + R_80_GLOBAL_CNTL_1, 0x00, /* reset tasks */ + R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, /* reset scaler */ - /* Why not in 60hz-Land, too? */ - 0xd0, 0x01, /* downscale = 1 */ - 0xd8, 0x00, /* hor lum scaling 0x0400 = 1 */ - 0xd9, 0x04, - 0xdc, 0x00, /* hor chrom scaling 0x0200. must be hor lum scaling / 2 */ - 0xdd, 0x02, /* H-scaling incr chroma */ + R_15_VGATE_START_FID_CHG, 0x03, + R_16_VGATE_STOP, 0x11, + R_17_MISC_VGATE_CONF_AND_MSB, 0x9c, - 0x00, 0x00 -}; -static const unsigned char saa7115_cfg_60hz_fullres_y[] = { - 0xce, 0xf8, /* vsize low (output), ver. output window size = 248 (but 60hz is 240?) */ - 0xcf, 0x00, /* vsize hi (output) */ + R_08_SYNC_CNTL, 0x68, /* 0xBO: auto detection, 0x68 = NTSC */ + R_0E_CHROMA_CNTL_1, 0x07, /* video autodetection is on */ - /* Why not in 60hz-Land, too? */ - 0xd5, 0x40, /* Lum contrast, nominal value = 0x40 */ - 0xd6, 0x40, /* Chroma satur. nominal value = 0x80 */ + R_5A_V_OFF_FOR_SLICER, 0x06, /* standard 60hz value for ITU656 line counting */ - 0xe0, 0x00, /* V-scaling incr luma low */ - 0xe1, 0x04, /* " hi */ - 0xe2, 0x00, /* V-scaling incr chroma low */ - 0xe3, 0x04, /* " hi */ + /* Task A */ + R_90_A_TASK_HANDLING_CNTL, 0x80, + R_91_A_X_PORT_FORMATS_AND_CONF, 0x48, + R_92_A_X_PORT_INPUT_REFERENCE_SIGNAL, 0x40, + R_93_A_I_PORT_OUTPUT_FORMATS_AND_CONF, 0x84, - 0x00, 0x00 -}; + /* hoffset low (input), 0x0002 is minimum */ + R_94_A_HORIZ_INPUT_WINDOW_START, 0x01, + R_95_A_HORIZ_INPUT_WINDOW_START_MSB, 0x00, -static const unsigned char saa7115_cfg_60hz_video[] = { - 0x80, 0x00, /* reset tasks */ - 0x88, 0xd0, /* reset scaler */ + /* hsize low (input), 0x02d0 = 720 */ + R_96_A_HORIZ_INPUT_WINDOW_LENGTH, 0xd0, + R_97_A_HORIZ_INPUT_WINDOW_LENGTH_MSB, 0x02, - 0x15, 0x03, /* VGATE pulse start */ - 0x16, 0x11, /* VGATE pulse stop */ - 0x17, 0x9c, /* VGATE MSB and other values */ + R_98_A_VERT_INPUT_WINDOW_START, 0x05, + R_99_A_VERT_INPUT_WINDOW_START_MSB, 0x00, - 0x08, 0x68, /* 0xBO: auto detection, 0x68 = NTSC */ - 0x0e, 0x07, /* lots of different stuff... video autodetection is on */ + R_9A_A_VERT_INPUT_WINDOW_LENGTH, 0x0c, + R_9B_A_VERT_INPUT_WINDOW_LENGTH_MSB, 0x00, - 0x5a, 0x06, /* Vertical offset, standard 60hz value for ITU656 line counting */ + R_9C_A_HORIZ_OUTPUT_WINDOW_LENGTH, 0xa0, + R_9D_A_HORIZ_OUTPUT_WINDOW_LENGTH_MSB, 0x05, - /* Task A */ - 0x90, 0x80, /* Task Handling Control */ - 0x91, 0x48, /* X-port formats/config */ - 0x92, 0x40, /* Input Ref. signal Def. */ - 0x93, 0x84, /* I-port config */ - 0x94, 0x01, /* hoffset low (input), 0x0002 is minimum */ - 0x95, 0x00, /* hoffset hi (input) */ - 0x96, 0xd0, /* hsize low (input), 0x02d0 = 720 */ - 0x97, 0x02, /* hsize hi (input) */ - 0x98, 0x05, /* voffset low (input) */ - 0x99, 0x00, /* voffset hi (input) */ - 0x9a, 0x0c, /* vsize low (input), 0x0c = 12 */ - 0x9b, 0x00, /* vsize hi (input) */ - 0x9c, 0xa0, /* hsize low (output), 0x05a0 = 1440 */ - 0x9d, 0x05, /* hsize hi (output) */ - 0x9e, 0x0c, /* vsize low (output), 0x0c = 12 */ - 0x9f, 0x00, /* vsize hi (output) */ + R_9E_A_VERT_OUTPUT_WINDOW_LENGTH, 0x0c, + R_9F_A_VERT_OUTPUT_WINDOW_LENGTH_MSB, 0x00, /* Task B */ - 0xc0, 0x00, /* Task Handling Control */ - 0xc1, 0x08, /* X-port formats/config */ - 0xc2, 0x00, /* Input Ref. signal Def. */ - 0xc3, 0x80, /* I-port config */ - 0xc4, 0x02, /* hoffset low (input), 0x0002 is minimum */ - 0xc5, 0x00, /* hoffset hi (input) */ - 0xc6, 0xd0, /* hsize low (input), 0x02d0 = 720 */ - 0xc7, 0x02, /* hsize hi (input) */ - 0xc8, 0x12, /* voffset low (input), 0x12 = 18 */ - 0xc9, 0x00, /* voffset hi (input) */ - 0xca, 0xf8, /* vsize low (input), 0xf8 = 248 */ - 0xcb, 0x00, /* vsize hi (input) */ - 0xcc, 0xd0, /* hsize low (output), 0x02d0 = 720 */ - 0xcd, 0x02, /* hsize hi (output) */ - - 0xf0, 0xad, /* Set PLL Register. 60hz 525 lines per frame, 27 MHz */ - 0xf1, 0x05, /* low bit with 0xF0 */ - 0xf5, 0xad, /* Set pulse generator register */ - 0xf6, 0x01, - - 0x87, 0x00, /* Disable I-port output */ - 0x88, 0xd0, /* reset scaler */ - 0x80, 0x20, /* Activate only task "B", continuous mode (was 0xA0) */ - 0x88, 0xf0, /* activate scaler */ - 0x87, 0x01, /* Enable I-port output */ - 0x00, 0x00 -}; + R_C0_B_TASK_HANDLING_CNTL, 0x00, + R_C1_B_X_PORT_FORMATS_AND_CONF, 0x08, + R_C2_B_INPUT_REFERENCE_SIGNAL_DEFINITION, 0x00, + R_C3_B_I_PORT_FORMATS_AND_CONF, 0x80, -static const unsigned char saa7115_cfg_50hz_fullres_x[] = { - 0xcc, 0xd0, /* hsize low (output), 720 same as 60hz */ - 0xcd, 0x02, /* hsize hi (output) */ + /* 0x0002 is minimum */ + R_C4_B_HORIZ_INPUT_WINDOW_START, 0x02, + R_C5_B_HORIZ_INPUT_WINDOW_START_MSB, 0x00, - 0xd0, 0x01, /* down scale = 1 */ - 0xd8, 0x00, /* hor lum scaling 0x0400 = 1 */ - 0xd9, 0x04, - 0xdc, 0x00, /* hor chrom scaling 0x0200. must be hor lum scaling / 2 */ - 0xdd, 0x02, /* H-scaling incr chroma */ + /* 0x02d0 = 720 */ + R_C6_B_HORIZ_INPUT_WINDOW_LENGTH, 0xd0, + R_C7_B_HORIZ_INPUT_WINDOW_LENGTH_MSB, 0x02, - 0x00, 0x00 -}; -static const unsigned char saa7115_cfg_50hz_fullres_y[] = { - 0xce, 0x20, /* vsize low (output), 0x0120 = 288 */ - 0xcf, 0x01, /* vsize hi (output) */ + /* vwindow start 0x12 = 18 */ + R_C8_B_VERT_INPUT_WINDOW_START, 0x12, + R_C9_B_VERT_INPUT_WINDOW_START_MSB, 0x00, + + /* vwindow length 0xf8 = 248 */ + R_CA_B_VERT_INPUT_WINDOW_LENGTH, VRES_60HZ>>1, + R_CB_B_VERT_INPUT_WINDOW_LENGTH_MSB, VRES_60HZ>>9, - 0xd5, 0x40, /* Lum contrast, nominal value = 0x40 */ - 0xd6, 0x40, /* Chroma satur. nominal value = 0x80 */ + /* hwindow 0x02d0 = 720 */ + R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH, 0xd0, + R_CD_B_HORIZ_OUTPUT_WINDOW_LENGTH_MSB, 0x02, - 0xe0, 0x00, /* V-scaling incr luma low */ - 0xe1, 0x04, /* " hi */ - 0xe2, 0x00, /* V-scaling incr chroma low */ - 0xe3, 0x04, /* " hi */ + R_F0_LFCO_PER_LINE, 0xad, /* Set PLL Register. 60hz 525 lines per frame, 27 MHz */ + R_F1_P_I_PARAM_SELECT, 0x05, /* low bit with 0xF0 */ + R_F5_PULSGEN_LINE_LENGTH, 0xad, + R_F6_PULSE_A_POS_LSB_AND_PULSEGEN_CONFIG, 0x01, 0x00, 0x00 }; static const unsigned char saa7115_cfg_50hz_video[] = { - 0x80, 0x00, /* reset tasks */ - 0x88, 0xd0, /* reset scaler */ + R_80_GLOBAL_CNTL_1, 0x00, + R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, /* reset scaler */ - 0x15, 0x37, /* VGATE start */ - 0x16, 0x16, /* VGATE stop */ - 0x17, 0x99, /* VGATE MSB and other values */ + R_15_VGATE_START_FID_CHG, 0x37, /* VGATE start */ + R_16_VGATE_STOP, 0x16, + R_17_MISC_VGATE_CONF_AND_MSB, 0x99, - 0x08, 0x28, /* 0x28 = PAL */ - 0x0e, 0x07, /* chrominance control 1 */ + R_08_SYNC_CNTL, 0x28, /* 0x28 = PAL */ + R_0E_CHROMA_CNTL_1, 0x07, - 0x5a, 0x03, /* Vertical offset, standard 50hz value */ + R_5A_V_OFF_FOR_SLICER, 0x03, /* standard 50hz value */ /* Task A */ - 0x90, 0x81, /* Task Handling Control */ - 0x91, 0x48, /* X-port formats/config */ - 0x92, 0x40, /* Input Ref. signal Def. */ - 0x93, 0x84, /* I-port config */ + R_90_A_TASK_HANDLING_CNTL, 0x81, + R_91_A_X_PORT_FORMATS_AND_CONF, 0x48, + R_92_A_X_PORT_INPUT_REFERENCE_SIGNAL, 0x40, + R_93_A_I_PORT_OUTPUT_FORMATS_AND_CONF, 0x84, + /* This is weird: the datasheet says that you should use 2 as the minimum value, */ /* but Hauppauge uses 0, and changing that to 2 causes indeed problems (for 50hz) */ - 0x94, 0x00, /* hoffset low (input), 0x0002 is minimum */ - 0x95, 0x00, /* hoffset hi (input) */ - 0x96, 0xd0, /* hsize low (input), 0x02d0 = 720 */ - 0x97, 0x02, /* hsize hi (input) */ - 0x98, 0x03, /* voffset low (input) */ - 0x99, 0x00, /* voffset hi (input) */ - 0x9a, 0x12, /* vsize low (input), 0x12 = 18 */ - 0x9b, 0x00, /* vsize hi (input) */ - 0x9c, 0xa0, /* hsize low (output), 0x05a0 = 1440 */ - 0x9d, 0x05, /* hsize hi (output) */ - 0x9e, 0x12, /* vsize low (output), 0x12 = 18 */ - 0x9f, 0x00, /* vsize hi (output) */ + /* hoffset low (input), 0x0002 is minimum */ + R_94_A_HORIZ_INPUT_WINDOW_START, 0x00, + R_95_A_HORIZ_INPUT_WINDOW_START_MSB, 0x00, + + /* hsize low (input), 0x02d0 = 720 */ + R_96_A_HORIZ_INPUT_WINDOW_LENGTH, 0xd0, + R_97_A_HORIZ_INPUT_WINDOW_LENGTH_MSB, 0x02, + + R_98_A_VERT_INPUT_WINDOW_START, 0x03, + R_99_A_VERT_INPUT_WINDOW_START_MSB, 0x00, + + /* vsize 0x12 = 18 */ + R_9A_A_VERT_INPUT_WINDOW_LENGTH, 0x12, + R_9B_A_VERT_INPUT_WINDOW_LENGTH_MSB, 0x00, + + /* hsize 0x05a0 = 1440 */ + R_9C_A_HORIZ_OUTPUT_WINDOW_LENGTH, 0xa0, + R_9D_A_HORIZ_OUTPUT_WINDOW_LENGTH_MSB, 0x05, /* hsize hi (output) */ + R_9E_A_VERT_OUTPUT_WINDOW_LENGTH, 0x12, /* vsize low (output), 0x12 = 18 */ + R_9F_A_VERT_OUTPUT_WINDOW_LENGTH_MSB, 0x00, /* vsize hi (output) */ /* Task B */ - 0xc0, 0x00, /* Task Handling Control */ - 0xc1, 0x08, /* X-port formats/config */ - 0xc2, 0x00, /* Input Ref. signal Def. */ - 0xc3, 0x80, /* I-port config */ - 0xc4, 0x00, /* hoffset low (input), 0x0002 is minimum. See comment at 0x94 above. */ - 0xc5, 0x00, /* hoffset hi (input) */ - 0xc6, 0xd0, /* hsize low (input), 0x02d0 = 720 */ - 0xc7, 0x02, /* hsize hi (input) */ - 0xc8, 0x16, /* voffset low (input), 0x16 = 22 */ - 0xc9, 0x00, /* voffset hi (input) */ - 0xca, 0x20, /* vsize low (input), 0x0120 = 288 */ - 0xcb, 0x01, /* vsize hi (input) */ - 0xcc, 0xd0, /* hsize low (output), 0x02d0 = 720 */ - 0xcd, 0x02, /* hsize hi (output) */ - 0xce, 0x20, /* vsize low (output), 0x0120 = 288 */ - 0xcf, 0x01, /* vsize hi (output) */ - - 0xf0, 0xb0, /* Set PLL Register. 50hz 625 lines per frame, 27 MHz */ - 0xf1, 0x05, /* low bit with 0xF0, (was 0x05) */ - 0xf5, 0xb0, /* Set pulse generator register */ - 0xf6, 0x01, - - 0x87, 0x00, /* Disable I-port output */ - 0x88, 0xd0, /* reset scaler (was 0xD0) */ - 0x80, 0x20, /* Activate only task "B" */ - 0x88, 0xf0, /* activate scaler */ - 0x87, 0x01, /* Enable I-port output */ + R_C0_B_TASK_HANDLING_CNTL, 0x00, + R_C1_B_X_PORT_FORMATS_AND_CONF, 0x08, + R_C2_B_INPUT_REFERENCE_SIGNAL_DEFINITION, 0x00, + R_C3_B_I_PORT_FORMATS_AND_CONF, 0x80, + + /* This is weird: the datasheet says that you should use 2 as the minimum value, */ + /* but Hauppauge uses 0, and changing that to 2 causes indeed problems (for 50hz) */ + /* hoffset low (input), 0x0002 is minimum. See comment above. */ + R_C4_B_HORIZ_INPUT_WINDOW_START, 0x00, + R_C5_B_HORIZ_INPUT_WINDOW_START_MSB, 0x00, + + /* hsize 0x02d0 = 720 */ + R_C6_B_HORIZ_INPUT_WINDOW_LENGTH, 0xd0, + R_C7_B_HORIZ_INPUT_WINDOW_LENGTH_MSB, 0x02, + + /* voffset 0x16 = 22 */ + R_C8_B_VERT_INPUT_WINDOW_START, 0x16, + R_C9_B_VERT_INPUT_WINDOW_START_MSB, 0x00, + + /* vsize 0x0120 = 288 */ + R_CA_B_VERT_INPUT_WINDOW_LENGTH, 0x20, + R_CB_B_VERT_INPUT_WINDOW_LENGTH_MSB, 0x01, + + /* hsize 0x02d0 = 720 */ + R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH, 0xd0, + R_CD_B_HORIZ_OUTPUT_WINDOW_LENGTH_MSB, 0x02, + + R_F0_LFCO_PER_LINE, 0xb0, /* Set PLL Register. 50hz 625 lines per frame, 27 MHz */ + R_F1_P_I_PARAM_SELECT, 0x05, /* low bit with 0xF0, (was 0x05) */ + R_F5_PULSGEN_LINE_LENGTH, 0xb0, + R_F6_PULSE_A_POS_LSB_AND_PULSEGEN_CONFIG, 0x01, + 0x00, 0x00 }; /* ============== SAA7715 VIDEO templates (end) ======= */ static const unsigned char saa7115_cfg_vbi_on[] = { - 0x80, 0x00, /* reset tasks */ - 0x88, 0xd0, /* reset scaler */ - 0x80, 0x30, /* Activate both tasks */ - 0x88, 0xf0, /* activate scaler */ - 0x87, 0x01, /* Enable I-port output */ + R_80_GLOBAL_CNTL_1, 0x00, /* reset tasks */ + R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, /* reset scaler */ + R_80_GLOBAL_CNTL_1, 0x30, /* Activate both tasks */ + R_88_POWER_SAVE_ADC_PORT_CNTL, 0xf0, /* activate scaler */ + R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, 0x01, /* Enable I-port output */ + 0x00, 0x00 }; static const unsigned char saa7115_cfg_vbi_off[] = { - 0x80, 0x00, /* reset tasks */ - 0x88, 0xd0, /* reset scaler */ - 0x80, 0x20, /* Activate only task "B" */ - 0x88, 0xf0, /* activate scaler */ - 0x87, 0x01, /* Enable I-port output */ - 0x00, 0x00 -}; + R_80_GLOBAL_CNTL_1, 0x00, /* reset tasks */ + R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, /* reset scaler */ + R_80_GLOBAL_CNTL_1, 0x20, /* Activate only task "B" */ + R_88_POWER_SAVE_ADC_PORT_CNTL, 0xf0, /* activate scaler */ + R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, 0x01, /* Enable I-port output */ -static const unsigned char saa7113_init_auto_input[] = { - 0x01, 0x08, /* PH7113_INCREMENT_DELAY - (1) (1) (1) (1) IDEL3 IDEL2 IDELL1 IDEL0 */ - 0x02, 0xc2, /* PH7113_ANALOG_INPUT_CONTR_1 - FUSE1 FUSE0 GUDL1 GUDL0 MODE3 MODE2 MODE1 MODE0 */ - 0x03, 0x30, /* PH7113_ANALOG_INPUT_CONTR_2 - (1) HLNRS VBSL WPOFF HOLDG GAFIX GAI28 GAI18 */ - 0x04, 0x00, /* PH7113_ANALOG_INPUT_CONTR_3 - GAI17 GAI16 GAI15 GAI14 GAI13 GAI12 GAI11 GAI10 */ - 0x05, 0x00, /* PH7113_ANALOG_INPUT_CONTR_4 - GAI27 GAI26 GAI25 GAI24 GAI23 GAI22 GAI21 GAI20 */ - 0x06, 0x89, /* PH7113_HORIZONTAL_SYNC_START - HSB7 HSB6 HSB5 HSB4 HSB3 HSB2 HSB1 HSB0 */ - 0x07, 0x0d, /* PH7113_HORIZONTAL_SYNC_STOP - HSS7 HSS6 HSS5 HSS4 HSS3 HSS2 HSS1 HSS0 */ - 0x08, 0x88, /* PH7113_SYNC_CONTROL - AUFD FSEL FOET HTC1 HTC0 HPLL VNOI1 VNOI0 */ - 0x09, 0x01, /* PH7113_LUMINANCE_CONTROL - BYPS PREF BPSS1 BPSS0 VBLB UPTCV APER1 APER0 */ - 0x0a, 0x80, /* PH7113_LUMINANCE_BRIGHTNESS - BRIG7 BRIG6 BRIG5 BRIG4 BRIG3 BRIG2 BRIG1 BRIG0 */ - 0x0b, 0x47, /* PH7113_LUMINANCE_CONTRAST - CONT7 CONT6 CONT5 CONT4 CONT3 CONT2 CONT1 CONT0 */ - 0x0c, 0x40, /* PH7113_CHROMA_SATURATION - SATN7 SATN6 SATN5 SATN4 SATN3 SATN2 SATN1 SATN0 */ - 0x0d, 0x00, /* PH7113_CHROMA_HUE_CONTROL - HUEC7 HUEC6 HUEC5 HUEC4 HUEC3 HUEC2 HUEC1 HUEC0 */ - 0x0e, 0x01, /* PH7113_CHROMA_CONTROL - CDTO CSTD2 CSTD1 CSTD0 DCCF FCTC CHBW1 CHBW0 */ - 0x0f, 0x2a, /* PH7113_CHROMA_GAIN_CONTROL - ACGC CGAIN6 CGAIN5 CGAIN4 CGAIN3 CGAIN2 CGAIN1 CGAIN0 */ - 0x10, 0x08, /* PH7113_FORMAT_DELAY_CONTROL - OFTS1 OFTS0 HDEL1 HDEL0 VRLN YDEL2 YDEL1 YDEL0 */ - 0x11, 0x0c, /* PH7113_OUTPUT_CONTROL_1 - GPSW1 CM99 GPSW0 HLSEL OEYC OERT VIPB COLO */ - 0x12, 0x07, /* PH7113_OUTPUT_CONTROL_2 - RTSE13 RTSE12 RTSE11 RTSE10 RTSE03 RTSE02 RTSE01 RTSE00 */ - 0x13, 0x00, /* PH7113_OUTPUT_CONTROL_3 - ADLSB (1) (1) OLDSB FIDP (1) AOSL1 AOSL0 */ - 0x14, 0x00, /* RESERVED 14 - (1) (1) (1) (1) (1) (1) (1) (1) */ - 0x15, 0x00, /* PH7113_V_GATE1_START - VSTA7 VSTA6 VSTA5 VSTA4 VSTA3 VSTA2 VSTA1 VSTA0 */ - 0x16, 0x00, /* PH7113_V_GATE1_STOP - VSTO7 VSTO6 VSTO5 VSTO4 VSTO3 VSTO2 VSTO1 VSTO0 */ - 0x17, 0x00, /* PH7113_V_GATE1_MSB - (1) (1) (1) (1) (1) (1) VSTO8 VSTA8 */ 0x00, 0x00 }; + static const unsigned char saa7115_init_misc[] = { - 0x81, 0x01, /* reg 0x15,0x16 define blanking window */ - 0x82, 0x00, - 0x83, 0x01, /* I port settings */ - 0x84, 0x20, - 0x85, 0x21, - 0x86, 0xc5, - 0x87, 0x01, + R_81_V_SYNC_FLD_ID_SRC_SEL_AND_RETIMED_V_F, 0x01, + R_83_X_PORT_I_O_ENA_AND_OUT_CLK, 0x01, + R_84_I_PORT_SIGNAL_DEF, 0x20, + R_85_I_PORT_SIGNAL_POLAR, 0x21, + R_86_I_PORT_FIFO_FLAG_CNTL_AND_ARBIT, 0xc5, + R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, 0x01, /* Task A */ - 0xa0, 0x01, /* down scale = 1 */ - 0xa1, 0x00, /* prescale accumulation length = 1 */ - 0xa2, 0x00, /* dc gain and fir prefilter control */ - 0xa4, 0x80, /* Lum Brightness, nominal value = 0x80 */ - 0xa5, 0x40, /* Lum contrast, nominal value = 0x40 */ - 0xa6, 0x40, /* Chroma satur. nominal value = 0x80 */ - 0xa8, 0x00, /* hor lum scaling 0x0200 = 2 zoom */ - 0xa9, 0x02, /* note: 2 x zoom ensures that VBI lines have same length as video lines. */ - 0xaa, 0x00, /* H-phase offset Luma = 0 */ - 0xac, 0x00, /* hor chrom scaling 0x0200. must be hor lum scaling / 2 */ - 0xad, 0x01, /* H-scaling incr chroma */ - 0xae, 0x00, /* H-phase offset chroma. must be offset luma / 2 */ - - 0xb0, 0x00, /* V-scaling incr luma low */ - 0xb1, 0x04, /* " hi */ - 0xb2, 0x00, /* V-scaling incr chroma low */ - 0xb3, 0x04, /* " hi */ - 0xb4, 0x01, /* V-scaling mode control */ - 0xb8, 0x00, /* V-phase offset chroma 00 */ - 0xb9, 0x00, /* V-phase offset chroma 01 */ - 0xba, 0x00, /* V-phase offset chroma 10 */ - 0xbb, 0x00, /* V-phase offset chroma 11 */ - 0xbc, 0x00, /* V-phase offset luma 00 */ - 0xbd, 0x00, /* V-phase offset luma 01 */ - 0xbe, 0x00, /* V-phase offset luma 10 */ - 0xbf, 0x00, /* V-phase offset luma 11 */ + R_A0_A_HORIZ_PRESCALING, 0x01, + R_A1_A_ACCUMULATION_LENGTH, 0x00, + R_A2_A_PRESCALER_DC_GAIN_AND_FIR_PREFILTER, 0x00, + + /* Configure controls at nominal value*/ + R_A4_A_LUMA_BRIGHTNESS_CNTL, 0x80, + R_A5_A_LUMA_CONTRAST_CNTL, 0x40, + R_A6_A_CHROMA_SATURATION_CNTL, 0x40, + + /* note: 2 x zoom ensures that VBI lines have same length as video lines. */ + R_A8_A_HORIZ_LUMA_SCALING_INC, 0x00, + R_A9_A_HORIZ_LUMA_SCALING_INC_MSB, 0x02, + + R_AA_A_HORIZ_LUMA_PHASE_OFF, 0x00, + + /* must be horiz lum scaling / 2 */ + R_AC_A_HORIZ_CHROMA_SCALING_INC, 0x00, + R_AD_A_HORIZ_CHROMA_SCALING_INC_MSB, 0x01, + + /* must be offset luma / 2 */ + R_AE_A_HORIZ_CHROMA_PHASE_OFF, 0x00, + + R_B0_A_VERT_LUMA_SCALING_INC, 0x00, + R_B1_A_VERT_LUMA_SCALING_INC_MSB, 0x04, + + R_B2_A_VERT_CHROMA_SCALING_INC, 0x00, + R_B3_A_VERT_CHROMA_SCALING_INC_MSB, 0x04, + + R_B4_A_VERT_SCALING_MODE_CNTL, 0x01, + + R_B8_A_VERT_CHROMA_PHASE_OFF_00, 0x00, + R_B9_A_VERT_CHROMA_PHASE_OFF_01, 0x00, + R_BA_A_VERT_CHROMA_PHASE_OFF_10, 0x00, + R_BB_A_VERT_CHROMA_PHASE_OFF_11, 0x00, + + R_BC_A_VERT_LUMA_PHASE_OFF_00, 0x00, + R_BD_A_VERT_LUMA_PHASE_OFF_01, 0x00, + R_BE_A_VERT_LUMA_PHASE_OFF_10, 0x00, + R_BF_A_VERT_LUMA_PHASE_OFF_11, 0x00, /* Task B */ - 0xd0, 0x01, /* down scale = 1 */ - 0xd1, 0x00, /* prescale accumulation length = 1 */ - 0xd2, 0x00, /* dc gain and fir prefilter control */ - 0xd4, 0x80, /* Lum Brightness, nominal value = 0x80 */ - 0xd5, 0x40, /* Lum contrast, nominal value = 0x40 */ - 0xd6, 0x40, /* Chroma satur. nominal value = 0x80 */ - 0xd8, 0x00, /* hor lum scaling 0x0400 = 1 */ - 0xd9, 0x04, - 0xda, 0x00, /* H-phase offset Luma = 0 */ - 0xdc, 0x00, /* hor chrom scaling 0x0200. must be hor lum scaling / 2 */ - 0xdd, 0x02, /* H-scaling incr chroma */ - 0xde, 0x00, /* H-phase offset chroma. must be offset luma / 2 */ - - 0xe0, 0x00, /* V-scaling incr luma low */ - 0xe1, 0x04, /* " hi */ - 0xe2, 0x00, /* V-scaling incr chroma low */ - 0xe3, 0x04, /* " hi */ - 0xe4, 0x01, /* V-scaling mode control */ - 0xe8, 0x00, /* V-phase offset chroma 00 */ - 0xe9, 0x00, /* V-phase offset chroma 01 */ - 0xea, 0x00, /* V-phase offset chroma 10 */ - 0xeb, 0x00, /* V-phase offset chroma 11 */ - 0xec, 0x00, /* V-phase offset luma 00 */ - 0xed, 0x00, /* V-phase offset luma 01 */ - 0xee, 0x00, /* V-phase offset luma 10 */ - 0xef, 0x00, /* V-phase offset luma 11 */ - - 0xf2, 0x50, /* crystal clock = 24.576 MHz, target = 27MHz */ - 0xf3, 0x46, - 0xf4, 0x00, - 0xf7, 0x4b, /* not the recommended settings! */ - 0xf8, 0x00, - 0xf9, 0x4b, - 0xfa, 0x00, - 0xfb, 0x4b, - 0xff, 0x88, /* PLL2 lock detection settings: 71 lines 50% phase error */ + R_D0_B_HORIZ_PRESCALING, 0x01, + R_D1_B_ACCUMULATION_LENGTH, 0x00, + R_D2_B_PRESCALER_DC_GAIN_AND_FIR_PREFILTER, 0x00, + + /* Configure controls at nominal value*/ + R_D4_B_LUMA_BRIGHTNESS_CNTL, 0x80, + R_D5_B_LUMA_CONTRAST_CNTL, 0x40, + R_D6_B_CHROMA_SATURATION_CNTL, 0x40, + + /* hor lum scaling 0x0400 = 1 */ + R_D8_B_HORIZ_LUMA_SCALING_INC, 0x00, + R_D9_B_HORIZ_LUMA_SCALING_INC_MSB, 0x04, + + R_DA_B_HORIZ_LUMA_PHASE_OFF, 0x00, + + /* must be hor lum scaling / 2 */ + R_DC_B_HORIZ_CHROMA_SCALING, 0x00, + R_DD_B_HORIZ_CHROMA_SCALING_MSB, 0x02, + + /* must be offset luma / 2 */ + R_DE_B_HORIZ_PHASE_OFFSET_CRHOMA, 0x00, + + R_E0_B_VERT_LUMA_SCALING_INC, 0x00, + R_E1_B_VERT_LUMA_SCALING_INC_MSB, 0x04, + + R_E2_B_VERT_CHROMA_SCALING_INC, 0x00, + R_E3_B_VERT_CHROMA_SCALING_INC_MSB, 0x04, + + R_E4_B_VERT_SCALING_MODE_CNTL, 0x01, + + R_E8_B_VERT_CHROMA_PHASE_OFF_00, 0x00, + R_E9_B_VERT_CHROMA_PHASE_OFF_01, 0x00, + R_EA_B_VERT_CHROMA_PHASE_OFF_10, 0x00, + R_EB_B_VERT_CHROMA_PHASE_OFF_11, 0x00, + + R_EC_B_VERT_LUMA_PHASE_OFF_00, 0x00, + R_ED_B_VERT_LUMA_PHASE_OFF_01, 0x00, + R_EE_B_VERT_LUMA_PHASE_OFF_10, 0x00, + R_EF_B_VERT_LUMA_PHASE_OFF_11, 0x00, + + R_F2_NOMINAL_PLL2_DTO, 0x50, /* crystal clock = 24.576 MHz, target = 27MHz */ + R_F3_PLL_INCREMENT, 0x46, + R_F4_PLL2_STATUS, 0x00, + R_F7_PULSE_A_POS_MSB, 0x4b, /* not the recommended settings! */ + R_F8_PULSE_B_POS, 0x00, + R_F9_PULSE_B_POS_MSB, 0x4b, + R_FA_PULSE_C_POS, 0x00, + R_FB_PULSE_C_POS_MSB, 0x4b, + + /* PLL2 lock detection settings: 71 lines 50% phase error */ + R_FF_S_PLL_MAX_PHASE_ERR_THRESH_NUM_LINES, 0x88, /* Turn off VBI */ - 0x40, 0x20, /* No framing code errors allowed. */ - 0x41, 0xff, - 0x42, 0xff, - 0x43, 0xff, - 0x44, 0xff, - 0x45, 0xff, - 0x46, 0xff, - 0x47, 0xff, - 0x48, 0xff, - 0x49, 0xff, - 0x4a, 0xff, - 0x4b, 0xff, - 0x4c, 0xff, - 0x4d, 0xff, - 0x4e, 0xff, - 0x4f, 0xff, - 0x50, 0xff, - 0x51, 0xff, - 0x52, 0xff, - 0x53, 0xff, - 0x54, 0xff, - 0x55, 0xff, - 0x56, 0xff, - 0x57, 0xff, - 0x58, 0x40, - 0x59, 0x47, - 0x5b, 0x83, - 0x5d, 0xbd, - 0x5e, 0x35, - - 0x02, 0x84, /* input tuner -> input 4, amplifier active */ - 0x09, 0x53, /* 0x53, was 0x56 for 60hz. luminance control */ - - 0x80, 0x20, /* enable task B */ - 0x88, 0xd0, - 0x88, 0xf0, + R_40_SLICER_CNTL_1, 0x20, /* No framing code errors allowed. */ + R_41_LCR_BASE, 0xff, + R_41_LCR_BASE+1, 0xff, + R_41_LCR_BASE+2, 0xff, + R_41_LCR_BASE+3, 0xff, + R_41_LCR_BASE+4, 0xff, + R_41_LCR_BASE+5, 0xff, + R_41_LCR_BASE+6, 0xff, + R_41_LCR_BASE+7, 0xff, + R_41_LCR_BASE+8, 0xff, + R_41_LCR_BASE+9, 0xff, + R_41_LCR_BASE+10, 0xff, + R_41_LCR_BASE+11, 0xff, + R_41_LCR_BASE+12, 0xff, + R_41_LCR_BASE+13, 0xff, + R_41_LCR_BASE+14, 0xff, + R_41_LCR_BASE+15, 0xff, + R_41_LCR_BASE+16, 0xff, + R_41_LCR_BASE+17, 0xff, + R_41_LCR_BASE+18, 0xff, + R_41_LCR_BASE+19, 0xff, + R_41_LCR_BASE+20, 0xff, + R_41_LCR_BASE+21, 0xff, + R_41_LCR_BASE+22, 0xff, + R_58_PROGRAM_FRAMING_CODE, 0x40, + R_59_H_OFF_FOR_SLICER, 0x47, + R_5B_FLD_OFF_AND_MSB_FOR_H_AND_V_OFF, 0x83, + R_5D_DID, 0xbd, + R_5E_SDID, 0x35, + + R_02_INPUT_CNTL_1, 0x84, /* input tuner -> input 4, amplifier active */ + + R_80_GLOBAL_CNTL_1, 0x20, /* enable task B */ + R_88_POWER_SAVE_ADC_PORT_CNTL, 0xd0, + R_88_POWER_SAVE_ADC_PORT_CNTL, 0xf0, 0x00, 0x00 }; -static int saa7115_odd_parity(u8 c) +static int saa711x_odd_parity(u8 c) { c ^= (c >> 4); c ^= (c >> 2); @@ -502,7 +599,7 @@ static int saa7115_odd_parity(u8 c) return c & 1; } -static int saa7115_decode_vps(u8 * dst, u8 * p) +static int saa711x_decode_vps(u8 * dst, u8 * p) { static const u8 biphase_tbl[] = { 0xf0, 0x78, 0x70, 0xf0, 0xb4, 0x3c, 0x34, 0xb4, @@ -549,7 +646,7 @@ static int saa7115_decode_vps(u8 * dst, u8 * p) return err & 0xf0; } -static int saa7115_decode_wss(u8 * p) +static int saa711x_decode_wss(u8 * p) { static const int wss_bits[8] = { 0, 0, 0, 1, 0, 1, 1, 1 @@ -576,26 +673,25 @@ static int saa7115_decode_wss(u8 * p) return wss; } - -static int saa7115_set_audio_clock_freq(struct i2c_client *client, u32 freq) +static int saa711x_set_audio_clock_freq(struct i2c_client *client, u32 freq) { - struct saa7115_state *state = i2c_get_clientdata(client); + struct saa711x_state *state = i2c_get_clientdata(client); u32 acpf; u32 acni; u32 hz; u64 f; u8 acc = 0; /* reg 0x3a, audio clock control */ + /* Checks for chips that don't have audio clock (saa7111, saa7113) */ + if (!saa711x_has_reg(state->ident,R_30_AUD_MAST_CLK_CYCLES_PER_FIELD)) + return 0; + v4l_dbg(1, debug, client, "set audio clock freq: %d\n", freq); /* sanity check */ if (freq < 32000 || freq > 48000) return -EINVAL; - /* The saa7113 has no audio clock */ - if (state->ident == V4L2_IDENT_SAA7113) - return 0; - /* hz is the refresh rate times 100 */ hz = (state->std & V4L2_STD_525_60) ? 5994 : 5000; /* 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) if (state->apll) acc |= 0x08; - saa7115_write(client, 0x38, 0x03); - saa7115_write(client, 0x39, 0x10); - saa7115_write(client, 0x3a, acc); - saa7115_write(client, 0x30, acpf & 0xff); - saa7115_write(client, 0x31, (acpf >> 8) & 0xff); - saa7115_write(client, 0x32, (acpf >> 16) & 0x03); - saa7115_write(client, 0x34, acni & 0xff); - saa7115_write(client, 0x35, (acni >> 8) & 0xff); - saa7115_write(client, 0x36, (acni >> 16) & 0x3f); + saa711x_write(client, R_38_CLK_RATIO_AMXCLK_TO_ASCLK, 0x03); + saa711x_write(client, R_39_CLK_RATIO_ASCLK_TO_ALRCLK, 0x10); + saa711x_write(client, R_3A_AUD_CLK_GEN_BASIC_SETUP, acc); + + saa711x_write(client, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD, acpf & 0xff); + saa711x_write(client, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD+1, + (acpf >> 8) & 0xff); + saa711x_write(client, R_30_AUD_MAST_CLK_CYCLES_PER_FIELD+2, + (acpf >> 16) & 0x03); + + saa711x_write(client, R_34_AUD_MAST_CLK_NOMINAL_INC, acni & 0xff); + saa711x_write(client, R_34_AUD_MAST_CLK_NOMINAL_INC+1, (acni >> 8) & 0xff); + saa711x_write(client, R_34_AUD_MAST_CLK_NOMINAL_INC+2, (acni >> 16) & 0x3f); state->audclk_freq = freq; return 0; } -static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) +static int saa711x_set_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) { - struct saa7115_state *state = i2c_get_clientdata(client); + struct saa711x_state *state = i2c_get_clientdata(client); switch (ctrl->id) { case V4L2_CID_BRIGHTNESS: @@ -642,7 +742,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c } state->bright = ctrl->value; - saa7115_write(client, 0x0a, state->bright); + saa711x_write(client, R_0A_LUMA_BRIGHT_CNTL, state->bright); break; case V4L2_CID_CONTRAST: @@ -652,7 +752,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c } state->contrast = ctrl->value; - saa7115_write(client, 0x0b, state->contrast); + saa711x_write(client, R_0B_LUMA_CONTRAST_CNTL, state->contrast); break; case V4L2_CID_SATURATION: @@ -662,7 +762,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c } state->sat = ctrl->value; - saa7115_write(client, 0x0c, state->sat); + saa711x_write(client, R_0C_CHROMA_SAT_CNTL, state->sat); break; case V4L2_CID_HUE: @@ -672,7 +772,7 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c } state->hue = ctrl->value; - saa7115_write(client, 0x0d, state->hue); + saa711x_write(client, R_0D_CHROMA_HUE_CNTL, state->hue); break; default: @@ -682,9 +782,9 @@ static int saa7115_set_v4lctrl(struct i2c_client *client, struct v4l2_control *c return 0; } -static int saa7115_get_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) +static int saa711x_get_v4lctrl(struct i2c_client *client, struct v4l2_control *ctrl) { - struct saa7115_state *state = i2c_get_clientdata(client); + struct saa711x_state *state = i2c_get_clientdata(client); switch (ctrl->id) { case V4L2_CID_BRIGHTNESS: @@ -706,10 +806,115 @@ static int saa7115_get_v4lctrl(struct i2c_client *client, struct v4l2_control *c return 0; } -static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std) +static int saa711x_set_size(struct i2c_client *client, int width, int height) +{ + struct saa711x_state *state = i2c_get_clientdata(client); + int HPSC, HFSC; + int VSCY; + int res; + int is_50hz = state->std & V4L2_STD_625_50; + int Vsrc = is_50hz ? 576 : 480; + + v4l_dbg(1, debug, client, "decoder set size to %ix%i\n",width,height); + + /* FIXME need better bounds checking here */ + if ((width < 1) || (width > 1440)) + return -EINVAL; + if ((height < 1) || (height > Vsrc)) + return -EINVAL; + + if (!saa711x_has_reg(state->ident,R_D0_B_HORIZ_PRESCALING)) { + /* Decoder only supports 720 columns and 480 or 576 lines */ + if (width != 720) + return -EINVAL; + if (height != Vsrc) + return -EINVAL; + } + + state->width = width; + state->height = height; + + if (!saa711x_has_reg(state->ident, R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH)) + return 0; + + /* probably have a valid size, let's set it */ + /* Set output width/height */ + /* width */ + + saa711x_write(client, R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH, + (u8) (width & 0xff)); + saa711x_write(client, R_CD_B_HORIZ_OUTPUT_WINDOW_LENGTH_MSB, + (u8) ((width >> 8) & 0xff)); + + /* Vertical Scaling uses height/2 */ + res=height/2; + + /* On 60Hz, it is using a higher Vertical Output Size */ + if (!is_50hz) + res+=(VRES_60HZ-480)>>1; + + /* height */ + saa711x_write(client, R_CE_B_VERT_OUTPUT_WINDOW_LENGTH, + (u8) (res & 0xff)); + saa711x_write(client, R_CF_B_VERT_OUTPUT_WINDOW_LENGTH_MSB, + (u8) ((res >> 8) & 0xff)); + + /* Scaling settings */ + /* Hprescaler is floor(inres/outres) */ + HPSC = (int)(720 / width); + /* 0 is not allowed (div. by zero) */ + HPSC = HPSC ? HPSC : 1; + HFSC = (int)((1024 * 720) / (HPSC * width)); + /* FIXME hardcodes to "Task B" + * write H prescaler integer */ + saa711x_write(client, R_D0_B_HORIZ_PRESCALING, + (u8) (HPSC & 0x3f)); + + v4l_dbg(1, debug, client, "Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC); + /* write H fine-scaling (luminance) */ + saa711x_write(client, R_D8_B_HORIZ_LUMA_SCALING_INC, + (u8) (HFSC & 0xff)); + saa711x_write(client, R_D9_B_HORIZ_LUMA_SCALING_INC_MSB, + (u8) ((HFSC >> 8) & 0xff)); + /* write H fine-scaling (chrominance) + * must be lum/2, so i'll just bitshift :) */ + saa711x_write(client, R_DC_B_HORIZ_CHROMA_SCALING, + (u8) ((HFSC >> 1) & 0xff)); + saa711x_write(client, R_DD_B_HORIZ_CHROMA_SCALING_MSB, + (u8) ((HFSC >> 9) & 0xff)); + + VSCY = (int)((1024 * Vsrc) / height); + v4l_dbg(1, debug, client, "Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY); + + /* Correct Contrast and Luminance */ + saa711x_write(client, R_D5_B_LUMA_CONTRAST_CNTL, + (u8) (64 * 1024 / VSCY)); + saa711x_write(client, R_D6_B_CHROMA_SATURATION_CNTL, + (u8) (64 * 1024 / VSCY)); + + /* write V fine-scaling (luminance) */ + saa711x_write(client, R_E0_B_VERT_LUMA_SCALING_INC, + (u8) (VSCY & 0xff)); + saa711x_write(client, R_E1_B_VERT_LUMA_SCALING_INC_MSB, + (u8) ((VSCY >> 8) & 0xff)); + /* write V fine-scaling (chrominance) */ + saa711x_write(client, R_E2_B_VERT_CHROMA_SCALING_INC, + (u8) (VSCY & 0xff)); + saa711x_write(client, R_E3_B_VERT_CHROMA_SCALING_INC_MSB, + (u8) ((VSCY >> 8) & 0xff)); + + saa711x_writeregs(client, saa7115_cfg_reset_scaler); + + /* Activates task "B" */ + saa711x_write(client, R_80_GLOBAL_CNTL_1, + saa711x_read(client,R_80_GLOBAL_CNTL_1)|0x20); + + return 0; +} + +static void saa711x_set_v4lstd(struct i2c_client *client, v4l2_std_id std) { - struct saa7115_state *state = i2c_get_clientdata(client); - int taskb = saa7115_read(client, 0x80) & 0x10; + struct saa711x_state *state = i2c_get_clientdata(client); /* Prevent unnecessary standard changes. During a standard 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) if (std == state->std) return; + state->std = std; + // This works for NTSC-M, SECAM-L and the 50Hz PAL variants. if (std & V4L2_STD_525_60) { v4l_dbg(1, debug, client, "decoder set standard 60 Hz\n"); - saa7115_writeregs(client, saa7115_cfg_60hz_video); + saa711x_writeregs(client, saa7115_cfg_60hz_video); + saa711x_set_size(client,720,480); } else { v4l_dbg(1, debug, client, "decoder set standard 50 Hz\n"); - saa7115_writeregs(client, saa7115_cfg_50hz_video); + saa711x_writeregs(client, saa7115_cfg_50hz_video); + saa711x_set_size(client,720,576); } /* Register 0E - Bits D6-D4 on NO-AUTO mode - (SAA7113 doesn't have auto mode) + (SAA7111 and SAA7113 doesn't have auto mode) 50 Hz / 625 lines 60 Hz / 525 lines 000 PAL BGDHI (4.43Mhz) NTSC M (3.58MHz) 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) 011 NTSC N (3.58MHz) PAL M (3.58MHz) 100 reserved NTSC-Japan (3.58MHz) */ - if (state->ident == V4L2_IDENT_SAA7113) { - u8 reg = saa7115_read(client, 0x0e) & 0x8f; + if (state->ident == V4L2_IDENT_SAA7111 || + state->ident == V4L2_IDENT_SAA7113) { + u8 reg = saa711x_read(client, R_0E_CHROMA_CNTL_1) & 0x8f; if (std == V4L2_STD_PAL_M) { reg |= 0x30; @@ -751,31 +961,30 @@ static void saa7115_set_v4lstd(struct i2c_client *client, v4l2_std_id std) } else if (std == V4L2_STD_NTSC_M_JP) { reg |= 0x40; } - saa7115_write(client, 0x0e, reg); - } - + saa711x_write(client, R_0E_CHROMA_CNTL_1, reg); + } else { + /* restart task B if needed */ + int taskb = saa711x_read(client, R_80_GLOBAL_CNTL_1) & 0x10; - state->std = std; + if (taskb && state->ident == V4L2_IDENT_SAA7114) { + saa711x_writeregs(client, saa7115_cfg_vbi_on); + } - /* restart task B if needed */ - if (taskb && state->ident != V4L2_IDENT_SAA7115) { - saa7115_writeregs(client, saa7115_cfg_vbi_on); + /* switch audio mode too! */ + saa711x_set_audio_clock_freq(client, state->audclk_freq); } - - /* switch audio mode too! */ - saa7115_set_audio_clock_freq(client, state->audclk_freq); } -static v4l2_std_id saa7115_get_v4lstd(struct i2c_client *client) +static v4l2_std_id saa711x_get_v4lstd(struct i2c_client *client) { - struct saa7115_state *state = i2c_get_clientdata(client); + struct saa711x_state *state = i2c_get_clientdata(client); return state->std; } -static void saa7115_log_status(struct i2c_client *client) +static void saa711x_log_status(struct i2c_client *client) { - struct saa7115_state *state = i2c_get_clientdata(client); + struct saa711x_state *state = i2c_get_clientdata(client); int reg1e, reg1f; int signalOk; int vcr; @@ -783,7 +992,7 @@ static void saa7115_log_status(struct i2c_client *client) v4l_info(client, "Audio frequency: %d Hz\n", state->audclk_freq); if (state->ident != V4L2_IDENT_SAA7115) { /* status for the saa7114 */ - reg1f = saa7115_read(client, 0x1f); + reg1f = saa711x_read(client, R_1F_STATUS_BYTE_2_VD_DEC); signalOk = (reg1f & 0xc1) == 0x81; v4l_info(client, "Video signal: %s\n", signalOk ? "ok" : "bad"); 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) } /* status for the saa7115 */ - reg1e = saa7115_read(client, 0x1e); - reg1f = saa7115_read(client, 0x1f); + reg1e = saa711x_read(client, R_1E_STATUS_BYTE_1_VD_DEC); + reg1f = saa711x_read(client, R_1F_STATUS_BYTE_2_VD_DEC); signalOk = (reg1f & 0xc1) == 0x81 && (reg1e & 0xc0) == 0x80; vcr = !(reg1f & 0x10); @@ -819,19 +1028,27 @@ static void saa7115_log_status(struct i2c_client *client) v4l_info(client, "Detected format: BW/No color\n"); break; } + v4l_info(client, "Width, Height: %d, %d\n", state->width, state->height); } /* setup the sliced VBI lcr registers according to the sliced VBI format */ -static void saa7115_set_lcr(struct i2c_client *client, struct v4l2_sliced_vbi_format *fmt) +static void saa711x_set_lcr(struct i2c_client *client, struct v4l2_sliced_vbi_format *fmt) { - struct saa7115_state *state = i2c_get_clientdata(client); + struct saa711x_state *state = i2c_get_clientdata(client); int is_50hz = (state->std & V4L2_STD_625_50); u8 lcr[24]; int i, x; - /* saa7113/7114 doesn't yet support VBI */ +#if 1 + /* saa7113/7114/7118 VBI support are experimental */ + if (!saa711x_has_reg(state->ident,R_41_LCR_BASE)) + return; + +#else + /* SAA7113 and SAA7118 also should support VBI - Need testing */ if (state->ident != V4L2_IDENT_SAA7115) return; +#endif for (i = 0; i <= 23; i++) lcr[i] = 0xff; @@ -888,14 +1105,16 @@ static void saa7115_set_lcr(struct i2c_client *client, struct v4l2_sliced_vbi_fo /* write the lcr registers */ for (i = 2; i <= 23; i++) { - saa7115_write(client, i - 2 + 0x41, lcr[i]); + saa711x_write(client, i - 2 + R_41_LCR_BASE, lcr[i]); } /* enable/disable raw VBI capturing */ - saa7115_writeregs(client, fmt->service_set == 0 ? saa7115_cfg_vbi_on : saa7115_cfg_vbi_off); + saa711x_writeregs(client, fmt->service_set == 0 ? + saa7115_cfg_vbi_on : + saa7115_cfg_vbi_off); } -static int saa7115_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) +static int saa711x_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) { static u16 lcr2vbi[] = { 0, V4L2_SLICED_TELETEXT_B, 0, /* 1 */ @@ -911,10 +1130,10 @@ static int saa7115_get_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt return -EINVAL; memset(sliced, 0, sizeof(*sliced)); /* done if using raw VBI */ - if (saa7115_read(client, 0x80) & 0x10) + if (saa711x_read(client, R_80_GLOBAL_CNTL_1) & 0x10) return 0; for (i = 2; i <= 23; i++) { - u8 v = saa7115_read(client, i - 2 + 0x41); + u8 v = saa711x_read(client, i - 2 + R_41_LCR_BASE); sliced->service_lines[0][i] = lcr2vbi[v >> 4]; 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 return 0; } -static int saa7115_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) +static int saa711x_set_v4lfmt(struct i2c_client *client, struct v4l2_format *fmt) { - struct saa7115_state *state = i2c_get_clientdata(client); - struct v4l2_pix_format *pix; - int HPSC, HFSC; - int VSCY, Vsrc; - int is_50hz = state->std & V4L2_STD_625_50; - if (fmt->type == V4L2_BUF_TYPE_SLICED_VBI_CAPTURE) { - saa7115_set_lcr(client, &fmt->fmt.sliced); + saa711x_set_lcr(client, &fmt->fmt.sliced); return 0; } if (fmt->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) return -EINVAL; - pix = &(fmt->fmt.pix); - - v4l_dbg(1, debug, client, "decoder set size\n"); - - /* FIXME need better bounds checking here */ - if ((pix->width < 1) || (pix->width > 1440)) - return -EINVAL; - if ((pix->height < 1) || (pix->height > 960)) - return -EINVAL; - - /* probably have a valid size, let's set it */ - /* Set output width/height */ - /* width */ - saa7115_write(client, 0xcc, (u8) (pix->width & 0xff)); - saa7115_write(client, 0xcd, (u8) ((pix->width >> 8) & 0xff)); - /* height */ - saa7115_write(client, 0xce, (u8) (pix->height & 0xff)); - saa7115_write(client, 0xcf, (u8) ((pix->height >> 8) & 0xff)); - - /* Scaling settings */ - /* Hprescaler is floor(inres/outres) */ - /* FIXME hardcoding input res */ - if (pix->width != 720) { - HPSC = (int)(720 / pix->width); - /* 0 is not allowed (div. by zero) */ - HPSC = HPSC ? HPSC : 1; - HFSC = (int)((1024 * 720) / (HPSC * pix->width)); - - v4l_dbg(1, debug, client, "Hpsc: 0x%05x, Hfsc: 0x%05x\n", HPSC, HFSC); - /* FIXME hardcodes to "Task B" - * write H prescaler integer */ - saa7115_write(client, 0xd0, (u8) (HPSC & 0x3f)); - - /* write H fine-scaling (luminance) */ - saa7115_write(client, 0xd8, (u8) (HFSC & 0xff)); - saa7115_write(client, 0xd9, (u8) ((HFSC >> 8) & 0xff)); - /* write H fine-scaling (chrominance) - * must be lum/2, so i'll just bitshift :) */ - saa7115_write(client, 0xDC, (u8) ((HFSC >> 1) & 0xff)); - saa7115_write(client, 0xDD, (u8) ((HFSC >> 9) & 0xff)); - } else { - if (is_50hz) { - v4l_dbg(1, debug, client, "Setting full 50hz width\n"); - saa7115_writeregs(client, saa7115_cfg_50hz_fullres_x); - } else { - v4l_dbg(1, debug, client, "Setting full 60hz width\n"); - saa7115_writeregs(client, saa7115_cfg_60hz_fullres_x); - } - } - - Vsrc = is_50hz ? 576 : 480; - - if (pix->height != Vsrc) { - VSCY = (int)((1024 * Vsrc) / pix->height); - v4l_dbg(1, debug, client, "Vsrc: %d, Vscy: 0x%05x\n", Vsrc, VSCY); - - /* Correct Contrast and Luminance */ - saa7115_write(client, 0xd5, (u8) (64 * 1024 / VSCY)); - saa7115_write(client, 0xd6, (u8) (64 * 1024 / VSCY)); - - /* write V fine-scaling (luminance) */ - saa7115_write(client, 0xe0, (u8) (VSCY & 0xff)); - saa7115_write(client, 0xe1, (u8) ((VSCY >> 8) & 0xff)); - /* write V fine-scaling (chrominance) */ - saa7115_write(client, 0xe2, (u8) (VSCY & 0xff)); - saa7115_write(client, 0xe3, (u8) ((VSCY >> 8) & 0xff)); - } else { - if (is_50hz) { - v4l_dbg(1, debug, client, "Setting full 50Hz height\n"); - saa7115_writeregs(client, saa7115_cfg_50hz_fullres_y); - } else { - v4l_dbg(1, debug, client, "Setting full 60hz height\n"); - saa7115_writeregs(client, saa7115_cfg_60hz_fullres_y); - } - } - - saa7115_writeregs(client, saa7115_cfg_reset_scaler); - return 0; + return saa711x_set_size(client,fmt->fmt.pix.width,fmt->fmt.pix.height); } /* Decode the sliced VBI data stream as created by the saa7115. The format is described in the saa7115 datasheet in Tables 25 and 26 and in Figure 33. The current implementation uses SAV/EAV codes and not the ancillary data - headers. The vbi->p pointer points to the SDID byte right after the SAV + headers. The vbi->p pointer points to the R_5E_SDID byte right after the SAV code. */ -static void saa7115_decode_vbi_line(struct i2c_client *client, +static void saa711x_decode_vbi_line(struct i2c_client *client, struct v4l2_decode_vbi_line *vbi) { static const char vbi_no_data_pattern[] = { 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0, 0xa0 }; - struct saa7115_state *state = i2c_get_clientdata(client); + struct saa711x_state *state = i2c_get_clientdata(client); u8 *p = vbi->p; u32 wss; 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, vbi->type = V4L2_SLICED_TELETEXT_B; break; case 4: - if (!saa7115_odd_parity(p[0]) || !saa7115_odd_parity(p[1])) + if (!saa711x_odd_parity(p[0]) || !saa711x_odd_parity(p[1])) return; vbi->type = V4L2_SLICED_CAPTION_525; break; case 5: - wss = saa7115_decode_wss(p); + wss = saa711x_decode_wss(p); if (wss == -1) return; p[0] = wss & 0xff; @@ -1079,7 +1215,7 @@ static void saa7115_decode_vbi_line(struct i2c_client *client, vbi->type = V4L2_SLICED_WSS_625; break; case 7: - if (saa7115_decode_vps(p, p) != 0) + if (saa711x_decode_vps(p, p) != 0) return; vbi->type = V4L2_SLICED_VPS; break; @@ -1090,21 +1226,21 @@ static void saa7115_decode_vbi_line(struct i2c_client *client, /* ============ SAA7115 AUDIO settings (end) ============= */ -static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *arg) +static int saa711x_command(struct i2c_client *client, unsigned int cmd, void *arg) { - struct saa7115_state *state = i2c_get_clientdata(client); + struct saa711x_state *state = i2c_get_clientdata(client); int *iarg = arg; /* ioctls to allow direct access to the saa7115 registers for testing */ switch (cmd) { case VIDIOC_S_FMT: - return saa7115_set_v4lfmt(client, (struct v4l2_format *)arg); + return saa711x_set_v4lfmt(client, (struct v4l2_format *)arg); case VIDIOC_G_FMT: - return saa7115_get_v4lfmt(client, (struct v4l2_format *)arg); + return saa711x_get_v4lfmt(client, (struct v4l2_format *)arg); case VIDIOC_INT_AUDIO_CLOCK_FREQ: - return saa7115_set_audio_clock_freq(client, *(u32 *)arg); + return saa711x_set_audio_clock_freq(client, *(u32 *)arg); case VIDIOC_G_TUNER: { @@ -1113,7 +1249,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar if (state->radio) break; - status = saa7115_read(client, 0x1f); + status = saa711x_read(client, R_1F_STATUS_BYTE_2_VD_DEC); v4l_dbg(1, debug, client, "status: 0x%02x\n", status); 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 } case VIDIOC_LOG_STATUS: - saa7115_log_status(client); + saa711x_log_status(client); break; case VIDIOC_G_CTRL: - return saa7115_get_v4lctrl(client, (struct v4l2_control *)arg); + return saa711x_get_v4lctrl(client, (struct v4l2_control *)arg); case VIDIOC_S_CTRL: - return saa7115_set_v4lctrl(client, (struct v4l2_control *)arg); + return saa711x_set_v4lctrl(client, (struct v4l2_control *)arg); case VIDIOC_QUERYCTRL: { @@ -1146,12 +1282,12 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar } case VIDIOC_G_STD: - *(v4l2_std_id *)arg = saa7115_get_v4lstd(client); + *(v4l2_std_id *)arg = saa711x_get_v4lstd(client); break; case VIDIOC_S_STD: state->radio = 0; - saa7115_set_v4lstd(client, *(v4l2_std_id *)arg); + saa711x_set_v4lstd(client, *(v4l2_std_id *)arg); break; case AUDC_SET_RADIO: @@ -1187,13 +1323,13 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar state->input = route->input; /* select mode */ - saa7115_write(client, 0x02, - (saa7115_read(client, 0x02) & 0xf0) | + saa711x_write(client, R_02_INPUT_CNTL_1, + (saa711x_read(client, R_02_INPUT_CNTL_1) & 0xf0) | state->input); /* bypass chrominance trap for S-Video modes */ - saa7115_write(client, 0x09, - (saa7115_read(client, 0x09) & 0x7f) | + saa711x_write(client, R_09_LUMA_CNTL, + (saa711x_read(client, R_09_LUMA_CNTL) & 0x7f) | (state->input >= SAA7115_SVIDEO0 ? 0x80 : 0x0)); break; } @@ -1205,7 +1341,9 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar if (state->enable != (cmd == VIDIOC_STREAMON)) { state->enable = (cmd == VIDIOC_STREAMON); - saa7115_write(client, 0x87, state->enable); + saa711x_write(client, + R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, + state->enable); } break; @@ -1220,17 +1358,17 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar state->cgcdiv = (freq->flags & SAA7115_FREQ_FL_CGCDIV) ? 3 : 4; state->ucgc = (freq->flags & SAA7115_FREQ_FL_UCGC) ? 1 : 0; state->apll = (freq->flags & SAA7115_FREQ_FL_APLL) ? 1 : 0; - saa7115_set_audio_clock_freq(client, state->audclk_freq); + saa711x_set_audio_clock_freq(client, state->audclk_freq); break; } case VIDIOC_INT_DECODE_VBI_LINE: - saa7115_decode_vbi_line(client, arg); + saa711x_decode_vbi_line(client, arg); break; case VIDIOC_INT_RESET: v4l_dbg(1, debug, client, "decoder RESET\n"); - saa7115_writeregs(client, saa7115_cfg_reset_scaler); + saa711x_writeregs(client, saa7115_cfg_reset_scaler); break; case VIDIOC_INT_G_VBI_DATA: @@ -1239,25 +1377,25 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar switch (data->id) { case V4L2_SLICED_WSS_625: - if (saa7115_read(client, 0x6b) & 0xc0) + if (saa711x_read(client, 0x6b) & 0xc0) return -EIO; - data->data[0] = saa7115_read(client, 0x6c); - data->data[1] = saa7115_read(client, 0x6d); + data->data[0] = saa711x_read(client, 0x6c); + data->data[1] = saa711x_read(client, 0x6d); return 0; case V4L2_SLICED_CAPTION_525: if (data->field == 0) { /* CC */ - if (saa7115_read(client, 0x66) & 0xc0) + if (saa711x_read(client, 0x66) & 0xc0) return -EIO; - data->data[0] = saa7115_read(client, 0x67); - data->data[1] = saa7115_read(client, 0x68); + data->data[0] = saa711x_read(client, 0x67); + data->data[1] = saa711x_read(client, 0x68); return 0; } /* XDS */ - if (saa7115_read(client, 0x66) & 0x30) + if (saa711x_read(client, 0x66) & 0x30) return -EIO; - data->data[0] = saa7115_read(client, 0x69); - data->data[1] = saa7115_read(client, 0x6a); + data->data[0] = saa711x_read(client, 0x69); + data->data[1] = saa711x_read(client, 0x6a); return 0; default: return -EINVAL; @@ -1272,7 +1410,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar if (reg->i2c_id != I2C_DRIVERID_SAA711X) return -EINVAL; - reg->val = saa7115_read(client, reg->reg & 0xff); + reg->val = saa711x_read(client, reg->reg & 0xff); break; } @@ -1284,7 +1422,7 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar return -EINVAL; if (!capable(CAP_SYS_ADMIN)) return -EPERM; - saa7115_write(client, reg->reg & 0xff, reg->val & 0xff); + saa711x_write(client, reg->reg & 0xff, reg->val & 0xff); break; } #endif @@ -1302,12 +1440,14 @@ static int saa7115_command(struct i2c_client *client, unsigned int cmd, void *ar /* ----------------------------------------------------------------------- */ -static struct i2c_driver i2c_driver_saa7115; +static struct i2c_driver i2c_driver_saa711x; -static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) +static int saa711x_attach(struct i2c_adapter *adapter, int address, int kind) { struct i2c_client *client; - struct saa7115_state *state; + struct saa711x_state *state; + int i; + char name[17]; u8 chip_id; /* Check if the adapter supports the needed features */ @@ -1319,28 +1459,31 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) return -ENOMEM; client->addr = address; client->adapter = adapter; - client->driver = &i2c_driver_saa7115; + client->driver = &i2c_driver_saa711x; snprintf(client->name, sizeof(client->name) - 1, "saa7115"); v4l_dbg(1, debug, client, "detecting saa7115 client on address 0x%x\n", address << 1); - saa7115_write(client, 0, 5); - chip_id = saa7115_read(client, 0) & 0x0f; - if (chip_id < 3 && chip_id > 5) { - v4l_dbg(1, debug, client, "saa7115 not found\n"); - kfree(client); - return 0; + for (i=0;i<0x0f;i++) { + saa711x_write(client, 0, i); + name[i] = (saa711x_read(client, 0) &0x0f) +'0'; + if (name[i]>'9') + name[i]+='a'-'9'-1; } + name[i]='\0'; + + saa711x_write(client, 0, 5); + chip_id = saa711x_read(client, 0) & 0x0f; + snprintf(client->name, sizeof(client->name) - 1, "saa711%d",chip_id); - v4l_info(client, "saa711%d found @ 0x%x (%s)\n", chip_id, address << 1, adapter->name); + v4l_info(client, "saa711%d found (%s) @ 0x%x (%s)\n", chip_id, name, address << 1, adapter->name); - state = kzalloc(sizeof(struct saa7115_state), GFP_KERNEL); + state = kzalloc(sizeof(struct saa711x_state), GFP_KERNEL); i2c_set_clientdata(client, state); if (state == NULL) { kfree(client); return -ENOMEM; } - state->std = V4L2_STD_NTSC; state->input = -1; state->enable = 1; state->radio = 0; @@ -1349,15 +1492,25 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) state->hue = 0; state->sat = 64; switch (chip_id) { + case 1: + state->ident = V4L2_IDENT_SAA7111; + break; case 3: state->ident = V4L2_IDENT_SAA7113; break; case 4: state->ident = V4L2_IDENT_SAA7114; break; - default: + case 5: state->ident = V4L2_IDENT_SAA7115; break; + case 8: + state->ident = V4L2_IDENT_SAA7118; + break; + default: + state->ident = V4L2_IDENT_SAA7111; + v4l_info(client, "WARNING: Chip is not known - Falling back to saa7111\n"); + } state->audclk_freq = 48000; @@ -1365,38 +1518,39 @@ static int saa7115_attach(struct i2c_adapter *adapter, int address, int kind) v4l_dbg(1, debug, client, "writing init values\n"); /* init to 60hz/48khz */ - if (state->ident == V4L2_IDENT_SAA7113) { - state->crystal_freq = SAA7115_FREQ_24_576_MHZ; - saa7115_writeregs(client, saa7113_init_auto_input); - } else { + state->crystal_freq = SAA7115_FREQ_24_576_MHZ; + switch (state->ident) { + case V4L2_IDENT_SAA7111: + saa711x_writeregs(client, saa7111_init); + break; + case V4L2_IDENT_SAA7113: + saa711x_writeregs(client, saa7113_init); + break; + default: state->crystal_freq = SAA7115_FREQ_32_11_MHZ; - saa7115_writeregs(client, saa7115_init_auto_input); + saa711x_writeregs(client, saa7115_init_auto_input); } - saa7115_writeregs(client, saa7115_init_misc); - saa7115_writeregs(client, saa7115_cfg_60hz_fullres_x); - saa7115_writeregs(client, saa7115_cfg_60hz_fullres_y); - saa7115_writeregs(client, saa7115_cfg_60hz_video); - saa7115_set_audio_clock_freq(client, state->audclk_freq); - saa7115_writeregs(client, saa7115_cfg_reset_scaler); + saa711x_writeregs(client, saa7115_init_misc); + saa711x_set_v4lstd(client, V4L2_STD_NTSC); i2c_attach_client(client); v4l_dbg(1, debug, client, "status: (1E) 0x%02x, (1F) 0x%02x\n", - saa7115_read(client, 0x1e), saa7115_read(client, 0x1f)); + saa711x_read(client, R_1E_STATUS_BYTE_1_VD_DEC), saa711x_read(client, R_1F_STATUS_BYTE_2_VD_DEC)); return 0; } -static int saa7115_probe(struct i2c_adapter *adapter) +static int saa711x_probe(struct i2c_adapter *adapter) { if (adapter->class & I2C_CLASS_TV_ANALOG) - return i2c_probe(adapter, &addr_data, &saa7115_attach); + return i2c_probe(adapter, &addr_data, &saa711x_attach); return 0; } -static int saa7115_detach(struct i2c_client *client) +static int saa711x_detach(struct i2c_client *client) { - struct saa7115_state *state = i2c_get_clientdata(client); + struct saa711x_state *state = i2c_get_clientdata(client); int err; err = i2c_detach_client(client); @@ -1412,26 +1566,26 @@ static int saa7115_detach(struct i2c_client *client) /* ----------------------------------------------------------------------- */ /* i2c implementation */ -static struct i2c_driver i2c_driver_saa7115 = { +static struct i2c_driver i2c_driver_saa711x = { .driver = { .name = "saa7115", }, .id = I2C_DRIVERID_SAA711X, - .attach_adapter = saa7115_probe, - .detach_client = saa7115_detach, - .command = saa7115_command, + .attach_adapter = saa711x_probe, + .detach_client = saa711x_detach, + .command = saa711x_command, }; -static int __init saa7115_init_module(void) +static int __init saa711x_init_module(void) { - return i2c_add_driver(&i2c_driver_saa7115); + return i2c_add_driver(&i2c_driver_saa711x); } -static void __exit saa7115_cleanup_module(void) +static void __exit saa711x_cleanup_module(void) { - i2c_del_driver(&i2c_driver_saa7115); + i2c_del_driver(&i2c_driver_saa711x); } -module_init(saa7115_init_module); -module_exit(saa7115_cleanup_module); +module_init(saa711x_init_module); +module_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 0000000..4e5f2eb --- /dev/null +++ b/drivers/media/video/saa711x_regs.h @@ -0,0 +1,549 @@ +/* saa711x - Philips SAA711x video decoder register specifications + * + * Copyright (c) 2006 Mauro Carvalho Chehab <mchehab@infradead.org> + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + */ + +#define R_00_CHIP_VERSION 0x00 +/* Video Decoder */ + /* Video Decoder - Frontend part */ +#define R_01_INC_DELAY 0x01 +#define R_02_INPUT_CNTL_1 0x02 +#define R_03_INPUT_CNTL_2 0x03 +#define R_04_INPUT_CNTL_3 0x04 +#define R_05_INPUT_CNTL_4 0x05 + /* Video Decoder - Decoder part */ +#define R_06_H_SYNC_START 0x06 +#define R_07_H_SYNC_STOP 0x07 +#define R_08_SYNC_CNTL 0x08 +#define R_09_LUMA_CNTL 0x09 +#define R_0A_LUMA_BRIGHT_CNTL 0x0a +#define R_0B_LUMA_CONTRAST_CNTL 0x0b +#define R_0C_CHROMA_SAT_CNTL 0x0c +#define R_0D_CHROMA_HUE_CNTL 0x0d +#define R_0E_CHROMA_CNTL_1 0x0e +#define R_0F_CHROMA_GAIN_CNTL 0x0f +#define R_10_CHROMA_CNTL_2 0x10 +#define R_11_MODE_DELAY_CNTL 0x11 +#define R_12_RT_SIGNAL_CNTL 0x12 +#define R_13_RT_X_PORT_OUT_CNTL 0x13 +#define R_14_ANAL_ADC_COMPAT_CNTL 0x14 +#define R_15_VGATE_START_FID_CHG 0x15 +#define R_16_VGATE_STOP 0x16 +#define R_17_MISC_VGATE_CONF_AND_MSB 0x17 +#define R_18_RAW_DATA_GAIN_CNTL 0x18 +#define R_19_RAW_DATA_OFF_CNTL 0x19 +#define R_1A_COLOR_KILL_LVL_CNTL 0x1a +#define R_1B_MISC_TVVCRDET 0x1b +#define R_1C_ENHAN_COMB_CTRL1 0x1c +#define R_1D_ENHAN_COMB_CTRL2 0x1d +#define R_1E_STATUS_BYTE_1_VD_DEC 0x1e +#define R_1F_STATUS_BYTE_2_VD_DEC 0x1f + +/* Component processing and interrupt masking part */ +#define R_23_INPUT_CNTL_5 0x23 +#define R_24_INPUT_CNTL_6 0x24 +#define R_25_INPUT_CNTL_7 0x25 +#define R_29_COMP_DELAY 0x29 +#define R_2A_COMP_BRIGHT_CNTL 0x2a +#define R_2B_COMP_CONTRAST_CNTL 0x2b +#define R_2C_COMP_SAT_CNTL 0x2c +#define R_2D_INTERRUPT_MASK_1 0x2d +#define R_2E_INTERRUPT_MASK_2 0x2e +#define R_2F_INTERRUPT_MASK_3 0x2f + +/* Audio clock generator part */ +#define R_30_AUD_MAST_CLK_CYCLES_PER_FIELD 0x30 +#define R_34_AUD_MAST_CLK_NOMINAL_INC 0x34 +#define R_38_CLK_RATIO_AMXCLK_TO_ASCLK 0x38 +#define R_39_CLK_RATIO_ASCLK_TO_ALRCLK 0x39 +#define R_3A_AUD_CLK_GEN_BASIC_SETUP 0x3a + +/* General purpose VBI data slicer part */ +#define R_40_SLICER_CNTL_1 0x40 +#define R_41_LCR_BASE 0x41 +#define R_58_PROGRAM_FRAMING_CODE 0x58 +#define R_59_H_OFF_FOR_SLICER 0x59 +#define R_5A_V_OFF_FOR_SLICER 0x5a +#define R_5B_FLD_OFF_AND_MSB_FOR_H_AND_V_OFF 0x5b +#define R_5D_DID 0x5d +#define R_5E_SDID 0x5e +#define R_60_SLICER_STATUS_BYTE_0 0x60 +#define R_61_SLICER_STATUS_BYTE_1 0x61 +#define R_62_SLICER_STATUS_BYTE_2 0x62 + +/* X port, I port and the scaler part */ + /* Task independent global settings */ +#define R_80_GLOBAL_CNTL_1 0x80 +#define R_81_V_SYNC_FLD_ID_SRC_SEL_AND_RETIMED_V_F 0x81 +#define R_83_X_PORT_I_O_ENA_AND_OUT_CLK 0x83 +#define R_84_I_PORT_SIGNAL_DEF 0x84 +#define R_85_I_PORT_SIGNAL_POLAR 0x85 +#define R_86_I_PORT_FIFO_FLAG_CNTL_AND_ARBIT 0x86 +#define R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED 0x87 +#define R_88_POWER_SAVE_ADC_PORT_CNTL 0x88 +#define R_8F_STATUS_INFO_SCALER 0x8f + /* Task A definition */ + /* Basic settings and acquisition window definition */ +#define R_90_A_TASK_HANDLING_CNTL 0x90 +#define R_91_A_X_PORT_FORMATS_AND_CONF 0x91 +#define R_92_A_X_PORT_INPUT_REFERENCE_SIGNAL 0x92 +#define R_93_A_I_PORT_OUTPUT_FORMATS_AND_CONF 0x93 +#define R_94_A_HORIZ_INPUT_WINDOW_START 0x94 +#define R_95_A_HORIZ_INPUT_WINDOW_START_MSB 0x95 +#define R_96_A_HORIZ_INPUT_WINDOW_LENGTH 0x96 +#define R_97_A_HORIZ_INPUT_WINDOW_LENGTH_MSB 0x97 +#define R_98_A_VERT_INPUT_WINDOW_START 0x98 +#define R_99_A_VERT_INPUT_WINDOW_START_MSB 0x99 +#define R_9A_A_VERT_INPUT_WINDOW_LENGTH 0x9a +#define R_9B_A_VERT_INPUT_WINDOW_LENGTH_MSB 0x9b +#define R_9C_A_HORIZ_OUTPUT_WINDOW_LENGTH 0x9c +#define R_9D_A_HORIZ_OUTPUT_WINDOW_LENGTH_MSB 0x9d +#define R_9E_A_VERT_OUTPUT_WINDOW_LENGTH 0x9e +#define R_9F_A_VERT_OUTPUT_WINDOW_LENGTH_MSB 0x9f + /* FIR filtering and prescaling */ +#define R_A0_A_HORIZ_PRESCALING 0xa0 +#define R_A1_A_ACCUMULATION_LENGTH 0xa1 +#define R_A2_A_PRESCALER_DC_GAIN_AND_FIR_PREFILTER 0xa2 +#define R_A4_A_LUMA_BRIGHTNESS_CNTL 0xa4 +#define R_A5_A_LUMA_CONTRAST_CNTL 0xa5 +#define R_A6_A_CHROMA_SATURATION_CNTL 0xa6 + /* Horizontal phase scaling */ +#define R_A8_A_HORIZ_LUMA_SCALING_INC 0xa8 +#define R_A9_A_HORIZ_LUMA_SCALING_INC_MSB 0xa9 +#define R_AA_A_HORIZ_LUMA_PHASE_OFF 0xaa +#define R_AC_A_HORIZ_CHROMA_SCALING_INC 0xac +#define R_AD_A_HORIZ_CHROMA_SCALING_INC_MSB 0xad +#define R_AE_A_HORIZ_CHROMA_PHASE_OFF 0xae +#define R_AF_A_HORIZ_CHROMA_PHASE_OFF_MSB 0xaf + /* Vertical scaling */ +#define R_B0_A_VERT_LUMA_SCALING_INC 0xb0 +#define R_B1_A_VERT_LUMA_SCALING_INC_MSB 0xb1 +#define R_B2_A_VERT_CHROMA_SCALING_INC 0xb2 +#define R_B3_A_VERT_CHROMA_SCALING_INC_MSB 0xb3 +#define R_B4_A_VERT_SCALING_MODE_CNTL 0xb4 +#define R_B8_A_VERT_CHROMA_PHASE_OFF_00 0xb8 +#define R_B9_A_VERT_CHROMA_PHASE_OFF_01 0xb9 +#define R_BA_A_VERT_CHROMA_PHASE_OFF_10 0xba +#define R_BB_A_VERT_CHROMA_PHASE_OFF_11 0xbb +#define R_BC_A_VERT_LUMA_PHASE_OFF_00 0xbc +#define R_BD_A_VERT_LUMA_PHASE_OFF_01 0xbd +#define R_BE_A_VERT_LUMA_PHASE_OFF_10 0xbe +#define R_BF_A_VERT_LUMA_PHASE_OFF_11 0xbf + /* Task B definition */ + /* Basic settings and acquisition window definition */ +#define R_C0_B_TASK_HANDLING_CNTL 0xc0 +#define R_C1_B_X_PORT_FORMATS_AND_CONF 0xc1 +#define R_C2_B_INPUT_REFERENCE_SIGNAL_DEFINITION 0xc2 +#define R_C3_B_I_PORT_FORMATS_AND_CONF 0xc3 +#define R_C4_B_HORIZ_INPUT_WINDOW_START 0xc4 +#define R_C5_B_HORIZ_INPUT_WINDOW_START_MSB 0xc5 +#define R_C6_B_HORIZ_INPUT_WINDOW_LENGTH 0xc6 +#define R_C7_B_HORIZ_INPUT_WINDOW_LENGTH_MSB 0xc7 +#define R_C8_B_VERT_INPUT_WINDOW_START 0xc8 +#define R_C9_B_VERT_INPUT_WINDOW_START_MSB 0xc9 +#define R_CA_B_VERT_INPUT_WINDOW_LENGTH 0xca +#define R_CB_B_VERT_INPUT_WINDOW_LENGTH_MSB 0xcb +#define R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH 0xcc +#define R_CD_B_HORIZ_OUTPUT_WINDOW_LENGTH_MSB 0xcd +#define R_CE_B_VERT_OUTPUT_WINDOW_LENGTH 0xce +#define R_CF_B_VERT_OUTPUT_WINDOW_LENGTH_MSB 0xcf + /* FIR filtering and prescaling */ +#define R_D0_B_HORIZ_PRESCALING 0xd0 +#define R_D1_B_ACCUMULATION_LENGTH 0xd1 +#define R_D2_B_PRESCALER_DC_GAIN_AND_FIR_PREFILTER 0xd2 +#define R_D4_B_LUMA_BRIGHTNESS_CNTL 0xd4 +#define R_D5_B_LUMA_CONTRAST_CNTL 0xd5 +#define R_D6_B_CHROMA_SATURATION_CNTL 0xd6 + /* Horizontal phase scaling */ +#define R_D8_B_HORIZ_LUMA_SCALING_INC 0xd8 +#define R_D9_B_HORIZ_LUMA_SCALING_INC_MSB 0xd9 +#define R_DA_B_HORIZ_LUMA_PHASE_OFF 0xda +#define R_DC_B_HORIZ_CHROMA_SCALING 0xdc +#define R_DD_B_HORIZ_CHROMA_SCALING_MSB 0xdd +#define R_DE_B_HORIZ_PHASE_OFFSET_CRHOMA 0xde + /* Vertical scaling */ +#define R_E0_B_VERT_LUMA_SCALING_INC 0xe0 +#define R_E1_B_VERT_LUMA_SCALING_INC_MSB 0xe1 +#define R_E2_B_VERT_CHROMA_SCALING_INC 0xe2 +#define R_E3_B_VERT_CHROMA_SCALING_INC_MSB 0xe3 +#define R_E4_B_VERT_SCALING_MODE_CNTL 0xe4 +#define R_E8_B_VERT_CHROMA_PHASE_OFF_00 0xe8 +#define R_E9_B_VERT_CHROMA_PHASE_OFF_01 0xe9 +#define R_EA_B_VERT_CHROMA_PHASE_OFF_10 0xea +#define R_EB_B_VERT_CHROMA_PHASE_OFF_11 0xeb +#define R_EC_B_VERT_LUMA_PHASE_OFF_00 0xec +#define R_ED_B_VERT_LUMA_PHASE_OFF_01 0xed +#define R_EE_B_VERT_LUMA_PHASE_OFF_10 0xee +#define R_EF_B_VERT_LUMA_PHASE_OFF_11 0xef + +/* second PLL (PLL2) and Pulsegenerator Programming */ +#define R_F0_LFCO_PER_LINE 0xf0 +#define R_F1_P_I_PARAM_SELECT 0xf1 +#define R_F2_NOMINAL_PLL2_DTO 0xf2 +#define R_F3_PLL_INCREMENT 0xf3 +#define R_F4_PLL2_STATUS 0xf4 +#define R_F5_PULSGEN_LINE_LENGTH 0xf5 +#define R_F6_PULSE_A_POS_LSB_AND_PULSEGEN_CONFIG 0xf6 +#define R_F7_PULSE_A_POS_MSB 0xf7 +#define R_F8_PULSE_B_POS 0xf8 +#define R_F9_PULSE_B_POS_MSB 0xf9 +#define R_FA_PULSE_C_POS 0xfa +#define R_FB_PULSE_C_POS_MSB 0xfb +#define R_FF_S_PLL_MAX_PHASE_ERR_THRESH_NUM_LINES 0xff + +#if 0 +/* Those structs will be used in the future for debug purposes */ +struct saa711x_reg_descr { + u8 reg; + int count; + char *name; +}; + +struct saa711x_reg_descr saa711x_regs[] = { + /* REG COUNT NAME */ + {R_00_CHIP_VERSION,1, + "Chip version"}, + + /* Video Decoder: R_01_INC_DELAY to R_1F_STATUS_BYTE_2_VD_DEC */ + + /* Video Decoder - Frontend part: R_01_INC_DELAY to R_05_INPUT_CNTL_4 */ + {R_01_INC_DELAY,1, + "Increment delay"}, + {R_02_INPUT_CNTL_1,1, + "Analog input control 1"}, + {R_03_INPUT_CNTL_2,1, + "Analog input control 2"}, + {R_04_INPUT_CNTL_3,1, + "Analog input control 3"}, + {R_05_INPUT_CNTL_4,1, + "Analog input control 4"}, + + /* Video Decoder - Decoder part: R_06_H_SYNC_START to R_1F_STATUS_BYTE_2_VD_DEC */ + {R_06_H_SYNC_START,1, + "Horizontal sync start"}, + {R_07_H_SYNC_STOP,1, + "Horizontal sync stop"}, + {R_08_SYNC_CNTL,1, + "Sync control"}, + {R_09_LUMA_CNTL,1, + "Luminance control"}, + {R_0A_LUMA_BRIGHT_CNTL,1, + "Luminance brightness control"}, + {R_0B_LUMA_CONTRAST_CNTL,1, + "Luminance contrast control"}, + {R_0C_CHROMA_SAT_CNTL,1, + "Chrominance saturation control"}, + {R_0D_CHROMA_HUE_CNTL,1, + "Chrominance hue control"}, + {R_0E_CHROMA_CNTL_1,1, + "Chrominance control 1"}, + {R_0F_CHROMA_GAIN_CNTL,1, + "Chrominance gain control"}, + {R_10_CHROMA_CNTL_2,1, + "Chrominance control 2"}, + {R_11_MODE_DELAY_CNTL,1, + "Mode/delay control"}, + {R_12_RT_SIGNAL_CNTL,1, + "RT signal control"}, + {R_13_RT_X_PORT_OUT_CNTL,1, + "RT/X port output control"}, + {R_14_ANAL_ADC_COMPAT_CNTL,1, + "Analog/ADC/compatibility control"}, + {R_15_VGATE_START_FID_CHG, 1, + "VGATE start FID change"}, + {R_16_VGATE_STOP,1, + "VGATE stop"}, + {R_17_MISC_VGATE_CONF_AND_MSB, 1, + "Miscellaneous VGATE configuration and MSBs"}, + {R_18_RAW_DATA_GAIN_CNTL,1, + "Raw data gain control",}, + {R_19_RAW_DATA_OFF_CNTL,1, + "Raw data offset control",}, + {R_1A_COLOR_KILL_LVL_CNTL,1, + "Color Killer Level Control"}, + { R_1B_MISC_TVVCRDET, 1, + "MISC /TVVCRDET"}, + { R_1C_ENHAN_COMB_CTRL1, 1, + "Enhanced comb ctrl1"}, + { R_1D_ENHAN_COMB_CTRL2, 1, + "Enhanced comb ctrl1"}, + {R_1E_STATUS_BYTE_1_VD_DEC,1, + "Status byte 1 video decoder"}, + {R_1F_STATUS_BYTE_2_VD_DEC,1, + "Status byte 2 video decoder"}, + + /* Component processing and interrupt masking part: 0x20h to R_2F_INTERRUPT_MASK_3 */ + /* 0x20 to 0x22 - Reserved */ + {R_23_INPUT_CNTL_5,1, + "Analog input control 5"}, + {R_24_INPUT_CNTL_6,1, + "Analog input control 6"}, + {R_25_INPUT_CNTL_7,1, + "Analog input control 7"}, + /* 0x26 to 0x28 - Reserved */ + {R_29_COMP_DELAY,1, + "Component delay"}, + {R_2A_COMP_BRIGHT_CNTL,1, + "Component brightness control"}, + {R_2B_COMP_CONTRAST_CNTL,1, + "Component contrast control"}, + {R_2C_COMP_SAT_CNTL,1, + "Component saturation control"}, + {R_2D_INTERRUPT_MASK_1,1, + "Interrupt mask 1"}, + {R_2E_INTERRUPT_MASK_2,1, + "Interrupt mask 2"}, + {R_2F_INTERRUPT_MASK_3,1, + "Interrupt mask 3"}, + + /* Audio clock generator part: R_30_AUD_MAST_CLK_CYCLES_PER_FIELD to 0x3f */ + {R_30_AUD_MAST_CLK_CYCLES_PER_FIELD,3, + "Audio master clock cycles per field"}, + /* 0x33 - Reserved */ + {R_34_AUD_MAST_CLK_NOMINAL_INC,3, + "Audio master clock nominal increment"}, + /* 0x37 - Reserved */ + {R_38_CLK_RATIO_AMXCLK_TO_ASCLK,1, + "Clock ratio AMXCLK to ASCLK"}, + {R_39_CLK_RATIO_ASCLK_TO_ALRCLK,1, + "Clock ratio ASCLK to ALRCLK"}, + {R_3A_AUD_CLK_GEN_BASIC_SETUP,1, + "Audio clock generator basic setup"}, + /* 0x3b-0x3f - Reserved */ + + /* General purpose VBI data slicer part: R_40_SLICER_CNTL_1 to 0x7f */ + {R_40_SLICER_CNTL_1,1, + "Slicer control 1"}, + {R_41_LCR,23, + "R_41_LCR"}, + {R_58_PROGRAM_FRAMING_CODE,1, + "Programmable framing code"}, + {R_59_H_OFF_FOR_SLICER,1, + "Horizontal offset for slicer"}, + {R_5A_V_OFF_FOR_SLICER,1, + "Vertical offset for slicer"}, + {R_5B_FLD_OFF_AND_MSB_FOR_H_AND_V_OFF,1, + "Field offset and MSBs for horizontal and vertical offset"}, + {R_5D_DID,1, + "Header and data identification (R_5D_DID)"}, + {R_5E_SDID,1, + "Sliced data identification (R_5E_SDID) code"}, + {R_60_SLICER_STATUS_BYTE_0,1, + "Slicer status byte 0"}, + {R_61_SLICER_STATUS_BYTE_1,1, + "Slicer status byte 1"}, + {R_62_SLICER_STATUS_BYTE_2,1, + "Slicer status byte 2"}, + /* 0x63-0x7f - Reserved */ + + /* X port, I port and the scaler part: R_80_GLOBAL_CNTL_1 to R_EF_B_VERT_LUMA_PHASE_OFF_11 */ + /* Task independent global settings: R_80_GLOBAL_CNTL_1 to R_8F_STATUS_INFO_SCALER */ + {R_80_GLOBAL_CNTL_1,1, + "Global control 1"}, + {R_81_V_SYNC_FLD_ID_SRC_SEL_AND_RETIMED_V_F,1, + "Vertical sync and Field ID source selection, retimed V and F signals"}, + /* 0x82 - Reserved */ + {R_83_X_PORT_I_O_ENA_AND_OUT_CLK,1, + "X port I/O enable and output clock"}, + {R_84_I_PORT_SIGNAL_DEF,1, + "I port signal definitions"}, + {R_85_I_PORT_SIGNAL_POLAR,1, + "I port signal polarities"}, + {R_86_I_PORT_FIFO_FLAG_CNTL_AND_ARBIT,1, + "I port FIFO flag control and arbitration"}, + {R_87_I_PORT_I_O_ENA_OUT_CLK_AND_GATED, 1, + "I port I/O enable output clock and gated"}, + {R_88_POWER_SAVE_ADC_PORT_CNTL,1, + "Power save/ADC port control"}, + /* 089-0x8e - Reserved */ + {R_8F_STATUS_INFO_SCALER,1, + "Status information scaler part"}, + + /* Task A definition: R_90_A_TASK_HANDLING_CNTL to R_BF_A_VERT_LUMA_PHASE_OFF_11 */ + /* Task A: Basic settings and acquisition window definition */ + {R_90_A_TASK_HANDLING_CNTL,1, + "Task A: Task handling control"}, + {R_91_A_X_PORT_FORMATS_AND_CONF,1, + "Task A: X port formats and configuration"}, + {R_92_A_X_PORT_INPUT_REFERENCE_SIGNAL,1, + "Task A: X port input reference signal definition"}, + {R_93_A_I_PORT_OUTPUT_FORMATS_AND_CONF,1, + "Task A: I port output formats and configuration"}, + {R_94_A_HORIZ_INPUT_WINDOW_START,2, + "Task A: Horizontal input window start"}, + {R_96_A_HORIZ_INPUT_WINDOW_LENGTH,2, + "Task A: Horizontal input window length"}, + {R_98_A_VERT_INPUT_WINDOW_START,2, + "Task A: Vertical input window start"}, + {R_9A_A_VERT_INPUT_WINDOW_LENGTH,2, + "Task A: Vertical input window length"}, + {R_9C_A_HORIZ_OUTPUT_WINDOW_LENGTH,2, + "Task A: Horizontal output window length"}, + {R_9E_A_VERT_OUTPUT_WINDOW_LENGTH,2, + "Task A: Vertical output window length"}, + + /* Task A: FIR filtering and prescaling */ + {R_A0_A_HORIZ_PRESCALING,1, + "Task A: Horizontal prescaling"}, + {R_A1_A_ACCUMULATION_LENGTH,1, + "Task A: Accumulation length"}, + {R_A2_A_PRESCALER_DC_GAIN_AND_FIR_PREFILTER,1, + "Task A: Prescaler DC gain and FIR prefilter"}, + /* 0xa3 - Reserved */ + {R_A4_A_LUMA_BRIGHTNESS_CNTL,1, + "Task A: Luminance brightness control"}, + {R_A5_A_LUMA_CONTRAST_CNTL,1, + "Task A: Luminance contrast control"}, + {R_A6_A_CHROMA_SATURATION_CNTL,1, + "Task A: Chrominance saturation control"}, + /* 0xa7 - Reserved */ + + /* Task A: Horizontal phase scaling */ + {R_A8_A_HORIZ_LUMA_SCALING_INC,2, + "Task A: Horizontal luminance scaling increment"}, + {R_AA_A_HORIZ_LUMA_PHASE_OFF,1, + "Task A: Horizontal luminance phase offset"}, + /* 0xab - Reserved */ + {R_AC_A_HORIZ_CHROMA_SCALING_INC,2, + "Task A: Horizontal chrominance scaling increment"}, + {R_AE_A_HORIZ_CHROMA_PHASE_OFF,1, + "Task A: Horizontal chrominance phase offset"}, + /* 0xaf - Reserved */ + + /* Task A: Vertical scaling */ + {R_B0_A_VERT_LUMA_SCALING_INC,2, + "Task A: Vertical luminance scaling increment"}, + {R_B2_A_VERT_CHROMA_SCALING_INC,2, + "Task A: Vertical chrominance scaling increment"}, + {R_B4_A_VERT_SCALING_MODE_CNTL,1, + "Task A: Vertical scaling mode control"}, + /* 0xb5-0xb7 - Reserved */ + {R_B8_A_VERT_CHROMA_PHASE_OFF_00,1, + "Task A: Vertical chrominance phase offset '00'"}, + {R_B9_A_VERT_CHROMA_PHASE_OFF_01,1, + "Task A: Vertical chrominance phase offset '01'"}, + {R_BA_A_VERT_CHROMA_PHASE_OFF_10,1, + "Task A: Vertical chrominance phase offset '10'"}, + {R_BB_A_VERT_CHROMA_PHASE_OFF_11,1, + "Task A: Vertical chrominance phase offset '11'"}, + {R_BC_A_VERT_LUMA_PHASE_OFF_00,1, + "Task A: Vertical luminance phase offset '00'"}, + {R_BD_A_VERT_LUMA_PHASE_OFF_01,1, + "Task A: Vertical luminance phase offset '01'"}, + {R_BE_A_VERT_LUMA_PHASE_OFF_10,1, + "Task A: Vertical luminance phase offset '10'"}, + {R_BF_A_VERT_LUMA_PHASE_OFF_11,1, + "Task A: Vertical luminance phase offset '11'"}, + + /* Task B definition: R_C0_B_TASK_HANDLING_CNTL to R_EF_B_VERT_LUMA_PHASE_OFF_11 */ + /* Task B: Basic settings and acquisition window definition */ + {R_C0_B_TASK_HANDLING_CNTL,1, + "Task B: Task handling control"}, + {R_C1_B_X_PORT_FORMATS_AND_CONF,1, + "Task B: X port formats and configuration"}, + {R_C2_B_INPUT_REFERENCE_SIGNAL_DEFINITION,1, + "Task B: Input reference signal definition"}, + {R_C3_B_I_PORT_FORMATS_AND_CONF,1, + "Task B: I port formats and configuration"}, + {R_C4_B_HORIZ_INPUT_WINDOW_START,2, + "Task B: Horizontal input window start"}, + {R_C6_B_HORIZ_INPUT_WINDOW_LENGTH,2, + "Task B: Horizontal input window length"}, + {R_C8_B_VERT_INPUT_WINDOW_START,2, + "Task B: Vertical input window start"}, + {R_CA_B_VERT_INPUT_WINDOW_LENGTH,2, + "Task B: Vertical input window length"}, + {R_CC_B_HORIZ_OUTPUT_WINDOW_LENGTH,2, + "Task B: Horizontal output window length"}, + {R_CE_B_VERT_OUTPUT_WINDOW_LENGTH,2, + "Task B: Vertical output window length"}, + + /* Task B: FIR filtering and prescaling */ + {R_D0_B_HORIZ_PRESCALING,1, + "Task B: Horizontal prescaling"}, + {R_D1_B_ACCUMULATION_LENGTH,1, + "Task B: Accumulation length"}, + {R_D2_B_PRESCALER_DC_GAIN_AND_FIR_PREFILTER,1, + "Task B: Prescaler DC gain and FIR prefilter"}, + /* 0xd3 - Reserved */ + {R_D4_B_LUMA_BRIGHTNESS_CNTL,1, + "Task B: Luminance brightness control"}, + {R_D5_B_LUMA_CONTRAST_CNTL,1, + "Task B: Luminance contrast control"}, + {R_D6_B_CHROMA_SATURATION_CNTL,1, + "Task B: Chrominance saturation control"}, + /* 0xd7 - Reserved */ + + /* Task B: Horizontal phase scaling */ + {R_D8_B_HORIZ_LUMA_SCALING_INC,2, + "Task B: Horizontal luminance scaling increment"}, + {R_DA_B_HORIZ_LUMA_PHASE_OFF,1, + "Task B: Horizontal luminance phase offset"}, + /* 0xdb - Reserved */ + {R_DC_B_HORIZ_CHROMA_SCALING,2, + "Task B: Horizontal chrominance scaling"}, + {R_DE_B_HORIZ_PHASE_OFFSET_CRHOMA,1, + "Task B: Horizontal Phase Offset Chroma"}, + /* 0xdf - Reserved */ + + /* Task B: Vertical scaling */ + {R_E0_B_VERT_LUMA_SCALING_INC,2, + "Task B: Vertical luminance scaling increment"}, + {R_E2_B_VERT_CHROMA_SCALING_INC,2, + "Task B: Vertical chrominance scaling increment"}, + {R_E4_B_VERT_SCALING_MODE_CNTL,1, + "Task B: Vertical scaling mode control"}, + /* 0xe5-0xe7 - Reserved */ + {R_E8_B_VERT_CHROMA_PHASE_OFF_00,1, + "Task B: Vertical chrominance phase offset '00'"}, + {R_E9_B_VERT_CHROMA_PHASE_OFF_01,1, + "Task B: Vertical chrominance phase offset '01'"}, + {R_EA_B_VERT_CHROMA_PHASE_OFF_10,1, + "Task B: Vertical chrominance phase offset '10'"}, + {R_EB_B_VERT_CHROMA_PHASE_OFF_11,1, + "Task B: Vertical chrominance phase offset '11'"}, + {R_EC_B_VERT_LUMA_PHASE_OFF_00,1, + "Task B: Vertical luminance phase offset '00'"}, + {R_ED_B_VERT_LUMA_PHASE_OFF_01,1, + "Task B: Vertical luminance phase offset '01'"}, + {R_EE_B_VERT_LUMA_PHASE_OFF_10,1, + "Task B: Vertical luminance phase offset '10'"}, + {R_EF_B_VERT_LUMA_PHASE_OFF_11,1, + "Task B: Vertical luminance phase offset '11'"}, + + /* second PLL (PLL2) and Pulsegenerator Programming */ + { R_F0_LFCO_PER_LINE, 1, + "LFCO's per line"}, + { R_F1_P_I_PARAM_SELECT,1, + "P-/I- Param. Select., PLL Mode, PLL H-Src., LFCO's per line"}, + { R_F2_NOMINAL_PLL2_DTO,1, + "Nominal PLL2 DTO"}, + {R_F3_PLL_INCREMENT,1, + "PLL2 Increment"}, + {R_F4_PLL2_STATUS,1, + "PLL2 Status"}, + {R_F5_PULSGEN_LINE_LENGTH,1, + "Pulsgen. line length"}, + {R_F6_PULSE_A_POS_LSB_AND_PULSEGEN_CONFIG,1, + "Pulse A Position, Pulsgen Resync., Pulsgen. H-Src., Pulsgen. line length"}, + {R_F7_PULSE_A_POS_MSB,1, + "Pulse A Position"}, + {R_F8_PULSE_B_POS,2, + "Pulse B Position"}, + {R_FA_PULSE_C_POS,2, + "Pulse C Position"}, + /* 0xfc to 0xfe - Reserved */ + {R_FF_S_PLL_MAX_PHASE_ERR_THRESH_NUM_LINES,1, + "S_PLL max. phase, error threshold, PLL2 no. of lines, threshold"}, +}; +#endif diff --git a/drivers/media/video/saa7134/Kconfig b/drivers/media/video/saa7134/Kconfig index f554316..59da79c 100644 --- a/drivers/media/video/saa7134/Kconfig +++ b/drivers/media/video/saa7134/Kconfig @@ -41,53 +41,15 @@ config VIDEO_SAA7134_DVB select VIDEO_BUF_DVB select FW_LOADER select DVB_PLL + select DVB_MT352 if !DVB_FE_CUSTOMISE + select DVB_TDA1004X if !DVB_FE_CUSTOMISE + select DVB_NXT200X if !DVB_FE_CUSTOMISE + select DVB_TDA10086 if !DVB_FE_CUSTOMISE + select DVB_TDA826X if !DVB_FE_CUSTOMISE + select DVB_ISL6421 if !DVB_FE_CUSTOMISE ---help--- This adds support for DVB cards based on the Philips saa7134 chip. To compile this driver as a module, choose M here: the module will be called saa7134-dvb. - - You must also select one or more DVB demodulators. - If you are unsure which you need, choose all of them. - -config VIDEO_SAA7134_DVB_ALL_FRONTENDS - bool "Build all supported frontends for saa7134 based TV cards" - default y - depends on VIDEO_SAA7134_DVB - select DVB_MT352 - select DVB_TDA1004X - select DVB_NXT200X - ---help--- - This builds saa7134-dvb with all currently supported frontend - demodulators. If you wish to tweak your configuration, and - only include support for the hardware that you need, choose N here. - - If you are unsure, choose Y. - -config VIDEO_SAA7134_DVB_MT352 - bool "Zarlink MT352 DVB-T Support" - default y - depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS - select DVB_MT352 - ---help--- - This adds DVB-T support for cards based on the - Philips saa7134 chip and the MT352 demodulator. - -config VIDEO_SAA7134_DVB_TDA1004X - bool "Phillips TDA10045H/TDA10046H DVB-T Support" - default y - depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS - select DVB_TDA1004X - ---help--- - This adds DVB-T support for cards based on the - Philips saa7134 chip and the TDA10045H/TDA10046H demodulator. - -config VIDEO_SAA7134_DVB_NXT200X - bool "NXT2002/NXT2004 ATSC Support" - default y - depends on VIDEO_SAA7134_DVB && !VIDEO_SAA7134_DVB_ALL_FRONTENDS - select DVB_NXT200X - ---help--- - This adds ATSC 8VSB and QAM64/256 support for cards based on the - Philips saa7134 chip and the NXT2002/NXT2004 demodulator. diff --git a/drivers/media/video/saa7134/Makefile b/drivers/media/video/saa7134/Makefile index be7b9ee..89a1565 100644 --- a/drivers/media/video/saa7134/Makefile +++ b/drivers/media/video/saa7134/Makefile @@ -16,8 +16,5 @@ EXTRA_CFLAGS += -Idrivers/media/dvb/dvb-core EXTRA_CFLAGS += -Idrivers/media/dvb/frontends extra-cflags-$(CONFIG_VIDEO_BUF_DVB) += -DHAVE_VIDEO_BUF_DVB=1 -extra-cflags-$(CONFIG_DVB_MT352) += -DHAVE_MT352=1 -extra-cflags-$(CONFIG_DVB_TDA1004X) += -DHAVE_TDA1004X=1 -extra-cflags-$(CONFIG_DVB_NXT200X) += -DHAVE_NXT200X=1 EXTRA_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 d73cff1..a39e013 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) static int snd_card_saa7134_capture_close(struct snd_pcm_substream * substream) { + snd_card_saa7134_t *saa7134 = snd_pcm_substream_chip(substream); + struct saa7134_dev *dev = saa7134->dev; + + dev->ctl_mute = 1; + saa7134_tvaudio_setmute(dev); return 0; } @@ -631,6 +636,9 @@ static int snd_card_saa7134_capture_open(struct snd_pcm_substream * substream) runtime->private_free = snd_card_saa7134_runtime_free; runtime->hw = snd_card_saa7134_capture; + dev->ctl_mute = 0; + saa7134_tvaudio_setmute(dev); + if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0) return err; diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index 927413a..aa1db50 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[] = { }, }, [SAA7134_BOARD_FLYDVBT_DUO_CARDBUS] = { - .name = "LifeView/Typhoon FlyDVB-T Duo Cardbus", + .name = "LifeView/Typhoon/Genius FlyDVB-T Duo Cardbus", .audio_clock = 0x00200000, .tuner_type = TUNER_PHILIPS_TDA8290, .radio_type = UNSET, @@ -2891,6 +2891,80 @@ struct saa7134_board saa7134_boards[] = { .gpio = 0x8000, }, }, + [SAA7134_BOARD_MEDION_MD8800_QUADRO] = { + .name = "Medion Md8800 Quadro", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TDA8290, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .mpeg = SAA7134_MPEG_DVB, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 0, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + }, + [SAA7134_BOARD_FLYDVBS_LR300] = { + /* LifeView FlyDVB-s */ + /* Igor M. Liplianin <liplianin@tut.by> */ + .name = "LifeView FlyDVB-S /Acorp TV134DS", + .audio_clock = 0x00200000, + .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .mpeg = SAA7134_MPEG_DVB, + .inputs = {{ + .name = name_comp1, /* Composite input */ + .vmux = 3, + .amux = LINE1, + },{ + .name = name_svideo, /* S-Video signal on S-Video input */ + .vmux = 8, + .amux = LINE1, + }}, + }, + [SAA7134_BOARD_PROTEUS_2309] = { + .name = "Proteus Pro 2309", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = LINE2, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 0, + .amux = LINE2, + },{ + .name = name_comp2, + .vmux = 3, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + .mute = { + .name = name_mute, + .amux = LINE1, + }, + }, }; const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); @@ -3375,7 +3449,7 @@ struct pci_device_id saa7134_pci_tbl[] = { .driver_data = SAA7134_BOARD_FLYDVB_TRIO, },{ .vendor = PCI_VENDOR_ID_PHILIPS, - .device = PCI_DEVICE_ID_PHILIPS_SAA7134, /* SAA 7131E */ + .device = PCI_DEVICE_ID_PHILIPS_SAA7134, .subvendor = 0x1461, .subdevice = 0x2c05, .driver_data = SAA7134_BOARD_AVERMEDIA_777, @@ -3422,6 +3496,18 @@ struct pci_device_id saa7134_pci_tbl[] = { .subdevice = 0x0005, .driver_data = SAA7134_BOARD_MD7134_BRIDGE_2, },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7134, + .subvendor = 0x5168, + .subdevice = 0x0300, + .driver_data = SAA7134_BOARD_FLYDVBS_LR300, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7134, + .subvendor = 0x4e42, + .subdevice = 0x0300,/* LR300 */ + .driver_data = SAA7134_BOARD_FLYDVBS_LR300, + },{ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, .subvendor = 0x1489, @@ -3446,6 +3532,36 @@ struct pci_device_id saa7134_pci_tbl[] = { .subdevice = 0x3502, /* whats the difference to 0x3306 ?*/ .driver_data = SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS, },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x16be, + .subdevice = 0x0007, + .driver_data = SAA7134_BOARD_MEDION_MD8800_QUADRO, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x16be, + .subdevice = 0x0008, + .driver_data = SAA7134_BOARD_MEDION_MD8800_QUADRO, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1461, + .subdevice = 0x2c05, + .driver_data = SAA7134_BOARD_AVERMEDIA_777, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1489, + .subdevice = 0x0502, /* Cardbus version */ + .driver_data = SAA7134_BOARD_FLYDVBT_DUO_CARDBUS, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7130, + .subvendor = 0x0919, /* Philips Proteus PRO 2309 */ + .subdevice = 0x2003, + .driver_data = SAA7134_BOARD_PROTEUS_2309, + },{ /* --- boards without eeprom + subsystem ID --- */ .vendor = PCI_VENDOR_ID_PHILIPS, .device = PCI_DEVICE_ID_PHILIPS_SAA7134, @@ -3548,6 +3664,12 @@ int saa7134_board_init1(struct saa7134_dev *dev) case SAA7134_BOARD_SEDNA_PC_TV_CARDBUS: case SAA7134_BOARD_FLYDVBT_LR301: case SAA7134_BOARD_FLYDVBTDUO: + case SAA7134_BOARD_PROTEUS_2309: + dev->has_remote = SAA7134_REMOTE_GPIO; + break; + case SAA7134_BOARD_FLYDVBS_LR300: + saa_writeb(SAA7134_GPIO_GPMODE3, 0x80); + saa_writeb(SAA7134_GPIO_GPSTATUS2, 0x40); dev->has_remote = SAA7134_REMOTE_GPIO; break; case SAA7134_BOARD_MD5044: @@ -3732,6 +3854,7 @@ int saa7134_board_init2(struct saa7134_dev *dev) case SAA7134_BOARD_PHILIPS_TIGER: case SAA7134_BOARD_TEVION_DVBT_220RF: case SAA7134_BOARD_ASUSTeK_P7131_DUAL: + case SAA7134_BOARD_MEDION_MD8800_QUADRO: /* this is a hybrid board, initialize to analog mode * and configure firmware eeprom address */ diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index be3a81f..09aa62f 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, latency = 0x0A; } #endif - if (pci_pci_problems & PCIPCI_FAIL) { + if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL)) { printk(KERN_INFO "%s: quirk: this driver and your " "chipset may not work together" " 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 279828b..b688154 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -34,17 +34,14 @@ #include <media/v4l2-common.h> #include "dvb-pll.h" -#ifdef HAVE_MT352 -# include "mt352.h" -# include "mt352_priv.h" /* FIXME */ -#endif -#ifdef HAVE_TDA1004X -# include "tda1004x.h" -#endif -#ifdef HAVE_NXT200X -# include "nxt200x.h" -#endif - +#include "mt352.h" +#include "mt352_priv.h" /* FIXME */ +#include "tda1004x.h" +#include "nxt200x.h" + +#include "tda10086.h" +#include "tda826x.h" +#include "isl6421.h" MODULE_AUTHOR("Gerd Knorr <kraxel@bytesex.org> [SuSE Labs]"); MODULE_LICENSE("GPL"); @@ -54,8 +51,6 @@ module_param(antenna_pwr, int, 0444); MODULE_PARM_DESC(antenna_pwr,"enable antenna power (Pinnacle 300i)"); /* ------------------------------------------------------------------ */ - -#ifdef HAVE_MT352 static int pinnacle_antenna_pwr(struct saa7134_dev *dev, int on) { u32 ok; @@ -185,12 +180,8 @@ static struct mt352_config avermedia_777 = { .demod_address = 0xf, .demod_init = mt352_aver777_init, }; -#endif /* ------------------------------------------------------------------ */ - -#ifdef HAVE_TDA1004X - static int philips_tda6651_pll_set(u8 addr, struct dvb_frontend *fe, struct dvb_frontend_parameters *params) { struct saa7134_dev *dev = fe->dvb->priv; @@ -969,11 +960,58 @@ static struct tda1004x_config tevion_dvbt220rf_config = { .request_firmware = NULL, }; -#endif +/* ------------------------------------------------------------------ */ + +static int md8800_dvbt_analog_mode(struct dvb_frontend *fe) +{ + struct saa7134_dev *dev = fe->dvb->priv; + static u8 data[] = { 0x3c, 0x33, 0x68}; + struct i2c_msg msg = {.addr=0x08, .flags=0, .buf=data, .len = sizeof(data)}; + + i2c_transfer(&dev->i2c_adap, &msg, 1); + philips_tda827xa_tuner_sleep( 0x61, fe); + return 0; +} + +static int md8800_dvbt_pll_set(struct dvb_frontend *fe, struct dvb_frontend_parameters *params) +{ + int ret; + struct saa7134_dev *dev = fe->dvb->priv; + static u8 tda8290_close[] = { 0x21, 0xc0}; + static u8 tda8290_open[] = { 0x21, 0x80}; + struct i2c_msg tda8290_msg = {.addr = 0x4b,.flags = 0, .len = 2}; + /* close tda8290 i2c bridge */ + tda8290_msg.buf = tda8290_close; + ret = i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); + if (ret != 1) + return -EIO; + msleep(20); + ret = philips_tda827xa_pll_set(0x60, fe, params); + if (ret != 0) + return ret; + /* open tda8290 i2c bridge */ + tda8290_msg.buf = tda8290_open; + i2c_transfer(&dev->i2c_adap, &tda8290_msg, 1); + return ret; +} + +static struct tda1004x_config md8800_dvbt_config = { + .demod_address = 0x08, + .invert = 1, + .invert_oclk = 0, + .xtal_freq = TDA10046_XTAL_16M, + .agc_config = TDA10046_AGC_TDA827X, + .if_freq = TDA10046_FREQ_045, + .request_firmware = NULL, +}; + +static struct tda10086_config flydvbs = { + .demod_address = 0x0e, + .invert = 0, +}; /* ------------------------------------------------------------------ */ -#ifdef HAVE_NXT200X static struct nxt200x_config avertvhda180 = { .demod_address = 0x0a, }; @@ -991,7 +1029,6 @@ static struct nxt200x_config kworldatsc110 = { .demod_address = 0x0a, .set_pll_input = nxt200x_set_pll_input, }; -#endif /* ------------------------------------------------------------------ */ @@ -1009,29 +1046,26 @@ static int dvb_init(struct saa7134_dev *dev) dev); switch (dev->board) { -#ifdef HAVE_MT352 case SAA7134_BOARD_PINNACLE_300I_DVBT_PAL: printk("%s: pinnacle 300i dvb setup\n",dev->name); - dev->dvb.frontend = mt352_attach(&pinnacle_300i, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(mt352_attach, &pinnacle_300i, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.set_params = mt352_pinnacle_tuner_set_params; } break; - case SAA7134_BOARD_AVERMEDIA_777: printk("%s: avertv 777 dvb setup\n",dev->name); - dev->dvb.frontend = mt352_attach(&avermedia_777, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(mt352_attach, &avermedia_777, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.calc_regs = mt352_aver777_tuner_calc_regs; } break; -#endif -#ifdef HAVE_TDA1004X case SAA7134_BOARD_MD7134: - dev->dvb.frontend = tda10046_attach(&medion_cardbus, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &medion_cardbus, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = philips_fmd1216_tuner_init; dev->dvb.frontend->ops.tuner_ops.sleep = philips_fmd1216_tuner_sleep; @@ -1039,16 +1073,18 @@ static int dvb_init(struct saa7134_dev *dev) } break; case SAA7134_BOARD_PHILIPS_TOUGH: - dev->dvb.frontend = tda10046_attach(&philips_tu1216_60_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &philips_tu1216_60_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_tuner_60_init; dev->dvb.frontend->ops.tuner_ops.set_params = philips_tu1216_tuner_60_set_params; } break; case SAA7134_BOARD_FLYDVBTDUO: - dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &tda827x_lifeview_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; @@ -1056,8 +1092,9 @@ static int dvb_init(struct saa7134_dev *dev) } break; case SAA7134_BOARD_FLYDVBT_DUO_CARDBUS: - dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &tda827x_lifeview_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; @@ -1065,8 +1102,9 @@ static int dvb_init(struct saa7134_dev *dev) } break; case SAA7134_BOARD_PHILIPS_EUROPA: - dev->dvb.frontend = tda10046_attach(&philips_europa_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &philips_europa_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->original_demod_sleep = dev->dvb.frontend->ops.sleep; dev->dvb.frontend->ops.sleep = philips_europa_demod_sleep; @@ -1076,8 +1114,9 @@ static int dvb_init(struct saa7134_dev *dev) } break; case SAA7134_BOARD_VIDEOMATE_DVBT_300: - dev->dvb.frontend = tda10046_attach(&philips_europa_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &philips_europa_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = philips_europa_tuner_init; dev->dvb.frontend->ops.tuner_ops.sleep = philips_europa_tuner_sleep; @@ -1085,16 +1124,18 @@ static int dvb_init(struct saa7134_dev *dev) } break; case SAA7134_BOARD_VIDEOMATE_DVBT_200: - dev->dvb.frontend = tda10046_attach(&philips_tu1216_61_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &philips_tu1216_61_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = philips_tu1216_tuner_61_init; dev->dvb.frontend->ops.tuner_ops.set_params = philips_tu1216_tuner_61_set_params; } break; case SAA7134_BOARD_PHILIPS_TIGER: - dev->dvb.frontend = tda10046_attach(&philips_tiger_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &philips_tiger_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep; @@ -1102,8 +1143,9 @@ static int dvb_init(struct saa7134_dev *dev) } break; case SAA7134_BOARD_ASUSTeK_P7131_DUAL: - dev->dvb.frontend = tda10046_attach(&philips_tiger_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &philips_tiger_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; dev->dvb.frontend->ops.tuner_ops.sleep = philips_tiger_tuner_sleep; @@ -1111,8 +1153,9 @@ static int dvb_init(struct saa7134_dev *dev) } break; case SAA7134_BOARD_FLYDVBT_LR301: - dev->dvb.frontend = tda10046_attach(&tda827x_lifeview_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &tda827x_lifeview_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = philips_tda827x_tuner_init; dev->dvb.frontend->ops.tuner_ops.sleep = philips_tda827x_tuner_sleep; @@ -1120,16 +1163,18 @@ static int dvb_init(struct saa7134_dev *dev) } break; case SAA7134_BOARD_FLYDVB_TRIO: - dev->dvb.frontend = tda10046_attach(&lifeview_trio_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &lifeview_trio_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.sleep = lifeview_trio_tuner_sleep; dev->dvb.frontend->ops.tuner_ops.set_params = lifeview_trio_tuner_set_params; } break; case SAA7134_BOARD_ADS_DUO_CARDBUS_PTV331: - dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &ads_tech_duo_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = ads_duo_tuner_init; dev->dvb.frontend->ops.tuner_ops.sleep = ads_duo_tuner_sleep; @@ -1137,37 +1182,63 @@ static int dvb_init(struct saa7134_dev *dev) } break; case SAA7134_BOARD_TEVION_DVBT_220RF: - dev->dvb.frontend = tda10046_attach(&tevion_dvbt220rf_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &tevion_dvbt220rf_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.sleep = tevion_dvb220rf_tuner_sleep; dev->dvb.frontend->ops.tuner_ops.set_params = tevion_dvb220rf_tuner_set_params; } break; case SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS: - dev->dvb.frontend = tda10046_attach(&ads_tech_duo_config, - &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(tda10046_attach, + &ads_tech_duo_config, + &dev->i2c_adap); if (dev->dvb.frontend) { dev->dvb.frontend->ops.tuner_ops.init = ads_duo_tuner_init; dev->dvb.frontend->ops.tuner_ops.sleep = ads_duo_tuner_sleep; dev->dvb.frontend->ops.tuner_ops.set_params = ads_duo_tuner_set_params; } break; -#endif -#ifdef HAVE_NXT200X + case SAA7134_BOARD_MEDION_MD8800_QUADRO: + dev->dvb.frontend = tda10046_attach(&md8800_dvbt_config, + &dev->i2c_adap); + if (dev->dvb.frontend) { + dev->dvb.frontend->ops.tuner_ops.init = philips_tiger_tuner_init; + dev->dvb.frontend->ops.tuner_ops.sleep = md8800_dvbt_analog_mode; + dev->dvb.frontend->ops.tuner_ops.set_params = md8800_dvbt_pll_set; + } + break; case SAA7134_BOARD_AVERMEDIA_AVERTVHD_A180: - dev->dvb.frontend = nxt200x_attach(&avertvhda180, &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(nxt200x_attach, &avertvhda180, + &dev->i2c_adap); if (dev->dvb.frontend) { - dvb_pll_attach(dev->dvb.frontend, 0x61, &dev->i2c_adap, &dvb_pll_tdhu2); + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + NULL, &dvb_pll_tdhu2); } break; case SAA7134_BOARD_KWORLD_ATSC110: - dev->dvb.frontend = nxt200x_attach(&kworldatsc110, &dev->i2c_adap); + dev->dvb.frontend = dvb_attach(nxt200x_attach, &kworldatsc110, + &dev->i2c_adap); + if (dev->dvb.frontend) { + dvb_attach(dvb_pll_attach, dev->dvb.frontend, 0x61, + NULL, &dvb_pll_tuv1236d); + } + break; + case SAA7134_BOARD_FLYDVBS_LR300: + dev->dvb.frontend = dvb_attach(tda10086_attach, &flydvbs, + &dev->i2c_adap); if (dev->dvb.frontend) { - dvb_pll_attach(dev->dvb.frontend, 0x61, &dev->i2c_adap, &dvb_pll_tuv1236d); + if (dvb_attach(tda826x_attach, dev->dvb.frontend, 0x60, + &dev->i2c_adap, 0) == NULL) { + printk("%s: No tda826x found!\n", __FUNCTION__); + } + if (dvb_attach(isl6421_attach, dev->dvb.frontend, + &dev->i2c_adap, 0x08, 0, 0) == NULL) { + printk("%s: No ISL6421 found!\n", __FUNCTION__); + } } break; -#endif default: printk("%s: Huh? unknown DVB card?\n",dev->name); break; diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index 7c59549..f7ea857 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) mask_keyup = 0x400000; polling = 50; // ms break; + case SAA7134_BOARD_PROTEUS_2309: + ir_codes = ir_codes_proteus_2309; + mask_keycode = 0x00007F; + mask_keyup = 0x000080; + polling = 50; // ms + break; case SAA7134_BOARD_VIDEOMATE_DVBT_300: case SAA7134_BOARD_VIDEOMATE_DVBT_200: 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 0db53d1..d31220d 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) } EXPORT_SYMBOL(saa_dsp_writel); +EXPORT_SYMBOL(saa7134_tvaudio_setmute); /* ----------------------------------------------------------- */ /* diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index c04ce61..7db7b97 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -223,6 +223,9 @@ struct saa7134_format { #define SAA7134_BOARD_MD7134_BRIDGE_2 93 #define SAA7134_BOARD_FLYDVBT_HYBRID_CARDBUS 94 #define SAA7134_BOARD_FLYVIDEO3000_NTSC 95 +#define SAA7134_BOARD_MEDION_MD8800_QUADRO 96 +#define SAA7134_BOARD_FLYDVBS_LR300 97 +#define SAA7134_BOARD_PROTEUS_2309 98 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 8dab481..87ffb0e 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) } if ((t->tda9887_config & TDA9887_INTERCARRIER_NTSC) && (t->std & V4L2_STD_NTSC)) buf[1] &= ~cQSS; + if (t->tda9887_config & TDA9887_GATING_18) + buf[3] &= ~cGating_36; return 0; } diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index abe37cf..63db4e9 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c @@ -10,7 +10,7 @@ #include <media/v4l2-common.h> static int offset = 0; -module_param(offset, int, 0666); +module_param(offset, int, 0664); MODULE_PARM_DESC(offset,"Allows to specify an offset for tuner"); /* ---------------------------------------------------------------------- */ @@ -331,6 +331,8 @@ static void default_set_tv_freq(struct i2c_client *c, unsigned int freq) else if (params->default_top_high) config |= TDA9887_TOP(params->default_top_high); } + if (params->default_pll_gating_18) + config |= TDA9887_GATING_18; i2c_clients_command(c->adapter, TDA9887_SET_CONFIG, &config); } 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) buffer[3] = 0xa4; break; } - buffer[0] = (div>>8) & 0x7f; - buffer[1] = div & 0xff; if (params->cb_first_if_lower_freq && div < t->last_div) { buffer[0] = buffer[2]; buffer[1] = buffer[3]; diff --git a/drivers/media/video/tuner-types.c b/drivers/media/video/tuner-types.c index 8b54259..8fff642 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[] = { .count = ARRAY_SIZE(tuner_temic_4009f_5_pal_ranges), .has_tda9887 = 1, .port1_invert_for_secam_lc = 1, + .default_pll_gating_18 = 1, }, }; diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 936e3f7..fcaef4b 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -28,6 +28,7 @@ #include <linux/i2c-algo-bit.h> #include <linux/init.h> #include <linux/smp_lock.h> +#include <linux/kthread.h> #include <media/tvaudio.h> #include <media/v4l2-common.h> @@ -124,11 +125,8 @@ struct CHIPSTATE { int input; /* thread */ - pid_t tpid; - struct completion texit; - wait_queue_head_t wq; + struct task_struct *thread; struct timer_list wt; - int done; int watch_stereo; int audmode; }; @@ -264,28 +262,23 @@ static int chip_cmd(struct CHIPSTATE *chip, char *name, audiocmd *cmd) static void chip_thread_wake(unsigned long data) { struct CHIPSTATE *chip = (struct CHIPSTATE*)data; - wake_up_interruptible(&chip->wq); + wake_up_process(chip->thread); } static int chip_thread(void *data) { - DECLARE_WAITQUEUE(wait, current); struct CHIPSTATE *chip = data; struct CHIPDESC *desc = chiplist + chip->type; - daemonize("%s", chip->c.name); - allow_signal(SIGTERM); v4l_dbg(1, debug, &chip->c, "%s: thread started\n", chip->c.name); for (;;) { - add_wait_queue(&chip->wq, &wait); - if (!chip->done) { - set_current_state(TASK_INTERRUPTIBLE); + set_current_state(TASK_INTERRUPTIBLE); + if (!kthread_should_stop()) schedule(); - } - remove_wait_queue(&chip->wq, &wait); + set_current_state(TASK_RUNNING); try_to_freeze(); - if (chip->done || signal_pending(current)) + if (kthread_should_stop()) break; v4l_dbg(1, debug, &chip->c, "%s: thread wakeup\n", chip->c.name); @@ -301,7 +294,6 @@ static int chip_thread(void *data) } v4l_dbg(1, debug, &chip->c, "%s: thread exiting\n", chip->c.name); - complete_and_exit(&chip->texit, 0); return 0; } @@ -1536,19 +1528,18 @@ static int chip_attach(struct i2c_adapter *adap, int addr, int kind) chip_write(chip,desc->treblereg,desc->treblefunc(chip->treble)); } - chip->tpid = -1; + chip->thread = NULL; if (desc->checkmode) { /* start async thread */ init_timer(&chip->wt); chip->wt.function = chip_thread_wake; chip->wt.data = (unsigned long)chip; - init_waitqueue_head(&chip->wq); - init_completion(&chip->texit); - chip->tpid = kernel_thread(chip_thread,(void *)chip,0); - if (chip->tpid < 0) - v4l_warn(&chip->c, "%s: kernel_thread() failed\n", + chip->thread = kthread_run(chip_thread, chip, chip->c.name); + if (IS_ERR(chip->thread)) { + v4l_warn(&chip->c, "%s: failed to create kthread\n", chip->c.name); - wake_up_interruptible(&chip->wq); + chip->thread = NULL; + } } return 0; } @@ -1569,11 +1560,10 @@ static int chip_detach(struct i2c_client *client) struct CHIPSTATE *chip = i2c_get_clientdata(client); del_timer_sync(&chip->wt); - if (chip->tpid >= 0) { + if (chip->thread) { /* shutdown async thread */ - chip->done = 1; - wake_up_interruptible(&chip->wq); - wait_for_completion(&chip->texit); + kthread_stop(chip->thread); + chip->thread = NULL; } i2c_detach_client(&chip->c); diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index d95529e..cd1502a 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, tvee->tuner_formats |= hauppauge_tuner_fmt[i].id; t_fmt_name1[j++] = hauppauge_tuner_fmt[i].name; } + } + for (i = j = 0; i < 8; i++) { if (t_format2 & (1 << i)) { tvee->tuner2_formats |= hauppauge_tuner_fmt[i].id; t_fmt_name2[j++] = hauppauge_tuner_fmt[i].name; diff --git a/drivers/media/video/tvp5150.c b/drivers/media/video/tvp5150.c index b167ffa..bc0a4fc 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) if ((decoder->route.output & TVP5150_BLACK_SCREEN) || !decoder->enable) input = 8; - switch (input) { + switch (decoder->route.input) { case TVP5150_COMPOSITE1: input |= 2; /* fall through */ @@ -308,6 +308,11 @@ static inline void tvp5150_selmux(struct i2c_client *c) break; } + tvp5150_dbg( 1, "Selecting video route: route input=%i, output=%i " + "=> tvp5150 input=%i, opmode=%i\n", + decoder->route.input,decoder->route.output, + input, opmode ); + tvp5150_write(c, TVP5150_OP_MODE_CTL, opmode); tvp5150_write(c, TVP5150_VD_IN_SRC_SEL_1, input); }; diff --git a/drivers/media/video/usbvideo/konicawc.c b/drivers/media/video/usbvideo/konicawc.c index 6f31ecc..4eee8be 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) static void konicawc_register_input(struct konicawc *cam, struct usb_device *dev) { struct input_dev *input_dev; + int error; usb_make_path(dev, cam->input_physname, sizeof(cam->input_physname)); 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 input_dev->private = cam; - input_register_device(cam->input); + error = input_register_device(cam->input); + if (error) { + warn("Failed to register camera's input device, err: %d\n", + error); + input_free_device(cam->input); + cam->input = NULL; + } } static void konicawc_unregister_input(struct konicawc *cam) diff --git a/drivers/media/video/usbvideo/vicam.c b/drivers/media/video/usbvideo/vicam.c index 90d48e8..08f9559 100644 --- a/drivers/media/video/usbvideo/vicam.c +++ b/drivers/media/video/usbvideo/vicam.c @@ -7,6 +7,7 @@ * Monroe Williams (monroe@pobox.com) * * Supports 3COM HomeConnect PC Digital WebCam + * Supports Compro PS39U WebCam * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by @@ -60,6 +61,8 @@ /* Define these values to match your device */ #define USB_VICAM_VENDOR_ID 0x04c1 #define USB_VICAM_PRODUCT_ID 0x009d +#define USB_COMPRO_VENDOR_ID 0x0602 +#define USB_COMPRO_PRODUCT_ID 0x1001 #define VICAM_BYTES_PER_PIXEL 3 #define VICAM_MAX_READ_SIZE (512*242+128) @@ -1254,6 +1257,7 @@ static struct video_device vicam_template = { /* table of devices that work with this driver */ static struct usb_device_id vicam_table[] = { {USB_DEVICE(USB_VICAM_VENDOR_ID, USB_VICAM_PRODUCT_ID)}, + {USB_DEVICE(USB_COMPRO_VENDOR_ID, USB_COMPRO_PRODUCT_ID)}, {} /* Terminating entry */ }; diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index d7c3fcb..1d899e2 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, { struct video_buffer *buffer = arg; + memset(buffer, 0, sizeof(*buffer)); + err = drv(inode, file, VIDIOC_G_FBUF, &fbuf2); if (err < 0) { dprintk("VIDIOCGFBUF / VIDIOC_G_FBUF: %d\n",err); @@ -361,7 +363,7 @@ v4l_compat_translate_ioctl(struct inode *inode, switch (fbuf2.fmt.pixelformat) { case V4L2_PIX_FMT_RGB332: buffer->depth = 8; - break; + break; case V4L2_PIX_FMT_RGB555: buffer->depth = 15; break; @@ -377,9 +379,13 @@ v4l_compat_translate_ioctl(struct inode *inode, default: buffer->depth = 0; } - if (0 != fbuf2.fmt.bytesperline) + if (fbuf2.fmt.bytesperline) { buffer->bytesperline = fbuf2.fmt.bytesperline; - else { + if (!buffer->depth && buffer->width) + buffer->depth = ((fbuf2.fmt.bytesperline<<3) + + (buffer->width-1) ) + /buffer->width; + } else { buffer->bytesperline = (buffer->width * buffer->depth + 7) & 7; buffer->bytesperline >>= 3; diff --git a/drivers/media/video/v4l2-common.c b/drivers/media/video/v4l2-common.c index 8d972ff..78d28b0 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) case VIDIOC_INT_AUDIO_CLOCK_FREQ: case VIDIOC_INT_I2S_CLOCK_FREQ: case VIDIOC_INT_S_STANDBY: + case VIDIOC_INT_RESET: { u32 *p=arg; diff --git a/drivers/media/video/video-buf-dvb.c b/drivers/media/video/video-buf-dvb.c index 7ee8a53..f53edf1 100644 --- a/drivers/media/video/video-buf-dvb.c +++ b/drivers/media/video/video-buf-dvb.c @@ -223,6 +223,7 @@ fail_dmxdev: fail_dmx: dvb_unregister_frontend(dvb->frontend); fail_frontend: + dvb_frontend_detach(dvb->frontend); dvb_unregister_adapter(&dvb->adapter); fail_adapter: return result; @@ -236,6 +237,7 @@ void videobuf_dvb_unregister(struct videobuf_dvb *dvb) dvb_dmxdev_release(&dvb->dmxdev); dvb_dmx_release(&dvb->demux); dvb_unregister_frontend(dvb->frontend); + dvb_frontend_detach(dvb->frontend); dvb_unregister_adapter(&dvb->adapter); } diff --git a/drivers/media/video/videodev.c b/drivers/media/video/videodev.c index edd7b83..479a067 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, case VIDIOC_DQBUF: { struct v4l2_buffer *p=arg; - if (!vfd->vidioc_qbuf) + if (!vfd->vidioc_dqbuf) break; ret = check_fmt (vfd, p->type); if (ret) break; - ret=vfd->vidioc_qbuf(file, fh, p); + ret=vfd->vidioc_dqbuf(file, fh, p); if (!ret) dbgbuf(cmd,vfd,p); break; @@ -836,7 +836,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, break; } - if (index < 0 || index >= vfd->tvnormsize) { + if (index<0 || index >= vfd->tvnormsize) { ret=-EINVAL; break; } @@ -1283,9 +1283,29 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, case VIDIOC_G_PARM: { struct v4l2_streamparm *p=arg; - if (!vfd->vidioc_g_parm) - break; - ret=vfd->vidioc_g_parm(file, fh, p); + if (vfd->vidioc_g_parm) { + ret=vfd->vidioc_g_parm(file, fh, p); + } else { + struct v4l2_standard s; + + if (!vfd->tvnormsize) { + printk (KERN_WARNING "%s: no TV norms defined!\n", + vfd->name); + break; + } + + if (p->type != V4L2_BUF_TYPE_VIDEO_CAPTURE) + return -EINVAL; + + v4l2_video_std_construct(&s, vfd->tvnorms[vfd->current_norm].id, + vfd->tvnorms[vfd->current_norm].name); + + memset(p,0,sizeof(*p)); + + p->parm.capture.timeperframe = s.frameperiod; + ret=0; + } + dbgarg (cmd, "type=%d\n", p->type); break; } diff --git a/drivers/media/video/vino.c b/drivers/media/video/vino.c index 268e69f..d1e04f7 100644 --- a/drivers/media/video/vino.c +++ b/drivers/media/video/vino.c @@ -4404,7 +4404,6 @@ static struct video_device v4l_device_template = { .name = "NOT SET", //.type = VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE | // VID_TYPE_CLIPPING | VID_TYPE_SCALES, VID_TYPE_OVERLAY - .hardware = VID_HARDWARE_VINO, .fops = &vino_fops, .minor = -1, }; diff --git a/drivers/media/video/vivi.c b/drivers/media/video/vivi.c index 841884a..e7c01d5 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) struct vivi_fh *fh=priv; struct videobuf_queue *q=&fh->vb_vidq; struct v4l2_requestbuffers req; - unsigned int i, ret; + unsigned int i; + int ret; req.type = q->type; req.count = 8; @@ -1359,6 +1360,8 @@ static int __init vivi_init(void) dev->vidq.timeout.data = (unsigned long)dev; init_timer(&dev->vidq.timeout); + vivi.current_norm = tvnorms[0].id; + ret = video_register_device(&vivi, VFL_TYPE_GRABBER, video_nr); printk(KERN_INFO "Video Technology Magazine Virtual Video Capture Board (Load status: %d)\n", ret); return ret; diff --git a/drivers/media/video/vpx3220.c b/drivers/media/video/vpx3220.c index 1eca7e6..8ef31ed 100644 --- a/drivers/media/video/vpx3220.c +++ b/drivers/media/video/vpx3220.c @@ -744,6 +744,6 @@ vpx3220_cleanup (void) module_init(vpx3220_init); module_exit(vpx3220_cleanup); -MODULE_DESCRIPTION("vpx3220a/vpx3216b/vpx3214c video encoder driver"); +MODULE_DESCRIPTION("vpx3220a/vpx3216b/vpx3214c video decoder driver"); MODULE_AUTHOR("Laurent Pinchart"); MODULE_LICENSE("GPL"); diff --git a/drivers/media/video/zoran_card.c b/drivers/media/video/zoran_card.c index 29f59c3..9f21d0b 100644 --- a/drivers/media/video/zoran_card.c +++ b/drivers/media/video/zoran_card.c @@ -1620,10 +1620,10 @@ init_dc10_cards (void) dprintk(5, KERN_DEBUG "Jotti is een held!\n"); /* some mainboards might not do PCI-PCI data transfer well */ - if (pci_pci_problems & PCIPCI_FAIL) { + if (pci_pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL|PCIPCI_ALIMAGIK)) { dprintk(1, KERN_WARNING - "%s: chipset may not support reliable PCI-PCI DMA\n", + "%s: chipset does not support reliable PCI-PCI DMA\n", ZORAN_NAME); } @@ -1631,7 +1631,7 @@ init_dc10_cards (void) for (i = 0; i < zoran_num; i++) { struct zoran *zr = &zoran[i]; - if (pci_pci_problems & PCIPCI_NATOMA && zr->revision <= 1) { + if ((pci_pci_problems & PCIPCI_NATOMA) && zr->revision <= 1) { zr->jpg_buffers.need_contiguous = 1; dprintk(1, KERN_INFO diff --git a/drivers/media/video/zoran_driver.c b/drivers/media/video/zoran_driver.c index 5f90db2..862a984 100644 --- a/drivers/media/video/zoran_driver.c +++ b/drivers/media/video/zoran_driver.c @@ -1512,6 +1512,13 @@ setup_fbuffer (struct file *file, if (!capable(CAP_SYS_ADMIN) && !capable(CAP_SYS_RAWIO)) return -EPERM; + /* Don't allow frame buffer overlay if PCI or AGP is buggy, or on + ALi Magik (that needs very low latency while the card needs a + higher value always) */ + + if (pci_pci_problems & (PCIPCI_FAIL | PCIAGP_FAIL | PCIPCI_ALIMAGIK)) + return -ENXIO; + /* we need a bytesperline value, even if not given */ if (!bytesperline) bytesperline = width * ((fmt->depth + 7) & ~7) / 8; diff --git a/drivers/media/video/zr36120.c b/drivers/media/video/zr36120.c index 5043738..9240638 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) VID_TYPE_SCALES; if (ztv->have_tuner) c.type |= VID_TYPE_TUNER; + if (pci_problems & (PCIPCI_FAIL|PCIAGP_FAIL)) + c.type &= ~VID_TYPE_OVERLAY; if (ztv->have_decoder) { c.channels = ztv->card->video_inputs; c.audios = ztv->card->audio_inputs; @@ -1284,6 +1286,8 @@ int zoran_ioctl(struct video_device* dev, unsigned int cmd, void *arg) struct video_buffer v; if(!capable(CAP_SYS_ADMIN)) return -EPERM; + if (pcipci_problems & (PCIPCI_FAIL|PCIAGP_FAIL)) + return -ENXIO; if (copy_from_user(&v, arg,sizeof(v))) return -EFAULT; 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) /* free it */ free_irq(ztv->dev->irq,ztv); - /* unregister i2c_bus */ + /* unregister i2c_bus */ i2c_unregister_bus((&ztv->i2c)); /* unmap and free memory */ |