diff options
Diffstat (limited to 'drivers/media/video')
42 files changed, 1615 insertions, 464 deletions
diff --git a/drivers/media/video/Kconfig b/drivers/media/video/Kconfig index 6c05fddb69a..f9383e7f34f 100644 --- a/drivers/media/video/Kconfig +++ b/drivers/media/video/Kconfig @@ -7,6 +7,19 @@ menu "Video For Linux" comment "Video Adapters" +config CONFIG_TUNER_MULTI_I2C + bool "Enable support for multiple I2C devices on Video Adapters (EXPERIMENTAL)" + depends on VIDEO_DEV && EXPERIMENTAL + ---help--- + Some video adapters have more than one tuner inside. This patch + enables support for using more than one tuner. This is required + for some cards to allow tunning both video and radio. + It also improves I2C autodetection for these cards. + + Only few tuners currently is supporting this. More to come. + + It is safe to say 'Y' here even if your card has only one I2C tuner. + config VIDEO_BT848 tristate "BT848 Video For Linux" depends on VIDEO_DEV && PCI && I2C @@ -330,6 +343,7 @@ config VIDEO_CX88_DVB select VIDEO_BUF_DVB select DVB_MT352 select DVB_OR51132 + select DVB_CX22702 ---help--- This adds support for DVB/ATSC cards based on the Connexant 2388x chip. diff --git a/drivers/media/video/bt832.c b/drivers/media/video/bt832.c index 07f72f64c5f..9a642c7de54 100644 --- a/drivers/media/video/bt832.c +++ b/drivers/media/video/bt832.c @@ -6,7 +6,7 @@ It outputs an 8-bit 4:2:2 YUV or YCrCb video signal which can be directly connected to bt848/bt878 GPIO pins on this purpose. (see: VLSI Vision Ltd. www.vvl.co.uk for camera datasheets) - + Supported Cards: - Pixelview Rev.4E: 0x8a GPIO 0x400000 toggles Bt832 RESET, and the chip changes to i2c 0x88 ! @@ -31,8 +31,8 @@ #include <linux/errno.h> #include <linux/slab.h> -#include "id.h" -#include "audiochip.h" +#include <media/audiochip.h> +#include <media/id.h> #include "bttv.h" #include "bt832.h" @@ -95,7 +95,7 @@ int bt832_init(struct i2c_client *i2c_client_s) buf=kmalloc(65,GFP_KERNEL); bt832_hexdump(i2c_client_s,buf); - + if(buf[0x40] != 0x31) { printk("bt832: this i2c chip is no bt832 (id=%02x). Detaching.\n",buf[0x40]); kfree(buf); @@ -135,7 +135,7 @@ int bt832_init(struct i2c_client *i2c_client_s) buf[1]= 0x27 & (~0x01); // Default | !skip if (2 != (rc = i2c_master_send(i2c_client_s,buf,2))) printk("bt832: i2c i/o error EO: rc == %d (should be 2)\n",rc); - + bt832_hexdump(i2c_client_s,buf); #if 0 @@ -168,8 +168,7 @@ int bt832_init(struct i2c_client *i2c_client_s) -static int bt832_attach(struct i2c_adapter *adap, int addr, - unsigned short flags, int kind) +static int bt832_attach(struct i2c_adapter *adap, int addr, int kind) { struct bt832 *t; @@ -184,27 +183,32 @@ static int bt832_attach(struct i2c_adapter *adap, int addr, return -ENOMEM; memset(t,0,sizeof(*t)); t->client = client_template; - t->client.data = t; + i2c_set_clientdata(&t->client, t); i2c_attach_client(&t->client); if(! bt832_init(&t->client)) { bt832_detach(&t->client); return -1; } - + return 0; } static int bt832_probe(struct i2c_adapter *adap) { +#ifdef I2C_CLASS_TV_ANALOG if (adap->class & I2C_CLASS_TV_ANALOG) return i2c_probe(adap, &addr_data, bt832_attach); +#else + if (adap->id == (I2C_ALGO_BIT | I2C_HW_B_BT848)) + return i2c_probe(adap, &addr_data, bt832_attach); +#endif return 0; } static int bt832_detach(struct i2c_client *client) { - struct bt832 *t = (struct bt832*)client->data; + struct bt832 *t = i2c_get_clientdata(client); printk("bt832: detach.\n"); i2c_detach_client(client); @@ -215,7 +219,7 @@ static int bt832_detach(struct i2c_client *client) static int bt832_command(struct i2c_client *client, unsigned int cmd, void *arg) { - struct bt832 *t = (struct bt832*)client->data; + struct bt832 *t = i2c_get_clientdata(client); printk("bt832: command %x\n",cmd); @@ -249,19 +253,18 @@ static struct i2c_driver driver = { }; static struct i2c_client client_template = { - .name = "bt832", - .flags = I2C_CLIENT_ALLOW_USE, - .driver = &driver, + I2C_DEVNAME("bt832"), + .flags = I2C_CLIENT_ALLOW_USE, + .driver = &driver, }; -int bt832_init_module(void) +static int __init bt832_init_module(void) { - i2c_add_driver(&driver); - return 0; + return i2c_add_driver(&driver); } -static void bt832_cleanup_module(void) +static void __exit bt832_cleanup_module(void) { i2c_del_driver(&driver); } @@ -269,3 +272,10 @@ static void bt832_cleanup_module(void) module_init(bt832_init_module); module_exit(bt832_cleanup_module); +/* + * Overrides for Emacs so that we follow Linus's tabbing style. + * --------------------------------------------------------------------------- + * Local variables: + * c-basic-offset: 8 + * End: + */ diff --git a/drivers/media/video/bt832.h b/drivers/media/video/bt832.h index 7a98c06e0e3..9b6a8d2c96b 100644 --- a/drivers/media/video/bt832.h +++ b/drivers/media/video/bt832.h @@ -1,6 +1,6 @@ /* Bt832 CMOS Camera Video Processor (VP) - The Bt832 CMOS Camera Video Processor chip connects a Quartsight CMOS + The Bt832 CMOS Camera Video Processor chip connects a Quartsight CMOS color digital camera directly to video capture devices via an 8-bit, 4:2:2 YUV or YCrCb video interface. @@ -85,7 +85,7 @@ #define BT832_DEVICE_ID 63 # define BT832_DEVICE_ID__31 0x31 // Bt832 has ID 0x31 -/* STMicroelectronivcs VV5404 camera module +/* STMicroelectronivcs VV5404 camera module i2c: 0x20: sensor address i2c: 0xa0: eeprom for ccd defect map */ @@ -256,26 +256,26 @@ For the CCIR-601 standards, the sampling is based on a static orthogonal samplin //=========================================================================== // Timing generator SRAM table values for CCIR601 720x480 NTSC //=========================================================================== -// For NTSC CCIR656 +// For NTSC CCIR656 BYTE BtCard::SRAMTable_NTSC[] = { // SRAM Timing Table for NTSC - 0x0c, 0xc0, 0x00, - 0x00, 0x90, 0xc2, - 0x03, 0x10, 0x03, - 0x06, 0x10, 0x34, - 0x12, 0x12, 0x65, - 0x02, 0x13, 0x24, - 0x19, 0x00, 0x24, - 0x39, 0x00, 0x96, - 0x59, 0x08, 0x93, + 0x0c, 0xc0, 0x00, + 0x00, 0x90, 0xc2, + 0x03, 0x10, 0x03, + 0x06, 0x10, 0x34, + 0x12, 0x12, 0x65, + 0x02, 0x13, 0x24, + 0x19, 0x00, 0x24, + 0x39, 0x00, 0x96, + 0x59, 0x08, 0x93, 0x83, 0x08, 0x97, - 0x03, 0x50, 0x30, - 0xc0, 0x40, 0x30, - 0x86, 0x01, 0x01, - 0xa6, 0x0d, 0x62, - 0x03, 0x11, 0x61, - 0x05, 0x37, 0x30, + 0x03, 0x50, 0x30, + 0xc0, 0x40, 0x30, + 0x86, 0x01, 0x01, + 0xa6, 0x0d, 0x62, + 0x03, 0x11, 0x61, + 0x05, 0x37, 0x30, 0xac, 0x21, 0x50 }; diff --git a/drivers/media/video/bttv-cards.c b/drivers/media/video/bttv-cards.c index 6334122704a..251092e7f19 100644 --- a/drivers/media/video/bttv-cards.c +++ b/drivers/media/video/bttv-cards.c @@ -1,5 +1,5 @@ /* - $Id: bttv-cards.c,v 1.47 2005/02/22 14:06:32 kraxel Exp $ + $Id: bttv-cards.c,v 1.49 2005/06/10 17:20:24 mchehab Exp $ bttv-cards.c @@ -51,6 +51,7 @@ static void avermedia_eeprom(struct bttv *btv); static void osprey_eeprom(struct bttv *btv); static void modtec_eeprom(struct bttv *btv); static void init_PXC200(struct bttv *btv); +static void init_RTV24(struct bttv *btv); static void winview_audio(struct bttv *btv, struct video_audio *v, int set); static void lt9415_audio(struct bttv *btv, struct video_audio *v, int set); @@ -2251,6 +2252,20 @@ struct tvcard bttv_tvcards[] = { .no_tda7432 = 1, .no_tda9875 = 1, .muxsel_hook = kodicom4400r_muxsel, +}, +{ + /* ---- card 0x85---------------------------------- */ + /* Michael Henson <mhenson@clarityvi.com> */ + /* Adlink RTV24 with special unlock codes */ + .name = "Adlink RTV24", + .video_inputs = 4, + .audio_inputs = 1, + .tuner = 0, + .svhs = 2, + .muxsel = { 2, 3, 1, 0}, + .tuner_type = -1, + .pll = PLL_28, + }}; static const unsigned int bttv_num_tvcards = ARRAY_SIZE(bttv_tvcards); @@ -2636,6 +2651,10 @@ void __devinit bttv_init_card1(struct bttv *btv) case BTTV_AVDVBT_771: btv->use_i2c_hw = 1; break; + case BTTV_ADLINK_RTV24: + init_RTV24( btv ); + break; + } if (!bttv_tvcards[btv->c.type].has_dvb) bttv_reset_audio(btv); @@ -2784,6 +2803,8 @@ void __devinit bttv_init_card2(struct bttv *btv) } btv->pll.pll_current = -1; + bttv_reset_audio(btv); + /* tuner configuration (from card list / autodetect / insmod option) */ if (UNSET != bttv_tvcards[btv->c.type].tuner_type) if(UNSET == btv->tuner_type) @@ -3304,6 +3325,83 @@ static void __devinit init_PXC200(struct bttv *btv) } + +/* ----------------------------------------------------------------------- */ +/* + * The Adlink RTV-24 (aka Angelo) has some special initialisation to unlock + * it. This apparently involves the following procedure for each 878 chip: + * + * 1) write 0x00C3FEFF to the GPIO_OUT_EN register + * + * 2) write to GPIO_DATA + * - 0x0E + * - sleep 1ms + * - 0x10 + 0x0E + * - sleep 10ms + * - 0x0E + * read from GPIO_DATA into buf (uint_32) + * - if ( data>>18 & 0x01 != 0) || ( buf>>19 & 0x01 != 1 ) + * error. ERROR_CPLD_Check_Failed stop. + * + * 3) write to GPIO_DATA + * - write 0x4400 + 0x0E + * - sleep 10ms + * - write 0x4410 + 0x0E + * - sleep 1ms + * - write 0x0E + * read from GPIO_DATA into buf (uint_32) + * - if ( buf>>18 & 0x01 ) || ( buf>>19 && 0x01 != 0 ) + * error. ERROR_CPLD_Check_Failed. + */ +/* ----------------------------------------------------------------------- */ +void +init_RTV24 (struct bttv *btv) +{ + uint32_t dataRead = 0; + long watchdog_value = 0x0E; + + printk (KERN_INFO + "bttv%d: Adlink RTV-24 initialisation in progress ...\n", + btv->c.nr); + + btwrite (0x00c3feff, BT848_GPIO_OUT_EN); + + btwrite (0 + watchdog_value, BT848_GPIO_DATA); + msleep (1); + btwrite (0x10 + watchdog_value, BT848_GPIO_DATA); + msleep (10); + btwrite (0 + watchdog_value, BT848_GPIO_DATA); + + dataRead = btread (BT848_GPIO_DATA); + + if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 1)) { + printk (KERN_INFO + "bttv%d: Adlink RTV-24 initialisation(1) ERROR_CPLD_Check_Failed (read %d)\n", + btv->c.nr, dataRead); + } + + btwrite (0x4400 + watchdog_value, BT848_GPIO_DATA); + msleep (10); + btwrite (0x4410 + watchdog_value, BT848_GPIO_DATA); + msleep (1); + btwrite (watchdog_value, BT848_GPIO_DATA); + msleep (1); + dataRead = btread (BT848_GPIO_DATA); + + if ((((dataRead >> 18) & 0x01) != 0) || (((dataRead >> 19) & 0x01) != 0)) { + printk (KERN_INFO + "bttv%d: Adlink RTV-24 initialisation(2) ERROR_CPLD_Check_Failed (read %d)\n", + btv->c.nr, dataRead); + + return; + } + + printk (KERN_INFO + "bttv%d: Adlink RTV-24 initialisation complete.\n", btv->c.nr); +} + + + /* ----------------------------------------------------------------------- */ /* Miro Pro radio stuff -- the tea5757 is connected to some GPIO ports */ /* diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 033cc5498f2..290289a9975 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c @@ -1,5 +1,5 @@ /* - $Id: bttv-driver.c,v 1.37 2005/02/21 13:57:59 kraxel Exp $ + $Id: bttv-driver.c,v 1.38 2005/06/10 17:20:24 mchehab Exp $ bttv - Bt848 frame grabber driver diff --git a/drivers/media/video/bttv-i2c.c b/drivers/media/video/bttv-i2c.c index c2368bc832e..da448a5f9e9 100644 --- a/drivers/media/video/bttv-i2c.c +++ b/drivers/media/video/bttv-i2c.c @@ -1,5 +1,5 @@ /* - $Id: bttv-i2c.c,v 1.18 2005/02/16 12:14:10 kraxel Exp $ + $Id: bttv-i2c.c,v 1.21 2005/06/10 17:20:24 mchehab Exp $ bttv-i2c.c -- all the i2c code is here diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index 8322b66e090..191eaf1714b 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h @@ -1,5 +1,5 @@ /* - * $Id: bttv.h,v 1.17 2005/02/22 14:06:32 kraxel Exp $ + * $Id: bttv.h,v 1.18 2005/05/24 23:41:42 nsh Exp $ * * bttv - Bt848 frame grabber driver * @@ -135,6 +135,7 @@ #define BTTV_DVICO_DVBT_LITE 0x80 #define BTTV_TIBET_CS16 0x83 #define BTTV_KODICOM_4400R 0x84 +#define BTTV_ADLINK_RTV24 0x85 /* i2c address list */ #define I2C_TSA5522 0xc2 diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h index 1a9ba7e1cf5..7b6f1e85602 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bttvp.h @@ -226,10 +226,6 @@ extern int fini_bttv_i2c(struct bttv *btv); #define dprintk if (bttv_debug >= 1) printk #define d2printk if (bttv_debug >= 2) printk -/* our devices */ -#define BTTV_MAX 16 -extern unsigned int bttv_num; - #define BTTV_MAX_FBUF 0x208000 #define VBIBUF_SIZE (2048*VBI_MAXLINES*2) #define BTTV_TIMEOUT (HZ/2) /* 0.5 seconds */ @@ -375,6 +371,10 @@ struct bttv { unsigned int users; struct bttv_fh init; }; + +/* our devices */ +#define BTTV_MAX 16 +extern unsigned int bttv_num; extern struct bttv bttvs[BTTV_MAX]; /* private ioctls */ diff --git a/drivers/media/video/cx88/cx88-blackbird.c b/drivers/media/video/cx88/cx88-blackbird.c index 46d6778b863..91f8afeded8 100644 --- a/drivers/media/video/cx88/cx88-blackbird.c +++ b/drivers/media/video/cx88/cx88-blackbird.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-blackbird.c,v 1.26 2005/03/07 15:58:05 kraxel Exp $ + * $Id: cx88-blackbird.c,v 1.27 2005/06/03 13:31:50 mchehab Exp $ * * Support for a cx23416 mpeg encoder via cx2388x host port. * "blackbird" reference design. @@ -61,37 +61,304 @@ static LIST_HEAD(cx8802_devlist); #define IVTV_CMD_HW_BLOCKS_RST 0xFFFFFFFF -/*Firmware API commands*/ -#define IVTV_API_ENC_PING_FW 0x00000080 -#define IVTV_API_ENC_GETVER 0x000000C4 -#define IVTV_API_ENC_HALT_FW 0x000000C3 -#define IVTV_API_STD_TIMEOUT 0x00010000 /*units??*/ -//#define IVTV_API_ASSIGN_PGM_INDEX_INFO 0x000000c7 -#define IVTV_API_ASSIGN_STREAM_TYPE 0x000000b9 -#define IVTV_API_ASSIGN_OUTPUT_PORT 0x000000bb -#define IVTV_API_ASSIGN_FRAMERATE 0x0000008f -#define IVTV_API_ASSIGN_FRAME_SIZE 0x00000091 -#define IVTV_API_ASSIGN_ASPECT_RATIO 0x00000099 -#define IVTV_API_ASSIGN_BITRATES 0x00000095 -#define IVTV_API_ASSIGN_GOP_PROPERTIES 0x00000097 -#define IVTV_API_ASSIGN_3_2_PULLDOWN 0x000000b1 -#define IVTV_API_ASSIGN_GOP_CLOSURE 0x000000c5 -#define IVTV_API_ASSIGN_AUDIO_PROPERTIES 0x000000bd -#define IVTV_API_ASSIGN_DNR_FILTER_MODE 0x0000009b -#define IVTV_API_ASSIGN_DNR_FILTER_PROPS 0x0000009d -#define IVTV_API_ASSIGN_CORING_LEVELS 0x0000009f -#define IVTV_API_ASSIGN_SPATIAL_FILTER_TYPE 0x000000a1 -#define IVTV_API_ASSIGN_FRAME_DROP_RATE 0x000000d0 -#define IVTV_API_ASSIGN_PLACEHOLDER 0x000000d8 -#define IVTV_API_MUTE_VIDEO 0x000000d9 -#define IVTV_API_MUTE_AUDIO 0x000000da -#define IVTV_API_INITIALIZE_INPUT 0x000000cd -#define IVTV_API_REFRESH_INPUT 0x000000d3 -#define IVTV_API_ASSIGN_NUM_VSYNC_LINES 0x000000d6 -#define IVTV_API_BEGIN_CAPTURE 0x00000081 -//#define IVTV_API_PAUSE_ENCODER 0x000000d2 -//#define IVTV_API_EVENT_NOTIFICATION 0x000000d5 -#define IVTV_API_END_CAPTURE 0x00000082 +/* Firmware API commands */ +/* #define IVTV_API_STD_TIMEOUT 0x00010000 // 65536, units?? */ +#define IVTV_API_STD_TIMEOUT 500 + +#define BLACKBIRD_API_PING 0x80 +#define BLACKBIRD_API_BEGIN_CAPTURE 0x81 +enum blackbird_capture_type { + BLACKBIRD_MPEG_CAPTURE, + BLACKBIRD_RAW_CAPTURE, + BLACKBIRD_RAW_PASSTHRU_CAPTURE +}; +enum blackbird_capture_bits { + BLACKBIRD_RAW_BITS_NONE = 0x00, + BLACKBIRD_RAW_BITS_YUV_CAPTURE = 0x01, + BLACKBIRD_RAW_BITS_PCM_CAPTURE = 0x02, + BLACKBIRD_RAW_BITS_VBI_CAPTURE = 0x04, + BLACKBIRD_RAW_BITS_PASSTHRU_CAPTURE = 0x08, + BLACKBIRD_RAW_BITS_TO_HOST_CAPTURE = 0x10 +}; +#define BLACKBIRD_API_END_CAPTURE 0x82 +enum blackbird_capture_end { + BLACKBIRD_END_AT_GOP, /* stop at the end of gop, generate irq */ + BLACKBIRD_END_NOW, /* stop immediately, no irq */ +}; +#define BLACKBIRD_API_SET_AUDIO_ID 0x89 +#define BLACKBIRD_API_SET_VIDEO_ID 0x8B +#define BLACKBIRD_API_SET_PCR_ID 0x8D +#define BLACKBIRD_API_SET_FRAMERATE 0x8F +enum blackbird_framerate { + BLACKBIRD_FRAMERATE_NTSC_30, /* NTSC: 30fps */ + BLACKBIRD_FRAMERATE_PAL_25 /* PAL: 25fps */ +}; +#define BLACKBIRD_API_SET_RESOLUTION 0x91 +#define BLACKBIRD_API_SET_VIDEO_BITRATE 0x95 +enum blackbird_video_bitrate_type { + BLACKBIRD_VIDEO_VBR, + BLACKBIRD_VIDEO_CBR +}; +#define BLACKBIRD_PEAK_RATE_DIVISOR 400 +enum blackbird_mux_rate { + BLACKBIRD_MUX_RATE_DEFAULT, + /* dvd mux rate: multiply by 400 to get the actual rate */ + BLACKBIRD_MUX_RATE_DVD = 25200 +}; +#define BLACKBIRD_API_SET_GOP_STRUCTURE 0x97 +#define BLACKBIRD_API_SET_ASPECT_RATIO 0x99 +enum blackbird_aspect_ratio { + BLACKBIRD_ASPECT_RATIO_FORBIDDEN, + BLACKBIRD_ASPECT_RATIO_1_1_SQUARE, + BLACKBIRD_ASPECT_RATIO_4_3, + BLACKBIRD_ASPECT_RATIO_16_9, + BLACKBIRD_ASPECT_RATIO_221_100, + BLACKBIRD_ASPECT_RATIO_RESERVED +}; +#define BLACKBIRD_API_SET_DNR_MODE 0x9B +enum blackbird_dnr_bits { + BLACKBIRD_DNR_BITS_MANUAL, + BLACKBIRD_DNR_BITS_AUTO_SPATIAL, + BLACKBIRD_DNR_BITS_AUTO_TEMPORAL, + BLACKBIRD_DNR_BITS_AUTO +}; +enum blackbird_median_filter { + BLACKBIRD_MEDIAN_FILTER_DISABLED, + BLACKBIRD_MEDIAN_FILTER_HORIZONTAL, + BLACKBIRD_MEDIAN_FILTER_VERTICAL, + BLACKBIRD_MEDIAN_FILTER_HV, + BLACKBIRD_MEDIAN_FILTER_DIAGONAL +}; +#define BLACKBIRD_API_SET_MANUAL_DNR 0x9D +#define BLACKBIRD_API_SET_DNR_MEDIAN 0x9F +#define BLACKBIRD_API_SET_SPATIAL_FILTER 0xA1 +enum blackbird_spatial_filter_luma { + BLACKBIRD_SPATIAL_FILTER_LUMA_DISABLED, + BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, + BLACKBIRD_SPATIAL_FILTER_LUMA_1D_VERT, + BLACKBIRD_SPATIAL_FILTER_LUMA_2D_HV, /* separable, default */ + BLACKBIRD_SPATIAL_FILTER_LUMA_2D_SYMM /* symmetric non-separable */ +}; +enum blackbird_spatial_filter_chroma { + BLACKBIRD_SPATIAL_FILTER_CHROMA_DISABLED, + BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ /* default */ +}; +#define BLACKBIRD_API_SET_3_2_PULLDOWN 0xB1 +enum blackbird_pulldown { + BLACKBIRD_3_2_PULLDOWN_DISABLED, + BLACKBIRD_3_2_PULLDOWN_ENABLED +}; +#define BLACKBIRD_API_SET_VBI_LINE_NO 0xB7 +enum blackbird_vbi_line_bits { + BLACKBIRD_VBI_LINE_BITS_TOP_FIELD, + BLACKBIRD_VBI_LINE_BITS_BOT_FIELD = (1 << 31), + BLACKBIRD_VBI_LINE_BITS_ALL_LINES = 0xFFFFFFFF +}; +enum blackbird_vbi_line { + BLACKBIRD_VBI_LINE_DISABLED, + BLACKBIRD_VBI_LINE_ENABLED +}; +enum blackbird_vbi_slicing { + BLACKBIRD_VBI_SLICING_NONE, + BLACKBIRD_VBI_SLICING_CLOSED_CAPTION +}; +#define BLACKBIRD_API_SET_STREAM_TYPE 0xB9 +enum blackbird_stream_type { + BLACKBIRD_STREAM_PROGRAM, + BLACKBIRD_STREAM_TRANSPORT, + BLACKBIRD_STREAM_MPEG1, + BLACKBIRD_STREAM_PES_AV, + BLACKBIRD_STREAM_UNKNOWN4, + BLACKBIRD_STREAM_PES_VIDEO, + BLACKBIRD_STREAM_UNKNOWN6, + BLACKBIRD_STREAM_PES_AUDIO, + BLACKBIRD_STREAM_UNKNOWN8, + BLACKBIRD_STREAM_UNKNOWN9, /* audio/pcm ? */ + BLACKBIRD_STREAM_DVD, + BLACKBIRD_STREAM_VCD, + BLACKBIRD_STREAM_UNKNOWN12 /* svcd/xvcd ? */ +}; +#define BLACKBIRD_API_SET_OUTPUT_PORT 0xBB +enum blackbird_stream_port { + BLACKBIRD_OUTPUT_PORT_MEMORY, + BLACKBIRD_OUTPUT_PORT_STREAMING, + BLACKBIRD_OUTPUT_PORT_SERIAL +}; +#define BLACKBIRD_API_SET_AUDIO_PARAMS 0xBD +enum blackbird_audio_bits_sample_rate { + BLACKBIRD_AUDIO_BITS_44100HZ, + BLACKBIRD_AUDIO_BITS_48000HZ, + BLACKBIRD_AUDIO_BITS_32000HZ, + BLACKBIRD_AUDIO_BITS_RESERVED_HZ, +}; +enum blackbird_audio_bits_encoding { + BLACKBIRD_AUDIO_BITS_LAYER_1 = 0x1 << 2, + BLACKBIRD_AUDIO_BITS_LAYER_2 = 0x2 << 2, +}; +enum blackbird_audio_bits_bitrate_layer_1 { + BLACKBIRD_AUDIO_BITS_LAYER_1_FREE_FORMAT, + BLACKBIRD_AUDIO_BITS_LAYER_1_32 = 0x01 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_64 = 0x02 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_96 = 0x03 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_128 = 0x04 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_160 = 0x05 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_192 = 0x06 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_224 = 0x07 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_256 = 0x08 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_288 = 0x09 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_320 = 0x0A << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_352 = 0x0B << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_384 = 0x0C << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_416 = 0x0D << 4, + BLACKBIRD_AUDIO_BITS_LAYER_1_448 = 0x0E << 4, +}; +enum blackbird_audio_bits_bitrate_layer_2 { + BLACKBIRD_AUDIO_BITS_LAYER_2_FREE_FORMAT, + BLACKBIRD_AUDIO_BITS_LAYER_2_32 = 0x01 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_48 = 0x02 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_56 = 0x03 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_64 = 0x04 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_80 = 0x05 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_96 = 0x06 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_112 = 0x07 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_128 = 0x08 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_160 = 0x09 << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_192 = 0x0A << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_224 = 0x0B << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_256 = 0x0C << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_320 = 0x0D << 4, + BLACKBIRD_AUDIO_BITS_LAYER_2_384 = 0x0E << 4, +}; +enum blackbird_audio_bits_mode { + BLACKBIRD_AUDIO_BITS_STEREO, + BLACKBIRD_AUDIO_BITS_JOINT_STEREO = 0x1 << 8, + BLACKBIRD_AUDIO_BITS_DUAL = 0x2 << 8, + BLACKBIRD_AUDIO_BITS_MONO = 0x3 << 8, +}; +enum blackbird_audio_bits_mode_extension { + BLACKBIRD_AUDIO_BITS_BOUND_4, + BLACKBIRD_AUDIO_BITS_BOUND_8 = 0x1 << 10, + BLACKBIRD_AUDIO_BITS_BOUND_12 = 0x2 << 10, + BLACKBIRD_AUDIO_BITS_BOUND_16 = 0x3 << 10, +}; +enum blackbird_audio_bits_emphasis { + BLACKBIRD_AUDIO_BITS_EMPHASIS_NONE, + BLACKBIRD_AUDIO_BITS_EMPHASIS_50_15 = 0x1 << 12, + BLACKBIRD_AUDIO_BITS_EMPHASIS_RESERVED = 0x2 << 12, + BLACKBIRD_AUDIO_BITS_EMPHASIS_CCITT_J17 = 0x3 << 12, +}; +enum blackbird_audio_bits_crc { + BLACKBIRD_AUDIO_BITS_CRC_OFF, + BLACKBIRD_AUDIO_BITS_CRC_ON = 0x1 << 14, +}; +enum blackbird_audio_bits_copyright { + BLACKBIRD_AUDIO_BITS_COPYRIGHT_OFF, + BLACKBIRD_AUDIO_BITS_COPYRIGHT_ON = 0x1 << 15, +}; +enum blackbird_audio_bits_original { + BLACKBIRD_AUDIO_BITS_COPY, + BLACKBIRD_AUDIO_BITS_ORIGINAL = 0x1 << 16, +}; +#define BLACKBIRD_API_HALT 0xC3 +#define BLACKBIRD_API_GET_VERSION 0xC4 +#define BLACKBIRD_API_SET_GOP_CLOSURE 0xC5 +enum blackbird_gop_closure { + BLACKBIRD_GOP_CLOSURE_OFF, + BLACKBIRD_GOP_CLOSURE_ON, +}; +#define BLACKBIRD_API_DATA_XFER_STATUS 0xC6 +enum blackbird_data_xfer_status { + BLACKBIRD_MORE_BUFFERS_FOLLOW, + BLACKBIRD_LAST_BUFFER, +}; +#define BLACKBIRD_API_PROGRAM_INDEX_INFO 0xC7 +enum blackbird_picture_mask { + BLACKBIRD_PICTURE_MASK_NONE, + BLACKBIRD_PICTURE_MASK_I_FRAMES, + BLACKBIRD_PICTURE_MASK_I_P_FRAMES = 0x3, + BLACKBIRD_PICTURE_MASK_ALL_FRAMES = 0x7, +}; +#define BLACKBIRD_API_SET_VBI_PARAMS 0xC8 +enum blackbird_vbi_mode_bits { + BLACKBIRD_VBI_BITS_SLICED, + BLACKBIRD_VBI_BITS_RAW, +}; +enum blackbird_vbi_insertion_bits { + BLACKBIRD_VBI_BITS_INSERT_IN_XTENSION_USR_DATA, + BLACKBIRD_VBI_BITS_INSERT_IN_PRIVATE_PACKETS = 0x1 << 1, + BLACKBIRD_VBI_BITS_SEPARATE_STREAM = 0x2 << 1, + BLACKBIRD_VBI_BITS_SEPARATE_STREAM_USR_DATA = 0x4 << 1, + BLACKBIRD_VBI_BITS_SEPARATE_STREAM_PRV_DATA = 0x5 << 1, +}; +#define BLACKBIRD_API_SET_DMA_BLOCK_SIZE 0xC9 +enum blackbird_dma_unit { + BLACKBIRD_DMA_BYTES, + BLACKBIRD_DMA_FRAMES, +}; +#define BLACKBIRD_API_DMA_TRANSFER_INFO 0xCA +#define BLACKBIRD_API_DMA_TRANSFER_STAT 0xCB +enum blackbird_dma_transfer_status_bits { + BLACKBIRD_DMA_TRANSFER_BITS_DONE = 0x01, + BLACKBIRD_DMA_TRANSFER_BITS_ERROR = 0x04, + BLACKBIRD_DMA_TRANSFER_BITS_LL_ERROR = 0x10, +}; +#define BLACKBIRD_API_SET_DMA2HOST_ADDR 0xCC +#define BLACKBIRD_API_INIT_VIDEO_INPUT 0xCD +#define BLACKBIRD_API_SET_FRAMESKIP 0xD0 +#define BLACKBIRD_API_PAUSE 0xD2 +enum blackbird_pause { + BLACKBIRD_PAUSE_ENCODING, + BLACKBIRD_RESUME_ENCODING, +}; +#define BLACKBIRD_API_REFRESH_INPUT 0xD3 +#define BLACKBIRD_API_SET_COPYRIGHT 0xD4 +enum blackbird_copyright { + BLACKBIRD_COPYRIGHT_OFF, + BLACKBIRD_COPYRIGHT_ON, +}; +#define BLACKBIRD_API_SET_NOTIFICATION 0xD5 +enum blackbird_notification_type { + BLACKBIRD_NOTIFICATION_REFRESH, +}; +enum blackbird_notification_status { + BLACKBIRD_NOTIFICATION_OFF, + BLACKBIRD_NOTIFICATION_ON, +}; +enum blackbird_notification_mailbox { + BLACKBIRD_NOTIFICATION_NO_MAILBOX = -1, +}; +#define BLACKBIRD_API_SET_CAPTURE_LINES 0xD6 +enum blackbird_field1_lines { + BLACKBIRD_FIELD1_SAA7114 = 0x00EF, /* 239 */ + BLACKBIRD_FIELD1_SAA7115 = 0x00F0, /* 240 */ + BLACKBIRD_FIELD1_MICRONAS = 0x0105, /* 261 */ +}; +enum blackbird_field2_lines { + BLACKBIRD_FIELD2_SAA7114 = 0x00EF, /* 239 */ + BLACKBIRD_FIELD2_SAA7115 = 0x00F0, /* 240 */ + BLACKBIRD_FIELD2_MICRONAS = 0x0106, /* 262 */ +}; +#define BLACKBIRD_API_SET_CUSTOM_DATA 0xD7 +enum blackbird_custom_data_type { + BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, + BLACKBIRD_CUSTOM_PRIVATE_PACKET, +}; +#define BLACKBIRD_API_MUTE_VIDEO 0xD9 +enum blackbird_mute { + BLACKBIRD_UNMUTE, + BLACKBIRD_MUTE, +}; +enum blackbird_mute_video_mask { + BLACKBIRD_MUTE_VIDEO_V_MASK = 0x0000FF00, + BLACKBIRD_MUTE_VIDEO_U_MASK = 0x00FF0000, + BLACKBIRD_MUTE_VIDEO_Y_MASK = 0xFF000000, +}; +enum blackbird_mute_video_shift { + BLACKBIRD_MUTE_VIDEO_V_SHIFT = 8, + BLACKBIRD_MUTE_VIDEO_U_SHIFT = 16, + BLACKBIRD_MUTE_VIDEO_Y_SHIFT = 24, +}; +#define BLACKBIRD_API_MUTE_AUDIO 0xDA /* Registers */ #define IVTV_REG_ENC_SDRAM_REFRESH (0x07F8 /*| IVTV_REG_OFFSET*/) @@ -405,68 +672,100 @@ static int blackbird_load_firmware(struct cx8802_dev *dev) return 0; } +/** + Settings used by the windows tv app for PVR2000: +================================================================================================================= +Profile | Codec | Resolution | CBR/VBR | Video Qlty | V. Bitrate | Frmrate | Audio Codec | A. Bitrate | A. Mode +----------------------------------------------------------------------------------------------------------------- +MPEG-1 | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 2000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo +MPEG-2 | MPEG2 | 720x576PAL | VBR | 600 :Good | 4000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo +VCD | MPEG1 | 352x288PAL | (CBR) | 1000:Optimal | 1150 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo +DVD | MPEG2 | 720x576PAL | VBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo +DB* DVD | MPEG2 | 720x576PAL | CBR | 600 :Good | 6000 Kbps | 25fps | MPG1 Layer2 | 224kbps | Stereo +================================================================================================================= +*DB: "DirectBurn" +*/ static void blackbird_codec_settings(struct cx8802_dev *dev) { int bitrate_mode = 1; int bitrate = 7500000; int bitrate_peak = 7500000; +#if 1 + bitrate_mode = BLACKBIRD_VIDEO_CBR; + bitrate = 4000*1024; + bitrate_peak = 4000*1024; +#endif /* assign stream type */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 0); /* program stream */ - //blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 2); /* MPEG1 stream */ - //blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 3); /* PES A/V */ - //blackbird_api_cmd(dev, IVTV_API_ASSIGN_STREAM_TYPE, 1, 0, 10); /* DVD stream */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_PROGRAM); + /* blackbird_api_cmd(dev, BLACKBIRD_API_SET_STREAM_TYPE, 1, 0, BLACKBIRD_STREAM_TRANSPORT); */ - /* assign output port */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_OUTPUT_PORT, 1, 0, 1); /* 1 = Host */ + /* assign output port */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_OUTPUT_PORT, 1, 0, BLACKBIRD_OUTPUT_PORT_STREAMING); /* Host */ - /* assign framerate */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAMERATE, 1, 0, 0); + /* assign framerate */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_FRAMERATE, 1, 0, BLACKBIRD_FRAMERATE_PAL_25); - /* assign frame size */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_SIZE, 2, 0, + /* assign frame size */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_RESOLUTION, 2, 0, dev->height, dev->width); - /* assign aspect ratio */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_ASPECT_RATIO, 1, 0, 2); + /* assign aspect ratio */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_ASPECT_RATIO, 1, 0, BLACKBIRD_ASPECT_RATIO_4_3); - /* assign bitrates */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_BITRATES, 5, 0, + /* assign bitrates */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_VIDEO_BITRATE, 5, 0, bitrate_mode, /* mode */ bitrate, /* bps */ - bitrate_peak / 400, /* peak/400 */ - 0, 0x70); /* encoding buffer, ckennedy */ - - /* assign gop properties */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_GOP_PROPERTIES, 2, 0, 15, 3); - //blackbird_api_cmd(dev, IVTV_API_ASSIGN_GOP_PROPERTIES, 2, 0, 2, 1); - - /* assign 3 2 pulldown */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_3_2_PULLDOWN, 1, 0, 0); - - /* note: it's not necessary to set the samplerate, the mpeg encoder seems to autodetect/adjust */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, (2<<2) | (8<<4)); + bitrate_peak / BLACKBIRD_PEAK_RATE_DIVISOR, /* peak/400 */ + BLACKBIRD_MUX_RATE_DEFAULT /*, 0x70*/); /* encoding buffer, ckennedy */ + + /* assign gop properties */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_STRUCTURE, 2, 0, 15, 3); + + /* assign 3 2 pulldown */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_3_2_PULLDOWN, 1, 0, BLACKBIRD_3_2_PULLDOWN_DISABLED); + + /* assign audio properties */ + /* note: it's not necessary to set the samplerate, the mpeg encoder seems to autodetect/adjust */ + /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, (2<<2) | (8<<4)); + blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, 0 | (2 << 2) | (14 << 4)); */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_AUDIO_PARAMS, 1, 0, + BLACKBIRD_AUDIO_BITS_44100HZ | + BLACKBIRD_AUDIO_BITS_LAYER_2 | + BLACKBIRD_AUDIO_BITS_LAYER_2_224 | + BLACKBIRD_AUDIO_BITS_STEREO | + /* BLACKBIRD_AUDIO_BITS_BOUND_4 | */ + BLACKBIRD_AUDIO_BITS_EMPHASIS_NONE | + BLACKBIRD_AUDIO_BITS_CRC_OFF | + BLACKBIRD_AUDIO_BITS_COPYRIGHT_OFF | + BLACKBIRD_AUDIO_BITS_COPY + ); /* assign gop closure */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_GOP_CLOSURE, 1, 0, 0); + blackbird_api_cmd(dev, BLACKBIRD_API_SET_GOP_CLOSURE, 1, 0, BLACKBIRD_GOP_CLOSURE_OFF); - /* assign audio properties */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_AUDIO_PROPERTIES, 1, 0, 0 | (2 << 2) | (14 << 4)); - /* assign dnr filter mode */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_DNR_FILTER_MODE, 2, 0, 0, 0); + /* assign dnr filter mode */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MODE, 2, 0, + BLACKBIRD_DNR_BITS_MANUAL, + BLACKBIRD_MEDIAN_FILTER_DISABLED + ); - /* assign dnr filter props*/ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_DNR_FILTER_PROPS, 2, 0, 0, 0); + /* assign dnr filter props*/ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_MANUAL_DNR, 2, 0, 0, 0); - /* assign coring levels (luma_h, luma_l, chroma_h, chroma_l) */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_CORING_LEVELS, 4, 0, 0, 255, 0, 255); + /* assign coring levels (luma_h, luma_l, chroma_h, chroma_l) */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_DNR_MEDIAN, 4, 0, 0, 255, 0, 255); - /* assign spatial filter type: luma_t: 1 = horiz_only, chroma_t: 1 = horiz_only */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_SPATIAL_FILTER_TYPE, 2, 0, 1, 1); + /* assign spatial filter type: luma_t: horiz_only, chroma_t: horiz_only */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_SPATIAL_FILTER, 2, 0, + BLACKBIRD_SPATIAL_FILTER_LUMA_1D_HORIZ, + BLACKBIRD_SPATIAL_FILTER_CHROMA_1D_HORIZ + ); - /* assign frame drop rate */ - blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_DROP_RATE, 1, 0, 0); + /* assign frame drop rate */ + /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_FRAME_DROP_RATE, 1, 0, 0); */ } static int blackbird_initialize_codec(struct cx8802_dev *dev) @@ -476,7 +775,7 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) int retval; dprintk(1,"Initialize codec\n"); - retval = blackbird_api_cmd(dev, IVTV_API_ENC_PING_FW, 0, 0); /* ping */ + retval = blackbird_api_cmd(dev, BLACKBIRD_API_PING, 0, 0); /* ping */ if (retval < 0) { /* ping was not successful, reset and upload firmware */ cx_write(MO_SRST_IO, 0); /* SYS_RSTO=0 */ @@ -491,13 +790,13 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) if (dev->mailbox < 0) return -1; - retval = blackbird_api_cmd(dev, IVTV_API_ENC_PING_FW, 0, 0); /* ping */ + retval = blackbird_api_cmd(dev, BLACKBIRD_API_PING, 0, 0); /* ping */ if (retval < 0) { dprintk(0, "ERROR: Firmware ping failed!\n"); return -1; } - retval = blackbird_api_cmd(dev, IVTV_API_ENC_GETVER, 0, 1, &version); + retval = blackbird_api_cmd(dev, BLACKBIRD_API_GET_VERSION, 0, 1, &version); if (retval < 0) { dprintk(0, "ERROR: Firmware get encoder version failed!\n"); return -1; @@ -517,25 +816,36 @@ static int blackbird_initialize_codec(struct cx8802_dev *dev) blackbird_codec_settings(dev); msleep(1); - //blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xef, 0xef); - blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xf0, 0xf0); - //blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0x180, 0x180); - blackbird_api_cmd(dev, IVTV_API_ASSIGN_PLACEHOLDER, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); + /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xef, 0xef); + blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0xf0, 0xf0); + blackbird_api_cmd(dev, IVTV_API_ASSIGN_NUM_VSYNC_LINES, 4, 0, 0x180, 0x180); */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_CAPTURE_LINES, 2, 0, + BLACKBIRD_FIELD1_SAA7115, + BLACKBIRD_FIELD1_SAA7115 + ); + + /* blackbird_api_cmd(dev, IVTV_API_ASSIGN_PLACEHOLDER, 12, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); */ + blackbird_api_cmd(dev, BLACKBIRD_API_SET_CUSTOM_DATA, 12, 0, + BLACKBIRD_CUSTOM_EXTENSION_USR_DATA, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0); - blackbird_api_cmd(dev, IVTV_API_INITIALIZE_INPUT, 0, 0); /* initialize the video input */ + blackbird_api_cmd(dev, BLACKBIRD_API_INIT_VIDEO_INPUT, 0, 0); /* initialize the video input */ msleep(1); - blackbird_api_cmd(dev, IVTV_API_MUTE_VIDEO, 1, 0, 0); + blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_VIDEO, 1, 0, BLACKBIRD_UNMUTE); msleep(1); - blackbird_api_cmd(dev, IVTV_API_MUTE_AUDIO, 1, 0, 0); + blackbird_api_cmd(dev, BLACKBIRD_API_MUTE_AUDIO, 1, 0, BLACKBIRD_UNMUTE); msleep(1); - blackbird_api_cmd(dev, IVTV_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); /* start capturing to the host interface */ - //blackbird_api_cmd(dev, IVTV_API_BEGIN_CAPTURE, 2, 0, 0, 0); /* start capturing to the host interface */ - msleep(1); + /* blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, 0, 0x13); // start capturing to the host interface */ + blackbird_api_cmd(dev, BLACKBIRD_API_BEGIN_CAPTURE, 2, 0, + BLACKBIRD_MPEG_CAPTURE, + BLACKBIRD_RAW_BITS_NONE + ); /* start capturing to the host interface */ + msleep(10); - blackbird_api_cmd(dev, IVTV_API_REFRESH_INPUT, 0,0); + blackbird_api_cmd(dev, BLACKBIRD_API_REFRESH_INPUT, 0,0); return 0; } @@ -709,7 +1019,12 @@ static int mpeg_release(struct inode *inode, struct file *file) { struct cx8802_fh *fh = file->private_data; - blackbird_api_cmd(fh->dev, IVTV_API_END_CAPTURE, 3, 0, 1, 0, 0x13); + /* blackbird_api_cmd(fh->dev, BLACKBIRD_API_END_CAPTURE, 3, 0, BLACKBIRD_END_NOW, 0, 0x13); */ + blackbird_api_cmd(fh->dev, BLACKBIRD_API_END_CAPTURE, 3, 0, + BLACKBIRD_END_NOW, + BLACKBIRD_MPEG_CAPTURE, + BLACKBIRD_RAW_BITS_NONE + ); /* stop mpeg capture */ if (fh->mpegq.streaming) @@ -908,4 +1223,5 @@ module_exit(blackbird_fini); * Local variables: * c-basic-offset: 8 * End: + * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off */ diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 367624822d7..b3fb04356b7 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-cards.c,v 1.66 2005/03/04 09:12:23 kraxel Exp $ + * $Id: cx88-cards.c,v 1.76 2005/06/08 01:28:09 mchehab Exp $ * * device driver for Conexant 2388x based TV cards * card-specific stuff. @@ -35,6 +35,9 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_UNKNOWN] = { .name = "UNKNOWN/GENERIC", .tuner_type = UNSET, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .input = {{ .type = CX88_VMUX_COMPOSITE1, .vmux = 0, @@ -52,6 +55,9 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_HAUPPAUGE] = { .name = "Hauppauge WinTV 34xxx models", .tuner_type = UNSET, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT, .input = {{ .type = CX88_VMUX_TELEVISION, @@ -78,6 +84,9 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_GDI] = { .name = "GDI Black Gold", .tuner_type = UNSET, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, @@ -85,7 +94,10 @@ struct cx88_board cx88_boards[] = { }, [CX88_BOARD_PIXELVIEW] = { .name = "PixelView", - .tuner_type = 5, + .tuner_type = TUNER_PHILIPS_PAL, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, @@ -104,7 +116,10 @@ struct cx88_board cx88_boards[] = { }, [CX88_BOARD_ATI_WONDER_PRO] = { .name = "ATI TV Wonder Pro", - .tuner_type = 44, + .tuner_type = TUNER_PHILIPS_4IN1, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT | TDA9887_INTERCARRIER, .input = {{ .type = CX88_VMUX_TELEVISION, @@ -122,7 +137,10 @@ struct cx88_board cx88_boards[] = { }, [CX88_BOARD_WINFAST2000XP_EXPERT] = { .name = "Leadtek Winfast 2000XP Expert", - .tuner_type = 44, + .tuner_type = TUNER_PHILIPS_4IN1, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT, .input = {{ .type = CX88_VMUX_TELEVISION, @@ -156,7 +174,10 @@ struct cx88_board cx88_boards[] = { }, [CX88_BOARD_AVERTV_303] = { .name = "AverTV Studio 303 (M126)", - .tuner_type = 38, + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT, .input = {{ .type = CX88_VMUX_TELEVISION, @@ -179,7 +200,10 @@ struct cx88_board cx88_boards[] = { // added gpio values thanks to Michal // values for PAL from DScaler .name = "MSI TV-@nywhere Master", - .tuner_type = 33, + .tuner_type = TUNER_MT2032, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT, .input = {{ .type = CX88_VMUX_TELEVISION, @@ -206,7 +230,10 @@ struct cx88_board cx88_boards[] = { }, [CX88_BOARD_WINFAST_DV2000] = { .name = "Leadtek Winfast DV2000", - .tuner_type = 38, + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT, .input = {{ .type = CX88_VMUX_TELEVISION, @@ -239,34 +266,40 @@ struct cx88_board cx88_boards[] = { .gpio3 = 0x02000000, }, }, - [CX88_BOARD_LEADTEK_PVR2000] = { + [CX88_BOARD_LEADTEK_PVR2000] = { // gpio values for PAL version from regspy by DScaler - .name = "Leadtek PVR 2000", - .tuner_type = 38, + .name = "Leadtek PVR 2000", + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .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, - }, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x0000bde2, + },{ + .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_GVVCP3PCI] = { .name = "IODATA GV-VCP3/PCI", .tuner_type = TUNER_ABSENT, - .input = {{ + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .input = {{ .type = CX88_VMUX_COMPOSITE1, .vmux = 0, },{ @@ -279,7 +312,10 @@ struct cx88_board cx88_boards[] = { }, [CX88_BOARD_PROLINK_PLAYTVPVR] = { .name = "Prolink PlayTV PVR", - .tuner_type = 43, + .tuner_type = TUNER_PHILIPS_FM1236_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT, .input = {{ .type = CX88_VMUX_TELEVISION, @@ -301,8 +337,11 @@ struct cx88_board cx88_boards[] = { }, [CX88_BOARD_ASUS_PVR_416] = { .name = "ASUS PVR-416", - .tuner_type = 43, - .tda9887_conf = TDA9887_PRESENT, + .tuner_type = TUNER_PHILIPS_FM1236_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .tda9887_conf = TDA9887_PRESENT, .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, @@ -320,7 +359,10 @@ struct cx88_board cx88_boards[] = { }, [CX88_BOARD_MSI_TVANYWHERE] = { .name = "MSI TV-@nywhere", - .tuner_type = 33, + .tuner_type = TUNER_MT2032, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT, .input = {{ .type = CX88_VMUX_TELEVISION, @@ -342,6 +384,9 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_KWORLD_DVB_T] = { .name = "KWorld/VStream XPert DVB-T", .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .input = {{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, @@ -358,6 +403,9 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1] = { .name = "DVICO FusionHDTV DVB-T1", .tuner_type = TUNER_ABSENT, /* No analog tuner */ + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .input = {{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, @@ -371,7 +419,10 @@ struct cx88_board cx88_boards[] = { }, [CX88_BOARD_KWORLD_LTV883] = { .name = "KWorld LTV883RF", - .tuner_type = 48, + .tuner_type = TUNER_TNF_8831BGFF, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, @@ -397,6 +448,9 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD] = { .name = "DViCO - FusionHDTV 3 Gold", .tuner_type = TUNER_MICROTUNE_4042FI5, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, /* GPIO[0] resets DT3302 DTV receiver 0 - reset asserted @@ -428,17 +482,14 @@ struct cx88_board cx88_boards[] = { .vmux = 2, .gpio0 = 0x0f00, }}, -#if 0 - .ts = { - .type = CX88_TS, - .gpio0 = 0x00000f01, /* Hooked to tuner reset bit */ - } -#endif }, [CX88_BOARD_HAUPPAUGE_DVB_T1] = { - .name = "Hauppauge Nova-T DVB-T", + .name = "Hauppauge Nova-T DVB-T", .tuner_type = TUNER_ABSENT, - .input = {{ + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + .input = {{ .type = CX88_VMUX_DVB, .vmux = 0, }}, @@ -447,6 +498,9 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_CONEXANT_DVB_T1] = { .name = "Conexant DVB-T reference design", .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .input = {{ .type = CX88_VMUX_DVB, .vmux = 0, @@ -456,6 +510,9 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_PROVIDEO_PV259] = { .name = "Provideo PV259", .tuner_type = TUNER_PHILIPS_FQ1216ME, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, @@ -465,6 +522,9 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_DVICO_FUSIONHDTV_DVB_T_PLUS] = { .name = "DVICO FusionHDTV DVB-T Plus", .tuner_type = TUNER_ABSENT, /* No analog tuner */ + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .input = {{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, @@ -479,6 +539,9 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_DNTV_LIVE_DVB_T] = { .name = "digitalnow DNTV Live! DVB-T", .tuner_type = TUNER_ABSENT, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .input = {{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, @@ -495,6 +558,9 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_PCHDTV_HD3000] = { .name = "pcHDTV HD3000 HDTV", .tuner_type = TUNER_THOMSON_DTT7610, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, @@ -530,8 +596,11 @@ struct cx88_board cx88_boards[] = { [CX88_BOARD_HAUPPAUGE_ROSLYN] = { // entry added by Kaustubh D. Bhalerao <bhalerao.1@osu.edu> // GPIO values obtained from regspy, courtesy Sean Covel - .name = "Hauppauge WinTV 28xxx (Roslyn) models", - .tuner_type = UNSET, + .name = "Hauppauge WinTV 28xxx (Roslyn) models", + .tuner_type = UNSET, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, @@ -559,33 +628,37 @@ struct cx88_board cx88_boards[] = { .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, + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT, .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, - .gpio0 = 0x0000bde6, + .gpio0 = 0x00009d80, },{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, - .gpio0 = 0x0000bde6, + .gpio0 = 0x00009d76, },{ .type = CX88_VMUX_SVIDEO, .vmux = 2, - .gpio0 = 0x0000bde6, + .gpio0 = 0x00009d76, }}, .radio = { .type = CX88_RADIO, - .gpio0 = 0x0000bd62, + .gpio0 = 0x00009d00, }, .blackbird = 1, }, [CX88_BOARD_IODATA_GVBCTV7E] = { .name = "IODATA GV/BCTV7E", .tuner_type = TUNER_PHILIPS_FQ1286, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, .tda9887_conf = TDA9887_PRESENT, .input = {{ .type = CX88_VMUX_TELEVISION, @@ -601,6 +674,56 @@ struct cx88_board cx88_boards[] = { .gpio1 = 0x0000e07f, }} }, + [CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO] = { + .name = "PixelView PlayTV Ultra Pro (Stereo)", + /* May be also TUNER_YMEC_TVF_5533MF for NTSC/M or PAL/M */ + .tuner_type = TUNER_PHILIPS_FM1216ME_MK3, + .radio_type = TUNER_TEA5767, + .tuner_addr = 0xc2>>1, + .radio_addr = 0xc0>>1, + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0xbf61, /* internal decoder */ + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0xbf63, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0xbf63, + }}, + .radio = { + .type = CX88_RADIO, + .gpio0 = 0xbf60, + }, + }, + [CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T] = { + .name = "DViCO - FusionHDTV 3 Gold-T", + .tuner_type = TUNER_THOMSON_DTT7611, + .radio_type = UNSET, + .tuner_addr = ADDR_UNSET, + .radio_addr = ADDR_UNSET, + /* See DViCO FusionHDTV 3 Gold for GPIO documentation. */ + .input = {{ + .type = CX88_VMUX_TELEVISION, + .vmux = 0, + .gpio0 = 0x0f0d, + },{ + .type = CX88_VMUX_CABLE, + .vmux = 0, + .gpio0 = 0x0f05, + },{ + .type = CX88_VMUX_COMPOSITE1, + .vmux = 1, + .gpio0 = 0x0f00, + },{ + .type = CX88_VMUX_SVIDEO, + .vmux = 2, + .gpio0 = 0x0f00, + }}, + }, }; const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); @@ -673,6 +796,10 @@ struct cx88_subid cx88_subids[] = { .subdevice = 0xd810, .card = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD, },{ + .subvendor = 0x18ac, + .subdevice = 0xd820, + .card = CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T, + },{ .subvendor = 0x18AC, .subdevice = 0xDB00, .card = CX88_BOARD_DVICO_FUSIONHDTV_DVB_T1, @@ -935,4 +1062,5 @@ EXPORT_SYMBOL(cx88_card_setup); * Local variables: * c-basic-offset: 8 * End: + * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off */ diff --git a/drivers/media/video/cx88/cx88-core.c b/drivers/media/video/cx88/cx88-core.c index 1ff79b5a883..c046a23537d 100644 --- a/drivers/media/video/cx88/cx88-core.c +++ b/drivers/media/video/cx88/cx88-core.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-core.c,v 1.24 2005/01/19 12:01:55 kraxel Exp $ + * $Id: cx88-core.c,v 1.28 2005/06/12 04:19:19 mchehab Exp $ * * device driver for Conexant 2388x based TV cards * driver core @@ -51,12 +51,15 @@ module_param(latency,int,0444); MODULE_PARM_DESC(latency,"pci latency timer"); static unsigned int tuner[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; +static unsigned int radio[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; static unsigned int card[] = {[0 ... (CX88_MAXBOARDS - 1)] = UNSET }; module_param_array(tuner, int, NULL, 0444); +module_param_array(radio, int, NULL, 0444); module_param_array(card, int, NULL, 0444); MODULE_PARM_DESC(tuner,"tuner type"); +MODULE_PARM_DESC(radio,"radio tuner type"); MODULE_PARM_DESC(card,"card type"); static unsigned int nicam = 0; @@ -429,7 +432,7 @@ int cx88_sram_channel_setup(struct cx88_core *core, /* ------------------------------------------------------------------ */ /* debug helper code */ -static int cx88_risc_decode(u32 risc) +int cx88_risc_decode(u32 risc) { static char *instr[16] = { [ RISC_SYNC >> 28 ] = "sync", @@ -736,6 +739,10 @@ static unsigned int inline norm_fsc8(struct cx88_tvnorm *norm) { static const unsigned int ntsc = 28636360; static const unsigned int pal = 35468950; + static const unsigned int palm = 28604892; + + if (norm->id & V4L2_STD_PAL_M) + return palm; return (norm->id & V4L2_STD_625_50) ? pal : ntsc; } @@ -749,6 +756,11 @@ static unsigned int inline norm_notchfilter(struct cx88_tvnorm *norm) static unsigned int inline norm_htotal(struct cx88_tvnorm *norm) { + /* Should always be Line Draw Time / (4*FSC) */ + + if (norm->id & V4L2_STD_PAL_M) + return 909; + return (norm->id & V4L2_STD_625_50) ? 1135 : 910; } @@ -1164,8 +1176,20 @@ struct cx88_core* cx88_core_get(struct pci_dev *pci) "insmod option" : "autodetected"); core->tuner_type = tuner[core->nr]; + core->radio_type = radio[core->nr]; if (UNSET == core->tuner_type) core->tuner_type = cx88_boards[core->board].tuner_type; + if (UNSET == core->radio_type) + core->radio_type = cx88_boards[core->board].radio_type; + if (!core->tuner_addr) + core->tuner_addr = cx88_boards[core->board].tuner_addr; + if (!core->radio_addr) + core->radio_addr = cx88_boards[core->board].radio_addr; + + printk(KERN_INFO "TV tuner %d at 0x%02x, Radio tuner %d at 0x%02x\n", + core->tuner_type, core->tuner_addr<<1, + core->radio_type, core->radio_addr<<1); + core->tda9887_conf = cx88_boards[core->board].tda9887_conf; /* init hardware */ diff --git a/drivers/media/video/cx88/cx88-dvb.c b/drivers/media/video/cx88/cx88-dvb.c index 9d15d3d5a2b..1a259c3966c 100644 --- a/drivers/media/video/cx88/cx88-dvb.c +++ b/drivers/media/video/cx88/cx88-dvb.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-dvb.c,v 1.31 2005/03/07 15:58:05 kraxel Exp $ + * $Id: cx88-dvb.c,v 1.33 2005/06/12 04:19:19 mchehab Exp $ * * device driver for Conexant 2388x based TV cards * MPEG Transport Stream (DVB) routines diff --git a/drivers/media/video/cx88/cx88-i2c.c b/drivers/media/video/cx88/cx88-i2c.c index 0725b1288f4..e20adefcfc6 100644 --- a/drivers/media/video/cx88/cx88-i2c.c +++ b/drivers/media/video/cx88/cx88-i2c.c @@ -1,5 +1,5 @@ /* - $Id: cx88-i2c.c,v 1.20 2005/02/15 15:59:35 kraxel Exp $ + $Id: cx88-i2c.c,v 1.23 2005/06/12 04:19:19 mchehab Exp $ cx88-i2c.c -- all the i2c code is here @@ -91,6 +91,7 @@ static int cx8800_bit_getsda(void *data) static int attach_inform(struct i2c_client *client) { + struct tuner_addr tun_addr; struct cx88_core *core = i2c_get_adapdata(client->adapter); dprintk(1, "i2c attach [addr=0x%x,client=%s]\n", @@ -98,8 +99,19 @@ static int attach_inform(struct i2c_client *client) if (!client->driver->command) return 0; - if (core->tuner_type != UNSET) - client->driver->command(client, TUNER_SET_TYPE, &core->tuner_type); + if (core->radio_type != UNSET) { + tun_addr.v4l2_tuner = V4L2_TUNER_RADIO; + tun_addr.type = core->radio_type; + tun_addr.addr = core->radio_addr; + client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr); + } + if (core->tuner_type != UNSET) { + tun_addr.v4l2_tuner = V4L2_TUNER_ANALOG_TV; + tun_addr.type = core->tuner_type; + tun_addr.addr = core->tuner_addr; + client->driver->command(client,TUNER_SET_TYPE_ADDR, &tun_addr); + } + if (core->tda9887_conf) client->driver->command(client, TDA9887_SET_CONFIG, &core->tda9887_conf); return 0; diff --git a/drivers/media/video/cx88/cx88-input.c b/drivers/media/video/cx88/cx88-input.c index af6ad8cdbdb..dc0dcf249aa 100644 --- a/drivers/media/video/cx88/cx88-input.c +++ b/drivers/media/video/cx88/cx88-input.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-input.c,v 1.9 2005/03/04 09:12:23 kraxel Exp $ + * $Id: cx88-input.c,v 1.11 2005/05/22 20:57:56 nsh Exp $ * * Device driver for GPIO attached remote control interfaces * on Conexant 2388x based TV/DVB cards. @@ -235,6 +235,7 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) /* detect & configure */ switch (core->board) { case CX88_BOARD_DNTV_LIVE_DVB_T: + case CX88_BOARD_KWORLD_DVB_T: ir_codes = ir_codes_dntv_live_dvb_t; ir->gpio_addr = MO_GP1_IO; ir->mask_keycode = 0x1f; @@ -261,7 +262,15 @@ int cx88_ir_init(struct cx88_core *core, struct pci_dev *pci) ir->mask_keydown = 0x02; ir->polling = 5; // ms break; + case CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO: + ir_codes = ir_codes_pixelview; + ir->gpio_addr = MO_GP1_IO; + ir->mask_keycode = 0x1f; + ir->mask_keyup = 0x80; + ir->polling = 1; // ms + break; } + if (NULL == ir_codes) { kfree(ir); return -ENODEV; diff --git a/drivers/media/video/cx88/cx88-mpeg.c b/drivers/media/video/cx88/cx88-mpeg.c index 07aae1899e1..9ade2ae91e9 100644 --- a/drivers/media/video/cx88/cx88-mpeg.c +++ b/drivers/media/video/cx88/cx88-mpeg.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-mpeg.c,v 1.25 2005/03/07 14:18:00 kraxel Exp $ + * $Id: cx88-mpeg.c,v 1.26 2005/06/03 13:31:51 mchehab Exp $ * * Support for the mpeg transport stream transfers * PCI function #2 of the cx2388x. @@ -55,7 +55,7 @@ static int cx8802_start_dma(struct cx8802_dev *dev, { struct cx88_core *core = dev->core; - dprintk(1, "cx8802_start_mpegport_dma %d\n", buf->vb.width); + dprintk(0, "cx8802_start_dma %d\n", buf->vb.width); /* setup fifo + format */ cx88_sram_channel_setup(core, &cx88_sram_channels[SRAM_CH28], @@ -100,18 +100,21 @@ static int cx8802_start_dma(struct cx8802_dev *dev, q->count = 1; /* enable irqs */ + dprintk( 0, "setting the interrupt mask\n" ); cx_set(MO_PCI_INTMSK, core->pci_irqmask | 0x04); - cx_write(MO_TS_INTMSK, 0x1f0011); + cx_set(MO_TS_INTMSK, 0x1f0011); + //cx_write(MO_TS_INTMSK, 0x0f0011); /* start dma */ - cx_write(MO_DEV_CNTRL2, (1<<5)); /* FIXME: s/write/set/ ??? */ - cx_write(MO_TS_DMACNTRL, 0x11); + cx_set(MO_DEV_CNTRL2, (1<<5)); + cx_set(MO_TS_DMACNTRL, 0x11); return 0; } static int cx8802_stop_dma(struct cx8802_dev *dev) { struct cx88_core *core = dev->core; + dprintk( 0, "cx8802_stop_dma\n" ); /* stop dma */ cx_clear(MO_TS_DMACNTRL, 0x11); @@ -131,8 +134,12 @@ static int cx8802_restart_queue(struct cx8802_dev *dev, struct cx88_buffer *buf; struct list_head *item; + dprintk( 0, "cx8802_restart_queue\n" ); if (list_empty(&q->active)) + { + dprintk( 0, "cx8802_restart_queue: queue is empty\n" ); return 0; + } buf = list_entry(q->active.next, struct cx88_buffer, vb.queue); dprintk(2,"restart_queue [%p/%d]: restart dma\n", @@ -182,27 +189,32 @@ void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) struct cx88_buffer *prev; struct cx88_dmaqueue *q = &dev->mpegq; + dprintk( 1, "cx8802_buf_queue\n" ); /* add jump to stopper */ buf->risc.jmp[0] = cpu_to_le32(RISC_JUMP | RISC_IRQ1 | RISC_CNT_INC); buf->risc.jmp[1] = cpu_to_le32(q->stopper.dma); if (list_empty(&q->active)) { + dprintk( 0, "queue is empty - first active\n" ); list_add_tail(&buf->vb.queue,&q->active); cx8802_start_dma(dev, q, buf); buf->vb.state = STATE_ACTIVE; buf->count = q->count++; mod_timer(&q->timeout, jiffies+BUFFER_TIMEOUT); - dprintk(2,"[%p/%d] %s - first active\n", + dprintk(0,"[%p/%d] %s - first active\n", buf, buf->vb.i, __FUNCTION__); + //udelay(100); } else { + dprintk( 1, "queue is not empty - append to active\n" ); prev = list_entry(q->active.prev, struct cx88_buffer, vb.queue); list_add_tail(&buf->vb.queue,&q->active); buf->vb.state = STATE_ACTIVE; buf->count = q->count++; prev->risc.jmp[1] = cpu_to_le32(buf->risc.dma); - dprintk(2,"[%p/%d] %s - append to active\n", + dprintk( 1, "[%p/%d] %s - append to active\n", buf, buf->vb.i, __FUNCTION__); + //udelay(100); } } @@ -224,7 +236,10 @@ static void do_cancel_buffers(struct cx8802_dev *dev, char *reason, int restart) buf, buf->vb.i, reason, (unsigned long)buf->risc.dma); } if (restart) + { + dprintk(0, "restarting queue\n" ); cx8802_restart_queue(dev,q); + } spin_unlock_irqrestore(&dev->slock,flags); } @@ -232,6 +247,7 @@ void cx8802_cancel_buffers(struct cx8802_dev *dev) { struct cx88_dmaqueue *q = &dev->mpegq; + dprintk( 1, "cx8802_cancel_buffers" ); del_timer_sync(&q->timeout); cx8802_stop_dma(dev); do_cancel_buffers(dev,"cancel",0); @@ -241,7 +257,7 @@ static void cx8802_timeout(unsigned long data) { struct cx8802_dev *dev = (struct cx8802_dev*)data; - dprintk(1, "%s\n",__FUNCTION__); + dprintk(0, "%s\n",__FUNCTION__); if (debug) cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]); @@ -254,12 +270,17 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) struct cx88_core *core = dev->core; u32 status, mask, count; + dprintk( 1, "cx8802_mpeg_irq\n" ); status = cx_read(MO_TS_INTSTAT); mask = cx_read(MO_TS_INTMSK); if (0 == (status & mask)) return; cx_write(MO_TS_INTSTAT, status); +#if 0 + cx88_print_irqbits(core->name, "irq mpeg ", + cx88_mpeg_irqs, status, mask); +#endif if (debug || (status & mask & ~0xff)) cx88_print_irqbits(core->name, "irq mpeg ", cx88_mpeg_irqs, status, mask); @@ -273,6 +294,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) /* risc1 y */ if (status & 0x01) { + dprintk( 1, "wake up\n" ); spin_lock(&dev->slock); count = cx_read(MO_TS_GPCNT); cx88_wakeup(dev->core, &dev->mpegq, count); @@ -288,6 +310,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) /* other general errors */ if (status & 0x1f0100) { + dprintk( 0, "general errors: 0x%08x\n", status & 0x1f0100 ); spin_lock(&dev->slock); cx8802_stop_dma(dev); cx8802_restart_queue(dev,&dev->mpegq); @@ -295,6 +318,8 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) } } +#define MAX_IRQ_LOOP 10 + static irqreturn_t cx8802_irq(int irq, void *dev_id, struct pt_regs *regs) { struct cx8802_dev *dev = dev_id; @@ -302,10 +327,13 @@ static irqreturn_t cx8802_irq(int irq, void *dev_id, struct pt_regs *regs) u32 status; int loop, handled = 0; - for (loop = 0; loop < 10; loop++) { + for (loop = 0; loop < MAX_IRQ_LOOP; loop++) { status = cx_read(MO_PCI_INTSTAT) & (core->pci_irqmask | 0x04); if (0 == status) goto out; + dprintk( 1, "cx8802_irq\n" ); + dprintk( 1, " loop: %d/%d\n", loop, MAX_IRQ_LOOP ); + dprintk( 1, " status: %d\n", status ); handled = 1; cx_write(MO_PCI_INTSTAT, status); @@ -314,7 +342,8 @@ static irqreturn_t cx8802_irq(int irq, void *dev_id, struct pt_regs *regs) if (status & 0x04) cx8802_mpeg_irq(dev); }; - if (10 == loop) { + if (MAX_IRQ_LOOP == loop) { + dprintk( 0, "clearing mask\n" ); printk(KERN_WARNING "%s/0: irq loop -- clearing mask\n", core->name); cx_write(MO_PCI_INTMSK,0); @@ -378,6 +407,7 @@ int cx8802_init_common(struct cx8802_dev *dev) void cx8802_fini_common(struct cx8802_dev *dev) { + dprintk( 2, "cx8802_fini_common\n" ); cx8802_stop_dma(dev); pci_disable_device(dev->pci); @@ -399,6 +429,7 @@ int cx8802_suspend_common(struct pci_dev *pci_dev, pm_message_t state) /* stop mpeg dma */ spin_lock(&dev->slock); if (!list_empty(&dev->mpegq.active)) { + dprintk( 2, "suspend\n" ); printk("%s: suspend mpeg\n", core->name); cx8802_stop_dma(dev); del_timer(&dev->mpegq.timeout); @@ -463,4 +494,5 @@ EXPORT_SYMBOL(cx8802_resume_common); * Local variables: * c-basic-offset: 8 * End: + * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off */ diff --git a/drivers/media/video/cx88/cx88-reg.h b/drivers/media/video/cx88/cx88-reg.h index 8638ce57d84..63ad33f5818 100644 --- a/drivers/media/video/cx88/cx88-reg.h +++ b/drivers/media/video/cx88/cx88-reg.h @@ -1,5 +1,5 @@ /* - $Id: cx88-reg.h,v 1.6 2004/10/13 10:39:00 kraxel Exp $ + $Id: cx88-reg.h,v 1.7 2005/06/03 13:31:51 mchehab Exp $ cx88x-hw.h - CX2388x register offsets @@ -397,6 +397,7 @@ #define AUD_RATE_ADJ4 0x3205e4 #define AUD_RATE_ADJ5 0x3205e8 #define AUD_APB_IN_RATE_ADJ 0x3205ec +#define AUD_I2SCNTL 0x3205ec #define AUD_PHASE_FIX_CTL 0x3205f0 #define AUD_PLL_PRESCALE 0x320600 #define AUD_PLL_DDS 0x320604 diff --git a/drivers/media/video/cx88/cx88-tvaudio.c b/drivers/media/video/cx88/cx88-tvaudio.c index f2a9475a2fe..46d78b1dc9b 100644 --- a/drivers/media/video/cx88/cx88-tvaudio.c +++ b/drivers/media/video/cx88/cx88-tvaudio.c @@ -1,5 +1,5 @@ /* - $Id: cx88-tvaudio.c,v 1.34 2005/03/07 16:10:51 kraxel Exp $ + $Id: cx88-tvaudio.c,v 1.36 2005/06/05 05:53:45 mchehab Exp $ cx88x-audio.c - Conexant CX23880/23881 audio downstream driver driver @@ -127,7 +127,8 @@ static void set_audio_start(struct cx88_core *core, cx_write(AUD_VOL_CTL, (1 << 6)); // increase level of input by 12dB - cx_write(AUD_AFE_12DB_EN, 0x0001); +// cx_write(AUD_AFE_12DB_EN, 0x0001); + cx_write(AUD_AFE_12DB_EN, 0x0000); // start programming cx_write(AUD_CTL, 0x0000); @@ -143,9 +144,15 @@ static void set_audio_finish(struct cx88_core *core) u32 volume; if (cx88_boards[core->board].blackbird) { + // sets sound input from external adc + cx_set(AUD_CTL, EN_I2SIN_ENABLE); + //cx_write(AUD_I2SINPUTCNTL, 0); + cx_write(AUD_I2SINPUTCNTL, 4); + cx_write(AUD_BAUDRATE, 1); // 'pass-thru mode': this enables the i2s output to the mpeg encoder - cx_set(AUD_CTL, 0x2000); + cx_set(AUD_CTL, EN_I2SOUT_ENABLE); cx_write(AUD_I2SOUTPUTCNTL, 1); + cx_write(AUD_I2SCNTL, 0); //cx_write(AUD_APB_IN_RATE_ADJ, 0); } @@ -707,50 +714,65 @@ static void set_audio_standard_EIAJ(struct cx88_core *core) set_audio_finish(core); } -static void set_audio_standard_FM(struct cx88_core *core) +static void set_audio_standard_FM(struct cx88_core *core, enum cx88_deemph_type deemph) { -#if 0 /* FIXME */ - switch (dev->audio_properties.FM_deemphasis) - { - case WW_FM_DEEMPH_50: - //Set De-emphasis filter coefficients for 50 usec - cx_write(AUD_DEEMPH0_G0, 0x0C45); - cx_write(AUD_DEEMPH0_A0, 0x6262); - cx_write(AUD_DEEMPH0_B0, 0x1C29); - cx_write(AUD_DEEMPH0_A1, 0x3FC66); - cx_write(AUD_DEEMPH0_B1, 0x399A); - - cx_write(AUD_DEEMPH1_G0, 0x0D80); - cx_write(AUD_DEEMPH1_A0, 0x6262); - cx_write(AUD_DEEMPH1_B0, 0x1C29); - cx_write(AUD_DEEMPH1_A1, 0x3FC66); - cx_write(AUD_DEEMPH1_B1, 0x399A); + static const struct rlist fm_deemph_50[] = { + { AUD_DEEMPH0_G0, 0x0C45 }, + { AUD_DEEMPH0_A0, 0x6262 }, + { AUD_DEEMPH0_B0, 0x1C29 }, + { AUD_DEEMPH0_A1, 0x3FC66}, + { AUD_DEEMPH0_B1, 0x399A }, + + { AUD_DEEMPH1_G0, 0x0D80 }, + { AUD_DEEMPH1_A0, 0x6262 }, + { AUD_DEEMPH1_B0, 0x1C29 }, + { AUD_DEEMPH1_A1, 0x3FC66}, + { AUD_DEEMPH1_B1, 0x399A}, + + { AUD_POLYPH80SCALEFAC, 0x0003}, + { /* end of list */ }, + }; + static const struct rlist fm_deemph_75[] = { + { AUD_DEEMPH0_G0, 0x091B }, + { AUD_DEEMPH0_A0, 0x6B68 }, + { AUD_DEEMPH0_B0, 0x11EC }, + { AUD_DEEMPH0_A1, 0x3FC66}, + { AUD_DEEMPH0_B1, 0x399A }, + + { AUD_DEEMPH1_G0, 0x0AA0 }, + { AUD_DEEMPH1_A0, 0x6B68 }, + { AUD_DEEMPH1_B0, 0x11EC }, + { AUD_DEEMPH1_A1, 0x3FC66}, + { AUD_DEEMPH1_B1, 0x399A}, + + { AUD_POLYPH80SCALEFAC, 0x0003}, + { /* end of list */ }, + }; - break; + /* It is enough to leave default values? */ + static const struct rlist fm_no_deemph[] = { - case WW_FM_DEEMPH_75: - //Set De-emphasis filter coefficients for 75 usec - cx_write(AUD_DEEMPH0_G0, 0x91B ); - cx_write(AUD_DEEMPH0_A0, 0x6B68); - cx_write(AUD_DEEMPH0_B0, 0x11EC); - cx_write(AUD_DEEMPH0_A1, 0x3FC66); - cx_write(AUD_DEEMPH0_B1, 0x399A); + { AUD_POLYPH80SCALEFAC, 0x0003}, + { /* end of list */ }, + }; - cx_write(AUD_DEEMPH1_G0, 0xAA0 ); - cx_write(AUD_DEEMPH1_A0, 0x6B68); - cx_write(AUD_DEEMPH1_B0, 0x11EC); - cx_write(AUD_DEEMPH1_A1, 0x3FC66); - cx_write(AUD_DEEMPH1_B1, 0x399A); + dprintk("%s (status: unknown)\n",__FUNCTION__); + set_audio_start(core, 0x0020, EN_FMRADIO_AUTO_STEREO); + switch (deemph) + { + case FM_NO_DEEMPH: + set_audio_registers(core, fm_no_deemph); break; - } -#endif - dprintk("%s (status: unknown)\n",__FUNCTION__); - set_audio_start(core, 0x0020, EN_FMRADIO_AUTO_STEREO); + case FM_DEEMPH_50: + set_audio_registers(core, fm_deemph_50); + break; - // AB: 10/2/01: this register is not being reset appropriately on occasion. - cx_write(AUD_POLYPH80SCALEFAC,3); + case FM_DEEMPH_75: + set_audio_registers(core, fm_deemph_75); + break; + } set_audio_finish(core); } @@ -778,7 +800,7 @@ void cx88_set_tvaudio(struct cx88_core *core) set_audio_standard_EIAJ(core); break; case WW_FM: - set_audio_standard_FM(core); + set_audio_standard_FM(core,FM_NO_DEEMPH); break; case WW_SYSTEM_L_AM: set_audio_standard_NICAM_L(core, 1); @@ -1029,4 +1051,5 @@ EXPORT_SYMBOL(cx88_audio_thread); * Local variables: * c-basic-offset: 8 * End: + * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off */ diff --git a/drivers/media/video/cx88/cx88-vbi.c b/drivers/media/video/cx88/cx88-vbi.c index 0584ff47638..320d57888bb 100644 --- a/drivers/media/video/cx88/cx88-vbi.c +++ b/drivers/media/video/cx88/cx88-vbi.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-vbi.c,v 1.16 2004/12/10 12:33:39 kraxel Exp $ + * $Id: cx88-vbi.c,v 1.17 2005/06/12 04:19:19 mchehab Exp $ */ #include <linux/kernel.h> #include <linux/module.h> @@ -47,8 +47,8 @@ void cx8800_vbi_fmt(struct cx8800_dev *dev, struct v4l2_format *f) } static int cx8800_start_vbi_dma(struct cx8800_dev *dev, - struct cx88_dmaqueue *q, - struct cx88_buffer *buf) + struct cx88_dmaqueue *q, + struct cx88_buffer *buf) { struct cx88_core *core = dev->core; diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index d1f5c92f0ce..e4ca7350df1 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-video.c,v 1.58 2005/03/07 15:58:05 kraxel Exp $ + * $Id: cx88-video.c,v 1.63 2005/06/12 04:19:19 mchehab Exp $ * * device driver for Conexant 2388x based TV cards * video4linux video interface @@ -1187,9 +1187,24 @@ static void init_controls(struct cx8800_dev *dev) .id = V4L2_CID_AUDIO_VOLUME, .value = 0x3f, }; + static struct v4l2_control hue = { + .id = V4L2_CID_HUE, + .value = 0x80, + }; + static struct v4l2_control contrast = { + .id = V4L2_CID_CONTRAST, + .value = 0x80, + }; + static struct v4l2_control brightness = { + .id = V4L2_CID_BRIGHTNESS, + .value = 0x80, + }; set_control(dev,&mute); set_control(dev,&volume); + set_control(dev,&hue); + set_control(dev,&contrast); + set_control(dev,&brightness); } /* ------------------------------------------------------------------ */ @@ -1336,6 +1351,9 @@ static int video_do_ioctl(struct inode *inode, struct file *file, V4L2_CAP_STREAMING | V4L2_CAP_VBI_CAPTURE | #if 0 + V4L2_TUNER_CAP_LOW | +#endif +#if 0 V4L2_CAP_VIDEO_OVERLAY | #endif 0; @@ -1696,7 +1714,11 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, sizeof(cap->card)); sprintf(cap->bus_info,"PCI:%s", pci_name(dev->pci)); cap->version = CX88_VERSION_CODE; - cap->capabilities = V4L2_CAP_TUNER; + cap->capabilities = V4L2_CAP_TUNER +#if 0 + | V4L2_TUNER_CAP_LOW +#endif + ; return 0; } case VIDIOC_G_TUNER: @@ -1992,6 +2014,7 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, { struct cx8800_dev *dev; struct cx88_core *core; + struct tuner_addr tun_addr; int err; dev = kmalloc(sizeof(*dev),GFP_KERNEL); @@ -2065,8 +2088,19 @@ static int __devinit cx8800_initdev(struct pci_dev *pci_dev, request_module("tuner"); if (core->tda9887_conf) request_module("tda9887"); - if (core->tuner_type != UNSET) - cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE,&core->tuner_type); + if (core->radio_type != UNSET) { + tun_addr.v4l2_tuner = V4L2_TUNER_RADIO; + tun_addr.type = core->radio_type; + tun_addr.addr = core->radio_addr; + cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE_ADDR, &tun_addr); + } + if (core->tuner_type != UNSET) { + tun_addr.v4l2_tuner = V4L2_TUNER_ANALOG_TV; + tun_addr.type = core->tuner_type; + tun_addr.addr = core->tuner_addr; + cx88_call_i2c_clients(dev->core,TUNER_SET_TYPE_ADDR, &tun_addr); + } + if (core->tda9887_conf) cx88_call_i2c_clients(dev->core,TDA9887_SET_CONFIG,&core->tda9887_conf); @@ -2162,7 +2196,7 @@ static void __devexit cx8800_finidev(struct pci_dev *pci_dev) static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) { - struct cx8800_dev *dev = pci_get_drvdata(pci_dev); + struct cx8800_dev *dev = pci_get_drvdata(pci_dev); struct cx88_core *core = dev->core; /* stop video+vbi capture */ @@ -2194,7 +2228,7 @@ static int cx8800_suspend(struct pci_dev *pci_dev, pm_message_t state) static int cx8800_resume(struct pci_dev *pci_dev) { - struct cx8800_dev *dev = pci_get_drvdata(pci_dev); + struct cx8800_dev *dev = pci_get_drvdata(pci_dev); struct cx88_core *core = dev->core; if (dev->state.disabled) { @@ -2230,8 +2264,8 @@ static struct pci_device_id cx8800_pci_tbl[] = { { .vendor = 0x14f1, .device = 0x8800, - .subvendor = PCI_ANY_ID, - .subdevice = PCI_ANY_ID, + .subvendor = PCI_ANY_ID, + .subdevice = PCI_ANY_ID, },{ /* --- end of list --- */ } @@ -2239,10 +2273,10 @@ static struct pci_device_id cx8800_pci_tbl[] = { MODULE_DEVICE_TABLE(pci, cx8800_pci_tbl); static struct pci_driver cx8800_pci_driver = { - .name = "cx8800", - .id_table = cx8800_pci_tbl, - .probe = cx8800_initdev, - .remove = __devexit_p(cx8800_finidev), + .name = "cx8800", + .id_table = cx8800_pci_tbl, + .probe = cx8800_initdev, + .remove = __devexit_p(cx8800_finidev), .suspend = cx8800_suspend, .resume = cx8800_resume, @@ -2274,4 +2308,5 @@ module_exit(cx8800_fini); * Local variables: * c-basic-offset: 8 * End: + * kate: eol "unix"; indent-width 3; remove-trailing-space on; replace-trailing-space-save on; tab-width 8; replace-tabs off; space-indent off; mixed-indent off */ diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index 88eaaaba5ad..ac0dc27bb38 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h @@ -1,5 +1,5 @@ /* - * $Id: cx88.h,v 1.56 2005/03/04 09:12:23 kraxel Exp $ + * $Id: cx88.h,v 1.62 2005/06/12 04:19:19 mchehab Exp $ * * v4l2 device driver for cx2388x based TV cards * @@ -64,6 +64,13 @@ #define SHADOW_AUD_BAL_CTL 2 #define SHADOW_MAX 2 +/* FM Radio deemphasis type */ +enum cx88_deemph_type { + FM_NO_DEEMPH = 0, + FM_DEEMPH_50, + FM_DEEMPH_75 +}; + /* ----------------------------------------------------------- */ /* tv norms */ @@ -162,6 +169,8 @@ extern struct sram_channel cx88_sram_channels[]; #define CX88_BOARD_HAUPPAUGE_ROSLYN 24 #define CX88_BOARD_DIGITALLOGIC_MEC 25 #define CX88_BOARD_IODATA_GVBCTV7E 26 +#define CX88_BOARD_PIXELVIEW_PLAYTV_ULTRA_PRO 27 +#define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28 enum cx88_itype { CX88_VMUX_COMPOSITE1 = 1, @@ -185,6 +194,9 @@ struct cx88_input { struct cx88_board { char *name; unsigned int tuner_type; + unsigned int radio_type; + unsigned char tuner_addr; + unsigned char radio_addr; int tda9887_conf; struct cx88_input input[8]; struct cx88_input radio; @@ -255,6 +267,9 @@ struct cx88_core { /* config info -- analog */ unsigned int board; unsigned int tuner_type; + unsigned int radio_type; + unsigned char tuner_addr; + unsigned char radio_addr; unsigned int tda9887_conf; unsigned int has_radio; @@ -420,6 +435,7 @@ struct cx8802_dev { /* ----------------------------------------------------------- */ /* cx88-core.c */ +extern char *cx88_pci_irqs[32]; extern char *cx88_vid_irqs[32]; extern char *cx88_mpeg_irqs[32]; extern void cx88_print_irqbits(char *name, char *tag, char **strings, @@ -471,6 +487,11 @@ extern void cx88_core_put(struct cx88_core *core, /* cx88-vbi.c */ void cx8800_vbi_fmt(struct cx8800_dev *dev, struct v4l2_format *f); +/* +int cx8800_start_vbi_dma(struct cx8800_dev *dev, + struct cx88_dmaqueue *q, + struct cx88_buffer *buf); +*/ int cx8800_stop_vbi_dma(struct cx8800_dev *dev); int cx8800_restart_vbi_queue(struct cx8800_dev *dev, struct cx88_dmaqueue *q); diff --git a/drivers/media/video/ir-kbd-gpio.c b/drivers/media/video/ir-kbd-gpio.c index ab6620de4b3..a565823330a 100644 --- a/drivers/media/video/ir-kbd-gpio.c +++ b/drivers/media/video/ir-kbd-gpio.c @@ -1,5 +1,5 @@ /* - * $Id: ir-kbd-gpio.c,v 1.12 2005/02/22 12:28:40 kraxel Exp $ + * $Id: ir-kbd-gpio.c,v 1.13 2005/05/15 19:01:26 mchehab Exp $ * * Copyright (c) 2003 Gerd Knorr * Copyright (c) 2003 Pavel Machek @@ -114,38 +114,6 @@ static IR_KEYTAB_TYPE ir_codes_avermedia_dvbt[IR_KEYTAB_SIZE] = { [ 0x3e ] = KEY_VOLUMEUP, // 'volume +' }; -static IR_KEYTAB_TYPE ir_codes_pixelview[IR_KEYTAB_SIZE] = { - [ 2 ] = KEY_KP0, - [ 1 ] = KEY_KP1, - [ 11 ] = KEY_KP2, - [ 27 ] = KEY_KP3, - [ 5 ] = KEY_KP4, - [ 9 ] = KEY_KP5, - [ 21 ] = KEY_KP6, - [ 6 ] = KEY_KP7, - [ 10 ] = KEY_KP8, - [ 18 ] = KEY_KP9, - - [ 3 ] = KEY_TUNER, // TV/FM - [ 7 ] = KEY_SEARCH, // scan - [ 28 ] = KEY_ZOOM, // full screen - [ 30 ] = KEY_POWER, - [ 23 ] = KEY_VOLUMEDOWN, - [ 31 ] = KEY_VOLUMEUP, - [ 20 ] = KEY_CHANNELDOWN, - [ 22 ] = KEY_CHANNELUP, - [ 24 ] = KEY_MUTE, - - [ 0 ] = KEY_LIST, // source - [ 19 ] = KEY_INFO, // loop - [ 16 ] = KEY_LAST, // +100 - [ 13 ] = KEY_CLEAR, // reset - [ 12 ] = BTN_RIGHT, // fun++ - [ 4 ] = BTN_LEFT, // fun-- - [ 14 ] = KEY_GOTO, // function - [ 15 ] = KEY_STOP, // freeze -}; - /* Attila Kondoros <attila.kondoros@chello.hu> */ static IR_KEYTAB_TYPE ir_codes_apac_viewcomp[IR_KEYTAB_SIZE] = { diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 09464d624a6..1b7d38e96f1 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c @@ -735,7 +735,6 @@ static int msp34xx_sleep(struct msp3400c *msp, int timeout) { DECLARE_WAITQUEUE(wait, current); -again: add_wait_queue(&msp->wq, &wait); if (!kthread_should_stop()) { if (timeout < 0) { @@ -751,12 +750,9 @@ again: #endif } } - + if (current->flags & PF_FREEZE) + refrigerator(PF_FREEZE); remove_wait_queue(&msp->wq, &wait); - - if (try_to_freeze(PF_FREEZE)) - goto again; - return msp->restart; } @@ -1436,7 +1432,7 @@ static int msp_detach(struct i2c_client *client); static int msp_probe(struct i2c_adapter *adap); static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg); -static int msp_suspend(struct device * dev, pm_message_t state, u32 level); +static int msp_suspend(struct device * dev, u32 state, u32 level); static int msp_resume(struct device * dev, u32 level); static void msp_wake_thread(struct i2c_client *client); @@ -1841,7 +1837,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) return 0; } -static int msp_suspend(struct device * dev, pm_message_t state, u32 level) +static int msp_suspend(struct device * dev, u32 state, u32 level) { struct i2c_client *c = container_of(dev, struct i2c_client, dev); diff --git a/drivers/media/video/msp3400.h b/drivers/media/video/msp3400.h index d70a954e13a..023f33056a4 100644 --- a/drivers/media/video/msp3400.h +++ b/drivers/media/video/msp3400.h @@ -1,3 +1,7 @@ +/* + * $Id: msp3400.h,v 1.3 2005/06/12 04:19:19 mchehab Exp $ + */ + #ifndef MSP3400_H #define MSP3400_H diff --git a/drivers/media/video/saa7134/saa6752hs.c b/drivers/media/video/saa7134/saa6752hs.c index 42c2b565c9f..e6d0a18833d 100644 --- a/drivers/media/video/saa7134/saa6752hs.c +++ b/drivers/media/video/saa7134/saa6752hs.c @@ -41,16 +41,16 @@ enum saa6752hs_videoformat { static const struct v4l2_format v4l2_format_table[] = { - [SAA6752HS_VF_D1] = { - .fmt = { .pix = { .width = 720, .height = 576 }, }, }, - [SAA6752HS_VF_2_3_D1] = { - .fmt = { .pix = { .width = 480, .height = 576 }, }, }, - [SAA6752HS_VF_1_2_D1] = { - .fmt = { .pix = { .width = 352, .height = 576 }, }, }, - [SAA6752HS_VF_SIF] = { - .fmt = { .pix = { .width = 352, .height = 288 }, }, }, - [SAA6752HS_VF_UNKNOWN] = { - .fmt = { .pix = { .width = 0, .height = 0 }, }, }, + [SAA6752HS_VF_D1] = + { .fmt = { .pix = { .width = 720, .height = 576 }}}, + [SAA6752HS_VF_2_3_D1] = + { .fmt = { .pix = { .width = 480, .height = 576 }}}, + [SAA6752HS_VF_1_2_D1] = + { .fmt = { .pix = { .width = 352, .height = 576 }}}, + [SAA6752HS_VF_SIF] = + { .fmt = { .pix = { .width = 352, .height = 288 }}}, + [SAA6752HS_VF_UNKNOWN] = + { .fmt = { .pix = { .width = 0, .height = 0}}}, }; struct saa6752hs_state { diff --git a/drivers/media/video/saa7134/saa7134-cards.c b/drivers/media/video/saa7134/saa7134-cards.c index c51eb7f078d..0c781e24c44 100644 --- a/drivers/media/video/saa7134/saa7134-cards.c +++ b/drivers/media/video/saa7134/saa7134-cards.c @@ -1,6 +1,6 @@ /* - * $Id: saa7134-cards.c,v 1.54 2005/03/07 12:01:51 kraxel Exp $ + * $Id: saa7134-cards.c,v 1.58 2005/06/07 18:05:00 nsh Exp $ * * device driver for philips saa7134 based TV cards * card-specific stuff. @@ -165,7 +165,7 @@ struct saa7134_board saa7134_boards[] = { .inputs = {{ .name = name_tv, .vmux = 1, - .amux = LINE2, + .amux = TV, .tv = 1, },{ .name = name_comp1, @@ -878,7 +878,7 @@ struct saa7134_board saa7134_boards[] = { }, [SAA7134_BOARD_MANLI_MTV002] = { /* Ognjen Nastic <ognjen@logosoft.ba> */ - .name = "Manli MuchTV M-TV002", + .name = "Manli MuchTV M-TV002/Behold TV 403 FM", .audio_clock = 0x00200000, .tuner_type = TUNER_PHILIPS_PAL, .inputs = {{ @@ -899,14 +899,10 @@ struct saa7134_board saa7134_boards[] = { .name = name_radio, .amux = LINE2, }, - .mute = { - .name = name_mute, - .amux = LINE1, - }, }, [SAA7134_BOARD_MANLI_MTV001] = { /* Ognjen Nastic <ognjen@logosoft.ba> UNTESTED */ - .name = "Manli MuchTV M-TV001", + .name = "Manli MuchTV M-TV001/Behold TV 401", .audio_clock = 0x00200000, .tuner_type = TUNER_PHILIPS_PAL, .inputs = {{ @@ -923,6 +919,10 @@ struct saa7134_board saa7134_boards[] = { .amux = LINE2, .tv = 1, }}, + .mute = { + .name = name_mute, + .amux = LINE1, + }, }, [SAA7134_BOARD_TG3000TV] = { /* TransGear 3000TV */ @@ -1078,7 +1078,6 @@ struct saa7134_board saa7134_boards[] = { .audio_clock = 0x00187de7, .tuner_type = TUNER_PHILIPS_FM1256_IH3, .tda9887_conf = TDA9887_PRESENT, - .gpiomask = 0x3, .inputs = {{ .name = name_tv, .vmux = 1, @@ -1285,7 +1284,7 @@ struct saa7134_board saa7134_boards[] = { .gpio =0x8000, } }, - [SAA7134_BOARD_AVERMEDIA_307] = { + [SAA7134_BOARD_AVERMEDIA_STUDIO_307] = { /* Nickolay V. Shmyrev <nshmyrev@yandex.ru> Lots of thanks to Andrey Zolotarev <zolotarev_andrey@mail.ru> @@ -1323,6 +1322,35 @@ struct saa7134_board saa7134_boards[] = { .gpio = 0x01, }, }, + [SAA7134_BOARD_AVERMEDIA_GO_007_FM] = { + .name = "Avermedia AVerTV GO 007 FM", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TDA8290, + .gpiomask = 0x00300003, +// .gpiomask = 0x8c240003, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + .gpio = 0x01, + },{ + .name = name_comp1, + .vmux = 0, + .amux = LINE2, + .gpio = 0x02, + },{ + .name = name_svideo, + .vmux = 6, + .amux = LINE2, + .gpio = 0x02, + }}, + .radio = { + .name = name_radio, + .amux = LINE1, + .gpio = 0x00300001, + }, + }, [SAA7134_BOARD_AVERMEDIA_CARDBUS] = { /* Jon Westgate <oryn@oryn.fsck.tv> */ .name = "AVerMedia Cardbus TV/Radio", @@ -1492,7 +1520,6 @@ struct saa7134_board saa7134_boards[] = { .audio_clock = 0x00187de7, .tuner_type = TUNER_PHILIPS_FQ1216ME, .tda9887_conf = TDA9887_PRESENT, - .gpiomask = 0x3, .inputs = {{ .name = name_tv, .vmux = 1, @@ -1546,7 +1573,82 @@ struct saa7134_board saa7134_boards[] = { // .gpio = 0x4000, }}, }, -}; + [SAA7134_BOARD_AVERMEDIA_307] = { + /* + Davydov Vladimir <vladimir@iqmedia.com> + */ + .name = "Avermedia AVerTV 307", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_FQ1216ME, + .tda9887_conf = TDA9887_PRESENT, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 0, + .amux = LINE1, + },{ + .name = name_comp2, + .vmux = 3, + .amux = LINE1, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE1, + }}, + }, + [SAA7134_BOARD_ADS_INSTANT_TV] = { + .name = "ADS Tech Instant TV (saa7135)", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_TDA8290, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + },{ + .name = name_comp1, + .vmux = 3, + .amux = LINE2, + },{ + .name = name_svideo, + .vmux = 8, + .amux = LINE2, + }}, + }, + [SAA7134_BOARD_KWORLD_VSTREAM_XPERT] = { + .name = "Kworld/Tevion V-Stream Xpert TV PVR7134", + .audio_clock = 0x00187de7, + .tuner_type = TUNER_PHILIPS_PAL_I, + .gpiomask = 0x0700, + .inputs = {{ + .name = name_tv, + .vmux = 1, + .amux = TV, + .tv = 1, + .gpio = 0x000, + },{ + .name = name_comp1, + .vmux = 3, + .amux = LINE1, + .gpio = 0x200, //gpio by DScaler + },{ + .name = name_svideo, + .vmux = 0, + .amux = LINE1, + .gpio = 0x200, + }}, + .radio = { + .name = name_radio, + .amux = LINE1, + .gpio = 0x100, + }, + }, + }; + const unsigned int saa7134_bcount = ARRAY_SIZE(saa7134_boards); /* ------------------------------------------------------------------ */ @@ -1663,7 +1765,7 @@ struct pci_device_id saa7134_pci_tbl[] = { .driver_data = SAA7134_BOARD_ASUSTeK_TVFM7134, },{ .vendor = PCI_VENDOR_ID_PHILIPS, - .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .device = PCI_DEVICE_ID_PHILIPS_SAA7135, .subvendor = PCI_VENDOR_ID_ASUSTEK, .subdevice = 0x4845, .driver_data = SAA7135_BOARD_ASUSTeK_TVFM7135, @@ -1824,6 +1926,12 @@ struct pci_device_id saa7134_pci_tbl[] = { .device = PCI_DEVICE_ID_PHILIPS_SAA7134, .subvendor = 0x1461, /* Avermedia Technologies Inc */ .subdevice = 0x9715, + .driver_data = SAA7134_BOARD_AVERMEDIA_STUDIO_307, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7134, + .subvendor = 0x1461, /* Avermedia Technologies Inc */ + .subdevice = 0xa70a, .driver_data = SAA7134_BOARD_AVERMEDIA_307, },{ .vendor = PCI_VENDOR_ID_PHILIPS, @@ -1844,6 +1952,26 @@ struct pci_device_id saa7134_pci_tbl[] = { .subvendor = 0x5168, .subdevice = 0x0306, .driver_data = SAA7134_BOARD_FLYDVBTDUO, + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7133, + .subvendor = 0x1461, /* Avermedia Technologies Inc */ + .subdevice = 0xf31f, + .driver_data = SAA7134_BOARD_AVERMEDIA_GO_007_FM, + + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7135, + .subvendor = 0x1421, + .subdevice = 0x0350, /* PCI version */ + .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, + + },{ + .vendor = PCI_VENDOR_ID_PHILIPS, + .device = PCI_DEVICE_ID_PHILIPS_SAA7135, + .subvendor = 0x1421, + .subdevice = 0x0370, /* cardbus version */ + .driver_data = SAA7134_BOARD_ADS_INSTANT_TV, },{ /* --- boards without eeprom + subsystem ID --- */ @@ -1954,20 +2082,23 @@ int saa7134_board_init1(struct saa7134_dev *dev) dev->has_remote = 1; board_flyvideo(dev); break; - case SAA7134_BOARD_FLYTVPLATINUM_FM: + case SAA7134_BOARD_FLYTVPLATINUM_FM: case SAA7134_BOARD_CINERGY400: case SAA7134_BOARD_CINERGY600: case SAA7134_BOARD_CINERGY600_MK3: case SAA7134_BOARD_ECS_TVP3XP: case SAA7134_BOARD_ECS_TVP3XP_4CB5: case SAA7134_BOARD_MD2819: + case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: case SAA7134_BOARD_AVERMEDIA_STUDIO_305: case SAA7134_BOARD_AVERMEDIA_305: + case SAA7134_BOARD_AVERMEDIA_STUDIO_307: case SAA7134_BOARD_AVERMEDIA_307: + case SAA7134_BOARD_AVERMEDIA_GO_007_FM: // case SAA7134_BOARD_SABRENT_SBTTVFM: /* not finished yet */ case SAA7134_BOARD_VIDEOMATE_TV_PVR: - dev->has_remote = 1; - break; + case SAA7134_BOARD_MANLI_MTV001: + case SAA7134_BOARD_MANLI_MTV002: case SAA7134_BOARD_AVACSSMARTTV: dev->has_remote = 1; break; diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c index d506cafba8f..f61ed1849a2 100644 --- a/drivers/media/video/saa7134/saa7134-core.c +++ b/drivers/media/video/saa7134/saa7134-core.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-core.c,v 1.28 2005/02/22 09:56:29 kraxel Exp $ + * $Id: saa7134-core.c,v 1.30 2005/05/22 19:23:39 nsh Exp $ * * device driver for philips saa7134 based TV cards * driver core @@ -316,7 +316,7 @@ unsigned long saa7134_buffer_base(struct saa7134_buf *buf) int saa7134_pgtable_alloc(struct pci_dev *pci, struct saa7134_pgtable *pt) { - u32 *cpu; + __le32 *cpu; dma_addr_t dma_addr; cpu = pci_alloc_consistent(pci, SAA7134_PGTABLE_SIZE, &dma_addr); @@ -332,7 +332,7 @@ int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt, struct scatterlist *list, unsigned int length, unsigned int startpage) { - u32 *ptr; + __le32 *ptr; unsigned int i,p; BUG_ON(NULL == pt || NULL == pt->cpu); @@ -340,7 +340,7 @@ int saa7134_pgtable_build(struct pci_dev *pci, struct saa7134_pgtable *pt, ptr = pt->cpu + startpage; for (i = 0; i < length; i++, list++) for (p = 0; p * 4096 < list->length; p++, ptr++) - *ptr = sg_dma_address(list) - list->offset; + *ptr = cpu_to_le32(sg_dma_address(list) - list->offset); return 0; } diff --git a/drivers/media/video/saa7134/saa7134-dvb.c b/drivers/media/video/saa7134/saa7134-dvb.c index c2873ae029f..aa8e2cf62d5 100644 --- a/drivers/media/video/saa7134/saa7134-dvb.c +++ b/drivers/media/video/saa7134/saa7134-dvb.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-dvb.c,v 1.12 2005/02/18 12:28:29 kraxel Exp $ + * $Id: saa7134-dvb.c,v 1.13 2005/06/12 04:19:19 mchehab Exp $ * * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] * diff --git a/drivers/media/video/saa7134/saa7134-empress.c b/drivers/media/video/saa7134/saa7134-empress.c index fa135733690..c85348d0239 100644 --- a/drivers/media/video/saa7134/saa7134-empress.c +++ b/drivers/media/video/saa7134/saa7134-empress.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-empress.c,v 1.10 2005/02/03 10:24:33 kraxel Exp $ + * $Id: saa7134-empress.c,v 1.11 2005/05/22 19:23:39 nsh Exp $ * * (c) 2004 Gerd Knorr <kraxel@bytesex.org> [SuSE Labs] * diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index 702bb63d981..b6f002e8421 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-i2c.c,v 1.10 2005/01/24 17:37:23 kraxel Exp $ + * $Id: saa7134-i2c.c,v 1.11 2005/06/12 01:36:14 mchehab Exp $ * * device driver for philips saa7134 based TV cards * i2c interface support diff --git a/drivers/media/video/saa7134/saa7134-input.c b/drivers/media/video/saa7134/saa7134-input.c index ca50cf531f2..aba2b9de60d 100644 --- a/drivers/media/video/saa7134/saa7134-input.c +++ b/drivers/media/video/saa7134/saa7134-input.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-input.c,v 1.16 2004/12/10 12:33:39 kraxel Exp $ + * $Id: saa7134-input.c,v 1.19 2005/06/07 18:02:26 nsh Exp $ * * handle saa7134 IR remotes via linux kernel input layer. * @@ -308,6 +308,102 @@ static IR_KEYTAB_TYPE videomate_tv_pvr_codes[IR_KEYTAB_SIZE] = { [ 32 ] = KEY_LANGUAGE, [ 33 ] = KEY_SLEEP, }; + +/* Michael Tokarev <mjt@tls.msk.ru> + http://www.corpit.ru/mjt/beholdTV/remote_control.jpg + keytable is used by MANLI MTV00[12] and BeholdTV 40[13] at + least, and probably other cards too. + The "ascii-art picture" below (in comments, first row + is the keycode in hex, and subsequent row(s) shows + the button labels (several variants when appropriate) + helps to descide which keycodes to assign to the buttons. + */ +static IR_KEYTAB_TYPE manli_codes[IR_KEYTAB_SIZE] = { + + /* 0x1c 0x12 * + * FUNCTION POWER * + * FM (|) * + * */ + [ 0x1c ] = KEY_RADIO, /*XXX*/ + [ 0x12 ] = KEY_POWER, + + /* 0x01 0x02 0x03 * + * 1 2 3 * + * * + * 0x04 0x05 0x06 * + * 4 5 6 * + * * + * 0x07 0x08 0x09 * + * 7 8 9 * + * */ + [ 0x01 ] = KEY_KP1, + [ 0x02 ] = KEY_KP2, + [ 0x03 ] = KEY_KP3, + [ 0x04 ] = KEY_KP4, + [ 0x05 ] = KEY_KP5, + [ 0x06 ] = KEY_KP6, + [ 0x07 ] = KEY_KP7, + [ 0x08 ] = KEY_KP8, + [ 0x09 ] = KEY_KP9, + + /* 0x0a 0x00 0x17 * + * RECALL 0 +100 * + * PLUS * + * */ + [ 0x0a ] = KEY_AGAIN, /*XXX KEY_REWIND? */ + [ 0x00 ] = KEY_KP0, + [ 0x17 ] = KEY_DIGITS, /*XXX*/ + + /* 0x14 0x10 * + * MENU INFO * + * OSD */ + [ 0x14 ] = KEY_MENU, + [ 0x10 ] = KEY_INFO, + + /* 0x0b * + * Up * + * * + * 0x18 0x16 0x0c * + * Left Ok Right * + * * + * 0x015 * + * Down * + * */ + [ 0x0b ] = KEY_UP, /*XXX KEY_SCROLLUP? */ + [ 0x18 ] = KEY_LEFT, /*XXX KEY_BACK? */ + [ 0x16 ] = KEY_OK, /*XXX KEY_SELECT? KEY_ENTER? */ + [ 0x0c ] = KEY_RIGHT, /*XXX KEY_FORWARD? */ + [ 0x15 ] = KEY_DOWN, /*XXX KEY_SCROLLDOWN? */ + + /* 0x11 0x0d * + * TV/AV MODE * + * SOURCE STEREO * + * */ + [ 0x11 ] = KEY_TV, /*XXX*/ + [ 0x0d ] = KEY_MODE, /*XXX there's no KEY_STEREO */ + + /* 0x0f 0x1b 0x1a * + * AUDIO Vol+ Chan+ * + * TIMESHIFT??? * + * * + * 0x0e 0x1f 0x1e * + * SLEEP Vol- Chan- * + * */ + [ 0x0f ] = KEY_AUDIO, + [ 0x1b ] = KEY_VOLUMEUP, + [ 0x1a ] = KEY_CHANNELUP, + [ 0x0e ] = KEY_SLEEP, /*XXX maybe KEY_PAUSE */ + [ 0x1f ] = KEY_VOLUMEDOWN, + [ 0x1e ] = KEY_CHANNELDOWN, + + /* 0x13 0x19 * + * MUTE SNAPSHOT* + * */ + [ 0x13 ] = KEY_MUTE, + [ 0x19 ] = KEY_RECORD, /*XXX*/ + + // 0x1d unused ? +}; /* ---------------------------------------------------------------------- */ static int build_key(struct saa7134_dev *dev) @@ -379,7 +475,7 @@ int saa7134_input_init1(struct saa7134_dev *dev) switch (dev->board) { case SAA7134_BOARD_FLYVIDEO2000: case SAA7134_BOARD_FLYVIDEO3000: - case SAA7134_BOARD_FLYTVPLATINUM_FM: + case SAA7134_BOARD_FLYTVPLATINUM_FM: ir_codes = flyvideo_codes; mask_keycode = 0xEC00000; mask_keydown = 0x0040000; @@ -405,8 +501,12 @@ int saa7134_input_init1(struct saa7134_dev *dev) polling = 50; // ms break; case SAA7134_BOARD_MD2819: + case SAA7134_BOARD_KWORLD_VSTREAM_XPERT: case SAA7134_BOARD_AVERMEDIA_305: case SAA7134_BOARD_AVERMEDIA_307: + case SAA7134_BOARD_AVERMEDIA_STUDIO_305: + case SAA7134_BOARD_AVERMEDIA_STUDIO_307: + case SAA7134_BOARD_AVERMEDIA_GO_007_FM: ir_codes = md2819_codes; mask_keycode = 0x0007C8; mask_keydown = 0x000010; @@ -415,6 +515,14 @@ int saa7134_input_init1(struct saa7134_dev *dev) saa_setb(SAA7134_GPIO_GPMODE0, 0x4); saa_setb(SAA7134_GPIO_GPSTATUS0, 0x4); break; + case SAA7134_BOARD_MANLI_MTV001: + case SAA7134_BOARD_MANLI_MTV002: + ir_codes = manli_codes; + mask_keycode = 0x001f00; + mask_keyup = 0x004000; + mask_keydown = 0x002000; + polling = 50; // ms + break; case SAA7134_BOARD_VIDEOMATE_TV_PVR: ir_codes = videomate_tv_pvr_codes; mask_keycode = 0x00003F; diff --git a/drivers/media/video/saa7134/saa7134-oss.c b/drivers/media/video/saa7134/saa7134-oss.c index 6b6a643bf1c..81732904623 100644 --- a/drivers/media/video/saa7134/saa7134-oss.c +++ b/drivers/media/video/saa7134/saa7134-oss.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-oss.c,v 1.13 2004/12/10 12:33:39 kraxel Exp $ + * $Id: saa7134-oss.c,v 1.14 2005/05/18 22:45:16 hhackmann Exp $ * * device driver for philips saa7134 based TV cards * oss dsp interface @@ -49,7 +49,6 @@ MODULE_PARM_DESC(oss_rate,"sample rate (valid are: 32000,48000)"); static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) { - blksize &= ~0xff; if (blksize < 0x100) blksize = 0x100; if (blksize > 0x10000) @@ -57,8 +56,6 @@ static int dsp_buffer_conf(struct saa7134_dev *dev, int blksize, int blocks) if (blocks < 2) blocks = 2; - while ((blksize * blocks) & ~PAGE_MASK) - blocks++; if ((blksize * blocks) > 1024*1024) blocks = 1024*1024 / blksize; @@ -79,7 +76,7 @@ static int dsp_buffer_init(struct saa7134_dev *dev) BUG(); videobuf_dma_init(&dev->oss.dma); err = videobuf_dma_init_kernel(&dev->oss.dma, PCI_DMA_FROMDEVICE, - dev->oss.bufsize >> PAGE_SHIFT); + (dev->oss.bufsize + PAGE_SIZE) >> PAGE_SHIFT); if (0 != err) return err; return 0; @@ -163,10 +160,11 @@ static int dsp_rec_start(struct saa7134_dev *dev) fmt |= 0x04; fmt |= (TV == dev->oss.input) ? 0xc0 : 0x80; - saa_writeb(SAA7134_NUM_SAMPLES0, (dev->oss.blksize & 0x0000ff)); - saa_writeb(SAA7134_NUM_SAMPLES1, (dev->oss.blksize & 0x00ff00) >> 8); - saa_writeb(SAA7134_NUM_SAMPLES2, (dev->oss.blksize & 0xff0000) >> 16); + saa_writeb(SAA7134_NUM_SAMPLES0, ((dev->oss.blksize - 1) & 0x0000ff)); + saa_writeb(SAA7134_NUM_SAMPLES1, ((dev->oss.blksize - 1) & 0x00ff00) >> 8); + saa_writeb(SAA7134_NUM_SAMPLES2, ((dev->oss.blksize - 1) & 0xff0000) >> 16); saa_writeb(SAA7134_AUDIO_FORMAT_CTRL, fmt); + break; case PCI_DEVICE_ID_PHILIPS_SAA7133: case PCI_DEVICE_ID_PHILIPS_SAA7135: @@ -817,7 +815,7 @@ void saa7134_irq_oss_done(struct saa7134_dev *dev, unsigned long status) reg = SAA7134_RS_BA1(6); } else { /* even */ - if (0 == (dev->oss.dma_blk & 0x00)) + if (1 == (dev->oss.dma_blk & 0x01)) reg = SAA7134_RS_BA2(6); } if (0 == reg) { diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c index ecac13c006d..3617e7f7a41 100644 --- a/drivers/media/video/saa7134/saa7134-tvaudio.c +++ b/drivers/media/video/saa7134/saa7134-tvaudio.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-tvaudio.c,v 1.22 2005/01/07 13:11:19 kraxel Exp $ + * $Id: saa7134-tvaudio.c,v 1.25 2005/06/07 19:00:38 nsh Exp $ * * device driver for philips saa7134 based TV cards * tv audio decoder (fm stereo, nicam, ...) @@ -181,7 +181,8 @@ static void tvaudio_init(struct saa7134_dev *dev) saa_writeb(SAA7134_AUDIO_CLOCK0, clock & 0xff); saa_writeb(SAA7134_AUDIO_CLOCK1, (clock >> 8) & 0xff); saa_writeb(SAA7134_AUDIO_CLOCK2, (clock >> 16) & 0xff); - saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x01); + // frame locked audio was reported not to be reliable + saa_writeb(SAA7134_AUDIO_PLL_CTRL, 0x02); saa_writeb(SAA7134_NICAM_ERROR_LOW, 0x14); saa_writeb(SAA7134_NICAM_ERROR_HIGH, 0x50); @@ -250,6 +251,11 @@ static void mute_input_7134(struct saa7134_dev *dev) saa_andorb(SAA7134_AUDIO_FORMAT_CTRL, 0xc0, ausel); saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x08, ics); saa_andorb(SAA7134_ANALOG_IO_SELECT, 0x07, ocs); + // for oss, we need to change the clock configuration + if (in->amux == TV) + saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, 0x00); + else + saa_andorb(SAA7134_SIF_SAMPLE_FREQ, 0x03, 0x01); /* switch gpio-connected external audio mux */ if (0 == card(dev).gpiomask) @@ -439,16 +445,15 @@ static int tvaudio_getstereo(struct saa7134_dev *dev, struct saa7134_tvaudio *au nicam = saa_readb(SAA7134_NICAM_STATUS); dprintk("getstereo: nicam=0x%x\n",nicam); switch (nicam & 0x0b) { + case 0x08: + retval = V4L2_TUNER_SUB_MONO; + break; case 0x09: retval = V4L2_TUNER_SUB_LANG1 | V4L2_TUNER_SUB_LANG2; break; case 0x0a: retval = V4L2_TUNER_SUB_MONO | V4L2_TUNER_SUB_STEREO; break; - case 0x08: - default: - retval = V4L2_TUNER_SUB_MONO; - break; } break; } @@ -572,14 +577,14 @@ static int tvaudio_thread(void *data) } else if (0 != dev->last_carrier) { /* no carrier -- try last detected one as fallback */ carrier = dev->last_carrier; - printk(KERN_WARNING "%s/audio: audio carrier scan failed, " + dprintk(KERN_WARNING "%s/audio: audio carrier scan failed, " "using %d.%03d MHz [last detected]\n", dev->name, carrier/1000, carrier%1000); } else { /* no carrier + no fallback -- use default */ carrier = default_carrier; - printk(KERN_WARNING "%s/audio: audio carrier scan failed, " + dprintk(KERN_WARNING "%s/audio: audio carrier scan failed, " "using %d.%03d MHz [default]\n", dev->name, carrier/1000, carrier%1000); } diff --git a/drivers/media/video/saa7134/saa7134-vbi.c b/drivers/media/video/saa7134/saa7134-vbi.c index 86954cc7c37..3c33c591cc8 100644 --- a/drivers/media/video/saa7134/saa7134-vbi.c +++ b/drivers/media/video/saa7134/saa7134-vbi.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-vbi.c,v 1.6 2004/12/10 12:33:39 kraxel Exp $ + * $Id: saa7134-vbi.c,v 1.7 2005/05/24 23:13:06 nsh Exp $ * * device driver for philips saa7134 based TV cards * video4linux video interface @@ -60,10 +60,10 @@ static void task_init(struct saa7134_dev *dev, struct saa7134_buf *buf, saa_writeb(SAA7134_VBI_H_START2(task), norm->h_start >> 8); saa_writeb(SAA7134_VBI_H_STOP1(task), norm->h_stop & 0xff); saa_writeb(SAA7134_VBI_H_STOP2(task), norm->h_stop >> 8); - saa_writeb(SAA7134_VBI_V_START1(task), norm->vbi_v_start & 0xff); - saa_writeb(SAA7134_VBI_V_START2(task), norm->vbi_v_start >> 8); - saa_writeb(SAA7134_VBI_V_STOP1(task), norm->vbi_v_stop & 0xff); - saa_writeb(SAA7134_VBI_V_STOP2(task), norm->vbi_v_stop >> 8); + saa_writeb(SAA7134_VBI_V_START1(task), norm->vbi_v_start_0 & 0xff); + saa_writeb(SAA7134_VBI_V_START2(task), norm->vbi_v_start_0 >> 8); + saa_writeb(SAA7134_VBI_V_STOP1(task), norm->vbi_v_stop_0 & 0xff); + saa_writeb(SAA7134_VBI_V_STOP2(task), norm->vbi_v_stop_0 >> 8); saa_writeb(SAA7134_VBI_H_SCALE_INC1(task), VBI_SCALE & 0xff); saa_writeb(SAA7134_VBI_H_SCALE_INC2(task), VBI_SCALE >> 8); @@ -127,7 +127,7 @@ static int buffer_prepare(struct videobuf_queue *q, unsigned int lines, llength, size; int err; - lines = norm->vbi_v_stop - norm->vbi_v_start +1; + lines = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1; if (lines > VBI_LINE_COUNT) lines = VBI_LINE_COUNT; #if 1 @@ -177,7 +177,7 @@ buffer_setup(struct videobuf_queue *q, unsigned int *count, unsigned int *size) struct saa7134_dev *dev = fh->dev; int llength,lines; - lines = dev->tvnorm->vbi_v_stop - dev->tvnorm->vbi_v_start +1; + lines = dev->tvnorm->vbi_v_stop_0 - dev->tvnorm->vbi_v_start_0 +1; #if 1 llength = VBI_LINE_LENGTH; #else diff --git a/drivers/media/video/saa7134/saa7134-video.c b/drivers/media/video/saa7134/saa7134-video.c index 5d66060026f..c0a2ee52053 100644 --- a/drivers/media/video/saa7134/saa7134-video.c +++ b/drivers/media/video/saa7134/saa7134-video.c @@ -1,5 +1,5 @@ /* - * $Id: saa7134-video.c,v 1.28 2005/02/15 15:59:35 kraxel Exp $ + * $Id: saa7134-video.c,v 1.30 2005/06/07 19:00:38 nsh Exp $ * * device driver for philips saa7134 based TV cards * video4linux video interface @@ -31,8 +31,6 @@ #include "saa7134-reg.h" #include "saa7134.h" -#define V4L2_I2C_CLIENTS 1 - /* ------------------------------------------------------------------ */ static unsigned int video_debug = 0; @@ -158,18 +156,20 @@ static struct saa7134_format formats[] = { .h_stop = 719, \ .video_v_start = 24, \ .video_v_stop = 311, \ - .vbi_v_start = 7, \ - .vbi_v_stop = 22, \ + .vbi_v_start_0 = 7, \ + .vbi_v_stop_0 = 22, \ + .vbi_v_start_1 = 319, \ .src_timing = 4 #define NORM_525_60 \ .h_start = 0, \ .h_stop = 703, \ - .video_v_start = 22, \ - .video_v_stop = 22+239, \ - .vbi_v_start = 10, /* FIXME */ \ - .vbi_v_stop = 21, /* FIXME */ \ - .src_timing = 1 + .video_v_start = 23, \ + .video_v_stop = 262, \ + .vbi_v_start_0 = 10, \ + .vbi_v_stop_0 = 21, \ + .vbi_v_start_1 = 273, \ + .src_timing = 7 static struct saa7134_tvnorm tvnorms[] = { { @@ -274,11 +274,12 @@ static struct saa7134_tvnorm tvnorms[] = { .h_start = 0, .h_stop = 719, - .video_v_start = 22, - .video_v_stop = 22+239, - .vbi_v_start = 10, /* FIXME */ - .vbi_v_stop = 21, /* FIXME */ - .src_timing = 1, + .video_v_start = 23, + .video_v_stop = 262, + .vbi_v_start_0 = 10, + .vbi_v_stop_0 = 21, + .vbi_v_start_1 = 273, + .src_timing = 7, .sync_control = 0x18, .luma_control = 0x40, @@ -335,8 +336,8 @@ static const struct v4l2_queryctrl video_ctrls[] = { .default_value = 0, .type = V4L2_CTRL_TYPE_INTEGER, },{ - .id = V4L2_CID_VFLIP, - .name = "vertical flip", + .id = V4L2_CID_HFLIP, + .name = "Mirror", .minimum = 0, .maximum = 1, .type = V4L2_CTRL_TYPE_BOOLEAN, @@ -482,7 +483,7 @@ static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) dev->crop_bounds.width = norm->h_stop - norm->h_start +1; dev->crop_defrect.width = norm->h_stop - norm->h_start +1; - dev->crop_bounds.top = (norm->vbi_v_stop+1)*2; + dev->crop_bounds.top = (norm->vbi_v_stop_0+1)*2; dev->crop_defrect.top = norm->video_v_start*2; dev->crop_bounds.height = ((norm->id & V4L2_STD_525_60) ? 524 : 624) - dev->crop_bounds.top; @@ -521,22 +522,7 @@ static void set_tvnorm(struct saa7134_dev *dev, struct saa7134_tvnorm *norm) saa_writeb(SAA7134_RAW_DATA_GAIN, 0x40); saa_writeb(SAA7134_RAW_DATA_OFFSET, 0x80); -#ifdef V4L2_I2C_CLIENTS saa7134_i2c_call_clients(dev,VIDIOC_S_STD,&norm->id); -#else - { - /* pass down info to the i2c chips (v4l1) */ - struct video_channel c; - memset(&c,0,sizeof(c)); - c.channel = dev->ctl_input; - c.norm = VIDEO_MODE_PAL; - if (norm->id & V4L2_STD_NTSC) - c.norm = VIDEO_MODE_NTSC; - if (norm->id & V4L2_STD_SECAM) - c.norm = VIDEO_MODE_SECAM; - saa7134_i2c_call_clients(dev,VIDIOCSCHAN,&c); - } -#endif } static void video_mux(struct saa7134_dev *dev, int input) @@ -1064,7 +1050,7 @@ static int get_control(struct saa7134_dev *dev, struct v4l2_control *c) case V4L2_CID_PRIVATE_INVERT: c->value = dev->ctl_invert; break; - case V4L2_CID_VFLIP: + case V4L2_CID_HFLIP: c->value = dev->ctl_mirror; break; case V4L2_CID_PRIVATE_Y_EVEN: @@ -1139,7 +1125,7 @@ static int set_control(struct saa7134_dev *dev, struct saa7134_fh *fh, saa_writeb(SAA7134_DEC_CHROMA_SATURATION, dev->ctl_invert ? -dev->ctl_saturation : dev->ctl_saturation); break; - case V4L2_CID_VFLIP: + case V4L2_CID_HFLIP: dev->ctl_mirror = c->value; restart_overlay = 1; break; @@ -1407,9 +1393,9 @@ static void saa7134_vbi_fmt(struct saa7134_dev *dev, struct v4l2_format *f) f->fmt.vbi.samples_per_line = 2048 /* VBI_LINE_LENGTH */; f->fmt.vbi.sample_format = V4L2_PIX_FMT_GREY; f->fmt.vbi.offset = 64 * 4; - f->fmt.vbi.start[0] = norm->vbi_v_start; - f->fmt.vbi.count[0] = norm->vbi_v_stop - norm->vbi_v_start +1; - f->fmt.vbi.start[1] = norm->video_v_stop + norm->vbi_v_start +1; + f->fmt.vbi.start[0] = norm->vbi_v_start_0; + f->fmt.vbi.count[0] = norm->vbi_v_stop_0 - norm->vbi_v_start_0 +1; + f->fmt.vbi.start[1] = norm->vbi_v_start_1; f->fmt.vbi.count[1] = f->fmt.vbi.count[0]; f->fmt.vbi.flags = 0; /* VBI_UNSYNC VBI_INTERLACED */ @@ -1880,11 +1866,9 @@ static int video_do_ioctl(struct inode *inode, struct file *file, return -EINVAL; down(&dev->lock); dev->ctl_freq = f->frequency; -#ifdef V4L2_I2C_CLIENTS + saa7134_i2c_call_clients(dev,VIDIOC_S_FREQUENCY,f); -#else - saa7134_i2c_call_clients(dev,VIDIOCSFREQ,&dev->ctl_freq); -#endif + saa7134_tvaudio_do_scan(dev); up(&dev->lock); return 0; @@ -2139,16 +2123,19 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, t->rangelow = (int)(65*16); t->rangehigh = (int)(108*16); -#ifdef V4L2_I2C_CLIENTS - saa7134_i2c_call_clients(dev,VIDIOC_G_TUNER,t); -#else - { - struct video_tuner vt; - memset(&vt,0,sizeof(vt)); - saa7134_i2c_call_clients(dev,VIDIOCGTUNER,&vt); - t->signal = vt.signal; - } -#endif + saa7134_i2c_call_clients(dev, VIDIOC_G_TUNER, t); + + return 0; + } + case VIDIOC_S_TUNER: + { + struct v4l2_tuner *t = arg; + + if (0 != t->index) + return -EINVAL; + + saa7134_i2c_call_clients(dev,VIDIOC_S_TUNER,t); + return 0; } case VIDIOC_ENUMINPUT: @@ -2182,7 +2169,6 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, return 0; } case VIDIOC_S_AUDIO: - case VIDIOC_S_TUNER: case VIDIOC_S_INPUT: case VIDIOC_S_STD: return 0; diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index ac90a985323..d6b1c0d4d0f 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h @@ -1,5 +1,5 @@ /* - * $Id: saa7134.h,v 1.38 2005/03/07 12:01:51 kraxel Exp $ + * $Id: saa7134.h,v 1.41 2005/06/07 18:02:26 nsh Exp $ * * v4l2 device driver for philips saa7134 based TV cards * @@ -21,7 +21,7 @@ */ #include <linux/version.h> -#define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,12) +#define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,13) #include <linux/pci.h> #include <linux/i2c.h> @@ -91,9 +91,10 @@ struct saa7134_tvnorm { unsigned int h_stop; unsigned int video_v_start; unsigned int video_v_stop; - unsigned int vbi_v_start; - unsigned int vbi_v_stop; + unsigned int vbi_v_start_0; + unsigned int vbi_v_stop_0; unsigned int src_timing; + unsigned int vbi_v_start_1; }; struct saa7134_tvaudio { @@ -167,7 +168,7 @@ struct saa7134_format { #define SAA7134_BOARD_SABRENT_SBTTVFM 42 #define SAA7134_BOARD_ZOLID_XPERT_TV7134 43 #define SAA7134_BOARD_EMPIRE_PCI_TV_RADIO_LE 44 -#define SAA7134_BOARD_AVERMEDIA_307 45 +#define SAA7134_BOARD_AVERMEDIA_STUDIO_307 45 #define SAA7134_BOARD_AVERMEDIA_CARDBUS 46 #define SAA7134_BOARD_CINERGY400_CARDBUS 47 #define SAA7134_BOARD_CINERGY600_MK3 48 @@ -178,6 +179,10 @@ struct saa7134_format { #define SAA7135_BOARD_ASUSTeK_TVFM7135 53 #define SAA7134_BOARD_FLYTVPLATINUM_FM 54 #define SAA7134_BOARD_FLYDVBTDUO 55 +#define SAA7134_BOARD_AVERMEDIA_307 56 +#define SAA7134_BOARD_AVERMEDIA_GO_007_FM 57 +#define SAA7134_BOARD_ADS_INSTANT_TV 58 +#define SAA7134_BOARD_KWORLD_VSTREAM_XPERT 59 #define SAA7134_MAXBOARDS 8 #define SAA7134_INPUT_MAX 8 @@ -241,7 +246,7 @@ struct saa7134_dma; /* saa7134 page table */ struct saa7134_pgtable { unsigned int size; - u32 *cpu; + __le32 *cpu; dma_addr_t dma; }; diff --git a/drivers/media/video/tda9887.c b/drivers/media/video/tda9887.c index 7e6e6dd966a..39773633cc3 100644 --- a/drivers/media/video/tda9887.c +++ b/drivers/media/video/tda9887.c @@ -53,6 +53,7 @@ struct tda9887 { unsigned int config; unsigned int pinnacle_id; unsigned int using_v4l2; + unsigned int radio_mode; }; struct tvnorm { @@ -212,12 +213,22 @@ static struct tvnorm tvnorms[] = { } }; -static struct tvnorm radio = { - .name = "radio", +static struct tvnorm radio_stereo = { + .name = "Radio Stereo", + .b = ( cFmRadio | + cQSS ), + .c = ( cDeemphasisOFF | + cAudioGain6 ), + .e = ( cAudioIF_5_5 | + cRadioIF_38_90 ), +}; + +static struct tvnorm radio_mono = { + .name = "Radio Mono", .b = ( cFmRadio | cQSS ), .c = ( cDeemphasisON | - cDeemphasis50 ), + cDeemphasis50), .e = ( cAudioIF_5_5 | cRadioIF_38_90 ), }; @@ -354,7 +365,10 @@ static int tda9887_set_tvnorm(struct tda9887 *t, char *buf) int i; if (t->radio) { - norm = &radio; + if (t->radio_mode == V4L2_TUNER_MODE_MONO) + norm = &radio_mono; + else + norm = &radio_stereo; } else { for (i = 0; i < ARRAY_SIZE(tvnorms); i++) { if (tvnorms[i].std & t->std) { @@ -545,11 +559,14 @@ static int tda9887_configure(struct tda9887 *t) memset(buf,0,sizeof(buf)); tda9887_set_tvnorm(t,buf); + buf[1] |= cOutputPort1Inactive; buf[1] |= cOutputPort2Inactive; + if (UNSET != t->pinnacle_id) { tda9887_set_pinnacle(t,buf); } + tda9887_set_config(t,buf); tda9887_set_insmod(t,buf); @@ -592,9 +609,12 @@ static int tda9887_attach(struct i2c_adapter *adap, int addr, int kind) if (NULL == (t = kmalloc(sizeof(*t), GFP_KERNEL))) return -ENOMEM; memset(t,0,sizeof(*t)); + t->client = client_template; t->std = 0; t->pinnacle_id = UNSET; + t->radio_mode = V4L2_TUNER_MODE_STEREO; + i2c_set_clientdata(&t->client, t); i2c_attach_client(&t->client); @@ -733,6 +753,16 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) } break; } + case VIDIOC_S_TUNER: + { + struct v4l2_tuner* tuner = arg; + + if (t->radio) { + t->radio_mode = tuner->audmode; + tda9887_configure (t); + } + break; + } default: /* nothing */ break; @@ -740,7 +770,7 @@ tda9887_command(struct i2c_client *client, unsigned int cmd, void *arg) return 0; } -static int tda9887_suspend(struct device * dev, pm_message_t state, u32 level) +static int tda9887_suspend(struct device * dev, u32 state, u32 level) { dprintk("tda9887: suspend\n"); return 0; diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index 81882ddab85..eaabfc85870 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c @@ -1,5 +1,5 @@ /* - * $Id: tuner-core.c,v 1.5 2005/02/15 15:59:35 kraxel Exp $ + * $Id: tuner-core.c,v 1.15 2005/06/12 01:36:14 mchehab Exp $ * * i2c tv tuner chip device driver * core core, i.e. kernel interfaces, registering and so on @@ -23,6 +23,11 @@ #include <media/tuner.h> #include <media/audiochip.h> +/* + * comment line bellow to return to old behavor, where only one I2C device is supported + */ +#define CONFIG_TUNER_MULTI_I2C /**/ + #define UNSET (-1U) /* standard i2c insmod options */ @@ -53,13 +58,16 @@ MODULE_AUTHOR("Ralph Metzler, Gerd Knorr, Gunther Mayer"); MODULE_LICENSE("GPL"); static int this_adap; +#ifdef CONFIG_TUNER_MULTI_I2C +static unsigned short first_tuner, tv_tuner, radio_tuner; +#endif static struct i2c_driver driver; static struct i2c_client client_template; /* ---------------------------------------------------------------------- */ -// Set tuner frequency, freq in Units of 62.5kHz = 1/16MHz +/* Set tuner frequency, freq in Units of 62.5kHz = 1/16MHz */ static void set_tv_freq(struct i2c_client *c, unsigned int freq) { struct tuner *t = i2c_get_clientdata(c); @@ -73,14 +81,26 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq) return; } if (freq < tv_range[0]*16 || freq > tv_range[1]*16) { - /* FIXME: better do that chip-specific, but - right now we don't have that in the config - struct and this way is still better than no - check at all */ - tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n", - freq/16,freq%16*100/16,tv_range[0],tv_range[1]); - return; + + if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) { + /* V4L2_TUNER_CAP_LOW frequency */ + + tuner_dbg("V4L2_TUNER_CAP_LOW freq selected for TV. Tuners yet doesn't support converting it to valid freq.\n"); + + t->tv_freq(c,freq>>10); + + return; + } else { + /* FIXME: better do that chip-specific, but + right now we don't have that in the config + struct and this way is still better than no + check at all */ + tuner_info("TV freq (%d.%02d) out of range (%d-%d)\n", + freq/16,freq%16*100/16,tv_range[0],tv_range[1]); + return; + } } + tuner_dbg("62.5 Khz freq step selected for TV.\n"); t->tv_freq(c,freq); } @@ -97,11 +117,29 @@ static void set_radio_freq(struct i2c_client *c, unsigned int freq) return; } if (freq < radio_range[0]*16 || freq > radio_range[1]*16) { - tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n", + if (freq >= tv_range[0]*16364 && freq <= tv_range[1]*16384) { + /* V4L2_TUNER_CAP_LOW frequency */ + if (t->type == TUNER_TEA5767) { + tuner_info("radio freq step 62.5Hz (%d.%06d)\n",(freq>>14),freq%(1<<14)*10000); + t->radio_freq(c,freq>>10); + return; + } + + tuner_dbg("V4L2_TUNER_CAP_LOW freq selected for Radio. Tuners yet doesn't support converting it to valid freq.\n"); + + tuner_info("radio freq (%d.%06d)\n",(freq>>14),freq%(1<<14)*10000); + + t->radio_freq(c,freq>>10); + return; + + } else { + tuner_info("radio freq (%d.%02d) out of range (%d-%d)\n", freq/16,freq%16*100/16, - radio_range[0],radio_range[1]); - return; + radio_range[0],radio_range[1]); + return; + } } + tuner_dbg("62.5 Khz freq step selected for Radio.\n"); t->radio_freq(c,freq); } @@ -129,8 +167,9 @@ static void set_type(struct i2c_client *c, unsigned int type) { struct tuner *t = i2c_get_clientdata(c); + tuner_dbg ("I2C addr 0x%02x with type %d\n",c->addr<<1,type); /* sanity check */ - if (type == UNSET || type == TUNER_ABSENT) + if (type == UNSET || type == TUNER_ABSENT) return; if (type >= tuner_count) return; @@ -145,6 +184,7 @@ static void set_type(struct i2c_client *c, unsigned int type) return; t->initialized = 1; + t->type = type; switch (t->type) { case TUNER_MT2032: @@ -159,6 +199,53 @@ static void set_type(struct i2c_client *c, unsigned int type) } } +#ifdef CONFIG_TUNER_MULTI_I2C +#define CHECK_ADDR(tp,cmd,tun) if (client->addr!=tp) { \ + return 0; } else \ + tuner_info ("Cmd %s accepted to "tun"\n",cmd); +#define CHECK_MODE(cmd) if (t->mode == V4L2_TUNER_RADIO) { \ + CHECK_ADDR(radio_tuner,cmd,"radio") } else \ + { CHECK_ADDR(tv_tuner,cmd,"TV"); } +#else +#define CHECK_ADDR(tp,cmd,tun) tuner_info ("Cmd %s accepted to "tun"\n",cmd); +#define CHECK_MODE(cmd) tuner_info ("Cmd %s accepted\n",cmd); +#endif + +#ifdef CONFIG_TUNER_MULTI_I2C + +static void set_addr(struct i2c_client *c, struct tuner_addr *tun_addr) +{ + /* ADDR_UNSET defaults to first available tuner */ + if ( tun_addr->addr == ADDR_UNSET ) { + if (first_tuner != c->addr) + return; + switch (tun_addr->v4l2_tuner) { + case V4L2_TUNER_RADIO: + radio_tuner=c->addr; + break; + default: + tv_tuner=c->addr; + break; + } + } else { + /* Sets tuner to its configured value */ + switch (tun_addr->v4l2_tuner) { + case V4L2_TUNER_RADIO: + radio_tuner=tun_addr->addr; + if ( tun_addr->addr == c->addr ) set_type(c,tun_addr->type); + return; + default: + tv_tuner=tun_addr->addr; + if ( tun_addr->addr == c->addr ) set_type(c,tun_addr->type); + return; + } + } + set_type(c,tun_addr->type); +} +#else +#define set_addr(c,tun_addr) set_type(c,(tun_addr)->type) +#endif + static char pal[] = "-"; module_param_string(pal, pal, sizeof(pal), 0644); @@ -197,8 +284,17 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) { struct tuner *t; +#ifndef CONFIG_TUNER_MULTI_I2C if (this_adap > 0) return -1; +#else + /* by default, first I2C card is both tv and radio tuner */ + if (this_adap == 0) { + first_tuner = addr; + tv_tuner = addr; + radio_tuner = addr; + } +#endif this_adap++; client_template.adapter = adap; @@ -211,11 +307,12 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) memcpy(&t->i2c,&client_template,sizeof(struct i2c_client)); i2c_set_clientdata(&t->i2c, t); t->type = UNSET; - t->radio_if2 = 10700*1000; // 10.7MHz - FM radio + t->radio_if2 = 10700*1000; /* 10.7MHz - FM radio */ i2c_attach_client(&t->i2c); tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); + set_type(&t->i2c, t->type); return 0; } @@ -228,6 +325,12 @@ static int tuner_probe(struct i2c_adapter *adap) } this_adap = 0; +#ifdef CONFIG_TUNER_MULTI_I2C + first_tuner = 0; + tv_tuner = 0; + radio_tuner = 0; +#endif + if (adap->class & I2C_CLASS_TV_ANALOG) return i2c_probe(adap, &addr_data, tuner_attach); return 0; @@ -236,8 +339,14 @@ static int tuner_probe(struct i2c_adapter *adap) static int tuner_detach(struct i2c_client *client) { struct tuner *t = i2c_get_clientdata(client); + int err; + + err=i2c_detach_client(&t->i2c); + if (err) { + tuner_warn ("Client deregistration failed, client not detached.\n"); + return err; + } - i2c_detach_client(&t->i2c); kfree(t); return 0; } @@ -256,18 +365,23 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) unsigned int *iarg = (int*)arg; switch (cmd) { - /* --- configuration --- */ case TUNER_SET_TYPE: set_type(client,*iarg); break; + case TUNER_SET_TYPE_ADDR: + set_addr(client,(struct tuner_addr *)arg); + break; case AUDC_SET_RADIO: + t->mode = V4L2_TUNER_RADIO; + CHECK_ADDR(tv_tuner,"AUDC_SET_RADIO","TV"); + if (V4L2_TUNER_RADIO != t->mode) { set_tv_freq(client,400 * 16); - t->mode = V4L2_TUNER_RADIO; } break; case AUDC_CONFIG_PINNACLE: + CHECK_ADDR(tv_tuner,"AUDC_CONFIG_PINNACLE","TV"); switch (*iarg) { case 2: tuner_dbg("pinnacle pal\n"); @@ -297,6 +411,8 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) CHECK_V4L2; t->mode = V4L2_TUNER_ANALOG_TV; + CHECK_ADDR(tv_tuner,"VIDIOCSCHAN","TV"); + if (vc->norm < ARRAY_SIZE(map)) t->std = map[vc->norm]; tuner_fixup_std(t); @@ -308,6 +424,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) { unsigned long *v = arg; + CHECK_MODE("VIDIOCSFREQ"); CHECK_V4L2; set_freq(client,*v); return 0; @@ -316,15 +433,27 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct video_tuner *vt = arg; + CHECK_ADDR(radio_tuner,"VIDIOCGTUNER","radio"); CHECK_V4L2; - if (V4L2_TUNER_RADIO == t->mode && t->has_signal) - vt->signal = t->has_signal(client); + if (V4L2_TUNER_RADIO == t->mode) { + if (t->has_signal) + vt->signal = t->has_signal(client); + if (t->is_stereo) { + if (t->is_stereo(client)) + vt-> flags |= VIDEO_TUNER_STEREO_ON; + else + vt-> flags &= 0xffff ^ VIDEO_TUNER_STEREO_ON; + } + vt->flags |= V4L2_TUNER_CAP_LOW; /* Allow freqs at 62.5 Hz */ + } + return 0; } case VIDIOCGAUDIO: { struct video_audio *va = arg; + CHECK_ADDR(radio_tuner,"VIDIOCGAUDIO","radio"); CHECK_V4L2; if (V4L2_TUNER_RADIO == t->mode && t->is_stereo) va->mode = t->is_stereo(client) @@ -339,6 +468,8 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) SWITCH_V4L2; t->mode = V4L2_TUNER_ANALOG_TV; + CHECK_ADDR(tv_tuner,"VIDIOC_S_STD","TV"); + t->std = *id; tuner_fixup_std(t); if (t->freq) @@ -349,6 +480,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct v4l2_frequency *f = arg; + CHECK_MODE("VIDIOC_S_FREQUENCY"); SWITCH_V4L2; if (V4L2_TUNER_RADIO == f->type && V4L2_TUNER_RADIO != t->mode) @@ -361,6 +493,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct v4l2_frequency *f = arg; + CHECK_MODE("VIDIOC_G_FREQUENCY"); SWITCH_V4L2; f->type = t->mode; f->frequency = t->freq; @@ -370,14 +503,29 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) { struct v4l2_tuner *tuner = arg; + CHECK_MODE("VIDIOC_G_TUNER"); SWITCH_V4L2; - if (V4L2_TUNER_RADIO == t->mode && t->has_signal) - tuner->signal = t->has_signal(client); + if (V4L2_TUNER_RADIO == t->mode) { + if (t->has_signal) + tuner -> signal = t->has_signal(client); + if (t->is_stereo) { + if (t->is_stereo(client)) { + tuner -> capability |= V4L2_TUNER_CAP_STEREO; + tuner -> rxsubchans |= V4L2_TUNER_SUB_STEREO; + } else { + tuner -> rxsubchans &= 0xffff ^ V4L2_TUNER_SUB_STEREO; + } + } + } + /* Wow to deal with V4L2_TUNER_CAP_LOW ? For now, it accepts from low at 62.5KHz step to high at 62.5 Hz */ tuner->rangelow = tv_range[0] * 16; - tuner->rangehigh = tv_range[1] * 16; +// tuner->rangehigh = tv_range[1] * 16; +// tuner->rangelow = tv_range[0] * 16384; + tuner->rangehigh = tv_range[1] * 16384; break; } default: + tuner_dbg ("Unimplemented IOCTL 0x%08x called to tuner.\n", cmd); /* nothing */ break; } @@ -385,7 +533,7 @@ tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) return 0; } -static int tuner_suspend(struct device * dev, pm_message_t state, u32 level) +static int tuner_suspend(struct device * dev, u32 state, u32 level) { struct i2c_client *c = container_of(dev, struct i2c_client, dev); struct tuner *t = i2c_get_clientdata(c); diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index 48c6ceff1dc..539f3055731 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c @@ -1,5 +1,5 @@ /* - * $Id: tuner-simple.c,v 1.10 2005/03/08 08:38:00 kraxel Exp $ + * $Id: tuner-simple.c,v 1.21 2005/06/10 19:53:26 nsh Exp $ * * i2c tv tuner chip device driver * controls all those simple 4-control-bytes style tuners. @@ -212,7 +212,25 @@ static struct tunertype tuners[] = { { "Philips FQ1236A MK4", Philips, NTSC, 16*160.00,16*442.00,0x01,0x02,0x04,0x8e,732 }, + /* Should work for TVF8531MF, TVF8831MF, TVF8731MF */ + { "Ymec TVision TVF-8531MF", Philips, NTSC, + 16*160.00,16*454.00,0xa0,0x90,0x30,0x8e,732}, + { "Ymec TVision TVF-5533MF", Philips, NTSC, + 16*160.00,16*454.00,0x01,0x02,0x04,0x8e,732}, + + { "Thomson DDT 7611 (ATSC/NTSC)", THOMSON, ATSC, + 16*157.25,16*454.00,0x39,0x3a,0x3c,0x8e,732}, + { "Tena TNF9533-D/IF", LGINNOTEK, PAL, + 16*160.25, 16*464.25, 0x01,0x02,0x08,0x8e,623}, + + /* + * This entry is for TEA5767 FM radio only chip used on several boards + * w/TV tuner + */ + { TEA5767_TUNER_NAME, Philips, RADIO, + -1, -1, 0, 0, 0, TEA5767_LOW_LO_32768,0}, }; + unsigned const int tuner_count = ARRAY_SIZE(tuners); /* ---------------------------------------------------------------------- */ @@ -223,6 +241,7 @@ static int tuner_getstatus(struct i2c_client *c) if (1 != i2c_master_recv(c,&byte,1)) return 0; + return byte; } @@ -231,17 +250,33 @@ static int tuner_getstatus(struct i2c_client *c) #define TUNER_MODE 0x38 #define TUNER_AFC 0x07 -#define TUNER_STEREO 0x10 /* radio mode */ -#define TUNER_SIGNAL 0x07 /* radio mode */ +#define TUNER_STEREO 0x10 /* radio mode */ +#define TUNER_STEREO_MK3 0x04 /* radio mode */ +#define TUNER_SIGNAL 0x07 /* radio mode */ static int tuner_signal(struct i2c_client *c) { - return (tuner_getstatus(c) & TUNER_SIGNAL)<<13; + return (tuner_getstatus(c) & TUNER_SIGNAL) << 13; } static int tuner_stereo(struct i2c_client *c) { - return (tuner_getstatus (c) & TUNER_STEREO); + int stereo, status; + struct tuner *t = i2c_get_clientdata(c); + + status = tuner_getstatus (c); + + switch (t->type) { + case TUNER_PHILIPS_FM1216ME_MK3: + case TUNER_PHILIPS_FM1236_MK3: + case TUNER_PHILIPS_FM1256_IH3: + stereo = ((status & TUNER_SIGNAL) == TUNER_STEREO_MK3); + break; + default: + stereo = status & TUNER_STEREO; + } + + return stereo; } #if 0 /* unused */ @@ -424,6 +459,14 @@ static void default_set_radio_freq(struct i2c_client *c, unsigned int freq) buffer[2] = tun->config; switch (t->type) { + case TUNER_TENA_9533_DI: + case TUNER_YMEC_TVF_5533MF: + + /*These values are empirically determinated */ + div = (freq*122)/16 - 20; + buffer[2] = 0x88; /* could be also 0x80 */ + buffer[3] = 0x19; /* could be also 0x10, 0x18, 0x99 */ + break; case TUNER_PHILIPS_FM1216ME_MK3: case TUNER_PHILIPS_FM1236_MK3: buffer[3] = 0x19; diff --git a/drivers/media/video/tvaudio.c b/drivers/media/video/tvaudio.c index 41b635e0d3c..9a493bea76d 100644 --- a/drivers/media/video/tvaudio.c +++ b/drivers/media/video/tvaudio.c @@ -285,7 +285,6 @@ static int chip_thread(void *data) schedule(); } remove_wait_queue(&chip->wq, &wait); - try_to_freeze(PF_FREEZE); if (chip->done || signal_pending(current)) break; dprintk("%s: thread wakeup\n", i2c_clientname(&chip->c)); @@ -1237,17 +1236,17 @@ static int ta8874z_checkit(struct CHIPSTATE *chip) /* audio chip descriptions - struct CHIPDESC */ /* insmod options to enable/disable individual audio chips */ -int tda8425 = 1; -int tda9840 = 1; -int tda9850 = 1; -int tda9855 = 1; -int tda9873 = 1; -int tda9874a = 1; -int tea6300 = 0; // address clash with msp34xx -int tea6320 = 0; // address clash with msp34xx -int tea6420 = 1; -int pic16c54 = 1; -int ta8874z = 0; // address clash with tda9840 +static int tda8425 = 1; +static int tda9840 = 1; +static int tda9850 = 1; +static int tda9855 = 1; +static int tda9873 = 1; +static int tda9874a = 1; +static int tea6300 = 0; // address clash with msp34xx +static int tea6320 = 0; // address clash with msp34xx +static int tea6420 = 1; +static int pic16c54 = 1; +static int ta8874z = 0; // address clash with tda9840 module_param(tda8425, int, 0444); module_param(tda9840, int, 0444); diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 3d216973798..0f03c25489f 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c @@ -75,7 +75,7 @@ hauppauge_tuner_fmt[] = { 0x00000007, "PAL(B/G)" }, { 0x00001000, "NTSC(M)" }, { 0x00000010, "PAL(I)" }, - { 0x00400000, "SECAM(L/L�)" }, + { 0x00400000, "SECAM(L/L´)" }, { 0x00000e00, "PAL(D/K)" }, { 0x03000000, "ATSC Digital" }, }; diff --git a/drivers/media/video/tvmixer.c b/drivers/media/video/tvmixer.c index eafd7061b31..51b99cdbf29 100644 --- a/drivers/media/video/tvmixer.c +++ b/drivers/media/video/tvmixer.c @@ -1,3 +1,7 @@ +/* + * $Id: tvmixer.c,v 1.8 2005/06/12 04:19:19 mchehab Exp $ + */ + #include <linux/module.h> #include <linux/moduleparam.h> #include <linux/kernel.h> diff --git a/drivers/media/video/v4l1-compat.c b/drivers/media/video/v4l1-compat.c index b0d4bcb027d..70ecbdb8027 100644 --- a/drivers/media/video/v4l1-compat.c +++ b/drivers/media/video/v4l1-compat.c @@ -1,4 +1,6 @@ /* + * $Id: v4l1-compat.c,v 1.9 2005/06/12 04:19:19 mchehab Exp $ + * * Video for Linux Two * Backward Compatibility Layer * @@ -15,14 +17,11 @@ * */ -#ifndef __KERNEL__ -#define __KERNEL__ -#endif - #include <linux/config.h> #include <linux/init.h> #include <linux/module.h> +#include <linux/moduleparam.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/sched.h> @@ -787,12 +786,15 @@ v4l_compat_translate_ioctl(struct inode *inode, !(qctrl2.flags & V4L2_CTRL_FLAG_DISABLED)) aud->step = qctrl2.step; aud->mode = 0; + + memset(&tun2,0,sizeof(tun2)); err = drv(inode, file, VIDIOC_G_TUNER, &tun2); if (err < 0) { dprintk("VIDIOCGAUDIO / VIDIOC_G_TUNER: %d\n",err); err = 0; break; } + if (tun2.rxsubchans & V4L2_TUNER_SUB_LANG2) aud->mode = VIDEO_SOUND_LANG1 | VIDEO_SOUND_LANG2; else if (tun2.rxsubchans & V4L2_TUNER_SUB_STEREO) |