v4l: cx88 driver update
PATCH 1/1 v4l: cx88 driver update
Hi,
Finally the big cx88 driver update which makes the cx88-dvb driver compile and work for some cards. A number of changes accumulated over time ...
* various new tv cards added / fixed.
* added support for infrared remote controls.
* some fixes in the blackbird (mpeg encoder) driver, starts working now.
* configurarion for analog hauppauge cards now uses the tveeprom module.
* kconfig fixups.
* powermanagement fixups.
* lot of tweaks for tv audio (make NICAM decoding work).
* lot of changes in the dvb driver, still not working for all cards though as some more changes in the dvb subsystem are needed.
--- drivers/media/video/Kconfig | 10 drivers/media/video/cx88/Makefile | 3 drivers/media/video/cx88/cx88-blackbird.c | 27 - drivers/media/video/cx88/cx88-cards.c | 393 ++++++++++--------- drivers/media/video/cx88/cx88-core.c | 42 +- drivers/media/video/cx88/cx88-dvb.c | 185 +++++--- drivers/media/video/cx88/cx88-i2c.c | 3 drivers/media/video/cx88/cx88-input.c | 396 +++++++++++++++++++ drivers/media/video/cx88/cx88-mpeg.c | 44 +- drivers/media/video/cx88/cx88-tvaudio.c | 455 +++++++++++++++------- drivers/media/video/cx88/cx88-vbi.c | 5 drivers/media/video/cx88/cx88-video.c | 34 - drivers/media/video/cx88/cx88.h | 38 + 13 files changed, 1189 insertions(+), 446 deletions(-)
drivers/media/video/cx88/cx88-cards.c +226 -167
@@ -1,5 +1,5 @@/* -* $Id: cx88-cards.c,v 1.47 2004/11/03 09:04:50 kraxel Exp $ +* $Id: cx88-cards.c,v 1.66 2005/03/04 09:12:23 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * card-specific stuff.
@@ -26,14 +26,7 @@#include <linux/pci.h> #include <linux/delay.h> -#if defined(CONFIG_VIDEO_CX88_DVB ) || defined(CONFIG_VIDEO_CX88_DVB_MODULE ) -# define WITH_DVB 1 -#endif -#include "cx88.h" -#ifdef WITH_DVB -#include "cx22702.h" -#endif /* ------------------------------------------------------------------ */ /* board config info */
@@ -59,6 +52,7 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_HAUPPAUGE] = { .name = "Hauppauge WinTV 34xxx models", .tuner_type = UNSET, + .tda9887_conf = TDA9887_PRESENT, .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0,
@@ -91,7 +85,7 @@ struct cx88_board cx88_boards[] = { }, [CX88_BOARD_PIXELVIEW] = { .name = "PixelView", - .tuner_type = UNSET, + .tuner_type = 5, .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0,
@@ -126,7 +120,7 @@ struct cx88_board cx88_boards[] = { .gpio0 = 0x03fe, }}, }, - [CX88_BOARD_WINFAST2000XP] = { + [CX88_BOARD_WINFAST2000XP_EXPERT] = { .name = "Leadtek Winfast 2000XP Expert", .tuner_type = 44, .tda9887_conf = TDA9887_PRESENT,
@@ -217,26 +211,55 @@ struct cx88_board cx88_boards[] = { .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, - }}, + .gpio0 = 0x0035e700, + .gpio1 = 0x00003004, + .gpio2 = 0x0035e700, + .gpio3 = 0x02000000, + },{ + + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x0035c700, + .gpio1 = 0x00003004, + .gpio2 = 0x0035c700, + .gpio3 = 0x02000000, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x0035c700, + .gpio1 = 0x0035c700, + .gpio2 = 0x02000000, + .gpio3 = 0x02000000, + }}, .radio = { - .type = CX88_RADIO, - }, + .type = CX88_RADIO, + .gpio0 = 0x0035d700, + .gpio1 = 0x00007004, + .gpio2 = 0x0035d700, + .gpio3 = 0x02000000, + }, }, [CX88_BOARD_LEADTEK_PVR2000] = { + // gpio values for PAL version from regspy by DScaler .name = "Leadtek PVR 2000", .tuner_type = 38, + .tda9887_conf = TDA9887_PRESENT, .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, + .gpio0 = 0x0000bde6, },{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, + .gpio0 = 0x0000bde6, },{ .type = CX88_VMUX_SVIDEO, .vmux = 2, + .gpio0 = 0x0000bde6, }}, .radio = { .type = CX88_RADIO, + .gpio0 = 0x0000bd62, }, .blackbird = 1, },
@@ -320,14 +343,15 @@ struct cx88_board cx88_boards[] = { .name = "KWorld/VStream XPert DVB-T", .tuner_type = TUNER_ABSENT, .input = {{ - .type = CX88_VMUX_DVB, - .vmux = 0, - },{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, + .gpio0 = 0x0700, + .gpio2 = 0x0101, },{ .type = CX88_VMUX_SVIDEO, .vmux = 2, + .gpio0 = 0x0700, + .gpio2 = 0x0101, }}, .dvb = 1, },
@@ -452,6 +476,131 @@ struct cx88_board cx88_boards[] = { }}, .dvb = 1, }, + [CX88_BOARD_DNTV_LIVE_DVB_T] = { + .name = "digitalnow DNTV Live! DVB-T", + .tuner_type = TUNER_ABSENT, + .input = {{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x00000700, + .gpio2 = 0x00000101, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x00000700, + .gpio2 = 0x00000101, + }}, + .dvb = 1, + }, + [CX88_BOARD_PCHDTV_HD3000] = { + .name = "pcHDTV HD3000 HDTV", + .tuner_type = TUNER_THOMSON_DTT7610, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x00008484, + .gpio1 = 0x00000000, + .gpio2 = 0x00000000, + .gpio3 = 0x00000000, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x00008400, + .gpio1 = 0x00000000, + .gpio2 = 0x00000000, + .gpio3 = 0x00000000, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x00008400, + .gpio1 = 0x00000000, + .gpio2 = 0x00000000, + .gpio3 = 0x00000000, + }}, + .radio = { + .type = CX88_RADIO, + .vmux = 2, + .gpio0 = 0x00008400, + .gpio1 = 0x00000000, + .gpio2 = 0x00000000, + .gpio3 = 0x00000000, + }, + .dvb = 1, + }, + [CX88_BOARD_HAUPPAUGE_ROSLYN] = { + // entry added by Kaustubh D. Bhalerao <[email protected]> + // GPIO values obtained from regspy, courtesy Sean Covel + .name = "Hauppauge WinTV 28xxx (Roslyn) models", + .tuner_type = UNSET, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0xed12, // internal decoder + .gpio2 = 0x00ff, + },{ + .type = CX88_VMUX_DEBUG, + .vmux = 0, + .gpio0 = 0xff01, // mono from tuner chip + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0xff02, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0xed92, + .gpio2 = 0x00ff, + }}, + .radio = { + .type = CX88_RADIO, + .gpio0 = 0xed96, + .gpio2 = 0x00ff, + }, + .blackbird = 1, + }, + [CX88_BOARD_DIGITALLOGIC_MEC] = { + /* params copied over from Leadtek PVR 2000 */ + .name = "Digital-Logic MICROSPACE Entertainment Center (MEC)", + /* not sure yet about the tuner type */ + .tuner_type = 38, + .tda9887_conf = TDA9887_PRESENT, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x0000bde6, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x0000bde6, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x0000bde6, + }}, + .radio = { + .type = CX88_RADIO, + .gpio0 = 0x0000bd62, + }, + .blackbird = 1, + }, + [CX88_BOARD_IODATA_GVBCTV7E] = { + .name = "IODATA GV/BCTV7E", + .tuner_type = TUNER_PHILIPS_FQ1286, + .tda9887_conf = TDA9887_PRESENT, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 1, + .gpio1 = 0x0000e03f, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 2, + .gpio1 = 0x0000e07f, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 3, + .gpio1 = 0x0000e07f, + }} + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards);
@@ -482,11 +631,11 @@ struct cx88_subid cx88_subids[] = { },{ .subvendor = 0x107d, .subdevice = 0x6611, - .card = CX88_BOARD_WINFAST2000XP, + .card = CX88_BOARD_WINFAST2000XP_EXPERT, },{ .subvendor = 0x107d, .subdevice = 0x6613, /* NTSC */ - .card = CX88_BOARD_WINFAST2000XP, + .card = CX88_BOARD_WINFAST2000XP_EXPERT, },{ .subvendor = 0x107d, .subdevice = 0x6620,
@@ -543,6 +692,30 @@ struct cx88_subid cx88_subids[] = { .subvendor = 0x18AC, .subdevice = 0xDB10, .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS, + },{ + .subvendor = 0x1554, + .subdevice = 0x4811, + .card = CX88_BOARD_PIXELVIEW, + },{ + .subvendor = 0x7063, + .subdevice = 0x3000, /* HD-3000 card */ + .card = CX88_BOARD_PCHDTV_HD3000, + },{ + .subvendor = 0x17DE, + .subdevice = 0xA8A6, + .card = CX88_BOARD_DNTV_LIVE_DVB_T, + },{ + .subvendor = 0x0070, + .subdevice = 0x2801, + .card = CX88_BOARD_HAUPPAUGE_ROSLYN, + },{ + .subvendor = 0x14F1, + .subdevice = 0x0342, + .card = CX88_BOARD_DIGITALLOGIC_MEC, + },{ + .subvendor = 0x10fc, + .subdevice = 0xd035, + .card = CX88_BOARD_IODATA_GVBCTV7E, } }; const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids);
@@ -552,7 +725,7 @@ const unsigned int cx88_idcount = ARRAY_static void __devinit leadtek_eeprom (struct cx88_core *core,u8 *eeprom_data) { -/* This is just for the Winfast 2000 XP board ATM; I don't have data on +/* This is just for the "Winfast 2000XP Expert" board ATM; I don't have data on * any others. * * Byte 0 is 1 on the NTSC board.
@@ -569,108 +742,27 @@ static void __devinit leadtek_eeprom(str core->has_radio =1 ; core->tuner_type = (eeprom_data[6 ] ==0x13 ) ?43 :38 ; -printk (KERN_INFO "%s: Leadtek Winfast 2000 XP config: " +printk (KERN_INFO "%s: Leadtek Winfast 2000XP Expert config: " "tuner=%d, eeprom[0]=0x%02x\n" , core->name, core->tuner_type, eeprom_data[0 ]); }/* ----------------------------------------------------------------------- */ -/* some hauppauge specific stuff */ - -static struct { -int id; -char *name; -} hauppauge_tuner[]__devinitdata = { - {TUNER_ABSENT ,"" }, - {TUNER_ABSENT ,"External" }, - {TUNER_ABSENT ,"Unspecified" }, - {TUNER_PHILIPS_PAL ,"Philips FI1216" }, - {TUNER_PHILIPS_SECAM ,"Philips FI1216MF" }, - {TUNER_PHILIPS_NTSC ,"Philips FI1236" }, - {TUNER_PHILIPS_PAL_I ,"Philips FI1246" }, - {TUNER_PHILIPS_PAL_DK ,"Philips FI1256" }, - {TUNER_PHILIPS_PAL ,"Philips FI1216 MK2" }, - {TUNER_PHILIPS_SECAM ,"Philips FI1216MF MK2" }, - {TUNER_PHILIPS_NTSC ,"Philips FI1236 MK2" }, - {TUNER_PHILIPS_PAL_I ,"Philips FI1246 MK2" }, - {TUNER_PHILIPS_PAL_DK ,"Philips FI1256 MK2" }, - {TUNER_TEMIC_NTSC ,"Temic 4032FY5" }, - {TUNER_TEMIC_PAL ,"Temic 4002FH5" }, - {TUNER_TEMIC_PAL_I ,"Temic 4062FY5" }, - {TUNER_PHILIPS_PAL ,"Philips FR1216 MK2" }, - {TUNER_PHILIPS_SECAM ,"Philips FR1216MF MK2" }, - {TUNER_PHILIPS_NTSC ,"Philips FR1236 MK2" }, - {TUNER_PHILIPS_PAL_I ,"Philips FR1246 MK2" }, - {TUNER_PHILIPS_PAL_DK ,"Philips FR1256 MK2" }, - {TUNER_PHILIPS_PAL ,"Philips FM1216" }, - {TUNER_PHILIPS_SECAM ,"Philips FM1216MF" }, - {TUNER_PHILIPS_NTSC ,"Philips FM1236" }, - {TUNER_PHILIPS_PAL_I ,"Philips FM1246" }, - {TUNER_PHILIPS_PAL_DK ,"Philips FM1256" }, - {TUNER_TEMIC_4036FY5_NTSC ,"Temic 4036FY5" }, - {TUNER_ABSENT ,"Samsung TCPN9082D" }, - {TUNER_ABSENT ,"Samsung TCPM9092P" }, - {TUNER_TEMIC_4006FH5_PAL ,"Temic 4006FH5" }, - {TUNER_ABSENT ,"Samsung TCPN9085D" }, - {TUNER_ABSENT ,"Samsung TCPB9085P" }, - {TUNER_ABSENT ,"Samsung TCPL9091P" }, - {TUNER_TEMIC_4039FR5_NTSC ,"Temic 4039FR5" }, - {TUNER_PHILIPS_FQ1216ME ,"Philips FQ1216 ME" }, - {TUNER_TEMIC_4066FY5_PAL_I ,"Temic 4066FY5" }, - {TUNER_PHILIPS_NTSC ,"Philips TD1536" }, - {TUNER_PHILIPS_NTSC ,"Philips TD1536D" }, - {TUNER_PHILIPS_NTSC ,"Philips FMR1236" },/* mono radio */ - {TUNER_ABSENT ,"Philips FI1256MP" }, - {TUNER_ABSENT ,"Samsung TCPQ9091P" }, - {TUNER_TEMIC_4006FN5_MULTI_PAL ,"Temic 4006FN5" }, - {TUNER_TEMIC_4009FR5_PAL ,"Temic 4009FR5" }, - {TUNER_TEMIC_4046FM5 ,"Temic 4046FM5" }, - {TUNER_TEMIC_4009FN5_MULTI_PAL_FM ,"Temic 4009FN5" }, - {TUNER_ABSENT ,"Philips TD1536D_FH_44" }, - {TUNER_LG_NTSC_FM ,"LG TPI8NSR01F" }, - {TUNER_LG_PAL_FM ,"LG TPI8PSB01D" }, - {TUNER_LG_PAL ,"LG TPI8PSB11D" }, - {TUNER_LG_PAL_I_FM ,"LG TAPC-I001D" }, - {TUNER_LG_PAL_I ,"LG TAPC-I701D" } -};static void hauppauge_eeprom (struct cx88_core *core,u8 *eeprom_data) { -unsigned int blk2,tuner,radio,model; - -if (eeprom_data[0 ] !=0x84 || eeprom_data[2 ] !=0 ) { -printk (KERN_WARNING "%s: Hauppauge eeprom: invalid\n" , - core->name); -return ; - } - -/* Block 2 starts after len+3 bytes header */ - blk2 = eeprom_data[1 ] +3 ; - -/* decode + use some config infos */ - model = eeprom_data[12 ] <<8 | eeprom_data[11 ]; - tuner = eeprom_data[9 ]; - radio = eeprom_data[blk2-1 ] &0x01 ; - -if (tuner <ARRAY_SIZE (hauppauge_tuner)) - core->tuner_type = hauppauge_tuner[tuner].id; -if (radio) - core->has_radio =1 ; +struct tveeprom tv; -printk (KERN_INFO "%s: hauppauge eeprom: model=%d, " -"tuner=%s (%d), radio=%s\n" , - core->name, model, (tuner <ARRAY_SIZE (hauppauge_tuner) - ? hauppauge_tuner[tuner].name :"?" ), - core->tuner_type, radio ?"yes" :"no" ); +tveeprom_hauppauge_analog (&tv, eeprom_data); + core->tuner_type = tv.tuner_type; + core->has_radio = tv.has_radio; } -#ifdef WITH_DVB static int hauppauge_eeprom_dvb (struct cx88_core *core,u8 *ee) {int model;int tuner; -char *tname;/* Make sure we support the board model */ model = ee[0x1f ] <<24 | ee[0x1e ] <<16 | ee[0x1d ] <<8 | ee[0x1c ];
@@ -689,26 +781,18 @@ static int hauppauge_eeprom_dvb(struct c/* Make sure we support the tuner */ tuner = ee[0x2d ];switch (tuner) { -case 0x4B : - tname ="Thomson DTT 7595" ; - core->pll_type =PLLTYPE_DTT7595 ; -break ; -case 0x4C : - tname ="Thomson DTT 7592" ; - core->pll_type =PLLTYPE_DTT7592 ; +case 0x4B :/* dtt 7595 */ +case 0x4C :/* dtt 7592 */ break ;default :printk ("%s: error: unknown hauppauge tuner 0x%02x\n" , core->name, tuner);return -ENODEV ; } -printk (KERN_INFO "%s: hauppauge eeprom: model=%d, tuner=%s (%d)\n" , - core->name, model, tname, tuner); - - core->pll_addr =0x61 ; - core->demod_addr = 0x43; +printk (KERN_INFO "%s: hauppauge eeprom: model=%d, tuner=%d\n" , + core->name, model, tuner); +return 0 ; } -#endif /* ----------------------------------------------------------------------- */ /* some GDI (was: Modular Technology) specific stuff */
@@ -763,36 +847,6 @@ static void gdi_eeprom(struct cx88_core/* ----------------------------------------------------------------------- */ -static int -i2c_eeprom (struct i2c_client *c,unsigned char *eedata,int len) -{ -unsigned char buf; -int err; - - c->addr =0xa0 >>1 ; - buf =0 ; -if (1 != (err =i2c_master_send (c,&buf,1 ))) { -printk (KERN_INFO "cx88: Huh, no eeprom present (err=%d)?\n" , - err); -return -1 ; - } -if (len != (err =i2c_master_recv (c,eedata,len))) { -printk (KERN_WARNING "cx88: i2c eeprom read error (err=%d)\n" , - err); -return -1 ; - } -#if 0 -for (i =0 ; i < len; i++) { -if (0 == (i %16 )) -printk (KERN_INFO "cx88 ee: %02x:" ,i); -printk (" %02x" ,eedata[i]); -if (15 == (i %16 )) -printk ("\n" ); - } -#endif -return 0 ; -} -void cx88_card_list (struct cx88_core *core,struct pci_dev *pci) {int i;
@@ -823,41 +877,46 @@ void cx88_card_setup(struct cx88_core *c {static u8 eeprom[128 ]; +if (0 == core->i2c_rc) { + core->i2c_client.addr =0xa0 >>1 ; +tveeprom_read (&core->i2c_client,eeprom,sizeof (eeprom)); + } +switch (core->board) {case CX88_BOARD_HAUPPAUGE : +case CX88_BOARD_HAUPPAUGE_ROSLYN :if (0 == core->i2c_rc) -i2c_eeprom (&core->i2c_client,eeprom,sizeof (eeprom)); -hauppauge_eeprom (core,eeprom+8 ); +hauppauge_eeprom (core,eeprom+8 );break ;case CX88_BOARD_GDI :if (0 == core->i2c_rc) -i2c_eeprom (&core->i2c_client,eeprom,sizeof (eeprom)); -gdi_eeprom (core,eeprom); +gdi_eeprom (core,eeprom);break ; -case CX88_BOARD_WINFAST2000XP : +case CX88_BOARD_WINFAST2000XP_EXPERT :if (0 == core->i2c_rc) -i2c_eeprom (&core->i2c_client,eeprom,sizeof (eeprom)); -leadtek_eeprom (core,eeprom); +leadtek_eeprom (core,eeprom); +break ; +case CX88_BOARD_HAUPPAUGE_DVB_T1 : +if (0 == core->i2c_rc) +hauppauge_eeprom_dvb (core,eeprom);break ;case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1 : -/* Tuner reset is hooked to the tuner out of reset */ +case CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS : +/* GPIO0:0 is hooked to mt352 reset pin */ cx_set (MO_GP0_IO ,0x00000101 );cx_clear (MO_GP0_IO ,0x00000001 );msleep (1 );cx_set (MO_GP0_IO ,0x00000101 );break ; -#ifdef WITH_DVB -case CX88_BOARD_HAUPPAUGE_DVB_T1 : -if (0 == core->i2c_rc) -i2c_eeprom (&core->i2c_client,eeprom,sizeof (eeprom)); -hauppauge_eeprom_dvb (core,eeprom); -break ; -case CX88_BOARD_CONEXANT_DVB_T1 : - core->pll_type =PLLTYPE_DTT7579 ; - core->pll_addr =0x60 ; - core->demod_addr =0x43 ; +case CX88_BOARD_KWORLD_DVB_T : +case CX88_BOARD_DNTV_LIVE_DVB_T : +cx_set (MO_GP0_IO ,0x00000707 ); +cx_set (MO_GP2_IO ,0x00000101 ); +cx_clear (MO_GP2_IO ,0x00000001 ); +msleep (1 ); +cx_clear (MO_GP0_IO ,0x00000007 ); +cx_set (MO_GP2_IO ,0x00000101 );break ; -#endif }if (cx88_boards[core->board].radio.type ==CX88_RADIO ) core->has_radio =1 ;
drivers/media/video/cx88/cx88-core.c +32 -10
127 lines not on this page · raw message
drivers/media/video/cx88/cx88-blackbird.c +17 -10
@@ -1,5 +1,5 @@/* -* $Id: cx88-blackbird.c,v 1.17 2004/11/07 13:17:15 kraxel Exp $ +* $Id: cx88-blackbird.c,v 1.26 2005/03/07 15:58:05 kraxel Exp $ * * Support for a cx23416 mpeg encoder via cx2388x host port. * "blackbird" reference design.
@@ -25,6 +25,7 @@*/ #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/init.h> #include <linux/fs.h> #include <linux/delay.h>
@@ -207,10 +208,6 @@ static int register_write(struct cx88_cocx_read (P1_RADDR0 );return wait_ready_gpio0_bit1 (core,1 ); -#if 0 -udelay (1000 );/* without this, things don't go right (subsequent memory_write()'s don't get through */ -/* ? would this be safe here? set_current_state(TASK_INTERRUPTIBLE); schedule_timeout(1); */ -#endif }
@@ -283,7 +280,7 @@ static int blackbird_api_cmd(struct cx88 timeout = jiffies +msecs_to_jiffies (10 );for (;;) {memory_read (dev->core, dev->mailbox, &flag); -if (0 == (flag &4 )) +if (0 != (flag &4 ))break ;if (time_after (jiffies,timeout)) {dprintk (0 ,"ERROR: API Mailbox timeout\n" );
@@ -324,7 +321,7 @@ static int blackbird_find_mailbox(struct signaturecnt =0 ;if (4 == signaturecnt) {dprintk (1 ,"Mailbox signature found\n" ); -return i; +return i+1 ; } }dprintk (0 ,"Mailbox signature values not found!\n" );
@@ -427,7 +424,8 @@ static void blackbird_codec_settings(strblackbird_api_cmd (dev,IVTV_API_ASSIGN_FRAMERATE ,1 ,0 ,0 );/* assign frame size */ -blackbird_api_cmd (dev,IVTV_API_ASSIGN_FRAME_SIZE ,2 ,0 ,480 ,720 ); +blackbird_api_cmd (dev,IVTV_API_ASSIGN_FRAME_SIZE ,2 ,0 , + dev->height, dev->width);/* assign aspect ratio */ blackbird_api_cmd (dev,IVTV_API_ASSIGN_ASPECT_RATIO ,1 ,0 ,2 );
@@ -629,8 +627,8 @@ static int mpeg_do_ioctl(struct inode *imemset (f,0 ,sizeof (*f)); f->type =V4L2_BUF_TYPE_VIDEO_CAPTURE ; - f->fmt.pix.width =720 ; - f->fmt.pix.height =576 ; + f->fmt.pix.width = dev->width; + f->fmt.pix.height = dev->height; f->fmt.pix.pixelformat =V4L2_PIX_FMT_MPEG ; f->fmt.pix.sizeimage =1024 *512 /* FIXME: BUFFER_SIZE */ ; }
@@ -694,6 +692,10 @@ static int mpeg_open(struct inode *inode file->private_data = fh; fh->dev = dev; +/* FIXME: locking against other video device */ +cx88_set_scale (dev->core, dev->width, dev->height, +V4L2_FIELD_INTERLACED ); + videobuf_queue_init(&fh->mpegq, &blackbird_qops, dev->pci, &dev->slock, V4L2_BUF_TYPE_VIDEO_CAPTURE,
@@ -715,6 +717,7 @@ static int mpeg_release(struct inode *inif (fh->mpegq.reading)videobuf_read_stop (&fh->mpegq); +videobuf_mmap_free (&fh->mpegq); file->private_data =NULL ;kfree (fh);return 0 ;
@@ -821,6 +824,8 @@ static int __devinit blackbird_probe(strmemset (dev,0 ,sizeof (*dev)); dev->pci = pci_dev; dev->core = core; + dev->width =720 ; + dev->height =480 ; err =cx8802_init_common (dev);if (0 != err)
@@ -852,6 +857,8 @@ static void __devexit blackbird_remove(s/* common */ cx8802_fini_common (dev); +cx88_core_put (dev->core,dev->pci); +kfree (dev); }static struct pci_device_id cx8802_pci_tbl[] = {
drivers/media/video/Kconfig +7 -3
@@ -305,11 +305,14 @@ config VIDEO_HEXIUM_GEMINI config VIDEO_CX88 tristate "Conexant 2388x (bt878 successor) support" - depends on VIDEO_DEV && PCI && EXPERIMENTAL + depends on VIDEO_DEV && PCI && I2C && EXPERIMENTAL select I2C_ALGOBIT + select FW_LOADER select VIDEO_BTCX select VIDEO_BUF select VIDEO_TUNER + select VIDEO_TVEEPROM + select VIDEO_IR ---help--- This is a video4linux driver for Conexant 2388x based TV cards.
@@ -319,10 +322,11 @@ config VIDEO_CX88 config VIDEO_CX88_DVB tristate "DVB Support for cx2388x based TV cards" - depends on VIDEO_CX88 && DVB_CORE && BROKEN + depends on VIDEO_CX88 && DVB_CORE select VIDEO_BUF_DVB + select DVB_MT352 ---help--- - This adds support for DVB cards based on the + This adds support for DVB/ATSC cards based on the Connexant 2388x chip. config VIDEO_OVCAMCHIP
drivers/media/video/cx88/cx88-video.c +19 -15
@@ -1,5 +1,5 @@/* -* $Id: cx88-video.c,v 1.46 2004/11/07 14:44:59 kraxel Exp $ +* $Id: cx88-video.c,v 1.58 2005/03/07 15:58:05 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * video4linux video interface
@@ -24,6 +24,7 @@#include <linux/init.h> #include <linux/list.h> #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/kmod.h> #include <linux/kernel.h> #include <linux/slab.h>
@@ -428,7 +429,7 @@ static int start_video_dma(struct cx8800 q->count =1 ;/* enable irqs */ -cx_set (MO_PCI_INTMSK ,0x00fc01 ); +cx_set (MO_PCI_INTMSK , core->pci_irqmask |0x01 );cx_set (MO_VID_INTMSK ,0x0f0011 );/* enable capture */
@@ -994,7 +995,7 @@ static int video_open(struct inode *inodcx_write (MO_GP3_IO , cx88_boards[board].radio.gpio3); dev->core->tvaudio =WW_FM ;cx88_set_tvaudio (core); -cx88_set_stereo (core,V4L2_TUNER_MODE_STEREO ); +cx88_set_stereo (core,V4L2_TUNER_MODE_STEREO ,1 );cx88_call_i2c_clients (dev->core,AUDC_SET_RADIO ,NULL ); }
@@ -1002,7 +1003,7 @@ static int video_open(struct inode *inod }static ssize_t -video_read (struct file *file,char __user *data,size_t count,loff_t *ppos) +video_read (struct file *file,char *data,size_t count,loff_t *ppos) {struct cx8800_fh *fh = file->private_data;
@@ -1083,6 +1084,8 @@ static int video_release(struct inode *ires_free (dev,fh,RESOURCE_VBI ); } +videobuf_mmap_free (&fh->vidq); +videobuf_mmap_free (&fh->vbiq); file->private_data =NULL ;kfree (fh);return 0 ;
@@ -1338,7 +1341,6 @@ static int video_do_ioctl(struct inode *0 ;if (UNSET != core->tuner_type) cap->capabilities |=V4L2_CAP_TUNER ; -return 0 ; }
@@ -1429,6 +1431,7 @@ static int video_do_ioctl(struct inode *if (*i >=4 )return -EINVAL ;down (&dev->lock); +cx88_newstation (core);video_mux (dev,*i);up (&dev->lock);return 0 ;
@@ -1560,7 +1563,7 @@ static int video_do_ioctl(struct inode *return -EINVAL ;if (0 != t->index)return -EINVAL ; -cx88_set_stereo (core, t->audmode); +cx88_set_stereo (core, t->audmode,1 );return 0 ; }case VIDIOC_G_FREQUENCY :
@@ -1590,6 +1593,7 @@ static int video_do_ioctl(struct inode *return -EINVAL ;down (&dev->lock); dev->freq = f->frequency; +cx88_newstation (core);#ifdef V4L2_I2C_CLIENTS cx88_call_i2c_clients (dev->core,VIDIOC_S_FREQUENCY ,f);#else
@@ -1880,19 +1884,18 @@ static irqreturn_t cx8800_irq(int irq, v {struct cx8800_dev *dev = dev_id;struct cx88_core *core = dev->core; -u32 status, mask; +u32 status;int loop, handled =0 ;for (loop =0 ; loop <10 ; loop++) { - status =cx_read (MO_PCI_INTSTAT ) & (~0x1f |0x01 ); - mask =cx_read (MO_PCI_INTMSK ); -if (0 == (status & mask)) + status =cx_read (MO_PCI_INTSTAT ) & (core->pci_irqmask |0x01 ); +if (0 == status) goto out;cx_write (MO_PCI_INTSTAT , status); handled =1 ; -if (status & mask & ~0x1f ) -cx88_irq (core,status,mask); +if (status & core->pci_irqmask) +cx88_core_irq (core,status);if (status &0x01 )cx8800_vid_irq (dev); };
@@ -2055,6 +2058,7 @@ static int __devinit cx8800_initdev(stru core->name,pci_dev->irq); goto fail_core; } +cx_set (MO_PCI_INTMSK , core->pci_irqmask);/* load and configure helper modules */ if (TUNER_ABSENT != core->tuner_type)
@@ -2156,7 +2160,7 @@ static void __devexit cx8800_finidev(strkfree (dev); } -static int cx8800_suspend (struct pci_dev *pci_dev,u32 state) +static int cx8800_suspend (struct pci_dev *pci_dev,pm_message_t state) {struct cx8800_dev *dev =pci_get_drvdata (pci_dev);struct cx88_core *core = dev->core;
@@ -2181,7 +2185,7 @@ static int cx8800_suspend(struct pci_dev#endif pci_save_state (pci_dev); -if (0 !=pci_set_power_state (pci_dev, state)) { +if (0 !=pci_set_power_state (pci_dev,pci_choose_state (pci_dev, state))) {pci_disable_device (pci_dev); dev->state.disabled =1 ; }
@@ -2197,7 +2201,7 @@ static int cx8800_resume(struct pci_devpci_enable_device (pci_dev); dev->state.disabled =0 ; } -pci_set_power_state (pci_dev,0 ); +pci_set_power_state (pci_dev,PCI_D0 );pci_restore_state (pci_dev);#if 1
drivers/media/video/cx88/cx88-mpeg.c +21 -23
115 lines not on this page · raw message
drivers/media/video/cx88/cx88-tvaudio.c +319 -136
577 lines not on this page · raw message
drivers/media/video/cx88/cx88-dvb.c +114 -71
247 lines not on this page · raw message
drivers/media/video/cx88/cx88-input.c new file +396 -0
396 lines not on this page · raw message
drivers/media/video/cx88/cx88-vbi.c +3 -2
@@ -1,8 +1,9 @@/* -* $Id: cx88-vbi.c,v 1.14 2004/11/07 13:17:15 kraxel Exp $ +* $Id: cx88-vbi.c,v 1.16 2004/12/10 12:33:39 kraxel Exp $ */ #include <linux/kernel.h> #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/init.h> #include <linux/slab.h>
@@ -64,7 +65,7 @@ int cx8800_start_vbi_dma(struct cx8800_d q->count =1 ;/* enable irqs */ -cx_set (MO_PCI_INTMSK ,0x00fc01 ); +cx_set (MO_PCI_INTMSK , core->pci_irqmask |0x01 );cx_set (MO_VID_INTMSK ,0x0f0088 );/* enable capture */
drivers/media/video/cx88/cx88.h +31 -7
@@ -1,5 +1,5 @@/* -* $Id: cx88.h,v 1.40 2004/11/03 09:04:51 kraxel Exp $ +* $Id: cx88.h,v 1.56 2005/03/04 09:12:23 kraxel Exp $ * * v4l2 device driver for cx2388x based TV cards *
@@ -27,6 +27,7 @@#include <linux/kdev_t.h> #include <media/tuner.h> +#include <media/tveeprom.h> #include <media/audiochip.h> #include <media/video-buf.h> #include <media/video-buf-dvb.h>
@@ -139,7 +140,7 @@ extern struct sram_channel cx88_sram_cha#define CX88_BOARD_GDI 2#define CX88_BOARD_PIXELVIEW 3#define CX88_BOARD_ATI_WONDER_PRO 4 -#define CX88_BOARD_WINFAST2000XP 5 +#define CX88_BOARD_WINFAST2000XP_EXPERT 5#define CX88_BOARD_AVERTV_303 6#define CX88_BOARD_MSI_TVANYWHERE_MASTER 7#define CX88_BOARD_WINFAST_DV2000 8
@@ -156,6 +157,11 @@ extern struct sram_channel cx88_sram_cha#define CX88_BOARD_CONEXANT_DVB_T1 19#define CX88_BOARD_PROVIDEO_PV259 20#define CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS 21 +#define CX88_BOARD_PCHDTV_HD3000 22 +#define CX88_BOARD_DNTV_LIVE_DVB_T 23 +#define CX88_BOARD_HAUPPAUGE_ROSLYN 24 +#define CX88_BOARD_DIGITALLOGIC_MEC 25 +#define CX88_BOARD_IODATA_GVBCTV7E 26enum cx88_itype {CX88_VMUX_COMPOSITE1 =1 ,
@@ -238,6 +244,7 @@ struct cx88_core {u32 __iomem *lmmio;u8 __iomem *bmmio;u32 shadow[SHADOW_MAX ]; +int pci_irqmask;/* i2c i/o */ struct i2c_adapter i2c_adap;
@@ -252,16 +259,20 @@ struct cx88_core {unsigned int has_radio;/* config info -- dvb */ -unsigned int pll_type; +struct dvb_pll_desc *pll_desc;unsigned int pll_addr; -unsigned int demod_addr;/* state info */ struct task_struct *kthread;struct cx88_tvnorm *tvnorm;u32 tvaudio; +u32 audiomode_manual; +u32 audiomode_current;u32 input;u32 astat; + +/* IR remote control state */ +struct cx88_IR *ir; };struct cx8800_dev ;
@@ -371,11 +382,16 @@ struct cx8802_dev {struct list_head devlist;struct video_device *mpeg_dev;u32 mailbox; +int width; +int height;/* for dvb only */ struct videobuf_dvb dvb;void * fe_handle;int (*fe_release)(void *handle); + +/* for switching modulation types */ +unsigned char ts_gen_cntrl; };/* ----------------------------------------------------------- */
@@ -411,7 +427,7 @@ extern void cx88_print_irqbits(char *nam u32 bits, u32 mask);extern void cx88_print_ioctl (char *name,unsigned int cmd); -extern void cx88_irq (struct cx88_core *core,u32 status,u32 mask); +extern int cx88_core_irq (struct cx88_core *core,u32 status);extern void cx88_wakeup (struct cx88_core *core,struct cx88_dmaqueue *q,u32 count);extern void cx88_shutdown (struct cx88_core *core);
@@ -503,11 +519,19 @@ extern void cx88_card_setup(struct cx88_#define WW_FM 12void cx88_set_tvaudio (struct cx88_core *core); +void cx88_newstation (struct cx88_core *core);void cx88_get_stereo (struct cx88_core *core,struct v4l2_tuner *t); -void cx88_set_stereo (struct cx88_core *core,u32 mode); +void cx88_set_stereo (struct cx88_core *core,u32 mode,int manual);int cx88_audio_thread (void *data);/* ----------------------------------------------------------- */ +/* cx88-input.c */ + +int cx88_ir_init (struct cx88_core *core,struct pci_dev *pci); +int cx88_ir_fini (struct cx88_core *core); +void cx88_ir_irq (struct cx88_core *core); + +/* ----------------------------------------------------------- */ /* cx88-mpeg.c */ int cx8802_buf_prepare (struct cx8802_dev *dev,struct cx88_buffer *buf);
@@ -517,7 +541,7 @@ void cx8802_cancel_buffers(struct cx8802int cx8802_init_common (struct cx8802_dev *dev);void cx8802_fini_common (struct cx8802_dev *dev); -int cx8802_suspend_common (struct pci_dev *pci_dev,u32 state); +int cx8802_suspend_common (struct pci_dev *pci_dev,pm_message_t state);int cx8802_resume_common (struct pci_dev *pci_dev);/*
drivers/media/video/cx88/Makefile +2 -1
@@ -1,4 +1,5 @@ -cx88xx-objs := cx88-cards.o cx88-core.o cx88-i2c.o cx88-tvaudio.o +cx88xx-objs := cx88-cards.o cx88-core.o cx88-i2c.o cx88-tvaudio.o \ + cx88-input.o cx8800-objs := cx88-video.o cx88-vbi.o cx8802-objs := cx88-mpeg.o
drivers/media/video/cx88/cx88-i2c.c +2 -1
@@ -1,5 +1,5 @@/* -$Id: cx88-i2c.c,v 1.18 2004/10/13 10:39:00 kraxel Exp $ +$Id: cx88-i2c.c,v 1.20 2005/02/15 15:59:35 kraxel Exp $ cx88-i2c.c -- all the i2c code is here
@@ -25,6 +25,7 @@*/ #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/init.h> #include <asm/io.h>
Signature · 1 line
#define printk(args...) fprintf(stderr, ## args)